local UIGuildBossInspire = UIViewClass() function UIGuildBossInspire:OnOpened(context) self:RegistSystemEvent(EventID.UI_GuildBoss_EncourageRefresh, self.SetEncourageInfo) if context.isGuild then self.panel_GuildBossInspireLegion.gameObject:SetActive(true) self.panel_GuildBossInspirePersonal.gameObject:SetActive(false) self.txt_Tips02.text = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_GuildEnhanceIntro2,context.count) if context.isGuildEnhance then self.lab_Consume.text = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_EnhanceTime ,1,1) else self.lab_Consume.text = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_EnhanceTime ,0,1) end UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GuildBoss_GuildEnhanceWinTitle) else self.panel_GuildBossInspirePersonal.gameObject:SetActive(true) self.panel_GuildBossInspireLegion.gameObject:SetActive(false) local list = DataSheetManager.ConstData:GetDataByID("GuildBossEncourageCostValue").IntListValue self.lab_Consume.text = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_EnhanceTime,context.count,#list) self.costType = DataSheetManager.ConstData:GetDataByID("GuildBossEncourageCostType").IntValue local coinData = DataSheetManager.ItemData:GetDataByID(self.costType) UTL.Item.SetAtlasSprite(self.img_Icon, "UI_Common", coinData.Icon) self.costCount = list[context.count+1] self:RefreshCost() self.lab_Consume1.text = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_EnhanceTime ,context.count,#list) self.txt_Attribute01_Before.text = 10*context.count.."%" self.txt_Attribute01_After.text = (10*context.count+10).."%" UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GuildBoss_PlayerEnhanceWinTitle) end end function UIGuildBossInspire:SetEncourageInfo() if not self.context.isGuild then local enhanceInfo = MDL.GuildBoss.GetEncourageInfo() local list = DataSheetManager.ConstData:GetDataByID("GuildBossEncourageCostValue").IntListValue if enhanceInfo.selfBuffTimes == #list then self:CloseView() return end self.costType = DataSheetManager.ConstData:GetDataByID("GuildBossEncourageCostType").IntValue local coinData = DataSheetManager.ItemData:GetDataByID(self.costType) UTL.Item.SetAtlasSprite(self.img_Icon, "UI_Common", coinData.Icon) self.costCount = list[enhanceInfo.selfBuffTimes+1] self:RefreshCost() self.lab_Consume1.text = string.FormatByIdsId(Const_IDS.IDS_GuildBoss_EnhanceTime ,enhanceInfo.selfBuffTimes,#list) self.txt_Attribute01_Before.text = 10*enhanceInfo.selfBuffTimes.."%" self.txt_Attribute01_After.text = (10*enhanceInfo.selfBuffTimes+10).."%" end end function UIGuildBossInspire:RefreshCost() if self.costType then local count = MDL.Currency.GetMoneyCount(self.costType) if count < self.costCount then self.txt_Count1.text = UTL.Color.FormatRedColor(self.costCount) self.isEnough = false else self.txt_Count1.text = self.costCount self.isEnough = true end end end function UIGuildBossInspire:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildBossInspire:OnButtonClicked(comp) if comp == self.btn_1 then if self.context.isGuild then CTL.Sound.PlayGameSound("UI_begin") MDL.GuildBoss.GuildCheerReq() self:CloseView() else if self.isEnough then CTL.Sound.PlayGameSound("UI_begin") MDL.GuildBoss.IndividualCheerReq() else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(Const_IDS.IDS_Chat_Shortage) end end elseif comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UIGuildBossInspire