Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

156 linhas
5.1 KiB

  1. local MJRoomToolView = MJFramework.MJFrameworkClassImprot("mj.luaScript.Views.Room.MJRoomToolView")
  2. local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
  3. local MJMessage = MJFramework.MJImport("mj.luaScript.Protocol.MJMessage")
  4. local hongzhongRoomToolView = class("hongzhongRoomToolView", MJRoomToolView)
  5. function hongzhongRoomToolView:ctor( ... )
  6. hongzhongRoomToolView.super.ctor(self)
  7. end
  8. function hongzhongRoomToolView:onEnter()
  9. hongzhongRoomToolView.super.onEnter(self)
  10. self.ui.Items.Button_tuoguan:registerClick(handler(self , self.onClickTuoGuan))
  11. self.ui.Items.Button_tuoguan:setEnabled(app.room.roomInfo.hosting~=1)
  12. self.ui.Items.Button_tuoguan:setVisible(false)
  13. self.ui.Items.Button_guoguan:registerClick(handler(self , self.onClickQXTuoGuan))
  14. self.ui.Items.Layout_tuoguan:registerClick(function ( sender )
  15. print("do nothing...")
  16. end)
  17. self.ui.Items.Layout_tuoguan:setLocalZOrder(1000)
  18. self:showTuoGuan(false)
  19. self.ui.Items.Button_fastStart:registerClick(handler(self, self.onClickFastStart))
  20. self:showFastStart(false)
  21. self:setMenuVisible(false, true)
  22. self.ui.Items.Button_Invite:setVisible(false)
  23. self.ui.Items.Button_Ready:setVisible(false)
  24. -- if self.ui.Items.Button_Face then
  25. -- self.ui.Items.Button_Face:registerClick(handler(self,self.onClickFace))
  26. -- end
  27. -- if self.ui.Items.Button_Voice then
  28. -- local voiceComponentView = import("luaScript.Views.Room.RoomVoiceComponentView"):new(self.ui.Items.Button_Voice)
  29. -- self:addChild(voiceComponentView)
  30. -- end
  31. end
  32. function hongzhongRoomToolView:loadUI()
  33. local ui = loadUI("hongzhong/res/ui_fangjian/hongzhong_ui_tool.ui")
  34. self.ui = ui
  35. self:addChild(ui)
  36. end
  37. -- 设置界面
  38. function hongzhongRoomToolView:onClickMenu()
  39. playBtnEffect()
  40. self:setMenuVisible(not self.ui.Items.Layout_Menu:isVisible())
  41. end
  42. --设置按钮菜单
  43. function hongzhongRoomToolView:setMenuVisible(bVisible, flag)
  44. self.ui.Items.Layout_Menu:setVisible(bVisible)
  45. self:hideOther()
  46. end
  47. --点击日记
  48. function hongzhongRoomToolView:onClickLog()
  49. hongzhongRoomToolView.super.onClickLog(self)
  50. self:hideOther()
  51. end
  52. function hongzhongRoomToolView:hideOther()
  53. -- 隐藏个人信息
  54. if self:getParent() and self:getParent().playerView then
  55. self:getParent().playerView:removePlayerInfoView()
  56. end
  57. end
  58. function hongzhongRoomToolView:onClickFastStart( sender )--发起申请
  59. playBtnEffect()
  60. local request = MJMessage.FastStartRequest:new()
  61. request.tp = 1
  62. self.ui:sendMsg(app.room, MJDefine.MJEvent.RequestFastsStart, request)
  63. end
  64. --[[function hongzhongRoomToolView:reloadCallback()
  65. -- 离开按钮
  66. self.ui.Items.Button_Leave:registerClick(function ()
  67. playBtnEffect()
  68. if app.room.roomInfo.tableOverFlag and app.room.roomInfo.tableOverFlag > MJDefine.TABLE_OVER_FLAG.TABLE_OVER_NORMAL then
  69. showTooltip(MJDefine.TABLE_OVER_FLAG_TEXT[app.room.roomInfo.tableOverFlag]);
  70. app:gotoView(import("luaScript.Views.Main.MainView"):new(GAME_IDS.LaiBing));
  71. else
  72. playBtnEffect()
  73. app.room.roomInfo.bQuitRoom = true
  74. self.ui:sendMsg(app.room, MJDefine.MJEvent.CallLeaveRequest)
  75. end
  76. end)
  77. end
  78. --]]
  79. function hongzhongRoomToolView:showFastStart(is)
  80. local roomInfo = app.room.roomInfo
  81. if roomInfo.nStatus and roomInfo.nStatus>=MJDefine.GameStatus.GAME_STATUS_WAIT_BANKER_START and roomInfo.nStatus<=MJDefine.GameStatus.GAME_STATUS_GAME_OVER then
  82. self.ui.Items.Button_fastStart:setVisible(false)
  83. else
  84. local playerCount = app.room:getPlayerCount()
  85. local roomInfo=app.room.roomInfo
  86. local gameInfo=json.decode(roomInfo.strGameInfo)
  87. if true == is and playerCount<app.room:getMaxPlayerCount() and app.room.roomInfo.nGameStartCount<=0 then
  88. local playerCount = app.room:getPlayerCount()
  89. self.ui.Items.Button_fastStart:setVisible(playerCount==2 or playerCount==3)
  90. else
  91. self.ui.Items.Button_fastStart:setVisible(false)
  92. end
  93. if gameInfo.isfaststart and gameInfo.isfaststart == 0 then
  94. self.ui.Items.Button_fastStart:setVisible(false)
  95. end
  96. end
  97. end
  98. --隐藏微信按钮
  99. function hongzhongRoomToolView:setWetChatVisible(bVisible)
  100. -- self.ui.Items.Button_Invite:setVisible(bVisible)
  101. self:setInviteClubVisible(bVisible)
  102. --self:updateButtonPosition()
  103. end
  104. function hongzhongRoomToolView:updateButton()
  105. end
  106. function hongzhongRoomToolView:onClickTuoGuan( sender )
  107. playBtnEffect()
  108. local request = MJMessage.HostingRequest:new()
  109. request.nUserId = app.room:getMyUserId()
  110. request.status = 1 --1托管 0取消托管
  111. self.ui:sendMsg(app.room, MJDefine.MJEvent.HostingRequest, request)
  112. end
  113. function hongzhongRoomToolView:onClickQXTuoGuan( sender )
  114. playBtnEffect()
  115. --
  116. local request = MJMessage.HostingRequest:new()
  117. request.nUserId = 0
  118. request.status = 0 --1托管 0取消托管
  119. self.ui:sendMsg(app.room, MJDefine.MJEvent.HostingRequest, request)
  120. end
  121. function hongzhongRoomToolView:showTuoGuan( is )
  122. self.ui.Items.Layout_tuoguan:setVisible(is==true)
  123. end
  124. -- function hongzhongRoomToolView:onClickFace()
  125. -- local chatView = import("luaScript.Views.Room.RoomChatView"):new(MJDefine.MJChatTxt,MJDefine.MJFaceConfig)
  126. -- chatView:setAnchorPoint(cc.p(0.5, 0.5))
  127. -- app:showWaitDialog(chatView,0,true)
  128. -- end
  129. return hongzhongRoomToolView