local UIHorseSoulStarSuccess = UIViewClass() function UIHorseSoulStarSuccess:OnOpened(context) UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_HorseSoul_StarHint7) self:SetStarLevelInfo(context.soulInfo) CTL.Sound.PlayGameSound("UI_breakout_03") end function UIHorseSoulStarSuccess:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.Bottom then self:CloseView() end end function UIHorseSoulStarSuccess:SetStarLevelInfo(soulInfo) UTL.Item.OnlyItemIconWithoutBg(self.img_Item, soulInfo.cfgId) UIUtils.SetLabel(self.txt_Awake, string.FormatByIdsId(Const_IDS.IDS_HorseSoul_StarHint2, UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_"..soulInfo.star]))) for k,v in ipairs(self.group_Star) do UIUtils.SetActive(v.img_Star, k <= soulInfo.star) if k <= soulInfo.star then v.effect_Light:PlayUIEffect() else v.effect_Light:StopUIEffect() end end local nextAttrTable = CTL.HorseSoul.GetSoulAwakeAttrTable(soulInfo.soulData.HorseSoulStarAttrID, soulInfo.star) if soulInfo.star == 1 then self:SetAttr(nil, nextAttrTable) else local attrTable = CTL.HorseSoul.GetSoulAwakeAttrTable(soulInfo.soulData.HorseSoulStarAttrID, soulInfo.star - 1) self:SetAttr(attrTable, nextAttrTable) end end function UIHorseSoulStarSuccess:SetAttr(nowAttrTable, nextAttrTable) local isInitStar = nowAttrTable == nil for i, v in ipairs(self.group_Attrs) do local attrData = nowAttrTable and nowAttrTable[i] or nil local nextAttrData = nextAttrTable and nextAttrTable[i] or nil if attrData then UIUtils.SetActive(v.gameObject, true) UTL.Attr.SetAttrItemByCompName(v, attrData.AttrType, nil, true) if nextAttrData then v.txt_Attr_Before.text = attrData.AttrNum v.txt_Attr.text = nextAttrData.AttrNum else v.txt_Attr_Before.text = attrData.AttrNum end elseif isInitStar then UIUtils.SetActive(v.gameObject, true) UTL.Attr.SetAttrItemByCompName(v, nextAttrData.AttrType, nil, true) v.txt_Attr_Before.text = 0 v.txt_Attr.text = nextAttrData.AttrNum else UIUtils.SetActive(v.gameObject, false) end end end return UIHorseSoulStarSuccess