Example #1
0
    public void CreateGroup(string adminUsername, string password, string groupName)
    {
        var loginWithPlayFabRequest = new LoginWithPlayFabRequest {
            Username = adminUsername, Password = password
        };

        PlayFabClientAPI.LoginWithPlayFab(loginWithPlayFabRequest,
                                          delegate(LoginResult loginResult)
        {
            PlayFabAuthenticationAPI.GetEntityToken(new PlayFab.AuthenticationModels.GetEntityTokenRequest(),
                                                    delegate(GetEntityTokenResponse getEntityTokenResponse)
            {
                var createGroupRequest = new CreateGroupRequest {
                    GroupName = groupName,
                    Entity    = ConvertEntityKey(getEntityTokenResponse.Entity)
                };

                PlayFabGroupsAPI.CreateGroup(createGroupRequest,
                                             delegate(CreateGroupResponse response)
                {
                    Debug.Log("Group was successfully created: " + response.GroupName + " -  " + response.Group.Id);
                },
                                             SharedError.OnSharedError);
            },
                                                    SharedError.OnSharedError);
        },
                                          SharedError.OnSharedError);
    }
    public void WriteOneDSEvents(UUnitTestContext testContext)
    {
        // get Entity Token which is needed for work events
        PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest
        {
            CustomId = PlayFabSettings.BuildIdentifier,
            TitleId  = PlayFabSettings.TitleId
        }, loginCallback =>
        {
            PlayFabAuthenticationAPI.GetEntityToken(new GetEntityTokenRequest
            {
                AuthenticationContext = loginCallback.AuthenticationContext
            }, entityCallback =>
            {
#if TPL_35
                Task.Run(() => WriteOneDSEventsAsync(testContext));
#else
                WriteOneDSEventsAsync(testContext);
#endif
            }, entityError =>
            {
                testContext.Skip("EntityToken required!");
            });
        }, loginError =>
        {
            testContext.Skip("Login required!");
        });
    }
Example #3
0
 void SetEntityToken()
 {
     PlayFabAuthenticationAPI.GetEntityToken
         (new GetEntityTokenRequest(),
         (result) => _entityKey = new EntityKey()
     {
         Id = result.Entity.Id, Type = result.Entity.Type
     },
         (err) => print(err.GenerateErrorReport()));
 }
        public static void GetEntityToken()
        {
            GetEntityTokenRequest request = new GetEntityTokenRequest();

            PlayFabAuthenticationAPI.GetEntityToken(request, GetEntityTokenResponseSuccess, Error, null, null);

            while (!loggedin)
            {
                Debug.Log("Not logged in");
            }
        }
Example #5
0
        private void GetPlayFabServers()
        {
            var getTitleEntityTokenRequest     = new GetEntityTokenRequest();
            GetEntityTokenRequest tokenRequest = new GetEntityTokenRequest();

            PlayFabAuthenticationAPI.GetEntityToken(tokenRequest, TokenResponseSuccess, Error, null, null);

            ListMultiplayerServersRequest request = new ListMultiplayerServersRequest();

            //request.BuildId = MMOClientInstance.Singleton.PlayFabManager.BuildIdKey;
            //request.Region = MMOClientInstance.Singleton.PlayFabManager.playFabRegion.ToString();

            PlayFabMultiplayerAPI.ListMultiplayerServers(request, GetServerList, Error, null, null);
        }
Example #6
0
        //Save character data
        public void TrySaveCharacterData(PlayFabCharacterData characterData)
        {
            GetEntityTokenRequest requestToken = GetTokenForRequest();

            PlayFabAuthenticationAPI.GetEntityToken(requestToken,
                                                    result =>
            {
                SaveCharacterData(characterData);
            },
                                                    error =>
            {
                Debug.Log($"Failed to get entity token");
            });
        }
Example #7
0
        void TryRetrieveCharacterData(ushort clientIdOfCaller, string characterID)
        {
            GetEntityTokenRequest requestToken = GetTokenForRequest();

            PlayFabAuthenticationAPI.GetEntityToken(requestToken,
                                                    result =>
            {
                Debug.Log("GetEntityToken call for GetCharacterData worked");
                RetrieveCharacterData(clientIdOfCaller, characterID);
            },
                                                    error =>
            {
                Debug.Log($"Failed to get entity token");
            });
        }
Example #8
0
    public void Authenticate()
    {
        ShowLoader();
        var request = new GetEntityTokenRequest();

        PlayFabAuthenticationAPI.GetEntityToken(request,
                                                result => {
            Debug.Log("GOT TOKEN OK: " + result.ToJson().ToString());
            Inform("Authentication Success!\n\nExpires " + result.TokenExpiration.Value.ToLocalTime().ToString());
            HideLoader();
            loginWindow.SetActive(false);
        }, error => {
            HideLoader();
            loginWindow.SetActive(true);
            Inform("GET TOKEN FAILED: " + error.ErrorMessage);
            Debug.LogError("GET TOKEN FAILED: " + error.ToString());
        });
    }
        /// <summary>
        /// A coroutine to wait until we get an Entity Id after PlayFabLogin
        /// </summary>
        /// <param name="secondsBetweenWait">delay wait between checking whether Entity has logged in</param>
        private IEnumerator WaitUntilEntityLoggedIn(float secondsBetweenWait)
        {
            WaitForSeconds delay = new WaitForSeconds(secondsBetweenWait);

            while (true)
            {
                if (PlayFabAuthenticationAPI.IsEntityLoggedIn())
                {
                    if (entityKey.Id == null)
                    {
                        AuthenticationModels.GetEntityTokenRequest request = new AuthenticationModels.GetEntityTokenRequest();
                        PlayFabAuthenticationAPI.GetEntityToken(request, GetEntityTokenCompleted, GetEntityTokenFailed);
                    }
                    break;
                }
                yield return(delay);
            }
        }
Example #10
0
        public void GetEntityToken(UUnitTestContext testContext)
        {
            var tokenRequest = new AuthenticationModels.GetEntityTokenRequest();

            PlayFabAuthenticationAPI.GetEntityToken(tokenRequest, PlayFabUUnitUtils.ApiActionWrapper <AuthenticationModels.GetEntityTokenResponse>(testContext, GetTokenCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }
        public void GetEntityToken()
        {
            GetEntityTokenRequest request = new GetEntityTokenRequest();

            PlayFabAuthenticationAPI.GetEntityToken(request, GetEntityTokenResponseSuccess, Error, null, null);
        }
 public void GetBackgroundColor()
 {
     PlayFabAuthenticationAPI.GetEntityToken(new GetEntityTokenRequest(), OnGetEntityTokenForGetBackgroundColor, SharedError.OnSharedError);
 }