PGRData/Script/matrix/xui/xuiplayerinfo/XUiGridSkillItemOther.lua

45 lines
1.6 KiB
Lua
Raw Normal View History

XUiGridSkillItemOther = XClass(nil, "XUiGridSkillItemOther")
function XUiGridSkillItemOther:Ctor(rootUi, ui, skill, character, equipList, assignChapterRecords, cb)
self.RootUi = rootUi
self.GameObject = ui.gameObject
self.Transform = ui.transform
self.SkillInfo = skill
self.EquipList = equipList
self.Character = character
self.AssignChapterRecords = assignChapterRecords
self.ClickCallback = cb
self:InitAutoScript()
self:UpdateInfo(self.SkillInfo)
end
function XUiGridSkillItemOther:InitAutoScript()
self.SpecialSoundMap = {}
self:AutoInitUi()
self:AutoAddListener()
end
function XUiGridSkillItemOther:AutoInitUi()
self.RImgSkillIcon = XUiHelper.TryGetComponent(self.Transform, "RImgSkillIcon", "RawImage")
self.BtnIconBg = XUiHelper.TryGetComponent(self.Transform, "BtnIconBg", "Button")
2024-09-01 20:49:41 +00:00
self.TxtSkillName = XUiHelper.TryGetComponent(self.Transform, "BtnIconBg/ImgBg/TxtSkillName", "Text")
self.PanelIconTip = XUiHelper.TryGetComponent(self.Transform, "PanelIconTip", nil)
self.ImgUpgradeTip = XUiHelper.TryGetComponent(self.Transform, "PanelIconTip/ImgUpgradeTip", "Image")
end
function XUiGridSkillItemOther:AutoAddListener()
XUiHelper.RegisterClickEvent(self, self.BtnIconBg, self.OnBtnIconBgClick)
end
function XUiGridSkillItemOther:OnBtnIconBgClick()
if self.ClickCallback then
self.ClickCallback()
end
end
function XUiGridSkillItemOther:UpdateInfo(skill)
2024-09-01 20:49:41 +00:00
self.TxtSkillName.text = skill.Name
self.RImgSkillIcon:SetRawImage(skill.Icon)
self.ImgUpgradeTip.gameObject:SetActive(false)
end