【sdk】避免出现sdk初始化慢导致无法自动打开登录界面的问题
parent
cae60a1318
commit
fccfeedba0
|
@ -438,5 +438,8 @@ GameEvent = {
|
|||
UpdateGongMingLv= "HongMeng.UpdateGongMingLv",
|
||||
--鸿蒙碑新手引导
|
||||
HongMengGuide = "HongMeng.HongMengGuide",
|
||||
},
|
||||
SDK={
|
||||
InitSuccess = "SDK.InitSuccess",
|
||||
}
|
||||
}
|
|
@ -23,6 +23,11 @@ function this.Initialize()
|
|||
|
||||
this.isRegister = false
|
||||
|
||||
SDKMgr.onInitLaunchCallback = function(result)
|
||||
if result == "1" then
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.SDK.InitSuccess)
|
||||
end
|
||||
end
|
||||
SDKMgr.onRegisterCallback = function()
|
||||
this.isRegister = true
|
||||
end
|
||||
|
|
|
@ -125,22 +125,28 @@ function this:BindEvent()
|
|||
|
||||
end
|
||||
|
||||
-- sdk 初始化完成回调
|
||||
function this.OnInitSuccess()
|
||||
this.sdkLoginBtn:SetActive(false)
|
||||
this.SDKLogin()
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function this:AddListener()
|
||||
|
||||
Game.GlobalEvent:AddEvent(Protocal.Connect, this.OnConnect)
|
||||
Game.GlobalEvent:AddEvent(Protocal.Disconnect, this.OnDisconnect)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.LoginSuccess.OnLoginSuccess, this.RefreshLoginStatus)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.LoginSuccess.OnLogout, this.OnLogout)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.SDK.InitSuccess, this.OnInitSuccess)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function this:RemoveListener()
|
||||
|
||||
Game.GlobalEvent:RemoveEvent(Protocal.Connect, this.OnConnect)
|
||||
Game.GlobalEvent:RemoveEvent(Protocal.Disconnect, this.OnDisconnect)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.LoginSuccess.OnLoginSuccess, this.RefreshLoginStatus)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.LoginSuccess.OnLogout, this.OnLogout)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.SDK.InitSuccess, this.OnInitSuccess)
|
||||
end
|
||||
|
||||
function this:OnLogout()
|
||||
|
|
Loading…
Reference in New Issue