Beispiel #1
0
    private void AuthCallback(ILoginResult result)
    {
        if (FB.IsLoggedIn)
        {
            // AccessToken class will have session details
            var aToken = Facebook.Unity.AccessToken.CurrentAccessToken;
            // Print current access token's User ID
            Debug.Log(aToken.UserId);
            // Print current access token's granted permissions
            foreach (string perm in aToken.Permissions)
            {
                Debug.Log(perm);
            }

            // 유저 이름(닉네임) 불러오기
            FB.API("me?fields=name", HttpMethod.GET, NameCallBack);


            // 인증 토큰 가져오기
            // TODO : CloudBread 클래스 생성 후, Login API 호출
            CloudBread cb = new CloudBread();
            cb.Login(AzureAuthentication.AuthenticationProvider.Facebook, aToken.TokenString, Callback_login);
        }
        else
        {
            Debug.Log("User cancelled login");
        }
    }
Beispiel #2
0
        public void RequestToken(FacebookData.Post postData_, System.Action <FacebookData.Receive[]> callback_, System.Action <string> errorCallback_ = null)
        {
            string url = ".auth/login/googleplay";
            string postData;

            CloudBread.Request(CloudBread.MakeFullUrl(url), JsonUtility.ToJson(postData_), callback_, errorCallback_);
        }
Beispiel #3
0
        public void RequestToken(string access_token, Action <AzureZumoToken.Receive> callback, Action <string> errorCallback = null)
        {
            string url = CloudBread.Address + OAuth2Setting.FacebookRedirectAddress;

            Debug.Log(url);

            string postData = "{ \"access_token\" : \"" + access_token + " \"}";

            Debug.Log(postData);

            CloudBread.Request(url, postData, callback, errorCallback);
        }
        public void RequestToken(string id_token, string access_token, Action <AzureZumoToken.Receive> callback, Action <string> errorCallback = null)
        {
            string url = CloudBread.Address + ".auth/login/google";

//			string url = CloudBread.Address + OAuth2Setting.GoogleRedirectAddress;
            Debug.Log(url);

            string postData = "{ \"id_token\": \"" + id_token + "\",  \"access_token\" : \"" + access_token + " \"}";

            Debug.Log(postData);

            CloudBread.Request(url, postData, callback, errorCallback);
        }
Beispiel #5
0
    private void Callback_login(string id, WWW www)
    {
        print(www.text);
        string resultJson = www.text;

        JsonReader jsonReader = new JsonReader();
        AuthData   resultData = jsonReader.Read <AuthData>(resultJson);

        // Azure 인증을 위해 발급받은 Azure Token 을 헤더에 추가
        AzureMobileAppRequestHelper.AuthToken = resultData.authenticationToken;

        // 게임에서 사용 할 userId 를 PlayerPrefs 에 저장
        // 원래 게임에서는 아래와 같이, Azure 에서 제공해 주는 userID 를 넣는 것이 맞지만,
        // 데모 서버를 사용하는 분들은 임의의 아이디를 넣어서 다른 사람들과 충돌이 나지 않도록 합시다
        PlayerPrefs.SetString("userId", resultData.user.userId);

        CloudBread cb = new CloudBread();

        cb.CBInsRegMember(Callback_CBInsRegMember);
    }
Beispiel #6
0
 // Update is called once per frame
 void Update()
 {
     if (GameStateManager.GameState == GameState.Playing)
     {
         if (previousScore != Score) //save perf from non needed calculations
         {
             if (Score < 10)
             {
                 //just draw units
                 Units.sprite = numberSprites[Score];
             }
             else if (Score >= 10 && Score < 100)
             {
                 (Tens.gameObject as GameObject).SetActive(true);
                 Tens.sprite  = numberSprites[Score / 10];
                 Units.sprite = numberSprites[Score % 10];
             }
             else if (Score >= 100)
             {
                 (Hundreds.gameObject as GameObject).SetActive(true);
                 Hundreds.sprite = numberSprites[Score / 100];
                 int rest = Score % 100;
                 Tens.sprite  = numberSprites[rest / 10];
                 Units.sprite = numberSprites[rest % 10];
             }
         }
     }
     else if (GameStateManager.GameState == GameState.Dead)
     {
         if (flag)
         {
             flag = false;
             PlayerPrefs.SetInt("bestScore", Score);
             CloudBread cb = new CloudBread();
             cb.CBComUdtMemberGameInfoes(Callback_Success);
         }
     }
 }
Beispiel #7
0
        public void RequestUser(string access_token, Action <FacebookUserData> callback, Action <string> errorCallback = null)
        {
            string url = "https://graph.facebook.com/me?access_token=" + access_token;

            CloudBread.Request(url, null, callback, errorCallback);
        }