local UIGVGFightSeasonStage = UIViewClass() --[[ 攻城略地——赛季阶段界面 --]] -------------------- function UIGVGFightSeasonStage:OnOpened(context) self:RegistSystemEvent(EventID.GVGFight_RefreshSeasonInfo, self.RefreshSeasonInfo) self:RegistSystemEvent(EventID.GVGFight_RefreshSeasonInfo, self.RefreshServerInfo) self:RegistSystemEvent(EventID.GVGFight_RefreshCityState, self.RefreshSeasonInfo) self:InitPanel() end function UIGVGFightSeasonStage:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGVGFightSeasonStage:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView(false) elseif comp == self.btn_ShowAllUp then self.state_Group:SetState(1) elseif comp == self.btn_ShowAllDown then self.state_Group:SetState(0) end end function UIGVGFightSeasonStage:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.Loop_GVGGroupList then local server = string.FormatByIdsId(Const_IDS.IDS_ServerInfo, data.serverId) UIUtils.SetLabel(cellTable.txt_ServerName, string.format("%s-%s", server, data.serverName)) if data.serverId == MDL.Login.GetServerShowId() then cellTable.state_My:SetState(1) else cellTable.state_My:SetState(0) end end end -------------------- function UIGVGFightSeasonStage:InitPanel() -- 设置标题 UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GVGFight_Season_Title) -- 初始化赛季界面 self:RefreshSeasonInfo() -- 初始化分组详情 self:RefreshServerInfo() end -- 刷新赛季信息 function UIGVGFightSeasonStage:RefreshSeasonInfo() local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() for i, item in ipairs(self.group_SeasonStage) do local state = i - 1 -- 设置时间 UIUtils.SetLabel(item.txt_SeasonStageTime, UTL.Time.FormatTimeCompletely(MDL.GVGFight.GetGVGFightStageOpenTime(state))) -- 设置状态 if state == curGVGFightState then item.state_Lab:SetState(1) elseif state < curGVGFightState then item.state_Lab:SetState(2) elseif state > curGVGFightState then item.state_Lab:SetState(0) end end end -- 刷新分组详情 function UIGVGFightSeasonStage:RefreshServerInfo() if MDL.GVGFight.GetserverInfoCount() > 0 then UIUtils.SetActive(self.btn_ShowAllUp, true) self.state_Group:SetState(1) UIUtils.SetLabelText(self.txt_CountDown, Const_IDS.IDS_GVGFight_Season_GroupDes) if self.Loop_GVGGroupList.Count > 0 then self.Loop_GVGGroupList:ClearCells() end for _, v in MDL.GVGFight.GetServerInfoIterator() do self.Loop_GVGGroupList:AddData(v, 0) end else UIUtils.SetActive(self.btn_ShowAllUp, false) self.state_Group:SetState(0) UIUtils.SetLabelText(self.txt_CountDown, Const_IDS.IDS_GVGFight_Season_GroupTips2) end end return UIGVGFightSeasonStage