Exemplo n.º 1
0
    private void CustomCallback(BackendReturnObject callback)
    {
        Debug.Log(callback);
        if (callback.IsSuccess())
        {
            bro       = callback;
            IsSuccess = true;
        }
        else
        {
            //string errCode = callback.GetErrorCode();
            string msg = string.Empty;

            switch (int.Parse(callback.GetStatusCode()))
            {
            case 401:
                msg = callback.GetMessage().Contains("customId") ? "존재하지 않는 아이디입니다." : "잘못된 비밀번호 입니다.";
                break;

            case 409:
                msg = "중복된 아이디입니다.";
                break;

            case 403:     // 차단
                msg = callback.GetErrorCode();
                break;

            default:
                msg = callback.GetMessage();
                break;
            }

            if (msg.Contains("비밀번호"))
            {
                Dispatcher.Instance.Invoke(() => SetPWGuide(msg));
            }
            else
            {
                Dispatcher.Instance.Invoke(() => SetIdGuide(msg));
            }
        }
    }
Exemplo n.º 2
0
    // 커스텀 계정을 구글 계정으로
    public void OnClickChangeCustomToFederation()
    {
        BackendReturnObject BRO = Backend.BMember.ChangeCustomToFederation(GetTokens(), FederationType.Google);

        if (BRO.IsSuccess())
        {
            Debug.Log("페더레이션 계정으로 변경 완료");


            if (PlayerPrefs.GetString("login") == "Custom")
            {
                PlayerPrefs.DeleteKey("id");
                PlayerPrefs.DeleteKey("password");

                PlayerPrefs.SetString("login", "Google");
            }
        }
        else
        {
            switch (BRO.GetStatusCode())
            {
            case "400":
                if (BRO.GetErrorCode() == "BadParameterException")
                {
                    Debug.Log("이미 ChangeCustomToFederation 완료 되었는데 다시 시도한 경우");
                }

                else if (BRO.GetErrorCode() == "UndefinedParameterException")
                {
                    Debug.Log("customLogin 하지 않은 상황에서 시도한 경우");
                }
                break;

            case "409":
                // 이미 가입되어 있는 경우
                Debug.Log("Duplicated federationId, 중복된 federationId 입니다");
                PopupManager.instance.Alram("Error_05");
                break;
            }
        }
    }
Exemplo n.º 3
0
    private void CheckError(BackendReturnObject BRO)
    {
        switch (BRO.GetStatusCode())
        {
        case "200":
            Debug.Log("해당 유저의 데이터가 테이블에 없습니다.");
            break;

        case "404":
            if (BRO.GetMessage().Contains("gamer not found"))
            {
                Debug.Log("gamerIndate가 존재하지 gamer의 indate인 경우");
            }
            else if (BRO.GetMessage().Contains("table not found"))
            {
                Debug.Log("존재하지 않는 테이블");
            }
            break;

        case "400":
            if (BRO.GetMessage().Contains("bad limit"))
            {
                Debug.Log("limit 값이 100이상인 경우");
            }
            else if (BRO.GetMessage().Contains("bad table"))
            {
                //public Table 정보를 얻는 코드로 privte Table 에 접근했을 떄 또는
                //private Table 정보를 얻는 코드로 public Table 에 접근했을 때
                Debug.Log("요청한 코드와 테이블의 고액여부가 맞지 않습니다.");
            }
            break;

        case "412":
            Debug.Log("비활성화된 테이블입니다.");
            break;

        default:
            Debug.Log("서버 공통 에러 발생: " + BRO.GetMessage());
            break;
        }
    }
Exemplo n.º 4
0
    public void OnClickGameInfoUpdate()
    {
        Param param = new Param();

        for (int i = 0; i < 3; i++)
        {
            param.Add("stage" + (i + 1), MyData.Instance.scoreInfo.stageScore[i]);
        }

        BackendReturnObject BRO = Backend.GameInfo.Update("StageScore", MyData.Instance.loginID, param);

        if (BRO.IsSuccess())
        {
            Debug.Log("수정 완료");
        }
        else
        {
            switch (BRO.GetStatusCode())
            {
            case "405":
                Debug.Log("param에 partition, gamer_id, inDate, updatedAt 네가지 필드가 있는 경우");
                break;

            case "403":
                Debug.Log("퍼블릭테이블의 타인정보를 수정하고자 하였을 경우");
                break;

            case "404":
                Debug.Log("존재하지 않는 tableName인 경우");
                break;

            case "412":
                Debug.Log("비활성화 된 tableName인 경우");
                break;

            case "413":
                Debug.Log("하나의 row( column들의 집합 )이 400KB를 넘는 경우");
                break;
            }
        }
    }
Exemplo n.º 5
0
    public void InsertOwnUnitTable()
    {
        // Param은 뒤끝 서버와 통신을 할 떄 넘겨주는 파라미터 클래스 입니다.
        GameObject[] Ally = GameObject.FindGameObjectsWithTag("Team"); //동료 숫자 파악.
        for (int i = 0; i < Ally.Length; i++)
        {
            if (Ally[i].gameObject.name != "player")
            {
                Param param = new Param();
                param.Add("Name", Ally[i].gameObject.name);

                BackendReturnObject BRO = Backend.GameData.Insert("OwnUnitTable", param);
                if (BRO.IsSuccess())
                {
                    Debug.Log("indate : " + BRO.GetInDate());
                }
                else
                {
                    switch (BRO.GetStatusCode())
                    {
                    case "404":
                        Debug.Log("존재하지 않는 tableName인 경우");
                        break;

                    case "412":
                        Debug.Log("비활성화 된 tableName인 경우");
                        break;

                    case "413":
                        Debug.Log("하나의 row( column들의 집합 )이 400KB를 넘는 경우");
                        break;

                    default:
                        Debug.Log("서버 공통 에러 발생: " + BRO.GetMessage());
                        break;
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
        public void SignUp()
        {
            //BackendReturnObject bro = Backend.BMember.LoginWithTheBackendToken();
            GenIDPW();

            BackendReturnObject returnObject = Backend.BMember.CustomSignUp(PlayerPrefs.GetString(DesignConstStorage.PlayerCustomID), (PlayerPrefs.GetString(DesignConstStorage.PlayerCustomPW)));

            string sCode = returnObject.GetStatusCode();

            switch (sCode)
            {
            case "409":
                SignUp();
                break;

            case "401":
                //회원가입 하는데 비번이 틀림????
                //리얼리??????????
                Debug.LogError(sCode);
                break;

            case "403":
                ShowBlockUserInfo();
                break;

            case "201":
                welcomeFalg = true;
                //WelcomeNewUser();

                break;

            default:

                break;
            }

            loadingtext.text = returnObject.GetMessage();
        }
Exemplo n.º 7
0
        public void SetPersonalRecordToServer(string tName)
        {
            //삽입인지 바로 넣을지 결정해야 한다.


            Param param = new Param();

            param.Add(tName, DesignConstStorage.PersonalTrackRecord[tName]);

            BackendReturnObject bro = Backend.GameInfo.Update(DesignConstStorage.tNameTrackRecord, PInfo.trackinDate, param);

            if (bro.IsSuccess())
            {
#if UNITY_EDITOR
                Debug.LogError(bro.IsSuccess());
                Debug.LogError("더 느린 기록이라도 업데이트 되는지 확인");
#endif
            }
            else
            {
                Debug.LogError(bro.GetStatusCode());
            }
        }
Exemplo n.º 8
0
    public void BroChecker
        (string CallingName, BackendReturnObject BRO,
        System.Action SuccessCallback = null, System.Action FailedCallback = null)
    {
        if (BRO.IsSuccess())
        {
            ////Debug.Log("BRO.IsSuccess() == true -> " + CallingName + " 성공: "
            //            + BRO.GetStatusCode() + " // "
            //            + BRO.GetErrorCode() + " // "
            //            + BRO.GetMessage());

            SuccessCallback?.Invoke();
        }
        else
        {
            Debug.Log("BRO.IsSuccess() = false -> " + CallingName + " 실패: "
                      + BRO.GetStatusCode() + " // "
                      + BRO.GetErrorCode() + " // "
                      + BRO.GetMessage());

            FailedCallback?.Invoke();
        }
    }
Exemplo n.º 9
0
    public void OnClickInsertData()
    {
        Param param = new Param();

        param.Add("stage1", 0);
        param.Add("stage2", 0);
        param.Add("stage3", 0);

        BackendReturnObject BRO = Backend.GameInfo.Insert("StageScore", param);

        if (BRO.IsSuccess())
        {
            Debug.Log("새로운 데이터가 서버에 등록되었습니다! indate 값 : " + BRO.GetInDate());
            OnClickPublicContents();
        }
        else
        {
            switch (BRO.GetStatusCode())
            {
            case "404":
                Debug.Log("존재하지 않는 tableName인 경우");
                break;

            case "412":
                Debug.Log("비활성화 된 tableName인 경우");
                break;

            case "413":
                Debug.Log("하나의 row(colum들의 집합)이 400KB를 넘는경우");
                break;

            default:
                Debug.Log("서버 공통 에러 발생 : " + BRO.GetMessage());
                break;
            }
        }
    }
Exemplo n.º 10
0
    public void OnClickGameInfoCalculatorUpdate()
    {
        Param param = new Param();

        param.AddCalculation("stage1", GameInfoOperator.addition, -10);
        BackendReturnObject BRO = Backend.GameInfo.Update("StageScore", "", param);

        if (BRO.IsSuccess())
        {
            Debug.Log("수정 완료");
        }
        else
        {
            switch (BRO.GetStatusCode())
            {
            case "405":
                Debug.Log("param에 partition, gamer_id, inDate, updatedAt 네가지 필드가 있는 경우");
                break;

            case "403":
                Debug.Log("퍼블릭테이블의 타인정보를 수정하고자 하였을 경우");
                break;

            case "404":
                Debug.Log("존재하지 않는 tableName인 경우");
                break;

            case "412":
                Debug.Log("비활성화 된 tableName인 경우");
                break;

            case "413":
                Debug.Log("하나의 row( column들의 집합 )이 400KB를 넘는 경우");
                break;
            }
        }
    }
Exemplo n.º 11
0
        public void BackeEndTokenLogIn()
        {
            //동기화 되어야 하는 기능

            BackendReturnObject returnObject;

            if (PlayerPrefs.GetString(DesignConstStorage.PlayerCustomID) == "")
            {
                //ID값이 초기값이라고?? 그럼 회원가입 해야지
                SignUp();
                return;
            }
            else
            {
                returnObject = Backend.BMember.LoginWithTheBackendToken();
            }

            string sCode = returnObject.GetStatusCode();

            if (sCode == "403")
            {
                ShowBlockUserInfo();

                return;
            }

            if (returnObject.IsSuccess())
            {
                return;
            }

            string asd = PlayerPrefs.GetString(DesignConstStorage.PlayerCustomID);

            Debug.LogError(PlayerPrefs.GetString(DesignConstStorage.PlayerCustomID));

            //초기값 아니니까 기존 ID PW로 로그인 ㄱㄱ

            BackendReturnObject cloginBRO = Backend.BMember.CustomLogin(PlayerPrefs.GetString(DesignConstStorage.PlayerCustomID), (PlayerPrefs.GetString(DesignConstStorage.PlayerCustomPW)));

            string clSCode = cloginBRO.GetStatusCode();

            switch (clSCode)
            {
            case "200":
            case "201":
            case "204":
                //성공
                //GetPlayerInfo();
                break;

            case "410":
                //아디 없음
                //회원가입 하면 된다?
                //테스트 상황에서는 여기  문제가 된다. 임시로 회원가입
                Debug.LogWarning("Waring!!");
                SignUp();
                break;

            case "409":
                //아디 중복
                //로그인시 409에러면 이상할거 같은데?
                Debug.LogError("Wrong Value");
                break;

            case "403":
                ShowBlockUserInfo();
                break;

            case "401":
                //비번 틀림
                //저장된 비번이 달라졌으니까 가능성은 2개다.
                //1 해킹이나 뭐든간에 변조
                //2 로그인시 잘못된 아디값으로 로그인
                //테스트 상황에서는 여기  문제가 된다. 임시로 회원가입
                Debug.LogWarning("Waring!!");
                SignUp();
                break;

            default:
                Debug.LogError(clSCode);
                break;
            }
        }
Exemplo n.º 12
0
    private void GoogleAuth(System.Action loginAction)
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated == false)
        {
            Social.localUser.Authenticate(success =>
            {
                if (success == false)
                {
                    Debug.Log("구글 로그인 실패");
                    return;
                }

                /*a
                 * // 로그인이 성공되었습니다.
                 * Debug.Log("GetIdToken - " + PlayGamesPlatform.Instance.GetIdToken());
                 * Debug.Log("Email - " + ((PlayGamesLocalUser)Social.localUser).Email);
                 * Debug.Log("GoogleId - " + Social.localUser.id);
                 * Debug.Log("UserName - " + Social.localUser.userName);
                 * Debug.Log("UserName - " + PlayGamesPlatform.Instance.GetUserDisplayName());*/

                BackendReturnObject BRO = Backend.BMember.AuthorizeFederation(GetTokens(), FederationType.Google, "gpgs로 만든계정");
                if (BRO.IsSuccess())
                {
                    Debug.Log("구글 로그인 동기화 성공");


                    BackendAsyncClass.BackendAsync(Backend.BMember.GetUserInfo, (callback1) =>
                    {
                        if (callback1.IsSuccess())
                        {
                            JsonData json = callback1.GetReturnValuetoJSON()["row"];

                            if (json["nickname"] != null)
                            {
                                string nickName            = json["nickname"].ToString();
                                UserInfo.instance.nickname = nickName;
                                string indate = json["inDate"].ToString();
                                Debug.Log("로그인 성공 닉네임 : " + nickName);
                                PlayerPrefs.SetString("login", "Google");
                                loginAction();
                                //lobbyLoding.Loading();
                            }
                            else
                            {
                                BackendReturnObject servertime = Backend.Utils.GetServerTime();
                                string time         = servertime.GetReturnValuetoJSON()["utcTime"].ToString();
                                DateTime parsedDate = DateTime.Parse(time);
                                string nickname     = parsedDate.Year.ToString() + parsedDate.Month.ToString() + parsedDate.Day.ToString() + parsedDate.Hour.ToString() + parsedDate.Minute.ToString() + parsedDate.Second.ToString() + UnityEngine.Random.Range(0, 1000).ToString();

                                BackendAsyncClass.BackendAsync(Backend.BMember.CreateNickname, nickname, (callback2) =>
                                {
                                    if (callback2.IsSuccess())
                                    {
                                        Debug.Log("닉네임 만들기 성공");
                                        UserInfo.instance.nickname = nickname;
                                        PlayerPrefs.SetString("login", "Google");
                                        loginAction();
                                    }
                                    else
                                    {
                                        switch (callback2.GetStatusCode())
                                        {
                                        case "400":
                                            Debug.Log("빈 닉네임으로 생성");
                                            Debug.Log("또는 20자 이상의 닉네임");
                                            Debug.Log("닉네임 앞 뒤 공백이 있는 경우");
                                            Debug.Log("에러 메세지" + callback2.GetMessage());
                                            break;

                                        case "409":
                                            Debug.Log("이미 중복된 닉네임");
                                            break;
                                        }
                                    }
                                });
                            }
                        }
                        else
                        {
                            Debug.Log(callback1.GetErrorCode());
                        }
                    });
                }
                else
                {
                    Debug.Log("구글 로그인 동기화 실패");
                    Debug.Log(BRO.GetStatusCode());
                    Debug.Log(BRO.GetMessage());
                    switch (BRO.GetStatusCode())
                    {
                    case "200":
                        Debug.Log("이미 회원가입된 회원");
                        break;

                    case "403":
                        Debug.Log("차단된 사용자 입니다. 차단 사유 : " + BRO.GetErrorCode());
                        break;
                    }
                }
            });
        }
        else
        {
            Debug.Log("bb");
            BackendReturnObject BRO = Backend.BMember.AuthorizeFederation(GetTokens(), FederationType.Google, "gpgs로 만든계정");
            if (BRO.IsSuccess())
            {
                Debug.Log("구글 로그인 동기화 성공");


                BackendAsyncClass.BackendAsync(Backend.BMember.GetUserInfo, (callback1) =>
                {
                    if (callback1.IsSuccess())
                    {
                        JsonData json = callback1.GetReturnValuetoJSON()["row"];

                        if (json["nickname"] != null)
                        {
                            string nickName = json["nickname"].ToString();
                            string indate   = json["inDate"].ToString();
                            Debug.Log("로그인 성공 닉네임 : " + nickName);
                            PlayerPrefs.SetString("login", "Google");
                            loginAction();
                            //lobbyLoding.Loading();
                        }
                        else
                        {
                            BackendReturnObject servertime = Backend.Utils.GetServerTime();
                            string time         = servertime.GetReturnValuetoJSON()["utcTime"].ToString();
                            DateTime parsedDate = DateTime.Parse(time);
                            string nickname     = parsedDate.Year.ToString() + parsedDate.Month.ToString() + parsedDate.Day.ToString() + parsedDate.Hour.ToString() + parsedDate.Minute.ToString() + parsedDate.Second.ToString() + UnityEngine.Random.Range(0, 1000).ToString();

                            BackendAsyncClass.BackendAsync(Backend.BMember.CreateNickname, nickname, (callback2) =>
                            {
                                if (callback2.IsSuccess())
                                {
                                    Debug.Log("닉네임 만들기 성공");
                                    PlayerPrefs.SetString("login", "Google");
                                    loginAction();
                                }
                                else
                                {
                                    switch (callback2.GetStatusCode())
                                    {
                                    case "400":
                                        Debug.Log("빈 닉네임으로 생성");
                                        Debug.Log("또는 20자 이상의 닉네임");
                                        Debug.Log("닉네임 앞 뒤 공백이 있는 경우");
                                        Debug.Log("에러 메세지" + callback2.GetMessage());
                                        break;

                                    case "409":
                                        Debug.Log("이미 중복된 닉네임");
                                        break;
                                    }
                                }
                            });
                        }
                    }
                    else
                    {
                        Debug.Log(callback1.GetErrorCode());
                    }
                });
            }
            else
            {
                Debug.Log("구글 로그인 동기화 실패");
                Debug.Log(BRO.GetStatusCode());
                Debug.Log(BRO.GetMessage());
                switch (BRO.GetStatusCode())
                {
                case "200":
                    Debug.Log("이미 회원가입된 회원");
                    break;

                case "403":
                    Debug.Log("차단된 사용자 입니다. 차단 사유 : " + BRO.GetErrorCode());
                    break;
                }
            }
        }
    }