miduo_client/Assets/ManagedResources/~Lua/View/JumpView.lua

69 lines
1.9 KiB
Lua

local JumpConfig=ConfigManager.GetConfig(ConfigName.JumpConfig)
JumpView = {}
function JumpView:New(gameObject)
local b = {}
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable(b,{ __index = JumpView })
return b
end
--初始化组件(用于子类重写)
function JumpView:InitComponent()
self.spLoader = SpriteLoader.New()
local tran = Util.GetGameObject(self.gameObject, "content")
self.info = Util.GetGameObject(tran, "info"):GetComponent("Text")
self.btnSure = Util.GetGameObject(tran, "btnSure")
self.btnSureText = Util.GetGameObject(tran, "btnSure/Text"):GetComponent("Text")
end
--绑定事件(用于子类重写)
function JumpView:BindEvent()
end
--添加事件监听(用于子类重写)
function JumpView:AddListener()
end
--移除事件监听(用于子类重写)
function JumpView:RemoveListener()
end
--界面打开时调用(用于子类重写)
function JumpView:OnOpen(jumpId,isRewardItemPop,parent)
self.jumpSData=JumpConfig[jumpId]
if self.jumpSData then
self.info.text=GetLanguageStrById(self.jumpSData.Title)
self.btnSureText.text = Language[10556]
Util.AddOnceClick(self.btnSure, function()
self:GoToJumpData()
if parent then
parent:ClosePanel()
end
end)
end
if MapManager.Mapping or UIManager.IsOpen(UIName.BattlePanel) or isRewardItemPop == false or (self.jumpSData.Skipfactor and #self.jumpSData.Skipfactor > 0 and self.jumpSData.Skipfactor[1] == -1) then-- or BagManager.isBagPanel
self.btnSure:SetActive(false)
else
self.btnSure:SetActive(true)
end
end
function JumpView:GoToJumpData()
JumpManager.GoJump(self.jumpSData.Id)
end
--界面关闭时调用(用于子类重写)
function JumpView:OnClose()
self.spLoader:Destroy()
end
--界面销毁时调用(用于子类重写)
function JumpView:OnDestroy()
end
return JumpView