local UIHeroSkillTips = UIViewClass() local SkillIconPath = ConstAssetPathConfig.SkillImagePath function UIHeroSkillTips:OnOpened(context) self.heroId = context.heroId self.isAwaken = context.isAwaken local skillId = context.skillId self.skillTips = {} self:InitSkillTips(skillId) self.state_Icon:SetState(1) self.txt_Lv = self.group_Circle.txt_Lv self.group_Level = self.group_Circle.group_Level self.img_Talent = self.group_Circle.img_Talent self.group_Locked = self.group_Circle.group_Locked self:RefreshSkillInfo(skillId) end function UIHeroSkillTips:RefreshSkillInfo(skillId) self.txt_Lv.text = "" local data = DataSheetManager.SkillTipsData:GetDataByID(skillId) UIUtils.SetLabelText(self.txt_TalentName, Const_IDS[data.Name]) UIUtils.SetLabel(self.txt_TalentDes, UTL.String.FormatCombineTextByID(self.skillTips[1])) --部分主将技能解释超框改滑动 如太史慈 if self.txt_TalentDes.preferredHeight > 400 then UIUtils.SetParent(self.txt_TalentDes, self.Content) UIUtils.SetActive(self.scroll_Txt, true) else UIUtils.SetParent(self.txt_TalentDes, self.group_Info) UIUtils.SetActive(self.scroll_Txt, false) end if self.isAwaken then UIUtils.SetImageByAssetBundle(self.img_Talent, CTL.HeroAwaken.GetAwakenDisplaySkillIcon(self.heroId, skillId)) else UIUtils.SetImageByAssetBundle(self.img_Talent, string.format(SkillIconPath, data.SkillIcon)) end local isHasHero = MDL.HeroSelect.IsHasHero(self.heroId) self.state_DesLock:SetState(isHasHero and 1 or 0) UIUtils.SetActive(self.group_Level, isHasHero) --升级形式显示 -- 1:功能尚未开放 -- 2:武将突破至+ LevelUpTypeParam后升级 -- 3:武将的神兵突破至+ LevelUpTypeParam后升级 if data.LevelUpType == 1 then UIUtils.SetLabelText(self.txt_LockInfo, Const_IDS.IDS_HeroSkill_FakeTips) self.currentSkillLevel = 1 self.txt_Lv.text = 1 local isLock = true UIUtils.SetActive(self.group_LockCondition, isLock) UIUtils.SetActive(self.group_LevelUpHint, not isLock) UIUtils.SetActive(self.group_Locked, false) elseif data.LevelUpType == 2 then local isLock,currentSkillId,currentSkillLevel = MDL.HeroSelect.GetSkillTipsOfCurrentLevel(self.heroId,skillId) self.txt_Lv.text = currentSkillLevel self.currentSkillLevel = currentSkillLevel local currentSkillData = DataSheetManager.SkillTipsData:GetDataByID(currentSkillId) if currentSkillData then --达到最大技能等级 if currentSkillData.NextDisplaySkill == 0 then UIUtils.SetLabelText(self.txt_LevelUpHint, Const_IDS.IDS_HeroSkill_UnlockHint3) else --突破至XX升级 local nextSkillLevelData = DataSheetManager.SkillTipsData:GetDataByID(currentSkillData.NextDisplaySkill) UIUtils.SetLabel(self.txt_LevelUpHint, string.FormatByIdsId(Const_IDS.IDS_TalentSkill_UnlockHint, nextSkillLevelData.LevelUpTypeParam)) end else logging.error(LTAG.ERROR,"not find SkillTipsData:"..tostring(currentSkillId)) end UIUtils.SetActive(self.group_LockCondition, isLock) UIUtils.SetActive(self.group_LevelUpHint, not isLock) UIUtils.SetActive(self.group_Locked, isLock) UIUtils.SetActive(self.group_Level, not isLock) self.state_DesLock:SetState(isLock and 0 or 1) elseif data.LevelUpType == 3 then local isLock,currentSkillId,currentSkillLevel = MDL.HeroSelect.GetSkillTipsOfCurrentLevel(self.heroId,skillId) self.txt_Lv.text = currentSkillLevel self.currentSkillLevel = currentSkillLevel local currentSkillData = DataSheetManager.SkillTipsData:GetDataByID(currentSkillId) if isLock then --未解锁 UIUtils.SetLabelText(self.txt_LockInfo, Const_IDS.IDS_HeroSkill_UnlockHint) else if currentSkillData then --达到最大技能等级 if currentSkillData.NextDisplaySkill == 0 then UIUtils.SetLabelText(self.txt_LevelUpHint, Const_IDS.IDS_HeroSkill_UnlockHint3) else --突破至XX升级 local nextSkillLevelData = DataSheetManager.SkillTipsData:GetDataByID(currentSkillData.NextDisplaySkill) UIUtils.SetLabel(self.txt_LevelUpHint, string.FormatByIdsId(Const_IDS.IDS_HeroSkill_UnlockHint2, nextSkillLevelData.LevelUpTypeParam)) end else logging.error(LTAG.ERROR,"not find SkillTipsData:"..tostring(currentSkillId)) end end UIUtils.SetActive(self.group_Locked, isLock) UIUtils.SetActive(self.group_LockCondition, isLock) UIUtils.SetActive(self.group_LevelUpHint, not isLock) UIUtils.SetActive(self.group_Level, not isLock) self.state_DesLock:SetState(isLock and 0 or 1) elseif data.LevelUpType == 4 then UIUtils.SetActive(self.group_LockCondition, false) UIUtils.SetActive(self.group_LevelUpHint, true) if data.LevelUpType == 4 then -- 武将养成 UIUtils.SetLabelText(self.txt_LevelUpHint, Const_IDS["IDS_Foundry_SkillLevelUpDesc"]) end local isLock,currentSkillId,currentSkillLevel = MDL.HeroSelect.GetSkillTipsOfCurrentLevel(self.heroId,skillId) self.txt_Lv.text = currentSkillLevel self.currentSkillLevel = currentSkillLevel elseif data.LevelUpType == 5 then UIUtils.SetActive(self.group_Level, false) UIUtils.SetActive(self.group_LevelUpHint, false) UIUtils.SetActive(self.group_LockInfo, false) UIUtils.SetActive(self.scroll_Talent, false) end --从第二条开始的技能描述 for i = 2, #self.skillTips do self.loop_TalentSkill:AddData({desc = self.skillTips[i],level = i}, 0) end for i, v in ipairs(self.group_Type) do if i == 1 then UIUtils.SetActive(v.gameObject, true) UIUtils.SetLabelText(v.txt_Type, Const_IDS[data.SkillFuncType]) else UIUtils.SetActive(v.gameObject, false) end end if data.LevelUpType < 5 then --滚动当前技能居中显示 self.loop_TalentSkill:MoveIndex(self.currentSkillLevel -2) end if self.isAwaken then UIUtils.SetLabelText(self.txt_LevelUpHint, Const_IDS["IDS_HeroAwaken_ThroughLingShi"]) end end function UIHeroSkillTips:OnButtonClicked(comp) if comp == self.btn_Back then self:CloseView() end end function UIHeroSkillTips:OnCellInit(scrollRect, index, cellTable, data) cellTable.txt_Level.text = string.FormatByIdsId(Const_IDS["IDS_TalentSkill_Level"], index + 2) UIUtils.SetLabel(cellTable.txt_Talent,UTL.String.FormatCombineTextByID(data.desc)) local dataLevel = data.level local nowLevel = self.currentSkillLevel if nowLevel == dataLevel then cellTable.state_Talent:SetState(2) else if nowLevel > dataLevel then cellTable.state_Talent:SetState(1) else cellTable.state_Talent:SetState(0) end end end --获取技能描述 function UIHeroSkillTips:InitSkillTips(skillId) local skillData = DataSheetManager.SkillTipsData:GetDataByID(skillId) if skillData then table.insert(self.skillTips,skillData.TipsFunc) if skillData.NextDisplaySkill ~= 0 then self:InitSkillTips(skillData.NextDisplaySkill) end end end return UIHeroSkillTips