private void GuestLogin() { //LOGIN TO SERVER.. NetworkManager.Instance.AuthLogin("guest", "guest", (state, response) => { if (state == NetworkState.NORMAL) { if (response.isBanned == 1) { LoadingPop.HidePopup(); this.ShowBanned(response.uid); } else { Preference.SavePreference(Pref.SOCIAL_ID, string.Empty); this.GetLobbyInfo(); } } else { LoadingPop.HidePopup(); MessagePop.ShowPop(LanguageManager.Instance.GetTryAgainText()).SetOnCompleteHide(() => { GameObject.Destroy(DontDestroyObject.Instance.gameObject); UnityEngine.SceneManagement.SceneManager.LoadScene(0); }); } }); }
private void GetLobbyInfo() { NetworkManager.Instance.LobbyInfo((state, response) => { LoadingPop.HidePopup(); if (state == NetworkState.NORMAL) { DataManager.Instance.SetServerData(response); // GameUI.Instance.Refresh(); if (DataManager.Instance.UserData.isCheater) { this.ShowBanned(DataManager.Instance.UserData.uid); } else { // if (!DataManager.Instance.UserData.nVersion.Equals(Application.version)) // { // NoticePop.ShowPopup(); // } } } else { MessagePop.ShowPop(LanguageManager.Instance.GetTryAgainText()).SetOnCompleteHide(() => { GameObject.Destroy(DontDestroyObject.Instance.gameObject); UnityEngine.SceneManagement.SceneManager.LoadScene(0); }); } }); }
private void Login() { NetworkManager.Instance.GetConfig((state, data) => { DataManager.Instance.SetConfig(data.config); string socialID = Preference.LoadPreference(Pref.SOCIAL_ID, string.Empty); if (!string.IsNullOrEmpty(socialID)) { LoadingPop.HidePopup(); this.SoicalLogin(); } else { this.GuestLogin(); } }); }
private void CheckVersion(string key) { this.getVersionTryCount++; LoadingPop.HidePopup(); NetworkManager.Instance.CheckVersion(key, (state, response) => { if (state == NetworkState.NORMAL) { Debug.Log("Current Server Spec Verison " + response.spec_version); SpecDataManager.Instance.SpecVersion = response.spec_version; int savedVersion = Preference.LoadPreference(Pref.SPEC_VERSION, 0); string specJson = Preference.LoadPreference(Pref.SPEC_DATA, string.Empty); if (response.status == 1) { LoadingPop.HidePopup(); string msg = LanguageManager.Instance.GetNeedUpdateText(); string confirm = LanguageManager.Instance.GetConfirmText(); MessagePop.ShowPop(msg, confirm, () => { Application.OpenURL(StringConst.MARKET_URL); }, canClose: false); } else if (response.status == 3) { LoadingPop.HidePopup(); string msg = LanguageManager.Instance.GetServerCheckText(); string confirm = LanguageManager.Instance.GetConfirmText(); MessagePop.ShowPop(msg, confirm, () => { Application.Quit(0); }, canClose: false); } else if (response.status == 6) { LoadingPop.HidePopup(); string msg = LanguageManager.Instance.GetNeedLoginText(); string confirm = LanguageManager.Instance.GetConfirmText(); MessagePop.ShowPop(msg, confirm, () => { Application.Quit(0); }, canClose: false); } else { if (SpecDataManager.Instance.SpecVersion == savedVersion && !string.IsNullOrEmpty(specJson)) { SpecDataManager.Instance.SetServerSpecData(JsonConvert.DeserializeObject <ServerSpecData>(specJson)); this.Login(); } else { this.LoadSpecData(); } } } else { if (this.getVersionTryCount < 3) { Run.After(1f, () => { this.CheckVersion(key); }); } else { LoadingPop.HidePopup(); MessagePop.ShowPop(LanguageManager.Instance.GetTryAgainText()).SetOnCompleteHide(() => { GameObject.Destroy(DontDestroyObject.Instance.gameObject); UnityEngine.SceneManagement.SceneManager.LoadScene(0); }); } } }); }