58 lines
1.8 KiB
Lua
58 lines
1.8 KiB
Lua
local this = {}
|
|
--传入父脚本模块
|
|
local parent
|
|
--传入特效层级
|
|
local sortingOrder=0
|
|
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
|
|
|
|
--初始化组件(用于子类重写)
|
|
function this:InitComponent(gameObject)
|
|
this.spLoader = SpriteLoader.New()
|
|
this.skillName = Util.GetGameObject(gameObject, "Title/Text"):GetComponent("Text")
|
|
this.withHero=Util.GetGameObject(gameObject,"SkillType"):GetComponent("Image")
|
|
this.icon = Util.GetGameObject(gameObject, "Icon"):GetComponent("Image")
|
|
this.Text = Util.GetGameObject(gameObject, "CurrentLvDesc/Text"):GetComponent("Text")
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function this:BindEvent()
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function this:AddListener()
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function this:RemoveListener()
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function this:OnShow(_parent,...)
|
|
parent=_parent
|
|
sortingOrder = _parent.sortingOrder
|
|
local _args = {...}
|
|
this.skillId = _args[1]
|
|
this.heroId = _args[2]
|
|
this.skillName.text = XiuXianSkillConfig[this.skillId].Name
|
|
this.icon.sprite = this.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[this.skillId].Icon))
|
|
this.Text.text = XiuXianSkillConfig[this.skillId].Desc
|
|
if this.heroId and this.heroId > 0 then
|
|
this.withHero.gameObject:SetActive(true)
|
|
this.withHero.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(this.heroId))
|
|
else
|
|
this.withHero.gameObject:SetActive(false)
|
|
end
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function this:OnClose()
|
|
this.skillId = nil
|
|
this.heroId = nil
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function this:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
end
|
|
|
|
return this |