miduo_client/Assets/ManagedResources/~Lua/Modules/Expert/JingjishiLianPatface.lua

77 lines
2.5 KiB
Lua

require("Base/BasePanel")
JingjishiLianPatface = Inherit(BasePanel)
--初始化组件(用于子类重写)
function JingjishiLianPatface:InitComponent()
self.spLoader = SpriteLoader.New()
self.liveRoot = Util.GetGameObject(self.gameObject,"bg/ren")
self.BackBtn = Util.GetGameObject(self.gameObject,"bg/BackBtn")
self.BackBtn.gameObject:SetActive(false)
self.maskBtn = Util.GetGameObject(self.gameObject,"bg")
self.jumpBtn = Util.GetGameObject(self.gameObject,"bg/jumpBtn")
end
--绑定事件(用于子类重写)
function JingjishiLianPatface:BindEvent()
Util.AddClick(self.BackBtn, function()
self:ClosePanel()
end)
Util.AddClick(self.maskBtn, function()
self:ClosePanel()
end)
Util.AddClick(self.jumpBtn, function()
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.jingjishilian) and ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.jingjishilian)> 0 then
UIManager.OpenPanel(UIName.ArenaTrialPanel)
self:ClosePanel()
else
self:ClosePanel()
end
end)
end
--添加事件监听(用于子类重写)
function JingjishiLianPatface:AddListener()
end
--移除事件监听(用于子类重写)
function JingjishiLianPatface:RemoveListener()
end
--界面打开时调用(用于子类重写)
function JingjishiLianPatface:OnOpen(fun)
PlayerPrefs.SetInt(PlayerManager.uid.."JingjishiLianPatface",1)
self.fun = fun
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function JingjishiLianPatface:OnShow()
if self.live then
poolManager:UnLoadLive(self.live.gameObject.name, self.live)
self.live = nil
end
local data = ConfigManager.GetConfigDataByKey(ConfigName.HeroConfig,"ReadingName","敖丙")
self.live = poolManager:LoadLive(GetResourcePath(data.Live), self.liveRoot.transform,
Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0))
local SkeletonGraphic = self.live:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
end
--界面关闭时调用(用于子类重写)
function JingjishiLianPatface:OnClose()
if self.fun then
self.fun()
end
end
--界面销毁时调用(用于子类重写)
function JingjishiLianPatface:OnDestroy()
self.spLoader:Destroy()
if self.live then
poolManager:UnLoadLive(self.live.gameObject.name, self.live)
self.live = nil
end
end
return JingjishiLianPatface