-- 加入亲友圈界面 local ClubBaoJianInfo = class("ClubBaoJianInfo", cc.UIView) local ClubDefine = require("luaScript.Protocol.Club.ClubDefine") function ClubBaoJianInfo:ctor(gid,gameId,gameNum,strGameRule,arena,title) ClubBaoJianInfo.super.ctor(self); local ui = loadUI("res/ui/ui_club/match/ui_club_match_baoJianInfo.ui"); self.ui = ui; self:addChild(ui); self.clubInfo = app.club_php.clubList[tonumber(gid)] self.clubId = gid self.rule = getRuleFromString(gameId, gameNum, strGameRule,arena) if app.club_php:getCestIsOpen(app.club_php.clubID) then self.arena = getClubCestRule(arena) else self.arena = getClubMatchRule(arena) end self.title = title == "" and "未设包间名" or title if app.club_php:getCestIsOpen(app.club_php.clubID) then self.title = title == "" and "未设赛事名" or title end end function ClubBaoJianInfo:onEnter() ClubBaoJianInfo.super.onEnter(self) self.ui.Items.Layout_Item:setVisible(false) self:updateView() --按钮注册事件 self:registerButton() end --按钮注册点击事件 function ClubBaoJianInfo:registerButton() self.ui.Items.Button_Sure:registerClick(handler(self , self.onClose)) end function ClubBaoJianInfo:updateView() if app.club_php:getCestIsOpen(app.club_php.clubID) then self.ui.Items.ImageView_1:loadTexture("res/ui/zy_club/club_room/club_baojian/club_saishi_xinxi.png") end self.ui.Items.Text_title:setText(tostring(self.title)) --游戏玩法 self:createText("游戏玩法",self.rule) if app.club_php:getMatchIsOpen(self.clubId) then if app.club_php:getIsQuanMinSai(self.clubId) then self:createText("排名赛规则",self.arena,true) else self:createText("比赛规则",self.arena,true) end end if app.club_php:getCestIsOpen(self.clubId) then -- if app.club_php:getIsQuanMinSai(self.clubId) then -- self:createText("排名赛规则",self.arena,true) -- else self:createText("赛事规则",self.arena,true) -- end end end function ClubBaoJianInfo:createText(title,data,isBiSai) local layoutItem = self.ui.Items.Layout_Item:getCopied() layoutItem.Items = getUIItems(layoutItem) layoutItem.Items.Text:setText(title) local str = "" for k,v in ipairs(data or {}) do for _,ruleStr in ipairs(v.value or {}) do str = str..tostring(ruleStr).." " end end layoutItem.Items.Text_Rule:setText(str) if isBiSai then layoutItem.Items.Text_Rule:setTextColor(cc.c4b(30,42,52,255)) end layoutItem:requestDoLayout() layoutItem:doLayout() self.ui.Items.Layout_wanfa:addChild(layoutItem) self.ui.Items.Layout_wanfa:requestDoLayout() self.ui.Items.Layout_wanfa:doLayout() end function ClubBaoJianInfo:onClose() playBtnCloseEffect() self:removeFromParent() end return ClubBaoJianInfo;