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.

117 rivejä
3.9 KiB

  1. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  2. local ZPMessage = ZPFramework.ZPImport("zp_base.luaScript.Protocol.ZPMessage")
  3. local ZPRoomToolView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomToolView")
  4. local changpaiRoomToolView = class("changpaiRoomToolView", ZPRoomToolView)
  5. function changpaiRoomToolView:ctor( ... )
  6. changpaiRoomToolView.super.ctor(self)
  7. end
  8. function changpaiRoomToolView:onEnter()
  9. changpaiRoomToolView.super.onEnter(self)
  10. --self:showFastStart(false)
  11. if PLN.CLUB_NAME == "茶馆" then
  12. self.ui.Items.Button_Invite_Club:loadTextureNormal("zp_changpai/res/ui/zy_fangjian/btn/yaoqing.png")
  13. else
  14. self.ui.Items.Button_Invite_Club:loadTextureNormal("zp_changpai/res/ui/zy_fangjian/btn/qinyouquanyaoqing.png")
  15. end
  16. self:initTuoGuan()
  17. end
  18. function changpaiRoomToolView:loadUi()
  19. local ui = loadUI("zp_changpai/res/ui/ui_fangjian/changpai_ui_Tool.ui")
  20. self.ui = ui;
  21. self:addChild(ui);
  22. end
  23. ---
  24. -- 初始化托管
  25. -- @return
  26. --
  27. function changpaiRoomToolView:initTuoGuan ()
  28. if self.ui.Items.Layout_tuoguan then
  29. self.ui.Items.Button_guoguan:registerClick(handler(self , self.onClickQXTuoGuan))
  30. self.ui.Items.Layout_tuoguan:setTouchEnabled(true)
  31. self.ui.Items.Layout_tuoguan:setLocalZOrder(1000)
  32. self:showTuoGuan(false)
  33. end
  34. end
  35. function changpaiRoomToolView:showFastStart(is)
  36. local roomInfo = app.room.roomInfo
  37. local curCount = roomInfo.nGameStartCount or 0
  38. if curCount > 0 or (roomInfo.nStatus and roomInfo.nStatus>=ZPDef.ReconnectState.GAME_STATUS_WAIT_OUT_CARDS and roomInfo.nStatus<=ZPDef.ReconnectState.GAME_STATUS_GAME_OVER) then
  39. self.ui.Items.Button_EarlyStart:setVisible(false)
  40. else
  41. local gameInfo=json.decode(roomInfo.strGameInfo)
  42. local playnum = gameInfo.playnum or 0
  43. if playnum == -1 then
  44. playnum = 4
  45. end
  46. local isShowEarlyStart = table.nums(app.room.roomInfo.memberList) < playnum and app.room:getActualPlayerNum() >= 2
  47. if true == is and isShowEarlyStart and curCount<=0 then
  48. --local playerCount = app.room:getPlayerCount()
  49. self.ui.Items.Button_EarlyStart:setVisible(true)
  50. else
  51. self.ui.Items.Button_EarlyStart:setVisible(false)
  52. end
  53. if gameInfo.startMode and gameInfo.startMode == 0 then--不是快速组局
  54. self.ui.Items.Button_EarlyStart:setVisible(false)
  55. end
  56. end
  57. end
  58. --[[function changpaiRoomToolView:onClickFastStart( sender )--发起申请
  59. playBtnEffect()
  60. local request = ZPMessage.FastStartRequest:new()
  61. request.tp = 1
  62. self.ui:sendMsg(app.room, ZPDef.MJEvent.RequestFastsStart, request)
  63. end
  64. function changpaiRoomToolView:showFastStart(is)
  65. local roomInfo = app.room.roomInfo
  66. if roomInfo.nStatus and roomInfo.nStatus>=ZPDef.GameStatus.GAME_STATUS_WAIT_BANKER_START and roomInfo.nStatus<=ZPDef.GameStatus.GAME_STATUS_GAME_OVER then
  67. self.ui.Items.Button_fastStart:setVisible(false)
  68. else
  69. local playerCount = app.room:getPlayerCount()
  70. local roomInfo=app.room.roomInfo
  71. local gameInfo=json.decode(roomInfo.strGameInfo)
  72. if true == is and playerCount<app.room:getMaxPlayerCount() and app.room.roomInfo.nGameStartCount<=0 then
  73. local playerCount = app.room:getPlayerCount()
  74. self.ui.Items.Button_fastStart:setVisible(playerCount==2 or playerCount==3)
  75. else
  76. self.ui.Items.Button_fastStart:setVisible(false)
  77. end
  78. if gameInfo.isfaststart and gameInfo.isfaststart == 0 then
  79. self.ui.Items.Button_fastStart:setVisible(false)
  80. end
  81. end
  82. end--]]
  83. ---
  84. -- 点击取消托管
  85. -- @param sender
  86. -- @return
  87. --
  88. function changpaiRoomToolView:onClickQXTuoGuan( sender )
  89. playBtnEffect()
  90. --
  91. local request = ZPMessage.HostingRequest:new()
  92. request.nUserId = 0
  93. request.status = 0 --1托管 0取消托管
  94. self.ui:sendMsg(app.room, ZPDef.ZPEvent.HostingRequest, request)
  95. end
  96. ---
  97. -- 显示托管
  98. -- @param is
  99. -- @return
  100. --
  101. function changpaiRoomToolView:showTuoGuan( is )
  102. self.ui.Items.Layout_tuoguan:setVisible(is==true)
  103. end
  104. return changpaiRoomToolView