--[[ 累充送【郭嘉】 author:yuanli ]] local UIAccumulatingRecharge = UIViewClass() function UIAccumulatingRecharge:OnCreated() self.heroCfgId = CTL.MultilevelRecharge.GetGetChargeStateId_6HeroId() end function UIAccumulatingRecharge:OnOpened(context) UIUtils.SetLabel(self.txt_Intelligence, DataSheetManager.HeroNum:GetDataByID(self.heroCfgId).HeroIntelligence) self.currentSkillGroupIndex = 1 --当前技能组显示索引 UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Title, "ljcz_msz_01.png") UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Tip, "ljcz_msz_02.png") local hasRechargeScore = MDL.Currency.GetTotalRechargeCredit() local targetRechargeScore = CTL.MultilevelRecharge.GetChargeStateId_6Amount() self.btn_Price:SetRedPoint(hasRechargeScore>=targetRechargeScore) if hasRechargeScore >= targetRechargeScore then UIUtils.SetLabel(self.txt_Tip, string.FormatByIdsKey("IDS_Accumulating_JinDuTiShi", UTL.Color.FormatTextByColor("70c665", hasRechargeScore), targetRechargeScore)) else UIUtils.SetLabel(self.txt_Tip, string.FormatByIdsKey("IDS_Accumulating_JinDuTiShi", UTL.Color.FormatTextByColor("ff3c3c", hasRechargeScore), targetRechargeScore)) end self:RefreshHeroSkill() end function UIAccumulatingRecharge:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIAccumulatingRecharge:OnButtonClicked(comp) if comp == self.btn_Close then CTL.PushInterface.HidePushInterface(self.__viewClassPath, self.toggle_Skip) self:CloseView() elseif comp == self.btn_Check then --跳转武将 UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIHeroSelectPanel, {heroID=self.heroCfgId}) elseif comp == self.btn_Price then --累充 CTL.ItemSources.ExecuteSourceFunctionById(MDL.ItemSources.SourceType.TotalTopUp) else for index, cell in ipairs(self.group_ActiveSkill) do if comp == cell.btn_Skill then CTL.Tips.CloseSkillTips(self.ActiveSkillTips) if index == 1 then CTL.Tips.OpenSkillTips(self.activeSkillList[self.currentSkillGroupIndex][index], self.ActiveSkillTips, CTL.Tips.SkillType.PassiveSkill, false) else CTL.Tips.OpenSkillTips(self.activeSkillList[self.currentSkillGroupIndex][index], self.ActiveSkillTips, CTL.Tips.SkillType.ActiveSkill, false) end end end end end local SkillPath = ConstAssetPathConfig.SkillImagePath function UIAccumulatingRecharge:RefreshHeroSkill() self.activeSkillList = MDL.HeroSelect.GetHeroDisplaySkillIdList(self.heroCfgId) for index, cell in ipairs(self.group_ActiveSkill) do local skillData = DataSheetManager.SkillTipsData:GetDataByID(self.activeSkillList[self.currentSkillGroupIndex][index]) --这里只显示第一组技能 UIUtils.SetImageByAssetBundle(cell.sprite_Skill, string.format(SkillPath, skillData.SkillIcon)) end end return UIAccumulatingRecharge