|
- -- require("luaScript.SubGameDefine.ZiPai.LiuHuQiangDef");
-
- -- local MJCreateRoomItem=require("luaScript.Views.CreateRoom.MJCreateRoom.hongzhongCreateRoomItem")
-
- local CreateRoomBase=require("luaScript.Views.CreateRoom.CreateRoomBase")
- -- 主界面
- local MJCreateRoomView = class("MJCreateRoomView", CreateRoomBase)
-
-
-
- function MJCreateRoomView:ctor()
- local datas =
- {
- -- 游戏ID
- gameId = app.gameId,
-
- -- 默认选中的玩法
- defaultPlayType = 1,
- }
-
- MJCreateRoomView.super.ctor(self,datas)
- end
-
- -- function MJCreateRoomView:ctor()
- -- MJCreateRoomView.super.ctor(self);
-
- -- local ui = loadUI("mj/res/ui/ui_dating/mj_ui_create_room.ui");
- -- self.ui = ui;
- -- self:addChild(ui);
-
- -- -- 当前选中的
- -- self.curPlayType = 1
-
- -- --可以配置
- -- self.ruleButtonList = {}
-
- -- -- 当前正在显示的规则界面
- -- self.ruleView = {}
-
- -- -- 不同玩法的规则配置
- -- self.PlayTypeClass =
- -- {
- -- [1] = MJCreateRoomItem,
- -- }
-
-
-
- -- end
-
- -- function MJCreateRoomView:onEnter()
- -- MJCreateRoomView.super.onEnter(self)
-
- -- self:initGameTypeView()
-
- -- -- 按钮 - 关闭
- -- self.ui.Items.Button_Close:registerClick(handler(self, self.onClickButtonClose))
-
- -- -- 按钮 - 创建房间
- -- self.ui.Items.Button_Create:registerClick(handler(self, self.onClickButtonCreate))
-
- -- end
-
- -- function MJCreateRoomView:onClickButtonClose()
- -- self:removeFromParent()
- -- end
-
-
- -- -- 玩法界面初始化
- -- function MJCreateRoomView:initGameTypeView()
- -- -- self.ui.Items.ScrollView:getInnerContainer():setAutoSize(true)
- -- --layout
- -- for i = 1,1 do
- -- local className = self.PlayTypeClass[i]
- -- self.ruleView[i] = className:new()
- -- self.ui.Items.Layout_Rule:addChild(self.ruleView[i])
-
- -- if self.ruleView[i]:getContentSize().height<self.ui.Items.Layout_Rule:getContentSize().height then
- -- -- self.ruleView[i]:setContentSize(cc.size(self.ruleView[i]:getContentSize().width,self.ui.Items.Layout_Rule:getContentSize().height))
- -- self.ruleView[i]:setPositionY(self.ui.Items.Layout_Rule:getContentSize().height-self.ruleView[i]:getContentSize().height)
- -- end
- -- end
-
- -- self.roomListGameIcon = import("luaScript.Tools.RadioManager"):new()
- -- self.ui.Items.CheckBox_HengYang:setSelectedState(true)
- -- -- self.roomListGameIcon:addItem(self.ui.Items.CheckBox_HengYang,LHQ_GAMERULE.LHQ)
-
- -- local function callback(gameRule)
- -- if gameRule ~= LHQ_GAMERULE.LHQ then
- -- self.ui.Items.CheckBox_HengYang:setSelectedState(false)
- -- end
- -- self.curPlayType = gameRule + 1
- -- end
- -- self.roomListGameIcon:setCallback(callback)
-
- -- self.ui.Items.ScrollView:hideAllBar()
- -- self.ui.Items.ScrollView:jumpToTop()--jumpToTopOnSizeChanged()
- -- end
-
- function MJCreateRoomView:onClickCreate()
- local totalGameNum,gameInfo = self:getRuleResult()
- log(gameInfo);
-
- local request = CreateRoomRequest:new()
- request.gameId = app.gameId
- request.basechips = 1
- request.totalGameNum = totalGameNum or 0
- request.requireCards = 0
- request.createFlag = 0
-
-
- -- local gameInfo = {}
- -- gameInfo.settlement=1
- -- gameInfo.playmode=tt.playmode
- -- gameInfo.extrahutype=tt.extrahutype
- -- gameInfo.gamerule=tt.gamerule
- -- gameInfo.niaopoint=tt.niaopoint
- -- gameInfo.niaonumber=tt.niaonumber
- -- gameInfo.canqiangganghu=tt.canqiangganghu
-
- request.gameInfo = gameInfo--json.encode(gameInfo)
- request.userInfo = app.user.userInfo;
-
- -- local tt = json.decode(app.user.userInfo)
- --群检测
- -- tt.unionid = app.user.password
- -- tt.openid = app.user.account
- --区域设置
- -- gameInfo.areaNo = tt.areano
- -- request.userInfo = json.encode(tt)
-
-
-
- logE("六胡抢 createroom request :"..table.tostring(request))
-
- app.hall:requestCreateRoom(request)
- end
-
-
-
-
- return MJCreateRoomView
|