Esempio n. 1
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);
                });
            }
        });
    }
Esempio n. 2
0
 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);
             });
         }
     });
 }
Esempio n. 3
0
    /////////////////////////////////////////////////////////////
    /// public static

    public static MessagePop ShowPop(string msg, string leftBtnText = null, DelOnClickButton leftBtnCallback  = null,
                                     string rightBtnText            = null, DelOnClickButton rightBtnCallback = null, bool canClose = true)
    {
        MessagePop popup = UEPopup.GetInstantiateComponent <MessagePop>("Prefabs/UI/Popups/MessagePop");

        popup.Show(msg, leftBtnText, leftBtnCallback, rightBtnText, rightBtnCallback, canClose);
        return(popup);
    }
Esempio n. 4
0
    private void ShowBanned(int uid)
    {
        string msg      = LanguageManager.Instance.GetAccountLockedText();
        string confirm  = LanguageManager.Instance.GetConfirmText();
        string sendMail = LanguageManager.Instance.GetContactUSText();

        MessagePop.ShowPop(msg, confirm, () =>
        {
            Application.Quit(0);
        }, sendMail, () =>
        {
            this.SendCSMail(uid);
        }, canClose: false);
    }
Esempio n. 5
0
 private void LoadSpecData()
 {
     //DOWNLOADING DATA..
     NetworkManager.Instance.GetSpecData(SpecDataManager.Instance.SpecVersion, (state, response) =>
     {
         if (state == NetworkState.NORMAL)
         {
             ServerSpecData data = JsonConvert.DeserializeObject <ServerSpecData>(response);
             SpecDataManager.Instance.SetServerSpecData(data);
             Preference.SavePreference(Pref.SPEC_VERSION, SpecDataManager.Instance.SpecVersion);
             Preference.SavePreference(Pref.SPEC_DATA, response);
             this.Login();
         }
         else
         {
             MessagePop.ShowPop(LanguageManager.Instance.GetTryAgainText()).SetOnCompleteHide(() =>
             {
                 GameObject.Destroy(DontDestroyObject.Instance.gameObject);
                 UnityEngine.SceneManagement.SceneManager.LoadScene(0);
             });
         }
     });
 }
Esempio n. 6
0
    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);
                    });
                }
            }
        });
    }