2021-04-21 13:12:04 +08:00
local JumpConfig = ConfigManager.GetConfig ( ConfigName.JumpConfig )
2020-05-09 13:31:21 +08:00
JumpView = { }
function JumpView : New ( gameObject )
local b = { }
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable ( b , { __index = JumpView } )
return b
end
--初始化组件(用于子类重写)
function JumpView : InitComponent ( )
2021-04-21 13:12:04 +08:00
self.spLoader = SpriteLoader.New ( )
2021-06-29 20:05:15 +08:00
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 " )
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function JumpView : BindEvent ( )
end
--添加事件监听(用于子类重写)
function JumpView : AddListener ( )
end
--移除事件监听(用于子类重写)
function JumpView : RemoveListener ( )
end
2020-06-28 17:52:29 +08:00
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
2021-01-14 17:07:45 +08:00
function JumpView : OnOpen ( jumpId , isRewardItemPop , parent )
2020-05-09 13:31:21 +08:00
self.jumpSData = JumpConfig [ jumpId ]
if self.jumpSData then
2021-01-26 17:08:39 +08:00
self.info . text = GetLanguageStrById ( self.jumpSData . Title )
2021-04-09 12:26:35 +08:00
self.btnSureText . text = Language [ 10556 ]
2020-05-09 13:31:21 +08:00
Util.AddOnceClick ( self.btnSure , function ( )
self : GoToJumpData ( )
2021-01-14 17:07:45 +08:00
if parent then
parent : ClosePanel ( )
end
2020-05-09 13:31:21 +08:00
end )
end
2021-04-12 15:12:12 +08:00
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
2020-05-09 13:31:21 +08:00
self.btnSure : SetActive ( false )
else
self.btnSure : SetActive ( true )
end
end
function JumpView : GoToJumpData ( )
JumpManager.GoJump ( self.jumpSData . Id )
end
--界面关闭时调用(用于子类重写)
function JumpView : OnClose ( )
2021-04-21 13:12:04 +08:00
self.spLoader : Destroy ( )
2020-05-09 13:31:21 +08:00
end
--界面销毁时调用(用于子类重写)
function JumpView : OnDestroy ( )
end
2020-06-23 18:36:24 +08:00
return JumpView