local UIGuildWarWallOfFame = UIViewClass() local guild_war_enum = require 'Proto/guild_war_enum_pb' local GuildHonorPosName = { [0] = "IDS_GuildWar_HOFScore", [1] = "IDS_GuildWar_HOFKill", [3] = "IDS_GuildWar_HOFHit", [4] = "IDS_GuildWar_HOFAssist" } -------------------- 系統函數 ---------------------------------- function UIGuildWarWallOfFame:OnOpened() self.honorFameInfos = nil self.curShowFameIndex = 1 self:RegistSystemEvent(EventID.UI_GuildWarWallOfFame_Refresh, self.RefreshPanel) UIUtils.SetActive(self.section_Empty, true) UIUtils.SetActive(self.group_GuildName, false) UIUtils.SetActive(self.event_Terms, false) MDL.GuildWar.RequestHonorWall() end function UIGuildWarWallOfFame:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIGuildWarWallOfFame:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.event_Terms then local isShow = self.LoopScroll_Fame_Terms.gameObject.activeSelf UIUtils.SetActive(self.LoopScroll_Fame_Terms, not isShow) UIUtils.SetActive(self.img_Arrow01, isShow) UIUtils.SetActive(self.img_Arrow02, not isShow) if isShow then CTL.Sound.PlayGameSound("UI_expand") else CTL.Sound.PlayGameSound("UI_fold") end end end function UIGuildWarWallOfFame:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.LoopScroll_Fame_Terms then UIUtils.SetLabel(cellTable.txt_PlayerName, string.FormatByIdsId(Const_IDS["IDS_GuildWar_ScheduleTitle"], data.issue)) elseif scrollRect == self.Loop_Fame_PLayerInfo then if index == guild_war_enum.Leader then UIUtils.SetLabel(cellTable.txt_ScoreName, nil) else UIUtils.SetLabel(cellTable.txt_Score, data.score) UIUtils.SetLabelText(cellTable.txt_ScoreName, Const_IDS[GuildHonorPosName[index]]) end UIUtils.SetActive(cellTable.group_GuildLord, index == guild_war_enum.Leader) if string.isNilOrEmpty(data.acid) then UIUtils.SetActive(cellTable.group_player, false) UIUtils.SetActive(cellTable.group_Empty, true) UIUtils.SetLabelText(cellTable.txt_Score, Const_IDS["IDS_GuildBoss_EmptyText"]) return end UIUtils.SetActive(cellTable.group_player, true) UIUtils.SetActive(cellTable.group_Empty, false) UIUtils.SetActive(cellTable.img_PlayerBackgroundFlag_Blue, index ~= guild_war_enum.Leader) UIUtils.SetActive(cellTable.img_PlayerBackgroundFlag_Red, index == guild_war_enum.Leader) CTL.Character.SetPortraitAndFrame(cellTable.UIHeroHead190, data.portraitId, data.frameId) UIUtils.SetLabel(cellTable.txt_PlayerName, data.name) UIUtils.SetActive(cellTable.txt_Score, index ~= guild_war_enum.Leader) end end function UIGuildWarWallOfFame:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.LoopScroll_Fame_Terms then if target == cellTable.btn_PlayerName then if self.curShowFameIndex ~= index + 1 then self.curShowFameIndex = index + 1 self:RefreshInfos() end UIUtils.SetActive(self.LoopScroll_Fame_Terms, false) UIUtils.SetActive(self.img_Arrow01, true) UIUtils.SetActive(self.img_Arrow02, false) end end end ------------------------------------------------------------------- function UIGuildWarWallOfFame:RefreshPanel(msg) if msg and #msg > 0 then UIUtils.SetActive(self.section_Empty, false) UIUtils.SetActive(self.group_GuildName, true) UIUtils.SetActive(self.LoopScroll_Fame_Terms, false) UIUtils.SetActive(self.event_Terms, true) UIUtils.SetActive(self.img_Arrow01, true) UIUtils.SetActive(self.img_Arrow02, false) -- 默认显示最新一期 self.honorFameInfos = msg self.curShowFameIndex = 1 self:RefreshInfos() end end function UIGuildWarWallOfFame:RefreshInfos() -- 期数处理 if self.LoopScroll_Fame_Terms.Count == 0 then for _, v in ipairs (self.honorFameInfos) do self.LoopScroll_Fame_Terms:AddData(v, 0) end end local fameInfo = self.honorFameInfos[self.curShowFameIndex] UIUtils.SetLabel(self.labLocal_Term, string.FormatByIdsId(Const_IDS["IDS_GuildWar_ScheduleTitle"], fameInfo.issue)) UIUtils.SetActive(self.group_GuildName, not string.isNilOrEmpty(fameInfo.guildName)) UIUtils.SetLabel(self.txt_GuildName, fameInfo.guildName) UIUtils.SetLabel(self.txt_GuildNameInitiate, fameInfo.emblemContent) -- 跨服信息 if CTL.GuildWar.IsShowCrossServerUI() then local serverId = fameInfo.zoneInfo.serverId UIUtils.SetActive(self.txt_CrossServer, true) UIUtils.SetLabel(self.txt_CrossServer, string.FormatByIdsId(Const_IDS["IDS_CrossSever_SeverInfoText"], CTL.CrossServer.GetServerIDAndServerNameByServerID(serverId)) ) else UIUtils.SetActive(self.txt_CrossServer, false) end local emblemCfg = DataSheetManager.GuildEmblem:GetDataByID(fameInfo.emblemFrame) if emblemCfg then UTL.Item.SetAtlasSprite(self.img_GuilaIconFrame, "UI_Guild", emblemCfg.Image) end self.Loop_Fame_PLayerInfo:ClearCells() if fameInfo.players and #fameInfo.players > 0 then UIUtils.SetActive(self.section_Empty, false) for _, v in ipairs (fameInfo.players) do self.Loop_Fame_PLayerInfo:AddData(v, 0) end else UIUtils.SetActive(self.section_Empty, true) end end return UIGuildWarWallOfFame