void ProcessLoginAuto() { ConnectState = eConnectState.connecting; C2L.LoginAuto _LoginAuto = new C2L.LoginAuto(); _LoginAuto.account_idx = SHSavedData.AccountIdx; _LoginAuto.login_token = SHSavedData.LoginToken; _LoginAuto.access_token = SHSavedData.AccessToken; _LoginAuto.info_version = SHSavedData.Instance.InfoVersion; _LoginAuto.push_id = PushManager.Instance.PushID; _LoginAuto.push_token = PushManager.Instance.PushToken; _LoginAuto.login_platform = SHSavedData.LoginPlatform; _LoginAuto.app_info = GetAppInfo(); _LoginAuto.agree = IsAgree; game_server.JsonAsync <C2L.LoginAuto, C2L.LoginAutoAck>(_LoginAuto, OnLoginAuto); }
void OnLoginAuto(C2L.LoginAuto packet, C2L.LoginAutoAck ack) { if (ack.result == C2L.eLoginResult.SessionExpired) { SHSavedData.AccountIdx = -1; if (SHSavedData.LoginPlatform == LoginPlatform.Facebook && Facebook.Unity.FB.IsLoggedIn) { Facebook.Unity.FB.LogOut(); } if (SHSavedData.LoginPlatform == LoginPlatform.GooglePlay && UM_GameServiceManager.Instance.IsConnected) { UM_GameServiceManager.Instance.Disconnect(); } SHSavedData.LoginPlatform = PacketEnums.LoginPlatform.Invalid; ConnectState = eConnectState.idle; return; } if (ack.result != C2L.eLoginResult.Successed) { if (ack.result == C2L.eLoginResult.NeedAgree) { Popup.Instance.Show(ePopupMode.Policy, new System.Action(ProcessLoginAuto)); return; } //Debug.LogError(ack.result); ConnectState = eConnectState.idle; if (Localization.Exists("LoginResult_" + ack.result) == true) { Popup.Instance.ShowMessageKey("LoginResult_" + ack.result); } else { Popup.Instance.ShowMessage(ack.result.ToString()); } return; } ConnectState = eConnectState.connecting; SHSavedData.AccessToken = ack.access_token; // if (ack.request_info == false) // SHSavedData.Instance.LoadData(true); // if (ack.request_data == false) // SaveDataManger.Instance.InitFromFile(); game_server.InitPacketNamespace("C2G"); game_server.InitSession(SHSavedData.AccountIdx, ack.access_token, ack.reconnect_index); if (ExceptionHandler.Instance != null) { ExceptionHandler.Instance.SendLastReport(); } ack.request_data = true; ack.request_info = true; C2G.Connect _Connect = new C2G.Connect(); _Connect.request_info = ack.request_info; _Connect.request_data = ack.request_data; game_server.JsonAsync <C2G.Connect, C2G.ConnectAck>(_Connect, OnConnect); }