--[[ 宠物技能Tips ]]-- local EventSystem = require('Event/EventSystem') local UIPetSkillTips = UIViewClass() function UIPetSkillTips:OnOpened(context) self.isClosedByParent = false self:RegistSystemEvent(EventID.UI_ItemTips_Closed_Child, self.OnCloseChildItemTips) UIUtils.SetImageByAssetBundle(self.img_Talent, context.SkillIcon) UIUtils.SetLabelText(self.txt_TalentName, Const_IDS[context.SkillName]) if type(context.SkillDesc) == 'string' then self.txt_TalentDes.text = context.SkillDesc else self.txt_TalentDes.text = UTL.String.FormatCombineTextByID(context.SkillDesc) end if context.SkillType1 == 0 then UIUtils.SetActive(self.group_TypeCell1, false) elseif context.SkillType1 == 1 then UIUtils.SetActive(self.group_TypeCell1, true) UIUtils.SetLabelText(self.txt_Type1, Const_IDS.IDS_Pet_SkillType2) elseif context.SkillType1 == 2 then UIUtils.SetActive(self.group_TypeCell1, true) UIUtils.SetLabelText(self.txt_Type1, Const_IDS.IDS_Pet_SkillType3) else UIUtils.SetActive(self.group_TypeCell1, true) UIUtils.SetLabelText(self.txt_Type1, Const_IDS.IDS_Pet_SkillType4) end if context.SkillType2 == 0 then UIUtils.SetActive(self.group_TypeCell2, false) elseif context.SkillType2 == 1 then UIUtils.SetActive(self.group_TypeCell2, true) UIUtils.SetLabelText(self.txt_Type2, Const_IDS.IDS_Pet_SkillType1) elseif context.SkillType2 == 2 then UIUtils.SetActive(self.group_TypeCell2, true) UIUtils.SetLabelText(self.txt_Type2, Const_IDS.IDS_Pet_SkillType5) else UIUtils.SetActive(self.group_TypeCell2, true) UIUtils.SetLabelText(self.txt_Type2, Const_IDS.IDS_SETKEYPOSITION_Describe_0) end end function UIPetSkillTips:OnBackButtonPressed() self:OnButtonClicked(self.btn_Back) end function UIPetSkillTips:OnButtonClicked(comp) if comp == self.btn_Back then if self.context.isChildTips then return end self:CloseView() end end function UIPetSkillTips:OnCloseChildItemTips(isClosedByParent) if self.context.isChildTips then self.isClosedByParent = isClosedByParent self:CloseView() end end function UIPetSkillTips:OnClosed() if self.context.isChildTips and not self.isClosedByParent then EventSystem.Dispatch(EventID.UI_ItemTips_Closed) end end return UIPetSkillTips