You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
3.7 KiB

  1. -- require("luaScript.SubGameDefine.ZiPai.LiuHuQiangDef");
  2. -- local MJCreateRoomItem=require("luaScript.Views.CreateRoom.MJCreateRoom.hongzhongCreateRoomItem")
  3. local CreateRoomBase=require("luaScript.Views.CreateRoom.CreateRoomBase")
  4. -- 主界面
  5. local MJCreateRoomView = class("MJCreateRoomView", CreateRoomBase)
  6. function MJCreateRoomView:ctor()
  7. local datas =
  8. {
  9. -- 游戏ID
  10. gameId = app.gameId,
  11. -- 默认选中的玩法
  12. defaultPlayType = 1,
  13. }
  14. MJCreateRoomView.super.ctor(self,datas)
  15. end
  16. -- function MJCreateRoomView:ctor()
  17. -- MJCreateRoomView.super.ctor(self);
  18. -- local ui = loadUI("mj/res/ui/ui_dating/mj_ui_create_room.ui");
  19. -- self.ui = ui;
  20. -- self:addChild(ui);
  21. -- -- 当前选中的
  22. -- self.curPlayType = 1
  23. -- --可以配置
  24. -- self.ruleButtonList = {}
  25. -- -- 当前正在显示的规则界面
  26. -- self.ruleView = {}
  27. -- -- 不同玩法的规则配置
  28. -- self.PlayTypeClass =
  29. -- {
  30. -- [1] = MJCreateRoomItem,
  31. -- }
  32. -- end
  33. -- function MJCreateRoomView:onEnter()
  34. -- MJCreateRoomView.super.onEnter(self)
  35. -- self:initGameTypeView()
  36. -- -- 按钮 - 关闭
  37. -- self.ui.Items.Button_Close:registerClick(handler(self, self.onClickButtonClose))
  38. -- -- 按钮 - 创建房间
  39. -- self.ui.Items.Button_Create:registerClick(handler(self, self.onClickButtonCreate))
  40. -- end
  41. -- function MJCreateRoomView:onClickButtonClose()
  42. -- self:removeFromParent()
  43. -- end
  44. -- -- 玩法界面初始化
  45. -- function MJCreateRoomView:initGameTypeView()
  46. -- -- self.ui.Items.ScrollView:getInnerContainer():setAutoSize(true)
  47. -- --layout
  48. -- for i = 1,1 do
  49. -- local className = self.PlayTypeClass[i]
  50. -- self.ruleView[i] = className:new()
  51. -- self.ui.Items.Layout_Rule:addChild(self.ruleView[i])
  52. -- if self.ruleView[i]:getContentSize().height<self.ui.Items.Layout_Rule:getContentSize().height then
  53. -- -- self.ruleView[i]:setContentSize(cc.size(self.ruleView[i]:getContentSize().width,self.ui.Items.Layout_Rule:getContentSize().height))
  54. -- self.ruleView[i]:setPositionY(self.ui.Items.Layout_Rule:getContentSize().height-self.ruleView[i]:getContentSize().height)
  55. -- end
  56. -- end
  57. -- self.roomListGameIcon = import("luaScript.Tools.RadioManager"):new()
  58. -- self.ui.Items.CheckBox_HengYang:setSelectedState(true)
  59. -- -- self.roomListGameIcon:addItem(self.ui.Items.CheckBox_HengYang,LHQ_GAMERULE.LHQ)
  60. -- local function callback(gameRule)
  61. -- if gameRule ~= LHQ_GAMERULE.LHQ then
  62. -- self.ui.Items.CheckBox_HengYang:setSelectedState(false)
  63. -- end
  64. -- self.curPlayType = gameRule + 1
  65. -- end
  66. -- self.roomListGameIcon:setCallback(callback)
  67. -- self.ui.Items.ScrollView:hideAllBar()
  68. -- self.ui.Items.ScrollView:jumpToTop()--jumpToTopOnSizeChanged()
  69. -- end
  70. function MJCreateRoomView:onClickCreate()
  71. local totalGameNum,gameInfo = self:getRuleResult()
  72. log(gameInfo);
  73. local request = CreateRoomRequest:new()
  74. request.gameId = app.gameId
  75. request.basechips = 1
  76. request.totalGameNum = totalGameNum or 0
  77. request.requireCards = 0
  78. request.createFlag = 0
  79. -- local gameInfo = {}
  80. -- gameInfo.settlement=1
  81. -- gameInfo.playmode=tt.playmode
  82. -- gameInfo.extrahutype=tt.extrahutype
  83. -- gameInfo.gamerule=tt.gamerule
  84. -- gameInfo.niaopoint=tt.niaopoint
  85. -- gameInfo.niaonumber=tt.niaonumber
  86. -- gameInfo.canqiangganghu=tt.canqiangganghu
  87. request.gameInfo = gameInfo--json.encode(gameInfo)
  88. request.userInfo = app.user.userInfo;
  89. -- local tt = json.decode(app.user.userInfo)
  90. --群检测
  91. -- tt.unionid = app.user.password
  92. -- tt.openid = app.user.account
  93. --区域设置
  94. -- gameInfo.areaNo = tt.areano
  95. -- request.userInfo = json.encode(tt)
  96. logE("六胡抢 createroom request :"..table.tostring(request))
  97. app.hall:requestCreateRoom(request)
  98. end
  99. return MJCreateRoomView