local UIGuildAlliesLobbyTips = UIViewClass() local MyFameStr = "+%d" local TarFameStr = "-%d" ------------------------- 系统函数 -------------------------------- function UIGuildAlliesLobbyTips:OnOpened(context) self.strategyCfg = DataSheetManager.GuildAlliesStrategy:GetDataByID_sortID(context.strategyID, context.sortID) self.params = context self.totalCount = context.totalCount self.accidentAlliesData_1 = nil self.accidentAlliesData_2 = nil if context.accidentParams then for _, data in DataSheetManager.GuildAlliesData:GetEnumerator() do if self.accidentAlliesData_1 and self.accidentAlliesData_2 then break end if data.ID ~= context.powerID and data.BigAllies == 1 then if not self.accidentAlliesData_1 then self.accidentAlliesData_1 = data else self.accidentAlliesData_2 = data end end end end UIUtils.SetActive(self.img_TitleBg, not context.isGoodResult) UIUtils.SetActive(self.img_TitleBg01, context.isGoodResult) UIUtils.SetActive(self.group_TargetValue, self.params.targetGuildID ~= 0) if context.isGoodResult then UIUtils.SetLabelText(self.lab_LobbySucceedTitle, Const_IDS[context.params.ResultName]) else UIUtils.SetLabelText(self.lab_VisitSucceedTitle, Const_IDS[context.params.ResultName]) end UIUtils.SetLabel(self.txt_MyFriendlyValueNum, string.format(MyFameStr, self.totalCount * CTL.GuildAllies.GetFriendlinessBenefit(self.strategyCfg, self.params.isGoodResult))) local FriendLossTxt = UTL.Color.FormatRedColor(string.format(TarFameStr, self.totalCount * CTL.GuildAllies.GetFriendlinessLose(self.strategyCfg)))--前面是色号,后面是字符串 UIUtils.SetLabel(self.txt_TargetFriendlyValueNum, FriendLossTxt) UTL.Item.ItemIconWithoutBg(self.img_DefenceIcon, self.strategyCfg.RewardItemId) UIUtils.SetLabel(self.txt_DefenceNumber, string.format(MyFameStr, self.totalCount * self.strategyCfg.GuildMoneyBenefit)) self:PlayUIAnimation("AnimationSuccess", true) self:StartRepeatFunc(self.OpenCloseAnimation,0.5,1) CTL.Sound.PlayGameSound("UI_visit") end function UIGuildAlliesLobbyTips:OnUIAnimationStoped(playingID) if not self.accidentAlliesData_1 and not self.accidentAlliesData_2 then self:CloseView() else if self.accidentAlliesData_1 then self:RefreshAccidentShow(self.accidentAlliesData_1) self.accidentAlliesData_1 = nil else self:RefreshAccidentShow(self.accidentAlliesData_2) self.accidentAlliesData_2 = nil end end end function UIGuildAlliesLobbyTips:OpenCloseAnimation() self.IsCanCloseAnimation = true end function UIGuildAlliesLobbyTips:OnButtonClicked(comp) --动画0.7秒后,可以点击空白处关闭 if comp == self.img_Bottom then if self.IsCanCloseAnimation then self.IsCanCloseAnimation = false self:CloseView() end end end ------------------------------------------------------------------- function UIGuildAlliesLobbyTips:RefreshAccidentShow(accidentAlliesData) UIUtils.SetActive(self.group_MyValue, false) UIUtils.SetActive(self.group_TargetValue, false) UIUtils.SetActive(self.group_DefenceBuff, false) UIUtils.SetLabelText(self.lab_VisitSucceedTitle, Const_IDS[self.params.accidentParams.ResultName]) UIUtils.SetLabel(self.txt_TextContent01, string.FormatByIdsId(Const_IDS[self.params.accidentParams.ResultInfo], UIUtils.GetLocalizedTxt(Const_IDS[accidentAlliesData.AlliesName]))) UIUtils.SetLabel(self.txt_MyFriendlyValueNum, string.format(TarFameStr, self.strategyCfg.AccidentValue)) self:PlayUIAnimation("AnimationSuccess", true) end return UIGuildAlliesLobbyTips