local UIWeaponForgeSoulInfo = UIViewClass() local unlockStrColor1 = "FDEFBC" local HERO_RENDER_ID = DataSheetManager.ConstData:GetDataByID("WeaponForgeSoulHeroRender").IntValue local BattleLight = ConstAssetPathConfig.LightLeft function UIWeaponForgeSoulInfo:OnOpened(context) self.heroId = context.heroId self.curLevel = MDL.DivineWeaponForgeSoul.GetWeaponForgeSoulLv(self.heroId) self.curLvCfg = DataSheetManager.MagicWeaponForgeSoulLevel:GetDataByMagicWeaponForgeSoulLevel(self.curLevel) self:RegistTriggerEvent(self.soulModel, UIEventTriggerType.Drag) self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.soulModel) self:RefreshBaseInfo() self:RefreshHalo() end function UIWeaponForgeSoulInfo:RefreshBaseInfo() if self.curLevel == 0 then local str = string.FormatByIdsId(Const_IDS.IDS_WeaponForgeSoul_SoulHint_4, UIUtils.GetLocalizedTxt(Const_IDS.IDS_Jade_Resonance_8)) self.txt_Name.text = UTL.Color.FormatGrayColor(str) UIUtils.SetActive(self.group_Lock, true) else local str = string.FormatByIdsId(Const_IDS.IDS_WeaponForgeSoul_SoulHint_4, string.FormatByIdsId(Const_IDS.IDS_BreakThrough_Lv, self.curLevel)) self.txt_Name.text = UTL.Color.FormatTextByColor(unlockStrColor1,str) UIUtils.SetActive(self.group_Lock, false) end self:RefreshAttr() self:RefreshSkillInfo() end function UIWeaponForgeSoulInfo:RefreshAttr() UIUtils.SetLabel(self.group_Attrs[1].lab_Attr, UIUtils.GetLocalizedTxt(Const_IDS.IDS_Capacity)) local gs = CTL.DivineWeaponForgeSoul.CaculateWeaponSoulSkillGs(self.heroId) + UTL.Attr.CalculateFight(self.curLvCfg.Attr_Table) UIUtils.SetLabel(self.group_Attrs[1].txt_Attr, "+"..gs) for i, v in ipairs(self.curLvCfg.Attr_Table) do UIUtils.SetLabel(self.group_Attrs[i+1].lab_Attr, UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(v.AttrType).Name])) UIUtils.SetLabel(self.group_Attrs[i+1].txt_Attr, "+"..v.AttrNum) end end function UIWeaponForgeSoulInfo:RefreshSkillInfo() if self.curLevel == 0 then local defaultCfg = DataSheetManager.MagicWeaponForgeSoulLevel:GetDataByMagicWeaponForgeSoulLevel(1) self.txt_SkillInfo.text = UTL.Color.FormatGrayColor(UTL.String.FormatCombineTextByID(defaultCfg.WeaponSoulSkillDes)) else self.txt_SkillInfo.text = UTL.Color.FormatWhiteColor(UTL.String.FormatCombineTextByID(self.curLvCfg.WeaponSoulSkillDes)) end end function UIWeaponForgeSoulInfo:RefreshHalo() UTL.UIRender.DisposeWeaponSoul(self.modelComponentDataHandle) local heroInfo = MDL.HeroSelect.GetHeroInfo(self.heroId) local dyeList = MDL.DyeAppearance.GetDyeAppearancePartList(heroInfo.curAppearanceId) UTL.UIRender.CreateHeroRenderTexture(self.modelComponentDataHandle, self.heroId, heroInfo.curAppearanceId, HERO_RENDER_ID, BattleLight, true, dyeList) UTL.UIRender.HeroEquipMagicWeapon(self.modelComponentDataHandle, self.heroId, heroInfo.curWeaponAppearanceId, heroInfo.magicWeaponLevel, heroInfo.isMagicWeaponActive, false) if self.curLevel > 0 then if self.toggle.isOn then UTL.UIRender.LoadPlayerWeaponSoul(self.modelComponentDataHandle, CTL.DivineWeaponForgeSoul.GetWeaponSoulMaxLvSkills()) else UTL.UIRender.LoadPlayerWeaponSoul(self.modelComponentDataHandle, MDL.DivineWeaponForgeSoul.GetWeaponForgeSoulSkillsLv(self.heroId)) end else UTL.UIRender.LoadPlayerWeaponSoul(self.modelComponentDataHandle, CTL.DivineWeaponForgeSoul.GetWeaponSoulLockLvSkills()) end end function UIWeaponForgeSoulInfo:OnDrag(comp, eventData) UTL.UIRender.RotateEntity(self.modelComponentDataHandle, -eventData.delta.x * 0.2, true, false) end function UIWeaponForgeSoulInfo:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() end end function UIWeaponForgeSoulInfo:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIWeaponForgeSoulInfo:OnValueChanged(comp, value) if comp == self.toggle then if self.curLevel == 0 then if not self.setToggleIng then self.setToggleIng = true self.toggle.isOn = not value CTL.Tips.AddTipsMsg(Const_IDS["IDS_WeaponForgeSoul_SoulHint_11"]) else self.setToggleIng = false end else self:RefreshHalo() end end end function UIWeaponForgeSoulInfo:OnClosed() UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) end return UIWeaponForgeSoulInfo