local UIGuildAlliesMyAllies = UIViewClass() local HeroIconPath = ConstAssetPathConfig.ItemIconPath ------------------------- 系统函数 -------------------------------- function UIGuildAlliesMyAllies:OnCreated() self:RegistSystemEvent(EventID.UI_GuildAlliesMyAllies_Refresh, self.RefreshPanel) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS["IDS_GuildAllies_MyAllies"]) end function UIGuildAlliesMyAllies:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GuildAllies_MyAllies) self:RefreshPanel() end function UIGuildAlliesMyAllies:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildAlliesMyAllies:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() else for i, v in ipairs (self.group_Info) do if comp == v.group_Ally.btn_RemoveUnion then local allyData = MDL.GuildAllies.GetGuildAllyByPos(i) if allyData then if not CTL.GuildAllies.HasPermissionByTitle() then CTL.Tips.AddTipsMsg(Const_IDS["IDS_Guild_CommonFail4"]) return end -- 解盟 CTL.GuildAllies.TriggerCancelAlly(allyData) end break end end end end ------------------------------------------------------------------- function UIGuildAlliesMyAllies:RefreshPanel() for i, v in ipairs (self.group_Info) do UIUtils.SetActive(v.group_Lock, false) UIUtils.SetActive(v.group_Active, false) UIUtils.SetActive(v.group_Ally.gameObject, false) if not CTL.GuildAllies.IsUnlockAllyPos(i) then UIUtils.SetActive(v.group_Lock, true) local fameLv = CTL.GuildAllies.GetUnlockFameLv(i) local fameCfg = DataSheetManager.GuildReputation:GetDataByID(fameLv) local lockStr = UTL.Color.FormatTextByColor(fameCfg.Color, string.FormatByIdsId(Const_IDS["IDS_GuildAllies_UnlockCondition"], UIUtils.GetLocalizedTxt(Const_IDS[fameCfg.Name]))) UIUtils.SetLabel(v.txt_LockTips, lockStr) else local allyData = MDL.GuildAllies.GetGuildAllyByPos(i) if allyData then UIUtils.SetActive(v.group_Ally.gameObject, true) local groupAlly = v.group_Ally local guildAllies = DataSheetManager.GuildAlliesData:GetDataByID(allyData.powerID) UIUtils.SetImageByAssetBundle(groupAlly.img_HeroHead, string.format(HeroIconPath, guildAllies.HeroHead)) CTL.GuildAllies.SetAllyPosImage(groupAlly.img_Medal, allyData.allyIndex) UIUtils.SetLabelText(groupAlly.txt_Name, Const_IDS[guildAllies.AlliesName]) UIUtils.SetLabel(groupAlly.txt_Number, allyData.friendliness) CTL.GuildAllies.SetTextBuff(guildAllies.State_Table[allyData.allyIndex].StateAttr, groupAlly.group_Buff_1.img_BuffIcon, groupAlly.group_Buff_1.txt_BuffName, groupAlly.group_Buff_1.txt_BuffNumber, groupAlly.group_Buff_2.img_BuffIcon, groupAlly.group_Buff_2.txt_BuffName, groupAlly.group_Buff_2.txt_BuffNumber) --大诸侯1号位显示首席 local isFirst = allyData.allyIndex == 1 and guildAllies.BigAllies == 1 UIUtils.SetActive(groupAlly.img_Chief, isFirst) else UIUtils.SetActive(v.group_Active, true) end end end end return UIGuildAlliesMyAllies