local UIGuildBossReport = UIViewClass() local AuctionTime = DataSheetManager.ConstData:GetDataByID("GuildAuctionShowTime").IntValue local MaxGuildBossPlayerRankShow = DataSheetManager.ConstData:GetDataByID("GuildBossPlayerRankShow").IntValue local MaxGuildBossGuildRankShow = DataSheetManager.ConstData:GetDataByID("GuildBossGuildRankShow").IntValue function UIGuildBossReport:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUpTab.txt_Title, Const_IDS.IDS_GuildBoss_ReportTitle) self.rightRewards = {} self.UICommonPopUpTab.loop_Tab:AddData({ ids = Const_IDS.IDS_FunctionName_Guild }, 0) self.UICommonPopUpTab.loop_Tab:AddData({ ids = Const_IDS.IDS_GuildBoss_Player }, 0) self.UICommonPopUpTab.loop_Tab:SelectIndex(0) self:SetSelfInfo() if CTL.GuildBoss.GetIsShowAuction() then UIUtils.SetActive(self.group_GuildInfo.group_Pm.gameObject, true) UIUtils.SetLabel(self.group_GuildInfo.lab_PmDesc, string.FormatByIdsId(Const_IDS.IDS_OpenInServeralMins, AuctionTime / UTL.Time.TotalSecondsOneMinute)) else UIUtils.SetActive(self.group_GuildInfo.group_Pm.gameObject, false) end end function UIGuildBossReport:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUpTab.btn_Close) end function UIGuildBossReport:OnButtonClicked(comp) if comp == self.UICommonPopUpTab.btn_Close then self:CloseView() end end function UIGuildBossReport:OnCellInit(scrollRect, index, cellTable, data) if self.UICommonPopUpTab.loop_Tab == scrollRect then UIUtils.SetLabelText(cellTable.txt_Name_Nomal, data.ids) UIUtils.SetLabelText(cellTable.txt_Name_Selected, data.ids) UIUtils.SetActive(cellTable.img_RedDot, false) UIUtils.SetActive(cellTable.img_Arrow, false) UIUtils.SetActive(cellTable.img_ArrowS, false) UIUtils.SetActive(cellTable.group_SignState, false) UIUtils.SetActive(cellTable.group_SignStateS, false) elseif self.group_Guild.Scroll_Rank == scrollRect then self:InitGuildCell(index, cellTable, data, false) UIUtils.SetActive(cellTable.img_Bg1, index % 2 == 0) UIUtils.SetActive(cellTable.img_Bg2, index % 2 == 1) elseif self.group_Personal.Scroll_Rank == scrollRect then self:InitPlayerCell(index, cellTable, data) end end function UIGuildBossReport:InitPlayerCell(index, cellTable, data) if index <= 2 then cellTable.section_Rank_Guild:SetState(index) UIUtils.SetActive(cellTable.bg_Rank, true) else cellTable.section_Rank_Guild:SetState(3) if index + 1 > MaxGuildBossPlayerRankShow then UIUtils.SetLabelText(cellTable.txt_Rank, Const_IDS.IDS_GuildBoss_EmptyText) else cellTable.txt_Rank.text = index + 1 end UIUtils.SetActive(cellTable.bg_Rank, false) end UIUtils.SetLabel(cellTable.txt_Name, data.name) cellTable.txt_Elo.text = data.damage UIUtils.SetActive(cellTable.img_Bg1, index % 2 == 0) UIUtils.SetActive(cellTable.img_Bg2, index % 2 == 1) end function UIGuildBossReport:InitGuildCell(index, cellTable, guildInfo, hideSerID) if index <= 2 then cellTable.section_Rank_Guild:SetState(index) UIUtils.SetActive(cellTable.bg_Rank, true) else cellTable.section_Rank_Guild:SetState(3) if index + 1 > MaxGuildBossGuildRankShow then UIUtils.SetLabelText(cellTable.txt_Rank, Const_IDS.IDS_GuildBoss_EmptyText) else cellTable.txt_Rank.text = index + 1 end UIUtils.SetActive(cellTable.bg_Rank, false) end cellTable.txt_Elo.text = UTL.String.GetCountStr(guildInfo.damage) if guildInfo.serId and guildInfo.serId > 0 and not hideSerID then UIUtils.SetLabel(cellTable.txt_Guild, guildInfo.name..string.FormatByIdsId(Const_IDS["IDS_CrossSever_SeverSuffixText1"], guildInfo.serId)) else UIUtils.SetLabel(cellTable.txt_Guild, guildInfo.name) end local guildEmblemCfg = DataSheetManager.GuildEmblem:GetDataByID(guildInfo.emblemFrame) if guildEmblemCfg then UTL.Item.SetAtlasSprite(cellTable.img_GuildEmblem, "UI_Guild", guildEmblemCfg.Image) end cellTable.lab_EmblemName.text = guildInfo.emblemContent cellTable.txt_Name.text = guildInfo.leaderName end function UIGuildBossReport:GetDataByRankIndex(index) local pre = 0 for i, v in DataSheetManager.GuildBossGuildReward:GetEnumerator() do if pre < index and v.Rank >= index or v.Rank < 0 then return v end pre = v.Rank end end function UIGuildBossReport:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then if index == 0 then UIUtils.SetActive(self.group_Guild.gameObject, true) UIUtils.SetActive(self.group_Personal.gameObject, false) if #self.context.guildRank == 0 then UIUtils.SetActive(self.obj_Rank, true) else UIUtils.SetActive(self.obj_Rank, false) local list = {} for i,v in ipairs(self.context.guildRank) do if i <= MaxGuildBossGuildRankShow then list[i] = v else break end end self.group_Guild.Scroll_Rank:ReloadAll(list) end else UIUtils.SetActive(self.group_Guild.gameObject, false) UIUtils.SetActive(self.group_Personal.gameObject, true) if #self.context.playerRank == 0 then UIUtils.SetActive(self.obj_Rank, true) else UIUtils.SetActive(self.obj_Rank, false) local list = {} for i,v in ipairs(self.context.playerRank) do if i <= MaxGuildBossPlayerRankShow then list[i] = v else break end end self.group_Personal.Scroll_Rank:ReloadAll(list) end end end end function UIGuildBossReport:SetSelfInfo() local isPlayerRank = false local isGuildRank = false for i, v in ipairs(self.context.playerRank) do if v.acid == BattleDataGetter.GetAcID() then self.group_GuildInfo.txt_Personal.text = i if i <= MaxGuildBossPlayerRankShow then isPlayerRank = true end self:InitPlayerCell(i - 1, self.group_Personal.group_PersonalSelf, v) end end for i, v in ipairs(self.context.guildRank) do if v.id == MDL.Guild.GetMyGuildInfo().guildId then self.group_GuildInfo.txt_Guild.text = i if i <= MaxGuildBossGuildRankShow then isGuildRank = true end self:InitGuildCell(i - 1, self.group_Guild.group_GuildSelf, v, true) end end if not isPlayerRank then UIUtils.SetLabelText(self.group_GuildInfo.txt_Personal, Const_IDS.IDS_GuildBoss_NotInList) end if not isGuildRank then UIUtils.SetLabelText(self.group_GuildInfo.txt_Guild, Const_IDS.IDS_GuildBoss_NotInList) end end return UIGuildBossReport