local UIStratagemAttributesInfoView = UIViewClass() function UIStratagemAttributesInfoView:OnOpened(context) self:InitAttr(context) local mainId = context[1] if mainId then local data = DataSheetManager.StratagemData:GetDataByID(mainId) self:InitTalentInfo(mainId) self:ShowSkillInfo(data) else UIUtils.SetActive(self.group_Skill, false) UIUtils.SetActive(self.group_ganwu, false) end UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_Stratagem_AttrDetail) end function UIStratagemAttributesInfoView:InitTalentInfo(mainId) local stratagemInfo = MDL.Stratagem.GetStratagemInfo(mainId) local talentList = MDL.Stratagem.GetTalentSortedList(mainId) if #talentList > 0 then UIUtils.SetActive(self.group_ganwu, true) for i = 1, #talentList do local talent = talentList[i] local node = self.group_StratagemComprehension[i] if node == nil then node = self:InstantiateCollection(self.group_StratagemComprehension, self.group_StratagemComprehension[1].gameObject) end UIUtils.SetActive(node.gameObject, true) UIUtils.SetLabelText(node.txt_ComprehensionName, Const_IDS[talent.Name]) UIUtils.SetLabel(node.txt_ComprehensionEffect, UTL.String.FormatCombineTextByID(talent.Desc)) node.txt_ComprehensionLv.text = "Lv." .. talent.PointLevel end for i = #talentList + 1, #self.group_StratagemComprehension do UIUtils.SetActive(self.group_StratagemComprehension[i], false) end else UIUtils.SetActive(self.group_ganwu, false) end UIUtils.SetActive(self.group_Active, false) ---self.panel_StratagemInfo:SetSizeDelta(620, 800) end function UIStratagemAttributesInfoView:InitAttr(slots) local attrDict = CTL.Stratagem.GetSlotAttr(slots) local index = 1 if next(attrDict) == nil then UIUtils.SetLabelText(self.lab_Empty, Const_IDS.IDS_Stratagem_NoEquip) UIUtils.SetActive(self.scroll_StratagemInfoContent, false) UIUtils.SetActive(self.lab_Empty, true) else for i, v in pairs(attrDict) do if self.group_AttrList[index] == nil then self:InstantiateCollection(self.group_AttrList, self.group_AttrList[1].gameObject) end UIUtils.SetActive(self.group_AttrList[index].gameObject, true) UTL.Attr.SetAttrItemByCompName(self.group_AttrList[index], i, math.floor(v), true) index = index + 1 end end end function UIStratagemAttributesInfoView:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIStratagemAttributesInfoView:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIStratagemAttributesInfoView:ShowSkillInfo(data) UIUtils.SetImageByAssetBundle(self.sprite_Skill, data.SkillIcon) UIUtils.SetLabelText(self.txt_SkillName, Const_IDS[data.StratagemName]) UIUtils.SetLabelText(self.lab_SkillEffect, Const_IDS[data.SkillDesc]) UIUtils.SetLabelText(self.txt_PassiveSkill, Const_IDS[data.SkillType]) UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.scroll_StratagemInfoContent) end return UIStratagemAttributesInfoView