示例#1
0
    /// <summary>
    /// 註冊回傳
    /// </summary>
    static IEnumerator Coroutine_ChangeNameCB(WWW w)
    {
        if (ReSendQuestTimes_ChangeName == MaxReSendQuestTimes_ChangeName)
        {
            CaseLogManager.ShowCaseLog(30003);//登入中
        }
        yield return(w);

        Debug.LogWarning(w.text);
        if (WaitCB_ChangeName)
        {
            WaitCB_ChangeName = false;
            if (w.error == null)
            {
                try
                {
                    string[] result = w.text.Split(':');
                    //////////////////成功////////////////
                    if (result[0] == "Success1")//db創帳號
                    {
                        string[] data = result[1].Split(',');
                        Player.ChangeName1(data);
                        PopupUI.HideLoading();   //隱藏Loading
                    }
                    if (result[0] == "Success2") //db已經有帳號只更新名稱
                    {
                        string[] data = result[1].Split(',');
                        Player.ChangeName2(data);
                        PopupUI.HideLoading();//隱藏Loading
                    }
                    //////////////////失敗///////////////
                    else if (result[0] == ServerCBCode.Fail.ToString())
                    {
                        int caseID = int.Parse(result[1]);
                        CaseLogManager.ShowCaseLog(caseID);
                        PopupUI.HideLoading();//隱藏Loading
                    }
                    else
                    {
                        CaseLogManager.ShowCaseLog(2004);
                        PopupUI.HideLoading();//隱藏Loading
                    }
                }
                //////////////////例外//////////////////
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    CaseLogManager.ShowCaseLog(2003); //註冊例外
                    PopupUI.HideLoading();            //隱藏Loading
                }
            }
            //////////////////回傳null////////////////
            else
            {
                Debug.LogWarning(w.error);
                CaseLogManager.ShowCaseLog(2);; //連線不到server
                PopupUI.HideLoading();          //隱藏Loading
            }
        }
    }
示例#2
0
    static IEnumerator ChangeNameTimeOutHandle(float _firstWaitTime, float _perWaitTime, byte _checkTimes, string _name)
    {
        yield return(new WaitForSeconds(_firstWaitTime));

        byte checkTimes = _checkTimes;

        //經過_fristWaitTime時間後,每_perWaitTime檢查一次資料是否回傳了,若檢查checkTimes次數後還是沒回傳就重送資料
        while (WaitCB_ChangeName && checkTimes > 0)
        {
            checkTimes--;
            yield return(new WaitForSeconds(_perWaitTime));
        }
        if (WaitCB_ChangeName)//如果還沒接收到CB就重送需求
        {
            //若重送要求的次數達到上限次數則代表連線有嚴重問題,直接報錯
            if (ReSendQuestTimes_ChangeName > 0)
            {
                ReSendQuestTimes_ChangeName--;
                CaseLogManager.ShowCaseLog(30001);//連線逾時,嘗試重複連線請玩家稍待
                //向Server重送要求
                SendChangeNameQuest(_name);
            }
            else
            {
                WaitCB_ChangeName = false;          //設定為false代表不接受回傳了
                CaseLogManager.ShowCaseLog(40001);; //請玩家檢查網路狀況或一段時間再嘗試連線
                //CaseLogManager.ShowCaseLog(11);//請玩家檢查網路狀況或一段時間再嘗試連線
                PopupUI.HideLoading();              //隱藏Loading
            }
        }
    }
示例#3
0
    static IEnumerator LeaderboardTimeOutHandle(float _firstWaitTime, float _perWaitTime, byte _checkTimes)
    {
        yield return(new WaitForSeconds(_firstWaitTime));

        byte checkTimes = _checkTimes;

        //經過_fristWaitTime時間後,每_perWaitTime檢查一次資料是否回傳了,若檢查checkTimes次數後還是沒回傳就重送資料
        while (WaitCB_Leaderboard && checkTimes > 0)
        {
            checkTimes--;
            yield return(new WaitForSeconds(_perWaitTime));
        }
        if (WaitCB_Leaderboard)//如果還沒接收到CB就重送需求
        {
            //若重送要求的次數達到上限次數則代表連線有嚴重問題,直接報錯
            if (ReSendQuestTimes_Leaderboard > 0)
            {
                ReSendQuestTimes_Leaderboard--;
                CaseLogManager.ShowCaseLog(30001);//連線逾時,嘗試重複連線請玩家稍待
                //向Server重送要求
                SendLeaderboardQuest();
            }
            else
            {
                WaitCB_Leaderboard = false;//設定為false代表不接受回傳了
                Debug.LogWarning("取得排行榜資料失敗");
                LeaderboardUI.GetChampionData(Player.LeaderboardData);
                //CaseLogManager.ShowCaseLog(40001); ;//請玩家檢查網路狀況或一段時間再嘗試連線
                //CaseLogManager.ShowCaseLog(11);//請玩家檢查網路狀況或一段時間再嘗試連線
                PopupUI.HideLoading();//隱藏Loading
            }
        }
    }
示例#4
0
    static IEnumerator SettlementTimeOutHandle(float _firstWaitTime, float _perWaitTime, byte _checkTimes)
    {
        yield return(new WaitForSeconds(_firstWaitTime));

        byte checkTimes = _checkTimes;

        //經過_fristWaitTime時間後,每_perWaitTime檢查一次資料是否回傳了,若檢查checkTimes次數後還是沒回傳就重送資料
        while (WaitCB_Settlement && checkTimes > 0)
        {
            checkTimes--;
            yield return(new WaitForSeconds(_perWaitTime));
        }
        if (WaitCB_Settlement)//如果還沒接收到CB就重送需求
        {
            //若重送要求的次數達到上限次數則代表連線有嚴重問題,直接報錯
            if (ReSendQuestTimes_Settlement > 0)
            {
                ReSendQuestTimes_Settlement--;
                if (ShowLoading)
                {
                    CaseLogManager.ShowCaseLog(30001);             //連線逾時,嘗試重複連線請玩家稍待
                }
                //向Server重送要求
                SendSettlementQuest();
            }
            else
            {
                WaitCB_Settlement = false;//設定為false代表不接受回傳了
                if (ShowLoading)
                {
                    CaseLogManager.ShowCaseLog(40001);
                }
                ;                      //請玩家檢查網路狀況或一段時間再嘗試連線
                //CaseLogManager.ShowCaseLog(11);//請玩家檢查網路狀況或一段時間再嘗試連線
                PopupUI.HideLoading(); //隱藏Loading
            }
        }
    }
示例#5
0
    /// <summary>
    /// 註冊回傳
    /// </summary>
    static IEnumerator Coroutine_SettlementCB(WWW w)
    {
        if (ReSendQuestTimes_Settlement == MaxReSendQuestTimes_Settlement)
        {
            if (ShowLoading)
            {
                CaseLogManager.ShowCaseLog(30003);             //登入中
            }
        }
        yield return(w);

        Debug.LogWarning(w.text);
        if (WaitCB_Settlement)
        {
            WaitCB_Settlement = false;
            if (w.error == null)
            {
                try
                {
                    string[] result = w.text.Split(':');
                    //////////////////成功////////////////
                    if (result[0] == ServerCBCode.Success.ToString())
                    {
                        //string[] data = result[1].Split(',');
                        PopupUI.HideLoading();//隱藏Loading
                    }
                    //////////////////失敗///////////////
                    else if (result[0] == ServerCBCode.Fail.ToString())
                    {
                        int caseID = int.Parse(result[1]);
                        if (ShowLoading)
                        {
                            CaseLogManager.ShowCaseLog(caseID);
                        }
                        PopupUI.HideLoading();//隱藏Loading
                    }
                    else
                    {
                        if (ShowLoading)
                        {
                            CaseLogManager.ShowCaseLog(2004);
                        }
                        PopupUI.HideLoading();//隱藏Loading
                    }
                }
                //////////////////例外//////////////////
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    if (ShowLoading)
                    {
                        CaseLogManager.ShowCaseLog(2003); //註冊例外
                    }
                    PopupUI.HideLoading();                //隱藏Loading
                }
            }
            //////////////////回傳null////////////////
            else
            {
                Debug.LogWarning(w.error);
                if (ShowLoading)
                {
                    CaseLogManager.ShowCaseLog(2);
                }
                ;                      //連線不到server
                PopupUI.HideLoading(); //隱藏Loading
            }
        }
    }
示例#6
0
    /// <summary>
    /// 註冊回傳
    /// </summary>
    static IEnumerator Coroutine_LeaderboardCB(WWW w)
    {
        if (ReSendQuestTimes_Leaderboard == MaxReSendQuestTimes_Leaderboard)
        {
            CaseLogManager.ShowCaseLog(30003);//登入中
        }
        yield return(w);

        Debug.LogWarning(w.text);
        if (WaitCB_Leaderboard)
        {
            WaitCB_Leaderboard = false;
            if (w.error == null)
            {
                try
                {
                    string[] result = w.text.Split(':');
                    //////////////////成功////////////////
                    if (result[0] == ServerCBCode.Success.ToString())
                    {
                        string rankStr = result[1];
                        LeaderboardUI.GetChampionData(rankStr);
                        PopupUI.HideLoading();//隱藏Loading
                    }
                    //////////////////失敗///////////////
                    else if (result[0] == ServerCBCode.Fail.ToString())
                    {
                        //int caseID = int.Parse(result[1]);
                        //CaseLogManager.ShowCaseLog(caseID);
                        Debug.LogWarning("取得排行榜資料失敗");
                        LeaderboardUI.GetChampionData(Player.LeaderboardData);
                        PopupUI.HideLoading();//隱藏Loading
                    }
                    else
                    {
                        //CaseLogManager.ShowCaseLog(2004);
                        Debug.LogWarning("取得排行榜資料失敗");
                        LeaderboardUI.GetChampionData(Player.LeaderboardData);
                        PopupUI.HideLoading();//隱藏Loading
                    }
                }
                //////////////////例外//////////////////
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    Debug.LogWarning("取得排行榜資料失敗");
                    LeaderboardUI.GetChampionData(Player.LeaderboardData);
                    //CaseLogManager.ShowCaseLog(2003);//註冊例外
                    PopupUI.HideLoading();//隱藏Loading
                }
            }
            //////////////////回傳null////////////////
            else
            {
                Debug.LogWarning(w.error);
                Debug.LogWarning("取得排行榜資料失敗");
                LeaderboardUI.GetChampionData(Player.LeaderboardData);
                //CaseLogManager.ShowCaseLog(2); ;//連線不到server
                PopupUI.HideLoading();//隱藏Loading
            }
        }
    }