From efc9ff9daf746182cf9eb11261c672bec2ff4ae8 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Wed, 9 Sep 2020 20:17:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E5=86=8C=E6=89=93?= =?UTF-8?q?=E7=82=B9=E4=BA=8B=E4=BB=B6=EF=BC=8C=E5=B0=86=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=9D=99=E6=80=81=E6=95=B0=E6=8D=AE=E6=94=BE=E5=9C=A8=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=B9=8B=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Login/LoginManager.lua | 28 ++++++++++++++++--- .../~Lua/Modules/Login/LoginPanel.lua | 11 ++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua index 9f427618f7..b353ad5279 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua @@ -21,14 +21,34 @@ function this.Initialize() this.CurAccount=PlayerPrefs.GetString(this.GameName.."Account",'') this.CurSession=PlayerPrefs.GetString(this.GameName.."Session",'') + this.isRegister = false + SDKMgr.onRegisterCallback = function() - -- Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,loginResp) - ThinkingAnalyticsManager.Track("create_account") + this.isRegister = true end SDKMgr.onLoginCallback = function(loginResp) - Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,loginResp) - -- ThinkingAnalyticsManager.Track("app_login") + -- 获取登录信息 + local result = string.split(loginResp, "#") + result[1] = tonumber(result[1]) + if result[1] == SDK_RESULT.SUCCESS then + AppConst.SdkId = result[2] + AppConst.OpenId = result[2] + AppConst.TokenStr = result[4] + AppConst.SdkChannel = result[5] + end + -- 判断是否是注册并登录 + if this.isRegister then + this.isRegister = false + ThinkingAnalyticsManager.SetSuperProperties({ + account = AppConst.isSDK and tostring(AppConst.OpenId) or "", + Bundle_id = AppConst.isSDK and AppConst.SdkPackageName or "", + xx_id = AppConst.isSDK and AppConst.SdkChannel or "", + }) + ThinkingAnalyticsManager.Track("create_account") + end + -- 发送登录成功事件 + Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1]) end SDKMgr.onSwitchAccountCallback = function(resp) diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua index 5d83d48e5e..3a13d591e5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua @@ -252,17 +252,10 @@ function this.SDKLogin() end end -function this.RefreshLoginStatus(loginResp) - local result = string.split(loginResp, "#") - if tonumber(result[1]) == SDK_RESULT.SUCCESS then +function this.RefreshLoginStatus(result) + if result == SDK_RESULT.SUCCESS then RequestPanel.Show(Language[11121]) this.SetLoginPart(true) - AppConst.SdkId = result[2] - AppConst.OpenId = result[2] - AppConst.TokenStr = result[4] - AppConst.SdkChannel = result[5] - AppConst.SdkPackageName = AndroidDeviceInfo.Instance:GetPackageName() - -- this.SetSDKExtensionParams(result[4]) -- 获取服务器列表 this.RequestServerList(AppConst.OpenId, this.OnReceiveServerList) else