-- 茶馆桌子界面Layout require("luaScript.SubGameFunctions.SubGameFunc_club") local ClubTable = class("ClubTable" , cc.UIView); local ClubDefine = require("luaScript.Protocol.Club.ClubDefine") function ClubTable:ctor(clubId) ClubTable.super.ctor(self) self:loadUI() self.clubId = clubId; app.club_php.clubID = clubId --单个茶馆数据 self.clubInfo = app.club_php.clubList[clubId] -- 页码 self.curPage = 1 -- 所有桌子的节点 self.allTableItem = {} self.first = true self.inView = ClubDefine.View.BAOMING if self.clubInfo.isArena ~= ClubDefine.MATCH_SWITCH.PEOPLE_CEST_OPEN then -- 先隐藏CEST相关资源 self.ui.Items.Layout_Cest:setVisible(false); self.ui.Items.Layout_CestInfo:setVisible(false); self.ui.Items.Layout_cest_bottom:setVisible(false); self.ui.Items.Layout_bisai_status:setVisible(false); end end function ClubTable:loadUI() local ui = loadUI("res/ui/ui_club/ui_club_table.ui") self.ui = ui self:addChild(ui) self.srcTableScrollowSize = self.ui.Items.ScrollView:getContentSize() end function ClubTable:onEnter() ClubTable.super.onEnter(self) setInClubRoom(true) --适配 --autoAdaptWidth(self.ui.Items.ScrollView) autoAdaptWidth(self.ui.Items.ImageView_down_bg) autoAdaptHeight(self.ui.Items.Layout_LeftGame) autoAdaptHeight(self.ui.Items.ImageView_LeftGame) autoAdaptHeight(self.ui.Items.ScrollView_GameList) --设置默认界面(第一次进入需要请求包间数据,所以类型为新增包间) self:setDefault() --设置自己的游戏状态 setMyGameStatus(false) --按钮注册事件 self:registerButton() --监听事件 self:tableBindEvent() --更新桌子 self:updateTableList({clubId = self.clubId}) --更换桌布 if self.clubInfo.club_bgprop and table.nums(self.clubInfo.club_bgprop) > 0 then self:setTableImg(self.clubInfo.club_bgprop.prop_id) end self:requestPlayerList() --请求茶馆桌子数据 app.club_php:requestClubHome(self.clubInfo.clubId,gameId,ruleId) self:initBoradcastView() -- todo lwqcest -- self:initClubCest() end function ClubTable:initPlayerInfo() --读取配置 self.clubData = self:loadGameInfoFromFile() local gameId = 0 local ruleId = 0 if self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then if self.clubData and self.clubData[tostring(self.clubId)] then gameId = self.clubData[tostring(self.clubId)].gameId ruleId = self.clubData[tostring(self.clubId)].ruleId else if self.clubData and not self.clubData[tostring(self.clubId)] then self.clubData[tostring(self.clubId)] = {} else self.clubData = {} end end elseif self.clubInfo.mode == ClubDefine.BaoJianType.Normal then self.clubData = {} gameId = self.clubInfo.settings.gameId ruleId = self.clubInfo.settings.baoJianId end --保存到内存 app.club_php:setSelectGameId(gameId) app.club_php:setSelectBaoJianId(ruleId) -- 茶馆名 local nickname = getShortNameByLength(self.clubInfo.clubName,5) self.ui.Items.Text_name:setText(nickname) --club id local idStr = string.format("ID:%d",self.clubInfo.clubId) self.ui.Items.Text_id:setText(idStr) -- 根据条件隐藏茶馆id local cliext = self.clubInfo.groupext and self.clubInfo.groupext.cliext if not cliext or not cliext.is_hideGid or (cliext and cliext.is_hideGid == 1) then if tonumber(self.clubInfo.role) ~= ClubDefine.Job.Manager and tonumber(self.clubInfo.role) ~= ClubDefine.Job.Creator then self.ui.Items.Text_id:setVisible(false) end end -- 房卡数量 self.ui.Items.Text_FangKa:bind(app.user.loginInfo, "curCardNum", function() self.ui.Items.Text_FangKa:setText(tostring(app.user.loginInfo.curCardNum)) end) end -- 从本地读取上一次游戏选择的信息(gameId,ruleId) function ClubTable:loadGameInfoFromFile() local locString = loadStringFromFile("clubData.json") if not locString or locString == "" then return nil end local locData = json.decode(locString) if locData then return locData end return nil end -- 将游戏选择(gameId,ruleId)信息写入到本地 function ClubTable:saveGameInfoToFile(gameId,ruleId) if not self.clubData then self.clubData = {} end self.clubData[tostring(self.clubId)] = { gameId = gameId, ruleId = ruleId, } if self.clubData then local locString = json.encode(self.clubData) saveStringToFile(locString,"clubData.json") end end --按钮注册点击事件 function ClubTable:registerButton() --关闭 self.ui.Items.Button_close:registerClick(handler(self , self.onClose)) --战绩 self.ui.Items.Button_zhanji:registerClick(handler(self , self.onZhanjiClub)) --申请消息 self.ui.Items.Button_apply_msg:registerClick(handler(self , self.onApplyMsg)) --设置 self.ui.Items.Button_set:registerClick(handler(self , self.onSet)) --比赛场设置 self.ui.Items.Button_match_set:registerClick(handler(self, self.onClickMatchSet)) --成员列表 self.ui.Items.Button_player_list:registerClick(handler(self , self.onPlayerList)) --合伙人 self.ui.Items.Button_hehuoren:registerClick(handler(self , self.onBtnHeHuoRenClicked)) --快速加入 self.ui.Items.Button_quick_start:registerClick(handler(self , self.onQuickStart)) self.ui.Items.Button_quick:registerClick(handler(self , self.onQuickStart)) --cest --修改玩法 self.ui.Items.Button_change_rule:registerClick(handler(self , self.onChangeRule)) --退出茶馆 self.ui.Items.Button_exit:registerClick(handler(self , self.onExitClub)) --点击层 self.ui.Items.Layout_touch:registerClick(handler(self , self.onTouch)) self.ui.Items.Layout_baojian_touch:registerClick(handler(self , self.onTouch)) --进入房间 self.ui.Items.Button_enter_table:registerClick(handler(self , self.onBackRoom)) self.ui.Items.Button_enter:registerClick(handler(self , self.onBackRoom)) --刷新 self.ui.Items.Button_refresh:registerClick(handler(self , self.onRefresh)) -- 比赛开关 self.ui.Items.Layout_match_set:setEnabled(false) -- 比赛信息 self.ui.Items.Button_match_info:registerClick(handler(self, self.onClickMatchInfo)) --更多游戏 self.ui.Items.Button_moreGame:registerClick(handler(self, self.onClickMoreGame)) --邀请 self.ui.Items.Button_invite:registerClick(handler(self, self.onBtnInviteClicked)) if isReviewVersion() then self.ui.Items.Layout_invite:setVisible(false) end -- 活动按钮 --self.ui.Items.Button_ActivityNew:registerClick(handler(self, self.onBtnActivityClicked)) --榜分说明 if self.clubInfo.role == ClubDefine.Job.Creator then --亲友圈等级 self.ui.Items.Button_level:registerClick(handler(self, self.onClickClubLevel)) end self.ui.Items.Button_wenhao:registerClick(handler(self, self.onClickWenHao)) self.ui.Items.ImageView_chognbangfen:registerClick(handler(self, self.onClickWenHao)) self.ui.Items.Layout_right_menu:setTouchEnabled(true); self.ui.Items.ScrollView:addEventListener(handler(self,self.onScrollViewEvent)) --合盟 self.ui.Items.Button_Union:registerClick(handler(self,self.onClickUnion)) self.ui.Items.Button_Union:setTouchEnabled(self.clubInfo.role == ClubDefine.Job.Creator) --查看牌桌 self.ui.Items.Button_LookHide:registerClick(handler(self,self.onLookHide)) end function ClubTable:onLookHide() playBtnEffect() self._bShowAllRoom = true if self.clubInfo.groupext then self.clubInfo.groupext.is_playerpri = 0 end local gameId = app.club_php:getSelectGameId() self:updateTableView(gameId) self.ui.Items.Layout_daojishi:setVisible(true) self.ui.Items.Button_LookHide:setVisible(false) self.ui.Items.HtmlCtrl_time:stopAllActions() local limlit = 60 self.ui.Items.HtmlCtrl_time:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.CallFunc:create(function() limlit = limlit - 1 local str = '剩余时间'..tostring(limlit)..'' self.ui.Items.HtmlCtrl_time:setText(str) if limlit < 0 then self.ui.Items.Layout_daojishi:setVisible(false) self.ui.Items.Button_LookHide:setVisible(true) self.ui.Items.HtmlCtrl_time:stopAllActions() if self.clubInfo.groupext then self.clubInfo.groupext.is_playerpri = 1 end self._bShowAllRoom = false local gameId = app.club_php:getSelectGameId() self:updateTableView(gameId) else self.ui.Items.HtmlCtrl_time:setText(str) end end),cc.DelayTime:create(1)))) end function ClubTable:onClickUnion() playBtnEffect() if self.clubInfo.groupext.master_union == 2 then local view = import("luaScript.Views.Club.ClubUnionMode.ClubUnionMaster"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) elseif self.clubInfo.groupext.slave_union == 2 then local view = import("luaScript.Views.Club.ClubUnionMode.ClubUnionSlave"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view,0) else showTooltip("盟主标识不存在") end --保存引导一次 if self.ui.Items.Layout_union_guide:isVisible() then --阅读引导 local privateSet = {} --客户端定义字段 privateSet.readUnionGuide = 1 local parm = { cliext = json.encode(privateSet), type = 0, } app.club_php:requestSetClubNew(self.clubInfo.clubId,parm) end self.ui.Items.Layout_union_guide:setVisible(false) end function ClubTable:onClickMoreGame() playBtnEffect() local view = import("luaScript.Views.Club.ClubMoreGame"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view,0) end function ClubTable:onClickWenHao() playBtnEffect() if self.clubInfo.unionType ~= 2 and app.club_php:getIsSlaveUnion(self.clubInfo.clubId) then showTooltip("请先加入一个联盟!") return end local view = import("luaScript.Views.Club.Match.ClubMatchChongBangFen"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view,150) end function ClubTable:onClickClubLevel() playBtnEffect() local view = import("luaScript.Views.Club.Match.ClubMatchLevel"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view,150) end function ClubTable:onClickMatchSet() playBtnEffect() local view = import("luaScript.Views.Club.Match.ClubBiSaiSet"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end function ClubTable:onClickMatchInfo() playBtnEffect() local player = app.club_php:getPlayer(self.clubInfo.clubId,app.user.loginInfo.uid) local memberInfo = self.clubInfo.memberInfo if memberInfo and memberInfo.status == 0 then showTooltip("黑名单无法查看!") return end if self.clubInfo.unionType ~= 2 and app.club_php:getIsSlaveUnion(self.clubInfo.clubId) then showTooltip("请先加入一个联盟!") return end local className = "" --从普通模式切换到比赛模式,把内存数据清掉,应该是哪里测试出问题,才这么做的。 if player and player.viewType == ClubDefine.PlayListType.NORMAL_MEMBER then self.clubInfo.players = {} end -- todo lwqcest -- if self.clubInfo.isArena >= ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_SEVER_CLOSE then if self.clubInfo.isArena >= ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_SEVER_CLOSE and self.clubInfo.isArena <= ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_OPEN then className = "luaScript.Views.Club.Match.ClubMatchMain" elseif self.clubInfo.isArena <= ClubDefine.MATCH_SWITCH.PEOPLE_CEST_OPEN then className = "luaScript.Views.Club.Cest.ClubCestMain" else if self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.Creator or self.clubInfo.role == ClubDefine.Job.LevelOneCopartner or self.clubInfo.role == ClubDefine.Job.LevelTwoCopartner or self.clubInfo.role == ClubDefine.Job.LevelThreeCopartner then className = "luaScript.Views.Club.ClubPlayerMatch" else className = "luaScript.Views.Club.ClubPlayerMatchInfo" end end local view = import(className):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end function ClubTable:onClickButtonAddDiamand() playBtnEffect() local view = import("luaScript.Views.Main.RechargeView"):new() view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end --监听事件 function ClubTable:tableBindEvent() --桌子数据获取成功 self:bindEvent(app.club_php , GAME_EVENT.CLUB_TABLE , handler(self , self.updateTableList)) --房间刷新 self:bindEvent(app.club_php , GAME_EVENT.CLUB_ROOM_LIST_UPDATE , handler(self , self.updateTableView)) --解散茶馆 self:bindEvent(app.club_php , GAME_EVENT.CLUB_JIE_SAN , handler(self , self.onClubJieSanEvent)) self:bindEvent(app.club_php, GAME_EVENT.CLUB_LIST, handler(self, self.updateTableList)) --绑定请求成员列表成功回调事件 self:bindEvent(app.club_php , GAME_EVENT.CLUB_PLAYER_LIST , handler(self , self.onUpdatePlayerListEvent)) --茶馆数据变更 self:bindEvent(app.club_php , GAME_EVENT.CLUB_CHANGE_PUSH , handler(self , self.onClubChangeEvent)) self:bindEvent(app.club_php , GAME_EVENT.CLUB_BACK_ROOM , handler(self , self.onBackRoomEvent)) --普通消息获取成功 self:bindEvent(app.club_php , GAME_EVENT.CLUB_MESSAGE , handler(self , self.onClubHintsUpdateEvent)) --获取官方活动 self:bindEvent(app.club_php , GAME_EVENT.CLUB_ACTIVITY_LIST , handler(self , self.onGetClubOfficialActivitySucc)); --收到更换背景消息 self:bindEvent(app.club_php, GAME_EVENT.CLUB_CHANGE_BG , handler(self , self.onClubTableChangeBg)) --绑定回调 self:bindEvent(app.club_php , GAME_EVENT.CLUB_SET , handler(self , self.updateSetting)); --调整红花 self:bindEvent(app.club_php , GAME_EVENT.CLUB_UPDATE_RED_FLOWER , handler(self , self.onUpdateHongHua)); --取消合伙人消息弹窗 self:bindEvent(app.club_php , GAME_EVENT.CLUB_CANCEL_COPARTNER_NOTICE , handler(self , self.popClubWindow)); --取消合伙人消息弹窗提示 self:bindEvent(app.club_php , GAME_EVENT.CLUB_CANCEL_COPARTNER_TIP , handler(self , self.onClubHeHuoRenCancelTip)); --GPS距离进房间监听 self:bindEvent(app.club, GAME_EVENT.CLUB_GPS_DISTANCE , handler(self , self.onClubGpsDistanceCheck)); --切换包间 self:bindEvent(app.club_php , GAME_EVENT.CLUB_CHANGE_BAO_JIAN , handler(self , self.onClubChangeBaoJianEvent)) --请求茶馆玩法回调 self.ui:bindEvent(app.club_php , GAME_EVENT.CLUB_CHANGE_RULE_PUSH , handler(self , self.updateTopBaoJianInfo)) self.ui:bindEvent(app.club_php , GAME_EVENT.CLUB_UPDATE_TABLE , handler(self , self.updateTable)) --监听从后台进入游戏事件 self:bindEvent(app, "applicationWillEnterForeground", handler(self, self.onApplicationWillEnterForeground)) self:bindEvent(app, "applicationDidEnterBackground", handler(self, self.onApplicationDidEnterBackground)) --联盟消息获取成功 self:bindEvent(app.club_php , GAME_EVENT.CLUB_UNION_HITS , handler(self , self.onClubUnionHintsUpdateEvent)) end function ClubTable:onClubTableChangeBg() if self.clubInfo.club_bgprop then if table.nums(self.clubInfo.club_bgprop) > 0 then self:setTableImg(tonumber(self.clubInfo.club_bgprop.prop_id)) else self:setTableImg() end end end function ClubTable:onClubJieSanEvent(event) if event.clubId == self.clubInfo.clubId then self:onClose() end end function ClubTable:updateLeftGame(scrollState) self.ui.Items.ScrollView_GameList:removeAllChildren() self.radioManager = import("luaScript.Tools.RadioManager"):new() self.radioManager:setColorSwitch(true) self.radioManager:setSelectColor(cc.c4b(255,255,255,255)) self.radioManager:setNormalColor(cc.c4b(108,130,196,255)) local function addItem(gameName,key) local gameItem = self.ui.Items.CheckBox_Item:getCopied() gameItem:setVisible(true) gameItem.Items = getUIItems(gameItem) gameItem.Items.Text_gameName:setText(tostring(gameName)) self.radioManager:addItem(gameItem, key) self.ui.Items.ScrollView_GameList:addChild(gameItem) end addItem("全部牌桌",0) --无激活游戏 if type(self.clubInfo.activeGames) == "table" then for k,gameId in ipairs(self.clubInfo.activeGames) do local gameRule = 0 local id = gameId local gameConfig = getSubGameConfig(tonumber(id)) if gameConfig and gameConfig.bSingleGame then log("过滤服务器多余的gameID,如黄十八碰胡等") else if gameId > 10000 then gameRule = math.floor(gameId%10000) id = math.floor(gameId/10000) end local gameConfig = getSubGameConfig(tonumber(id)) if gameConfig then if gameConfig.bSingleGame then local gameName = getSubGameRuleName(id,gameRule) if gameName and gameName~= "" then addItem(gameName,gameId) end else addItem(gameConfig.gameName,gameId) end end end end end self.radioManager:setCallback(handler(self, self.onClickItem)) local default = app.club_php:getSelectGameId() self.radioManager:setDefault(default) self.ui.Items.ScrollView_GameList:requestDoLayout() self.ui.Items.ScrollView_GameList:doLayout() if scrollState == 2 then runDelayWithTime(function () if not tolua.isnull(self.ui.Items.ScrollView_GameList) then self.ui.Items.ScrollView_GameList:jumpToBottom() end end,0.05) elseif scrollState == 0 then logD("do nothing") else runDelayWithTime(function () if not tolua.isnull(self.ui.Items.ScrollView_GameList) then self.ui.Items.ScrollView_GameList:jumpToTop() end end,0.05) end end function ClubTable:onClickItem(value,node) self.curSelectBaoJian = nil if self.first then self.first = false return end self.isUpdateAll = true if app.club_php:getSelectGameId() ~= value then self.ui.Items.ScrollView_BaoJian:jumpToLeft() end app.club_php:setSelectGameId(value) self.ui.Items.Layout_no_set:setVisible(false) self.ui.Items.Text_no_table:setVisible(false) self.ui.Items.ScrollView:removeAllChildren() self.ui.Items.Layout_BaoJian:setVisible(false) self.curPage = 1 self.ui.Items.Button_quick_start:setVisible(false) if value == 0 then self:saveGameInfoToFile(value,0) if self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then self.ui.Items.Layout_btn_change_rule:setVisible(false) end app.club_php:setChangeTable(true) app.club_php:setSelectBaoJianId(0) app.club_php:requestRoomList(self.clubInfo.clubId,0,0,self.curPage,true) else self:updateChangeRuleBtn() self:updateBaoJianList() local isHaveUse = false for k,v in pairs(self.clubInfo.baoJians) do if tonumber(v.gameId) == value then if tonumber(v.is_use) == 1 then isHaveUse = true end end end if not isHaveUse then self:updateTableView(value) end end end function ClubTable:updateBaoJianList() local gameId = self.radioManager:getResult() self.ui.Items.ScrollView_BaoJian:removeAllChildren() local baojians = {} for k,v in pairs(self.clubInfo.baoJians) do if tonumber(v.gameId) == gameId then baojians[k] = v end end if baojians then local radioManager = import("luaScript.Tools.RadioManager"):new() radioManager:setColorSwitch(false) local function addItem(state,baojian,index) local baoJianItem = self.ui.Items.Layout_BaoJian_Item:getCopied() baoJianItem:setVisible(true) baoJianItem.Items = getUIItems(baoJianItem) baoJianItem.Items.Layout_normal:setVisible(false) baoJianItem.Items.Layout_all:setVisible(false) baoJianItem.state = state baoJianItem.baojianId = baojian and toNumber(baojian.baoJianId) baoJianItem.index = index if state == 0 then baoJianItem.Items.Layout_all:setVisible(true) baoJianItem.Items.Text_baojianinfo:setTextColor(cc.c4b(121,146,180,255)) self.curSelectBaoJian = baoJianItem radioManager:addItem(baoJianItem.Items.CheckBox_BaoJian_Item,0) elseif state == 1 then--正常状态normal local jushu = baojian.gameNum local name = "" if string.len(baojian.title) > 0 then name = baojian.title else name = "未设包间名" if app.club_php:getCestIsOpen(app.club_php.clubID) then name = "未设赛事名" end end baoJianItem.Items.Layout_normal:setVisible(true) baoJianItem.Items.HtmlCtrl:setText('' .. tostring(name) .. '' .. tostring("("..tostring(jushu).."局)") .. ''); baoJianItem.Items.Layout_normal:registerClick(function () self.isTouchInfo = true local gameId = baojian.realGameId local view = import("luaScript.Views.Club.ClubBaoJianInfo"):new(self.clubInfo.clubId,gameId,baojian.gameNum, baojian.strGameRule,baojian.arena,baojian.title) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end) baoJianItem.Items.Layout_normal:setEnabled(false) radioManager:addItem(baoJianItem.Items.CheckBox_BaoJian_Item,baoJianItem.baojianId) end self.ui.Items.ScrollView_BaoJian:addChild(baoJianItem) end local index = 1 for ruleid,v in pairsByKeys(baojians) do if tonumber(v.is_use) == 1 then local gameRule = json.decode(v.strGameRule) if index == 1 then --全部 addItem(0,v,1) end addItem(1,v,index) index = index + 1 end end radioManager:setCallback(handler(self, self.onClickBaoJian)) local default = app.club_php:getSelectBaoJianId() radioManager:setDefault(default) local gameId = self.radioManager:getResult() self:saveGameInfoToFile(gameId,value) end end function ClubTable:onClickBaoJian(value,node) if self.isTouchInfo then self.isTouchInfo = false return end self.isUpdateAll = true local gameId = self.radioManager:getResult() self:saveGameInfoToFile(gameId,value) app.club_php:setChangeTable(true) app.club_php:setSelectBaoJianId(value) self.curPage = 1 app.club_php:requestRoomList(self.clubInfo.clubId,gameId,value,self.curPage,true) if self.curSelectBaoJian and self.curSelectBaoJian.state ~= 0 then local baoJian = app.club_php:getBaoJian(self.clubInfo.clubId,self.curSelectBaoJian.baojianId) local jushu = baoJian.gameNum local name = baoJian.title if not baoJian.title or baoJian.title == "" then name = "未设包间名" if app.club_php:getCestIsOpen(app.club_php.clubID) then name = "未设赛事名" end end self.curSelectBaoJian.Items.Layout_normal:setVisible(false) self.curSelectBaoJian.Items.Layout_all:setVisible(false) self.curSelectBaoJian.Items.Layout_normal:setVisible(true) self.curSelectBaoJian.Items.Layout_normal:setEnabled(false) self.curSelectBaoJian.Items.HtmlCtrl:setText('' .. tostring(name) .. '' .. tostring("("..tostring(jushu).."局)") .. ''); elseif self.curSelectBaoJian and self.curSelectBaoJian.state == 0 then self.curSelectBaoJian.Items.Text_baojianinfo:setTextColor(cc.c4b(121,146,180,255)) end if node:getParent().state ~= 0 then local baoJian = app.club_php:getBaoJian(self.clubInfo.clubId,node:getParent().baojianId) local jushu = baoJian.gameNum local name = "" if string.len(baoJian.title) > 0 then name = baoJian.title else name = "未设包间名" if app.club_php:getCestIsOpen(app.club_php.clubID) then name = "未设赛事名" end end node:getParent().Items.Layout_normal:setVisible(false) node:getParent().Items.Layout_all:setVisible(false) node:getParent().Items.Layout_normal:setVisible(true) node:getParent().Items.HtmlCtrl:setText('' .. tostring(name) .. '' .. tostring("("..tostring(jushu).."局)") .. ''); node:getParent().Items.Layout_normal:setEnabled(true) elseif node:getParent().state == 0 then node:getParent().Items.Text_baojianinfo:setTextColor(cc.c4b(255,255,255,255)) end self.curSelectBaoJian = node:getParent() end --修改玩法 function ClubTable:onChangeRule() playBtnEffect(); if self.clubInfo.mode ~= ClubDefine.BaoJianType.ManyRooms then self:onClickBaojianNormal() else if self.tableIdx then --有桌子下标,表示当前在房间内游戏,返回时需要退出房间 showTooltip("正在游戏中,禁止修改玩法") return end local gameId = self.radioManager:getResult() local gamerule = nil local index = 1 local baojianId = nil if toNumber(gameId) > 10000 then gamerule = toNumber(gameId)%10000 --gameId = math.floor(toNumber(gameId)/10000) else if self.curSelectBaoJian and self.curSelectBaoJian.state ~= 0 then local baojian = app.club_php:getBaoJian(self.clubInfo.clubId,self.curSelectBaoJian.baojianId) if baojian then gamerule = json.decode(baojian.strGameRule).gamerule end end end if self.curSelectBaoJian and self.curSelectBaoJian.index then if self.curSelectBaoJian.index then index = self.curSelectBaoJian.index end if self.curSelectBaoJian.baojianId then baojianId = self.curSelectBaoJian.baojianId end end local view = import("luaScript.Views.Club.ClubChangeRule"):new(self.clubInfo.clubId,gameId,gamerule,baojianId,index) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end end function ClubTable:onClubHintsUpdateEvent() self.ui.Items.ImageView_dian:setVisible(self.clubInfo.isHints) end --设置默认界面 function ClubTable:setDefault() --根据平台修改提示:当前茶馆还未设置任何游戏哦! self.ui.Items.Text_1:setString(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NOT_GAME or PLN.CLUB_NOT_GAME) self.ui.Items.Button_enter_table:setVisible(false) self.ui.Items.Button_quick_start:setVisible(false) --右边按钮集 self:setRightMenuVisible(false); --默认不显示人物及提示 self.ui.Items.Layout_no_set:setVisible(false) self.ui.Items.Text_no_table:setVisible(false) --点击层 self.ui.Items.Layout_touch:setVisible(false); self.ui.Items.Layout_baojian_touch:setVisible(false); --默认不显示红点提示 self.ui.Items.ImageView_dian:setVisible(false) --包间 self.ui.Items.Layout_BaoJian:setVisible(false) self.ui.Items.CheckBox_BaoJian_Item:setVisible(false) --左边游戏集合 self.ui.Items.CheckBox_Item:setVisible(false) self.ui.Items.ScrollView_GameList:hideAllBar() self.ui.Items.ScrollView_GameList:getInnerContainer():setAutoSize(true) self.ui.Items.ScrollView_BaoJian:hideAllBar() self.ui.Items.ScrollView_BaoJian:getInnerContainer():setAutoSize(true) --合盟 self.ui.Items.Layout_union_guide:setVisible(false) self.ui.Items.ImageView_union_dian:setVisible(false) --隐藏桌数 self.ui.Items.Layout_look_table:setVisible(false) -- 隐藏海选赛的快速开始layout 和 返回桌子 self.ui.Items.Layout_btn_quick:setVisible(false) self.ui.Items.Button_enter:setVisible(false) end --设置亲友圈背景 function ClubTable:setTableImg(tableImgIndex) if tableImgIndex and tonumber(tableImgIndex) >= 0 then self.ui.Items.ImageView:loadTexture("res/ui/zy_club/club_common/club_common_bg_"..tableImgIndex..".jpg"); else self.ui.Items.ImageView:loadTexture("res/ui/zy_club/club_common/club_common_bg.jpg"); end end function ClubTable:onScrollViewEvent(node,event) if self.clubInfo and self.clubInfo.mode ~= ClubDefine.BaoJianType.Normal then if event == cc.ScrollviewEventType.bounceRightEnd and not self.isUpdateing and self.isCanRequest and self.clubInfo and self.clubInfo.pageNum and table.nums(self.clubInfo.rooms) >= self.clubInfo.pageNum then local gameId = app.club_php:getSelectGameId() local maxPlayingRoomCount = gameId == 0 and (self.clubInfo.config.allPlayerPri or 10) or (self.clubInfo.config.playerPri or 8) --创始人和管理员当且查看隐藏桌数的时候可以无限拉取,查看全部桌数 if self._bShowAllRoom or (table.nums(self.clubInfo.rooms) < maxPlayingRoomCount) then self.isCanRequest = false self.curPage = self.curPage + 1 app.club_php:setChangeTable(false) logD("only do onece!!!") self.isUpdateing = true runDelay(0.1,function () self.isUpdateing = false end) app.club_php:requestRoomList(self.clubInfo.clubId,app.club_php:getSelectGameId(),app.club_php:getSelectBaoJianId(),self.curPage,true) end elseif event == cc.ScrollviewEventType.scrolling then local width1 = self.ui.Items.ScrollView:getContentSize().width local width2 = self.ui.Items.ScrollView:getInnerContainer():getContentSize().width local pos = self.ui.Items.ScrollView:getInnerContainer():getPosition() if math.abs(pos.x + width1 - width2) > 100 then self.isCanRequest = true end end end end function ClubTable:onUpdatePlayerListEvent(event) end --刷新桌子 function ClubTable:updateTableList(event) logD(" ------------------------- ClubTable:updateTableList() ------------------------- ") local clubId = event.clubId local scrollState = event.scrollState -- 非当前俱乐部的数据,则不处理 if clubId ~= self.clubId then logD("ClubTable:updateTableList() clubId ~= self.clubId ") return end self:changeScrollViewSize() local clubInfo = app.club_php:getClubInfo(self.clubId) if not clubInfo then logD("ClubTable:updateTableList() clubInfo is nil") return end self._allTables = {} --更新个人配置信息 self:initPlayerInfo() --再来一局 local againBaoJianId = getAgainGameBaoJianId() local bPlayAgain,wanfa = getIsAgainGamebol() if bPlayAgain then gameId = app.club_php:getGameIdByBaoJianId(self.clubInfo.clubId,againBaoJianId) ruleId = againBaoJianId --保存到内存 app.club_php:setSelectGameId(gameId) app.club_php:setSelectBaoJianId(ruleId) self:saveGameInfoToFile(gameId,ruleId) local club = app.club_php.clubList[tonumber(self.clubInfo.clubId)] club.isplaying = 0 end self:updateSetting() self:setMenuButton() --俱乐部消息红点 self:onClubHintsUpdateEvent() --主盟消息红点 self:onClubUnionHintsUpdateEvent() self:popClubWindow() self:updateLeftGame(scrollState) end function ClubTable:updateTableView(data) local clubInfo = app.club_php:getClubInfo(self.clubId) if not clubInfo then logD("ClubTable:updateTableList() clubInfo is nil") return end if self._bShowAllRoom and self.clubInfo.groupext then self.clubInfo.groupext.is_playerpri = 0 end --快速加入状态更换 self:showButtonState() local baoJians = {} local gameId = data if type(data) == "table" then gameId = data.gameId--没包括0 if data.tpage and data.tpage < self.curPage then self.curPage = data.tpage end end --本地的gameid local localGameId = app.club_php:getSelectGameId() --全部情况下过滤包间 if localGameId ~= 0 then local ruleId = app.club_php:getSelectBaoJianId() for k,v in pairs(self.clubInfo.baoJians) do if (tonumber(v.gameId) == gameId or gameId == 0) and (tonumber(v.baoJianId) == ruleId or ruleId == 0) and tonumber(v.is_use) == 1 then baoJians[k] = v end end elseif self.clubInfo.mode == ClubDefine.BaoJianType.Multiple then for k,v in pairs(self.clubInfo.baoJians) do if tonumber(v.is_use) == 1 then baoJians[k] = v end end end --localGameId 为0则是选中全部,无须过滤,不同游戏之间过滤刷新。 if gameId ~= localGameId and localGameId ~= 0 then return end local mListView = self.ui.Items.ScrollView mListView:getInnerContainer():setAutoSize(true) if self.isUpdateAll then mListView:removeAllChildren() mListView:jumpToLeft() self.allTableItem = {} self.isUpdateAll = false end mListView:hideAllBar() -- 判断包间是否存在 local function isExistBaoJian(baoJianId) local isExist = false; local baojians = clubInfo.baoJians; for k, v in pairs(baojians or {}) do if tonumber(k) == tonumber(baoJianId) then isExist = true; break; end end return isExist; end local baoJianNum = table.nums(baoJians) if baoJianNum == 0 and (localGameId ~= 0 or self.clubInfo.mode == ClubDefine.BaoJianType.Multiple or (self.clubInfo.mode == ClubDefine.BaoJianType.Normal and table.nums(self.clubInfo.settings) == 0)) then --未设置玩法 self.ui.Items.Layout_no_set:setVisible(true) mListView:removeAllChildren() logD(" ------------------------- ClubTable:updateTableList() 删除所有桌子") else if localGameId ~= 0 and self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then self.ui.Items.Layout_BaoJian:setVisible(true) end mListView:setTouchEnabled(false) self.ui.Items.Layout_no_set:setVisible(false) -- 记录所有新的 item 的索引 local newAllTableItem = {} -- 包间的数量 logD(" ------------------------- ClubTable:updateTableList() baoJianNum = ", baoJianNum) local function isRoomHided (hideRooms, pos) local isHided = false for k, v in ipairs(hideRooms or {}) do if v.pos == pos then isHided = true break end end return isHided end local rooms, hideRooms = app.club_php:getShowRooms(self.clubInfo.clubId) local roomNum = table.nums(rooms) if roomNum == 0 and localGameId == 0 and self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then self.ui.Items.Text_no_table:setVisible(true) else self.ui.Items.Text_no_table:setVisible(false) end logD(" ------------------------- ClubTable:updateTableList() roomNum = ", roomNum) local index = 0 if self.clubInfo.mode == ClubDefine.BaoJianType.Normal then local idxBegin = (self.clubInfo.settings.orderId - 1) * ClubDefine.TableCountMax + 1 local idxEnd = idxBegin + (ClubDefine.TableCountMax - 1) --1.优先显示属于这个包间已经越界的posnumber桌子 --2.遵守满足30张的规则,不够30张再从当前包间的区间范围里抽余下空桌来凑30张。 ----1. local maxCount = 30 for i = 1, #rooms do local roomInfo = rooms[i] if idxBegin > roomInfo.pos and roomInfo.pos > idxEnd and (not isRoomHided(hideRooms, roomInfo.pos)) then index = index + 1 newAllTableItem[roomInfo.pos] = 1 -- 只显示包间存在的桌子, -- 包间不存在的桌子,可能是管理员删除了包间 if isExistBaoJian(roomInfo.baoJianId) then local realIndex = roomInfo.pos local showIndex = index if self.allTableItem[roomInfo.pos] then logD(" ------------------------- ClubTable:updateTableList() 更新桌子 ", roomInfo.pos) local item = self.allTableItem[roomInfo.pos]; item.layout:setLocalZOrder(index) item:updateData(self.clubId, realIndex, showIndex) else logD(" ------------------------- ClubTable:updateTableList() 创建桌子 ", roomInfo.pos) local item = import("luaScript.Views.Club.ClubTableItem"):new(self.clubId, realIndex, showIndex) item.ui.Items.Button_enter_table = self.ui.Items.Button_enter_table -- 保存节点 self.allTableItem[roomInfo.pos] = item -- 添加到容器 mListView:addChild(item.layout, index) end end end end -----2. for tableIdx = idxBegin, idxEnd do if index < maxCount and (not isRoomHided(hideRooms, tableIdx)) then index = index + 1 newAllTableItem[tableIdx] = 1 local realIndex = tableIdx local showIndex = index if self.allTableItem[tableIdx] then logD(" ------------------------- ClubTable:updateTableList() 2更新桌子 ", tableIdx) local item = self.allTableItem[tableIdx]; item.layout:setLocalZOrder(index) item:updateData(self.clubId, realIndex, showIndex) else logD(" ------------------------- ClubTable:updateTableList() 2创建桌子 ", tableIdx) local item = import("luaScript.Views.Club.ClubTableItem"):new(self.clubId, realIndex, showIndex) item.ui.Items.Button_enter_table = self.ui.Items.Button_enter_table -- 保存节点 self.allTableItem[tableIdx] = item -- 添加到容器 mListView:addChild(item.layout, index); end end end else --包间排序 local newBaoJians = app.club_php:getSortClubBaoJians(self.clubInfo.clubId,baoJians) -- 第一页需要先创建包间 for k,baojianInfo in ipairs(newBaoJians) do index = index + 1 local baoJianId = baojianInfo.baoJianId; newAllTableItem[baoJianId] = 1; if self.allTableItem[baoJianId] then logD(" ------------------------- ClubTable:updateTableList() 更新玩法桌子 ", baoJianId) local item = self.allTableItem[baoJianId] item.layout:setLocalZOrder(index) item:updateData(baojianInfo, index) else logD(" ------------------------- ClubTable:updateTableList() 创建玩法桌子 ", baoJianId) local item = import("luaScript.Views.Club.ClubTableBaoJianItem"):new(baojianInfo, clubInfo.clubId) item.ui.Items.Button_enter_table = self.ui.Items.Button_enter_table -- 保存节点 self.allTableItem[baoJianId] = item -- 添加到容器 mListView:addChild(item.layout, index); end end for i = 1, #rooms do index = index + 1 local roomInfo = rooms[i] newAllTableItem[roomInfo.pos] = 1; -- 只显示包间存在的桌子, -- 包间不存在的桌子,可能是管理员删除了包间 if isExistBaoJian(roomInfo.baoJianId) then local realIndex = roomInfo.pos local showIndex = index - baoJianNum if self.allTableItem[roomInfo.pos] then logD(" ------------------------- ClubTable:updateTableList() 更新桌子 ", roomInfo.pos) local item = self.allTableItem[roomInfo.pos]; item.layout:setLocalZOrder(index) item:updateData(self.clubId, realIndex, showIndex) else logD(" ------------------------- ClubTable:updateTableList() 创建桌子 ", roomInfo.pos) local item = import("luaScript.Views.Club.ClubTableItem"):new(self.clubId, realIndex, showIndex) if item then item.ui.Items.Button_enter_table = self.ui.Items.Button_enter_table -- 保存节点 self.allTableItem[roomInfo.pos] = item -- 添加到容器 mListView:addChild(item.layout, index); else --上传日志,便于查找错误问题 uploadLogs(GAME_ERROR_TYPE.TABLENOFIND) end end end end -- 比较新旧IDX,删除过期的桌子 for k,v in pairs(self.allTableItem) do if not newAllTableItem[k] then if self.clubInfo.mode ~= ClubDefine.BaoJianType.Normal then local idx = v:getTableIdx() logD(" ------------------------- ClubTable:updateTableList() 删除桌子 ", k, idx) v:removeSelf() end self.allTableItem[k] = nil end end end mListView:setTouchEnabled(true) mListView:getInnerContainer():requestDoLayout() end self:playAgainlogic() logD("ClubTable:updateTableList2") end --再来一局 function ClubTable:playAgainlogic() --在子游戏总结算,点了邀请的同意后,在这里实现进入房间 local agdata = getAgainGameInvitedata() if agdata then --同意后进入房间,赋值当前进入的俱乐部id app.club_php.clubID = agdata.gid local function doRequest(gameId, roomId) if not gameId or tonumber(gameId) <= 0 then showTooltip("房间号不存在") return end app.hall:requestJoinRoom(gameId, roomId) end app.hall:queryRoomId(agdata.roomid,doRequest) setAgainGameInvitedata(nil) end --这部分逻辑的意思:点了再来一局按钮时,包间玩法被人删掉了,做了个校验。 local againBaoJianId = getAgainGameBaoJianId() local baojianbol = false if self.clubInfo.baoJians then for key,var in pairs(self.clubInfo.baoJians) do if tonumber(key) == tonumber(againBaoJianId) then baojianbol = true end end end if not baojianbol then if not getMyGameCreateStatus() then local againbol,wanfa = getIsAgainGamebol() if wanfa ~= "" then --showTooltip("房间创建失败,该包间玩法已被删除或修改!") showTooltip("该游戏包间玩法已被关闭!") end setIsAgainGamebol(false,"") else setIsAgainGamebol(false) end end local clubgamedata = getIsRoomGamedata() if clubgamedata then setisContinueRoomGamebol(true) end end function ClubTable:onClickEnter(data) setisContinueRoomGamebol(true) local tableMenuView = import("luaScript.Views.Club.ClubTableOperatMenu"):new(data.clubInfo.clubId, data.roomInfo, data.showIndex, false) tableMenuView.ui.Items.Button_enter_table = self.ui.Items.Button_enter_table tableMenuView:setAnchorPoint(cc.p(0.5, 0.5)) local worldPos = self.ui.Items.Layout_touch:getWorldPosition(); local viewContentSize = cc.size(232, 360); local x = worldPos.x; local y = worldPos.y - self.ui.Items.Layout_touch:getContentSize().height; local newPos = cc.p(x, y); tableMenuView:setPosition(newPos); app:showWaitDialog(tableMenuView, 0, true) end function ClubTable:showButtonState() local room = app.club_php:getMyInRoom(self.clubInfo.clubId) local view = app:getCurrentView() local baoJian = app.club_php:getBaoJianByGameId(self.clubInfo.clubId,app.club_php:getSelectGameId()) local isHaveUser = false if baoJian then for k,v in pairs(baoJian) do if tonumber(v.gameId) == app.club_php:getSelectGameId() then if tonumber(v.is_use) == 1 then isHaveUser = true end end end end if not room then --在房间界面的话显示进入桌子按钮 --进入桌子 self.ui.Items.Button_enter_table:setVisible(false) self.ui.Items.Button_quick_start:setVisible(true) --如果所在游戏没有包间且不是全部游戏就隐藏 if ((not isHaveUser and app.club_php:getSelectGameId() ~= 0) or app.club_php:getSelectGameId() == 0 or app.club_php:getSelectBaoJianId() == 0) and self.clubInfo.mode ~= ClubDefine.BaoJianType.Normal then self.ui.Items.Button_enter_table:setVisible(false) self.ui.Items.Button_quick_start:setVisible(false) end -- cest if app.club_php:getCestIsOpen(app.club_php.clubID) then --进入桌子 self.ui.Items.Button_enter:setVisible(false) self.ui.Items.Button_quick:setVisible(true) --如果所在游戏没有包间且不是全部游戏就隐藏 if ((not isHaveUser and app.club_php:getSelectGameId() ~= 0) or app.club_php:getSelectGameId() == 0 or app.club_php:getSelectBaoJianId() == 0) and self.clubInfo.mode ~= ClubDefine.BaoJianType.Normal then self.ui.Items.Button_enter:setVisible(false) self.ui.Items.Button_quick:setVisible(false) end --刷新layout布局 self.ui.Items.Layout_under:requestDoLayout() self.ui.Items.Layout_under:doLayout() end else --进入桌子 self.ui.Items.Button_enter_table:setVisible(true) self.ui.Items.Button_quick_start:setVisible(false) -- cest if app.club_php:getCestIsOpen(app.club_php.clubID) then self.ui.Items.ImageView_zhanji_line:setVisible(true) self.ui.Items.Layout_btn_quick:setVisible(true) self.ui.Items.Button_enter:setVisible(true) self.ui.Items.Button_quick:setVisible(false) --刷新layout布局 self.ui.Items.Layout_under:requestDoLayout() self.ui.Items.Layout_under:doLayout() end end end function ClubTable:setMenuButton() --自己不是管理员或创始人(1:成员 2:管理员 3:创始人) local isAdmin = tonumber(self.clubInfo.role) == ClubDefine.Job.Creator --设置 self.ui.Items.Layout_set:setVisible(true) --消息 if self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_OPEN then self.ui.Items.Layout_apply_msg:setVisible(isAdmin or self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.LevelOneCopartner or self.clubInfo.role == ClubDefine.Job.LevelTwoCopartner or self.clubInfo.role == ClubDefine.Job.LevelThreeCopartner); elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_CEST_OPEN then self.ui.Items.Layout_apply_msg:setVisible(isAdmin or self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.LevelOneCopartner or self.clubInfo.role == ClubDefine.Job.LevelTwoCopartner or self.clubInfo.role == ClubDefine.Job.LevelThreeCopartner); else self.ui.Items.Layout_apply_msg:setVisible(isAdmin or tonumber(self.clubInfo.role) == ClubDefine.Job.Manager); end --退出 self.ui.Items.Layout_exit:setVisible(not isAdmin); self.ui.Items.Layout_invite:setVisible(self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.Creator) --self.ui.Items.Layout_activity:setVisible(self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.Creator) if isReviewVersion() then self.ui.Items.Layout_invite:setVisible(false) end --刷新右上方layout布局 self.ui.Items.Layout_up_menu:requestDoLayout() self.ui.Items.Layout_up_menu:doLayout() --刷新下方layout布局 self.ui.Items.Layout_under:requestDoLayout() self.ui.Items.Layout_under:doLayout() end function ClubTable:updateChangeRuleBtn() --如果是成员则显示包间玩法按钮,如果是管理员或创始人则显示修改玩法按钮 if self.clubInfo.mode == ClubDefine.BaoJianType.Normal or self.clubInfo.mode == ClubDefine.BaoJianType.Multiple then if (self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.Creator) and not app.club_php:getIsSlaveUnion(self.clubInfo.clubId) then self.ui.Items.Button_change_rule:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_btn_change_rule.png") else self.ui.Items.Button_change_rule:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_btn_baojian_wanfa.png") end self.ui.Items.Layout_btn_change_rule:setVisible(true); elseif self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then if (self.clubInfo.role == ClubDefine.Job.Manager or self.clubInfo.role == ClubDefine.Job.Creator) and app.club_php:getSelectGameId() ~= 0 and not app.club_php:getIsSlaveUnion(self.clubInfo.clubId) then self.ui.Items.Layout_btn_change_rule:setVisible(true); else self.ui.Items.Layout_btn_change_rule:setVisible(false); end end -- todo lwqcest -- self.ui.Items.Button_change_rule:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_cest_room_btn_bisai_guanli.png") -- self.ui.Items.Button_match_info:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_cest_room_btn_cest_rank.png") -- self.ui.Items.Button_zhanji:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_cest_room_btn_zhanji.png") --刷新layout布局 self.ui.Items.Layout_under:requestDoLayout() self.ui.Items.Layout_under:doLayout() end --更新玩法数据 function ClubTable:updateSetting(event) if event and event.setType then local setType = event.setType if setType == GAME_CLUB_SET_STATE.Change_Mode then -- 修改包间模式,需要清除一下桌子,再创建新的桌子 if self.clubInfo.mode ~= event.value then self._allTables = {} self.ui.Items.ScrollView:removeAllChildren() end self.clubInfo.mode = event.value self:changeScrollViewSize() -- --请求茶馆桌子数据 local gameId local baoJianId if self.clubInfo.mode == ClubDefine.BaoJianType.Normal then gameId = self.clubInfo.settings.realGameId baoJianId = self.clubInfo.settings.baoJianId end app.club_php:setSelectGameId(gameId or 0) app.club_php:setSelectBaoJianId(baoJianId or 0) app.club_php:requestClubHome(self.clubInfo.clubId) end end --顶部包间信息 self:updateTopBaoJianInfo() --更多游戏 if self.clubInfo.role == ClubDefine.Job.Creator or self.clubInfo.role == ClubDefine.Job.Manager then self.ui.Items.Button_moreGame:setVisible(true) self.ui.Items.Layout_look_table:setVisible(self.clubInfo.mode ~= ClubDefine.BaoJianType.Normal) else self.ui.Items.Button_moreGame:setVisible(false) self.ui.Items.Layout_look_table:setVisible(false) self._bShowAllRoom = false end --包间设置 self:updateChangeRuleBtn() --比赛场设置 self.ui.Items.Layout_btn_match_info:setVisible(false) self.ui.Items.Layout_Score:setVisible(false) self.ui.Items.Button_wenhao:setVisible(false) self.ui.Items.Button_level:setVisible(false) --0后台是否开启这个按钮,1,关闭,2开启 if self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.SERVER_CLOSE then self.ui.Items.Layout_btn_hehuoren:setVisible(true) local isShowHeHuoRen = app.config.ModuleConfig.IsSupportHeHuoRen and (self.clubInfo.role == 2 or self.clubInfo.role == 3 or self.clubInfo.role == 4) self.ui.Items.Layout_btn_hehuoren:setVisible(isShowHeHuoRen) self.ui.Items.Layout_FangKa:setVisible(self.clubInfo.role == 3) self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_bottom_normal_mode.png") elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_SEVER_CLOSE then local isShowHeHuoRen = app.config.ModuleConfig.IsSupportHeHuoRen and (self.clubInfo.role == 2 or self.clubInfo.role == 3 or self.clubInfo.role == 4) self.ui.Items.Layout_btn_hehuoren:setVisible(isShowHeHuoRen) self.ui.Items.Layout_FangKa:setVisible(self.clubInfo.role == 3) self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_bottom_normal_mode.png") elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.CLIENT_OPEN then self.ui.Items.Layout_btn_hehuoren:setVisible(false) if self.clubInfo.role ~= ClubDefine.Job.Member then self.ui.Items.Layout_btn_match_info:setVisible(true) end self.ui.Items.Layout_btn_player_list:setVisible(false) self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_bottom_match_mode.png") self.ui.Items.Button_wenhao:setVisible(true) self.ui.Items.Button_level:setVisible(true) self.ui.Items.Layout_FangKa:setVisible(self.clubInfo.role == 3) elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.CLIENT_CLOSE then local isShowHeHuoRen = app.config.ModuleConfig.IsSupportHeHuoRen and (self.clubInfo.role == 2 or self.clubInfo.role == 3 or self.clubInfo.role == 4) self.ui.Items.Layout_btn_hehuoren:setVisible(isShowHeHuoRen) self.ui.Items.Layout_btn_player_list:setVisible(true) self.ui.Items.Layout_btn_match_info:setVisible(false) self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_bottom_normal_mode.png") self.ui.Items.Button_wenhao:setVisible(true) self.ui.Items.Button_level:setVisible(true) self.ui.Items.Layout_FangKa:setVisible(self.clubInfo.role == 3) elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_OPEN then self.ui.Items.Layout_btn_hehuoren:setVisible(false) self.ui.Items.Layout_btn_match_info:setVisible(true) self.ui.Items.Layout_btn_player_list:setVisible(false) self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_btn_quanminsai.png") self.ui.Items.Button_match_info:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_btn_match_quanminsai.png") self.ui.Items.Button_level:setTouchEnabled(self.clubInfo.role == ClubDefine.Job.Creator) self.ui.Items.Button_wenhao:setTouchEnabled(true) self.ui.Items.Layout_Score:setTouchEnabled(true) self.ui.Items.Button_wenhao:setVisible(true) self.ui.Items.Button_level:setVisible(true) self.ui.Items.Layout_Score:setVisible(true) self.ui.Items.Layout_FangKa:setVisible(self.clubInfo.role == 3) elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_CLOSE then local isShowHeHuoRen = app.config.ModuleConfig.IsSupportHeHuoRen and (self.clubInfo.role == 2 or self.clubInfo.role == 3 or self.clubInfo.role == 4) self.ui.Items.Layout_btn_hehuoren:setVisible(isShowHeHuoRen) self.ui.Items.Layout_btn_player_list:setVisible(true) self.ui.Items.Layout_btn_match_info:setVisible(false) self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_bottom_normal_mode.png") self.ui.Items.Layout_FangKa:setVisible(self.clubInfo.role == 3) end -- -- todo lwqcest -- self.ui.Items.Button_match_set:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_room_bottom_cest.png") -- self.ui.Items.Button_match_info:loadTextureNormal("res/ui/zy_club/club_table/bottom_view/club_cest_room_btn_cest_rank.png") --合盟显示 self:onUpdateMaster() self:onUpdateHongHua() if self.clubInfo.mode == ClubDefine.BaoJianType.Normal or self.clubInfo.mode == ClubDefine.BaoJianType.Multiple then --屏蔽左侧游戏列表 self.ui.Items.Layout_LeftGame:setVisible(false) --屏蔽子游戏多包间的包间列表 self.ui.Items.Layout_BaoJian:setVisible(false) else self.ui.Items.Layout_LeftGame:setVisible(true) end --刷新layout布局 self.ui.Items.Layout_under:requestDoLayout() self.ui.Items.Layout_under:doLayout() --刷新layout布局 self.ui.Items.Layout_ChongBangFen:requestDoLayout() self.ui.Items.Layout_ChongBangFen:doLayout() end function ClubTable:onUpdateHongHua() if self.clubInfo.memberInfo then local memberInfo = self.clubInfo.memberInfo self.ui.Items.Text_chongbangfen:setText(tostring(memberInfo.warnum)) self.ui.Items.TextBMFont:setText(tostring(self.clubInfo.groupLevel)) end end --合盟 function ClubTable:onUpdateMaster() local groupext = self.clubInfo.groupext --隐私数据 local cliext = self.clubInfo.groupext and self.clubInfo.groupext.cliext if groupext then local action = cc.Sequence:create(cc.ScaleTo:create(0.4,0.95),cc.ScaleTo:create(0.4,1.2)) self.ui.Items.ImageView_hand:runAction(cc.RepeatForever:create(action)) if groupext and groupext.master_union == 2 then self.ui.Items.Button_Union:loadTextureNormal("res/ui/zy_club/club_table/top_view/club_room_master.png") self.ui.Items.Button_Union:setVisible(true) if cliext and cliext.readUnionGuide ~= 1 and self.clubInfo.role == ClubDefine.Job.Creator then self.ui.Items.Layout_union_guide:setVisible(true) end self.ui.Items.Text_union:setText(PLN.CLUB_UNION_MASTER_INTRO) elseif groupext and groupext.slave_union == 2 then self.ui.Items.Button_Union:setVisible(true) self.ui.Items.Button_Union:loadTextureNormal("res/ui/zy_club/club_table/top_view/club_room_slave.png") if cliext and cliext.readUnionGuide ~= 1 and self.clubInfo.role == ClubDefine.Job.Creator then self.ui.Items.Layout_union_guide:setVisible(true) end self.ui.Items.Text_union:setText(PLN.CLUB_UNION_SLAVE_INTRO) else self.ui.Items.Button_Union:setVisible(false) end end --不管哪个模式,如果自己是副盟,房卡不显示 if app.club_php:getIsSlaveUnion(self.clubInfo.clubId) then self.ui.Items.Layout_FangKa:setVisible(false) self.ui.Items.Button_moreGame:setVisible(false) end end function ClubTable:onClose() playBtnCloseEffect(); local room = app.club_php:getMyInRoom(self.clubInfo.clubId) if room then --有桌子下标,表示当前在房间内游戏,返回时需要退出房间 self:onExitRoom(room) else local view = app:getCurrentView() -- logD(view.__cname) if view and view.__cname == "MainView" then --在主界面则清除ID 在房间界面则不清除 应该是点击切换包间打开的 app.club_php.clubID = 0 app.club_php.tableIdx = 0 end setInClubRoom(false) self:removeFromParent() end end -- 战绩 function ClubTable:onZhanjiClub() playBtnEffect() if self.clubInfo and self.clubInfo.isGamb and (self.clubInfo.role == ClubDefine.Job.Member or self.clubInfo.role == ClubDefine.Job.Copartner or self.clubInfo.role == ClubDefine.Job.LevelOneCopartner or self.clubInfo.role == ClubDefine.Job.LevelTwoCopartner or self.clubInfo.role == ClubDefine.Job.LevelThreeCopartner) then --开启屏蔽战绩时,不显示战绩数据(只限成员) local function onOK() end local function onCancel() end showConfirmDialog("当前战绩已被屏蔽,如需开启,请联系"..(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_CREATOR_DESC or PLN.CLUB_CREATOR_DESC).."重新设置隐私选项",onOK,onCancel) return end local memberInfo = self.clubInfo.memberInfo if memberInfo and memberInfo.status == 0 then showTooltip("黑名单无法查看!") return end local view = import("luaScript.Views.Club.ClubZhanJiView"):new(self.clubInfo) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end --消息 function ClubTable:onApplyMsg() playBtnEffect(); if self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_OPEN then local view = import("luaScript.Views.Club.Match.ClubMatchMessage"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_CEST_OPEN then -- lwqcest local view = import("luaScript.Views.Club.Cest.ClubCestMessage"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) else local view = import("luaScript.Views.Club.ClubMessage"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end end --设置 function ClubTable:onSet() playBtnEffect(); local isAdmin = (tonumber(self.clubInfo.role) == 3) if isAdmin then local view = import("luaScript.Views.Club.ClubSheZhi.ClubShezhi"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) else local isShow = self.ui.Items.Layout_right_menu:isVisible(); self.ui.Items.Layout_touch:setVisible(not isShow) self:setRightMenuVisible(not isShow) end end function ClubTable:setRightMenuVisible(bVisble) self.ui.Items.Layout_right_menu:setVisible(bVisble); end --成员列表 function ClubTable:onPlayerList() playBtnEffect(); self:onTouch() local function delView() self.playerListView = nil end local player = app.club_php:getPlayer(self.clubInfo.clubId,app.user.loginInfo.uid) if player and player.viewType ~= ClubDefine.PlayListType.NORMAL_MEMBER then self.clubInfo.players = {} end local view = import("luaScript.Views.Club.ClubNormalMode.ClubPlayerMain"):new(self.clubInfo.clubId,delView) self.playerListView = view view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end --快速开始 function ClubTable:onQuickStart() playBtnEffect(); if not isEnableEnterRoom() then return end self:enterRoom(); end function ClubTable:enterRoom() local baoJian if self.clubInfo.mode ~= ClubDefine.BaoJianType.Normal then if not self.curSelectBaoJian then return end baoJian = app.club_php:getBaoJian(self.clubInfo.clubId,self.curSelectBaoJian.baojianId) else baoJian = self.clubInfo.settings end local roomFull = {} local rooms = self.clubInfo.rooms if rooms then for pos,room in pairsByKeys(rooms) do if baoJian.baoJianId == room.baoJianId then if table.nums(room.players) < app.club_php:getPlayerNum(baoJian) then if room.status == 1 then --未开局 self:joinClubRoom(pos,room.roomId, baoJian) return else roomFull[pos] = true end else roomFull[pos] = true end end end self:createRoom(baoJian) end end function ClubTable:createRoom(baoJianInfo) if self.clubInfo.status == 2 then showConfirmDialog(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_DONG_JIE_TIP or PLN.CLUB_DONG_JIE_TIP); return; end if table.nums(baoJianInfo) <= 0 then showConfirmDialog("未设置游戏玩法,请先设置游戏玩法后再来开房!"); return; end if not app.subGameManager:isInstaller(tonumber(baoJianInfo.realGameId)) or app.subGameManager:isNeedUpdate(tonumber(baoJianInfo.realGameId)) then requestDownloadSubGame(tonumber(baoJianInfo.realGameId), function () showTooltip("下载完成") end, true) return end local memberInfo = self.clubInfo.memberInfo if memberInfo and memberInfo.status == 0 then showTooltip("您已被暂停游戏,请联系管理员!") return end local request = self:getCreateRoomData(nil,baoJianInfo); logD("clubCreateRoomRequest() request = ",table.tostring(request)); --开房时记录茶馆id,用于退出房间时返回界面做判断 app.club_php.clubID = self.clubInfo.clubId app.club:requesetCreateRoomInClub(request) end function ClubTable:getCreateRoomData(pos,ruleInfo) --局数 local jushu = 0; if table.nums(ruleInfo) > 0 then jushu = ruleInfo.gameNum; end local tableIdx = pos; if not pos and ruleInfo.orderId then local startIndex = (ruleInfo.orderId - 1)* ClubDefine.TableCountMax + 1 for i=startIndex,startIndex + (ClubDefine.TableCountMax - 1) do if not self.clubInfo.posList[i] then tableIdx = i break end end end if not tableIdx then showTooltip("当前房间数量已达到上限!") return end --showConfirmDialog(tostring(tableIdx)) local gameId = tonumber(ruleInfo.realGameId) --记录茶馆桌子下标,用于房间切换回茶馆时做判断 app.club_php.tableIdx = tableIdx local request = ClubCreateRoomRequest:new() request.gameid = gameId;--游戏id request.groupId = tonumber(self.clubInfo.clubId);--茶馆标识 request.groupIndex = tostring(tableIdx); --茶馆桌子序号 request.groupUid = tonumber(self.clubInfo.ownerId);--茶馆管理员ID request.groupMemNum = tonumber(self.clubInfo.playerNum);--茶馆成员人数 --游戏局数 request.gameNum = jushu; --游戏信息,同游戏创建参数 local gameinfo = ruleInfo.strGameRule local ttGameInfo = json.decode(gameinfo) or {} ttGameInfo.clubId = tonumber(self.clubInfo.clubId) ttGameInfo.tableIdx = tonumber(tableIdx) ttGameInfo.ruleid = tostring(ruleInfo.baoJianId) --柳州字牌增加23人玩法 if gameId == 20 and not ttGameInfo.startMode then ttGameInfo.startMode = 1 end gameinfo = json.encode(ttGameInfo) request.gameInfo = gameinfo --发起创建的用户信息 local tt = json.decode(app.user.userInfo) tt.openid = app.user.openid tt.unionid = app.user.unionid tt.sex = tonumber(tt.sex) request.usrinfo =json.encode(tt) return request; end function ClubTable:joinClubRoom( pos, roomid, ruleInfo) if self.clubInfo.status == 2 then showConfirmDialog(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_DONG_JIE_TIP or PLN.CLUB_DONG_JIE_TIP); return; end local gameId = tonumber(ruleInfo.realGameId) if not app.subGameManager:isInstaller(gameId) or app.subGameManager:isNeedUpdate(gameId) then requestDownloadSubGame(gameId, function () showTooltip("下载完成") end, true) return end --[[if self.clubInfo.players then local playerList = self.clubInfo.players for k,v in pairs(playerList) do if v.uid == tostring(app.user.loginInfo.uid) and v.status == 0 then showTooltip("您已被暂停游戏,请联系管理员!") return end end end--]] local memberInfo = self.clubInfo.memberInfo if memberInfo and memberInfo.status == 0 then showTooltip("您已被暂停游戏,请联系管理员!") return end local request = ClubJoinRoomRequest:new() request.gameid = gameId; --游戏id request.tableid = tonumber(roomid); --房间号 request.grouId = tonumber(self.clubInfo.clubId); --茶馆标识 request.groupIndex = tonumber(pos); --茶馆桌子序号 --发起创建的用户信息 local tt = json.decode(app.user.userInfo) tt.unionid = app.user.unionid tt.openid = app.user.openid tt.sex = tonumber(sex) request.usrinfo =json.encode(tt) --游戏信息,同游戏创建参数 local gameinfo = json.decode(ruleInfo.strGameRule) if gameinfo then request.gamerule = gameinfo.gamerule end logD("clubJoinRoomRequest() request = ",table.tostring(request)); --开房时记录茶馆id,用于退出房间时返回界面做判断 app.club_php.clubID = self.clubInfo.clubId; local createRoomRequest = self:getCreateRoomData(pos, ruleInfo); app.club:requestJoinRoomInClub(request, createRoomRequest) end --退出茶馆 function ClubTable:onExitClub() playBtnEffect(); local room = app.club_php:getMyInRoom(self.clubInfo.clubId) if room then --有桌子下标,表示当前在房间内游戏 showTooltip(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_IN_GAME_EXIT or PLN.CLUB_IN_GAME_EXIT) return end self:onTouch() local view = import("luaScript.Views.Club.ClubDongJie"):new(self.clubInfo.clubId,3) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end function ClubTable:onTouch() self.ui.Items.Layout_touch:setVisible(false) self:setRightMenuVisible(false); self.ui.Items.Layout_baojian_touch:setVisible(false); end function ClubTable:onApplicationWillEnterForeground() logD("ClubTable:onApplicationWillEnterForeground()") if not self.clubInfo then logD("ClubTable:onApplicationWillEnterForeground() self.clubInfo is nil") return end logD("ClubTable:onApplicationWillEnterForeground() self.clubInfo = ", table.tostring(self.ClubInfo)) app.club_php:requestClubHome(self.clubInfo.clubId) --不在成员列表界面请求茶馆成员列表,默认今日,在成员列表界面由成员列表自己去刷新对应的日期 if not self.playerListView then self:requestPlayerList() end end function ClubTable:onApplicationDidEnterBackground() --[[ local size = self.ui.Items.ScrollView:getContentSize() self.lastScrollViewSize = size dump(size, "ClubTable:onApplicationDidEnterBackground")--]] end --返回房间 function ClubTable:onBackRoom() playBtnEffect() self:removeFromParent() end function ClubTable:onBackRoomEvent() self:removeFromParent() end --退出房间 function ClubTable:onExitRoom() playBtnEffect(); local function onClickOk() self.ui:sendMsg(app.room, "callLeaveRequest"); end local function onClickCancel() end local room = app.club_php:getMyInRoom(self.clubInfo.clubId) if room then showTooltip("游戏中,无法退出!!!") return end --showConfirmDialog("离开后将会自动退出已落座的桌子?", onClickOk, onClickCancel) end --刷新 function ClubTable:onRefresh() playBtnEffect() --最后点击刷新的时间 self.lastRefreshTime = tonumber(loadUserInfo("lastRefreshTime")) or 0 saveUserInfo("lastRefreshTime",self.lastRefreshTime) --连续点击次数 self.touchTimes = tonumber(loadUserInfo("touchTime")) or 0 self.touchTimes = self.touchTimes + 1; saveUserInfo("touchTime", self.touchTimes) local curTime = os.time() local distance = curTime - self.lastRefreshTime local disbandTime = 5 --点击超过三次,提示 if self.touchTimes > 3 and distance <= disbandTime then showTooltip(string.format("请勿频繁刷新,休息一下下哦!")) return end self.lastRefreshTime = curTime saveUserInfo("lastRefreshTime",self.lastRefreshTime) --刷新回到第一页 self.curPage = 1; app.club_php:setChangeTable(true) local gameId = app.club_php:getSelectGameId() local ruleId = app.club_php:getSelectBaoJianId() app.club_php:requestClubHome(self.clubInfo.clubId,gameId,ruleId) --请求茶馆成员列表 self:requestPlayerList() showTooltip("刷新成功") end --点击公告 function ClubTable:onClickGongGao() if self.clubInfo.role == 1 then -- showTooltip("非管理人员") else playBtnEffect() local view = import("luaScript.Views.Club.ClubSetNotice"):new(self.clubInfo) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end end function ClubTable:onGetClubOfficialActivitySucc(event) local view = import("luaScript.Views.Club.ClubOfficialActivityView"):new(event.activitys) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end function ClubTable:popClubWindow(data) if data then self.clubInfo.cancelCopartner = data.response end if self.clubInfo and self.clubInfo.cancelCopartner and self.clubInfo.cancelCopartner.uid then local view = import("luaScript.Views.Club.ClubNoticeHeHuoRen"):new(self.clubInfo.clubId,self.clubInfo.cancelCopartner) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view,0) end end function ClubTable:onClubHeHuoRenCancelTip(data) local view = import("luaScript.Views.Club.ClubNoticeHeHuoRenTip"):new() view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view,0) end function ClubTable:requestPlayerList() local playerJson if self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.CLIENT_OPEN then--比赛场(弃用模式) playerJson = { clubId = self.clubInfo.clubId, viewType = ClubDefine.PlayListType.MATCH_MEMBER, status = ClubDefine.PlayListType.MATCH_MEMBER, } app.club_php:requestPlayerList(playerJson) elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_MATCH_OPEN then--排名赛(悠闲没有) local localData ={ clubId = self.clubId, viewType = ClubDefine.PlayListType.ALL_PEOPLE_MATCH_MANAGER, type = 1, muid = 0, isMyMem = 0, orderby = "role", sort = "desc", lastDay = 0, page = 1, suid = 0, } app.club_php:requestMatchManage(localData) elseif self.clubInfo.isArena == ClubDefine.MATCH_SWITCH.PEOPLE_CEST_OPEN then -- local localData ={ -- clubId = self.clubId, -- viewType = self.viewType, -- type = self.type, -- muid = self.muid, -- isMyMem = self.suid and PLAYER_TYPE_PHP_DATA[PLAYER_TYPE.ALL_MEMBER] or self.isMyMem,--搜索就在全部里面搜索,某个类别里面搜索,可能找不到人。 -- orderby = self.orderby, -- sort = self.sort, -- lastday = self.lastDay, -- page = self.curPage, -- suid = self.suid, -- } local localData ={ clubId = self.clubId, viewType = ClubDefine.PlayListType.ALL_PEOPLE_MATCH_MANAGER, type = 1, muid = 0, isMyMem = 0,--搜索就在全部里面搜索,某个类别里面搜索,可能找不到人。 orderby = "role", sort = "desc", lastday = 0, page = 1, suid = 0, } -- app.club_php:requestMatchManage(localData) app.club_php:requestCestManage(localData) else --普通场 playerJson = { clubId = self.clubInfo.clubId, viewType = ClubDefine.PlayListType.NORMAL_MEMBER, status = ClubDefine.PlayListType.NORMAL_MEMBER, } app.club_php:requestPlayerList(playerJson) end end function ClubTable:onClubGpsDistanceCheck(data) if not data then return end local uid = data.uid local userInfo = json.decode(data.userInfo) local nickname = getShortName(userInfo.nickname) local gpsDistance = data.gpsLimit local content = "当前房间禁止"..tostring(gpsDistance).."米内玩家同桌,经检测,您与"..nickname.."的距离小于"..tostring(gpsDistance).."米,无法加入房间" showConfirmDialog(content) setIsAgainGamebol(false,"") end function ClubTable:changeScrollViewSize() if self.clubInfo.mode == ClubDefine.BaoJianType.Normal then self.ui.Items.ScrollView:setSize(cc.size(1280*g_radio_x, self.srcTableScrollowSize.height)) elseif self.clubInfo.mode == ClubDefine.BaoJianType.Multiple then self.ui.Items.ScrollView:setSize(cc.size(1280*g_radio_x, self.srcTableScrollowSize.height)) elseif self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then self.ui.Items.ScrollView:setSize(cc.size(self.srcTableScrollowSize.width * g_radio_x, self.srcTableScrollowSize.height)) end end --设置通知 function ClubTable:onClubChangeEvent() -- 茶馆名 local nickname = getShortNameByLength(self.clubInfo.clubName,5) self.ui.Items.Text_name:setText(nickname) -- 根据条件隐藏茶馆id local cliext = self.clubInfo.groupext and self.clubInfo.groupext.cliext if not cliext or not cliext.is_hideGid or (cliext and cliext.is_hideGid == 1) then if tonumber(self.clubInfo.role) ~= ClubDefine.Job.Manager and tonumber(self.clubInfo.role) ~= ClubDefine.Job.Creator then self.ui.Items.Text_id:setVisible(false) if app.club_php:getCestIsOpen(self.clubId) then self.ui.Items.Text_cest_id:setVisible(false) end end else self.ui.Items.Text_id:setVisible(true) if app.club_php:getCestIsOpen(self.clubId) then self.ui.Items.Text_cest_id:setVisible(true) end end --刷新菜单按钮 self:setMenuButton() --包间切换 self:changeScrollViewSize() local gameId local baoJianId if self.clubInfo.mode == ClubDefine.BaoJianType.Normal then gameId = self.clubInfo.settings.realGameId baoJianId = self.clubInfo.settings.baoJianId app.club_php:setSelectGameId(gameId or 0) app.club_php:setSelectBaoJianId(baoJianId or 0) end self.ui.Items.Layout_baojian_touch:setVisible(false); end --点击包间列表 function ClubTable:onClickBaojianNormal() local bVisble = self.ui.Items.Layout_baojian_touch:isVisible() self.ui.Items.Layout_baojian_touch:setVisible(not bVisble) if not self.baoJianView then self.baoJianView = import("luaScript.Views.Club.ClubBaojian"):new(self.clubInfo.clubId) self.ui.Items.Layout_baojian_normal:addChild(self.baoJianView); end end --单包间-自己切换包间事件 function ClubTable:onClubChangeBaoJianEvent() self.ui.Items.Layout_baojian_touch:setVisible(false) local gameId = self.clubInfo.settings.gameId local baoJianId = self.clubInfo.settings.baoJianId app.club_php:setSelectGameId(gameId or 0) app.club_php:setSelectBaoJianId(baoJianId or 0) app.club_php:requestClubHome(self.clubInfo.clubId) -- 每次切包间,都滚到最左边 self.ui.Items.ScrollView:jumpToLeft() end function ClubTable:updateTopBaoJianInfo() if self.clubInfo.baoJians then if self.clubInfo.mode == ClubDefine.BaoJianType.Normal then local index = 0 local newBaoJians = app.club_php:getSortClubBaoJians(self.clubInfo.clubId) for k,v in ipairs(newBaoJians) do if tonumber(v.is_use) == 1 then index = index + 1 end if tonumber(v.baoJianId) == tonumber(self.clubInfo.settings.baoJianId) then break end end if self.clubInfo.settings.strGameRule then local strGameRule = json.decode(self.clubInfo.settings.strGameRule) local gamerule = strGameRule.gamerule or strGameRule.gameRule local name = getSubGameRuleName(self.clubInfo.settings.realGameId,tonumber(gamerule)) self.ui.Items.Text_baojian:setText(tostring(name)) self.ui.Items.Layout_top_baojian_info:setVisible(true) -- cest if app.club_php:getCestIsOpen(app.club_php.clubID) then -- cest self.ui.Items.ImageView_zhanji_line:setVisible(true) self.ui.Items.Layout_btn_quick:setVisible(true) end else self.ui.Items.Text_baojian:setText(tostring("未设置包间")) end if index ~= 0 then self.ui.Items.Text_index:setText(tostring(index)) else self.ui.Items.Layout_top_baojian_info:setVisible(false) -- cest self.ui.Items.ImageView_zhanji_line:setVisible(false) self.ui.Items.Layout_btn_quick:setVisible(false) end elseif self.clubInfo.mode == ClubDefine.BaoJianType.Multiple or self.clubInfo.mode == ClubDefine.BaoJianType.ManyRooms then self.ui.Items.Layout_top_baojian_info:setVisible(false) -- cest if app.club_php:getCestIsOpen(app.club_php.clubID) then -- self.ui.Items.ImageView_zhanji_line:setVisible(false) -- self.ui.Items.Layout_btn_quick:setVisible(false) end end local size = self.ui.Items.Layout_TextSize:getSize() self.ui.Items.Layout_TextSize:setSize(cc.size(self.ui.Items.Text_baojian:getSize().width,size.height)) self.ui.Items.Layout_top_baojian_info:requestDoLayout() self.ui.Items.Layout_top_baojian_info:doLayout() end end -- 合伙人按钮点击事件 function ClubTable:onBtnHeHuoRenClicked() playBtnEffect() if self.clubInfo.clubId <= 0 then showTooltip("请先选择" .. (app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME)) return end if tonumber(self.clubInfo.role) == ClubDefine.Job.Manager or tonumber(self.clubInfo.role) == ClubDefine.Job.Creator then local view = import("luaScript.Views.Club.HeHuoRen.ClubHeHuoRenMain"):new(self.clubInfo.clubId) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) else local view = import("luaScript.Views.Club.HeHuoRen.ClubHeHuoRenDetailed"):new(self.clubInfo, app.user.loginInfo.uid) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end end -- 邀请按钮点击事件 -- @return -- function ClubTable:onBtnInviteClicked() playBtnEffect() if self.clubInfo.clubId <= 0 then showTooltip("请先选择" .. (app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME)) return end -- local gname = self.clubInfo.gname -- local clubList = app.club_php.clubList -- if clubList then -- local clubInfo = clubList[tonumber(self.clubInfo.gid)] -- if clubInfo then -- gname = clubInfo.gname -- end -- end local title = string.format("%s名称:%s", (app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME), self.clubInfo.clubName) local content = string.format("可视化牌桌,不用自己开房就可以玩牌。"); local desc = string.format("%sID:%s\n%s", (app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME), self.clubInfo.clubId, content); local info = {} info.ClubID = self.clubInfo.clubId info.title = title info.description = desc print("用户开始分享") --需要显示的按钮(1:微信 2:复制 3:茶馆 ) if type(menuIdxs) ~= "table" then info.menuIdxs = {1, 4, 5, 6} end if type(copyData) == "string" then info.copyData = copyData else info.copyData = "" end dump(info) local view = import("luaScript.Views.Main.ShareView"):new(info) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end -- 活动按钮点击事件 -- function ClubTable:onBtnActivityClicked() playBtnEffect() if self.clubInfo.clubId <= 0 then showTooltip("请先选择" .. (app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME)) return end local clubId = self.clubInfo.clubId app.club_php:requestClubOfficialActivity(clubId) end --- -- 初始化广播条 -- @return -- function ClubTable:initBoradcastView(noticeList) if not self._broadcastView then local ClubBroadcastView = require("luaScript.Views.Club.ClubBroadcastView") self._broadcastView = ClubBroadcastView:new() self.ui.Items.Layout_Broadcast:addChild(self._broadcastView) end self._broadcastView:setBroadcastList(noticeList) end function ClubTable:updateTable(event) local showRooms, hideRooms = app.club_php:getShowRooms(nil, nil) for kk, vv in pairs(hideRooms or {}) do local pos = vv.pos for k,v in pairs(self.allTableItem or {}) do local idx = v:getTableIdx() if idx == pos then logD("ClubTable:updateTable 删除桌子 ", k, idx) v:removeSelf() self.allTableItem[k] = nil end end end end function ClubTable:onClubUnionHintsUpdateEvent() self.ui.Items.ImageView_union_dian:setVisible(self.clubInfo.isUnionHints) end -- function ClubTable:initClubCest() -- self.ui.Items.Layout_Mid:setVisible(false); -- self.ui.Items.Layout_Cest:setVisible(true); -- --隐藏桌数 -- self.ui.Items.Layout_look_table:setVisible(false) -- self:initClubCestRule() -- self:initClubCestChange() -- end -- function ClubTable:initClubCestRule() -- self.ui.Items.Text_rule:setVisible(false); -- self.ui.Items.ScrollView_rule:hideAllBar() -- self.ui.Items.ScrollView_rule:getInnerContainer():setAutoSize(true) -- local mListView = self.ui.Items.ScrollView_rule -- mListView:removeAllChildren() -- local content = { -- "1、玩家根据自己的竞技能力,可自主报名参与对应的比赛场;\n", -- "2、报名成功后,可获得该场的初始积分和参赛券;\n", -- "3、每参与一场比赛,消耗一定数量参赛券,比赛积分低于淘汰分或参赛券不足时,需本轮比赛结束,将本轮成绩更新到海选赛排行榜上后,可重新参与新一轮比赛;\n", -- "4、海选赛排行榜实时更新,以选手每天上报的最高好绩进行排名,为保证自己的最好成绩,选手可提前申请结束本轮比赛,保存本轮比赛成绩;\n", -- "5、海选赛排行榜24:00停止刷新,确定最终排名,取排行榜前50名,分别奖励50-1分的天梯赛分和CEST商城兑换积分;\n", -- "6、获得天梯赛排名可参与CEST专业赛事,CEST商城兑换积分,可到商城中兑换礼物\n", -- } -- for k,v in ipairs(content) do -- local item = self.ui.Items.Text_rule:getCopied() -- item:setString(v) -- mListView:addChild(item,0); -- end -- mListView:requestDoLayout() -- mListView:doLayout() -- mListView:jumpToTopOnSizeChanged() -- end -- function ClubTable:initClubCestChange() -- self.ui.Items.Button_baoming_1:registerClick(handler(self , self.onCestRequestBaoming)) -- self.ui.Items.Button_baoming_2:registerClick(handler(self , self.onCestRequestBaoming)) -- self.ui.Items.Button_baoming_3:registerClick(handler(self , self.onCestRequestBaoming)) -- end -- -- 报名参加 -- function ClubTable:onCestRequestBaoming(_change) -- -- local localData ={ -- -- clubId = self.clubId, -- -- viewType = self.viewType, -- -- type = self.type, -- -- muid = self.muid, -- -- isMyMem = self.suid and PLAYER_TYPE_PHP_DATA[PLAYER_TYPE.ALL_MEMBER] or self.isMyMem,--搜索就在全部里面搜索,某个类别里面搜索,可能找不到人。 -- -- orderby = self.orderby, -- -- sort = self.sort, -- -- lastday = self.lastDay, -- -- page = self.curPage, -- -- suid = self.suid, -- -- } -- -- app.club_php:requestMatchManage(localData) -- self:onCloseCestApplyLayer() -- end -- function ClubTable:onCloseCestApplyLayer() -- self.ui.Items.Layout_Cest:setVisible(false); -- end -- function ClubTable:onUpdateCestInfo() -- -- if self.clubInfo.memberInfo then -- local memberInfo = self.clubInfo.memberInfo -- self.ui.Items.Text_chongbangfen:setText(tostring(memberInfo.warnum)) -- self.ui.Items.TextBMFont:setText(tostring(self.clubInfo.groupLevel)) -- -- end -- end return ClubTable