local UIFriendshipRank = UIViewClass() ------------------------- 系统函数 -------------------------------- function UIFriendshipRank:OnOpened(context) self.curGuildAllies = context UIUtils.SetLabel(self.UICommonPopUp.txt_Title, string.FormatByIdsId(Const_IDS["IDS_GuildAllies_AlliesDetail"], UIUtils.GetLocalizedTxt(Const_IDS[self.curGuildAllies.AlliesName]))) local members = MDL.GuildAllies.GetGuildAllyMembers() for _, v in ipairs (members) do self.loop_Rank:AddData(v, 0) end local myMember = MDL.GuildAllies.GetMyGuildMember() UIUtils.SetActive(self.group_MyRank.gameObject, myMember ~= nil) if myMember then local myRank = self.group_MyRank CTL.GuildAllies.SetAllyPosImage(myRank.img_Medal, MDL.GuildAllies.GetMyGuildMemberIndex()) CTL.GuildAllies.SetAllyPosText(myRank.txt_Rank, MDL.GuildAllies.GetMyGuildMemberIndex()) UTL.Item.SetAtlasSprite(myRank.img_GuildIcon, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(myMember.emblemFrame).Image) UIUtils.SetLabel(myRank.txt_GuildNameInitiate, myMember.emblemContent) UIUtils.SetLabel(myRank.txt_GuildName, myMember.guildName) UIUtils.SetLabel(myRank.txt_FriendshipNumber, myMember.friendliness) if self.curGuildAllies.State_Table[myMember.allyIndex] then UIUtils.SetActive(myRank.group_Buff_1.gameObject, true) UIUtils.SetActive(myRank.group_Buff_2.gameObject, true) UIUtils.SetActive(myRank.group_emptyState, false) CTL.GuildAllies.SetTextBuff(self.curGuildAllies.State_Table[myMember.allyIndex].StateAttr, myRank.group_Buff_1.img_BuffIcon, myRank.group_Buff_1.txt_BuffName, myRank.group_Buff_1.txt_BuffNumber, myRank.group_Buff_2.img_BuffIcon, myRank.group_Buff_2.txt_BuffName, myRank.group_Buff_2.txt_BuffNumber) else UIUtils.SetActive(myRank.group_Buff_1.gameObject, false) UIUtils.SetActive(myRank.group_Buff_2.gameObject, false) UIUtils.SetActive(myRank.group_emptyState, true) end end end function UIFriendshipRank:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIFriendshipRank:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIFriendshipRank:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Rank then UIUtils.SetActive(cellTable.img_Bg_01, index % 2 ~= 0) UIUtils.SetActive(cellTable.img_Bg_02, index % 2 == 0) CTL.GuildAllies.SetAllyPosImage(cellTable.img_Medal, index + 1) CTL.GuildAllies.SetAllyPosText(cellTable.txt_Rank, index + 1) UIUtils.SetLabel(cellTable.txt_FriendshipNumber, data.friendliness) if CTL.GuildAllies.IsRobotGuild(data.guildId) then UIUtils.SetLabelText(cellTable.txt_GuildName, Const_IDS[data.guildName]) UIUtils.SetActive(cellTable.group_GuildNameIcon, false) else UIUtils.SetActive(cellTable.group_GuildNameIcon, true) UIUtils.SetLabel(cellTable.txt_GuildName, data.guildName) UIUtils.SetLabel(cellTable.txt_GuildNameInitiate, data.emblemContent) UTL.Item.SetAtlasSprite(cellTable.img_GuildIcon, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data.emblemFrame).Image) end if self.curGuildAllies.State_Table[data.allyIndex] then UIUtils.SetActive(cellTable.group_Buff_1.gameObject, true) UIUtils.SetActive(cellTable.group_Buff_2.gameObject, true) UIUtils.SetActive(cellTable.group_emptyState, false) CTL.GuildAllies.SetTextBuff(self.curGuildAllies.State_Table[data.allyIndex].StateAttr, cellTable.group_Buff_1.img_BuffIcon, cellTable.group_Buff_1.txt_BuffName, cellTable.group_Buff_1.txt_BuffNumber, cellTable.group_Buff_2.img_BuffIcon, cellTable.group_Buff_2.txt_BuffName, cellTable.group_Buff_2.txt_BuffNumber) else UIUtils.SetActive(cellTable.group_Buff_1.gameObject, false) UIUtils.SetActive(cellTable.group_Buff_2.gameObject, false) UIUtils.SetActive(cellTable.group_emptyState, true) end end end ------------------------------------------------------------------- return UIFriendshipRank