Exemple #1
0
        public void UserCharacter(UUnitTestContext testContext)
        {
            var request = new ListUsersCharactersRequest();

            request.PlayFabId = PlayFabId; // Received from client upon login
            PlayFabClientAPI.GetAllUsersCharacters(request, PlayFabUUnitUtils.ApiActionWrapper <ListUsersCharactersResult>(testContext, GetCharsCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }
Exemple #2
0
        public void TryRetrieveAllPlayerCharacters(ushort clientIdOfCaller, string playfabID, string characterID)
        {
            Debug.Log($"Trying to get character data for character: {characterID}");
            ListUsersCharactersRequest listUsersCharactersRequest = new ListUsersCharactersRequest
            {
                PlayFabId = playfabID
            };

            //Have to get all characters - playfab can't just return a single character
            PlayFabServerAPI.GetAllUsersCharacters(listUsersCharactersRequest,
                                                   result =>
            {
                foreach (CharacterResult character in result.Characters)
                {
                    if (character.CharacterId == characterID)
                    {
                        TryRetrieveCharacterData(clientIdOfCaller, characterID);
                    }
                }
            },
                                                   error =>
            {
                Debug.Log("Error retrieving character");
            });
        }
Exemple #3
0
        public void UserCharacter(UUnitTestContext testContext)
        {
            var request = new ListUsersCharactersRequest {
                PlayFabId = PlayFabSettings.staticPlayer.PlayFabId
            };
            var getCharsTask = clientApi.GetAllUsersCharactersAsync(request, null, testTitleData.extraHeaders);

            ContinueWithContext(getCharsTask, testContext, null, true, "Failed to GetChars", true);
        }
Exemple #4
0
        public void UserCharacter(UUnitTestContext testContext)
        {
            var request = new ListUsersCharactersRequest {
                PlayFabId = PlayFabId
            };
            var getCharsTask = PlayFabClientAPI.GetAllUsersCharactersAsync(request);

            ContinueWithContext(getCharsTask, testContext, null, true, "Failed to GetChars", true);
        }
        public void UserCharacter()
        {
            var request = new ListUsersCharactersRequest();

            request.PlayFabId = playFabId; // Received from client upon login
            PlayFabClientAPI.GetAllUsersCharacters(request, GetCharsCallback, SharedErrorCallback);
            WaitForApiCalls();

            UUnitAssert.Equals("Get Chars Successful", lastReceivedMessage);
            UUnitAssert.NotNull(targetCharacter, "The test character did not exist");
        }
Exemple #6
0
        public static void LoginCallBack(LoginResult loginResult)
        {
            // CLIENT
            PfSharedModelEx.globalClientUser.playFabId = loginResult.PlayFabId;
            PfSharedControllerEx.PostEventMessage(PfSharedControllerEx.EventType.OnUserLogin, loginResult.PlayFabId, null, PfSharedControllerEx.Api.Client, false);
            var clientRequest = new ListUsersCharactersRequest();

            PlayFabClientAPI.GetAllUsersCharacters(clientRequest, ClientCharCallBack, PfSharedControllerEx.FailCallback("C_GetAllUsersCharacters"));

            // SERVER
            PfSharedModelEx.serverUsers.Add(loginResult.PlayFabId, PfSharedModelEx.globalClientUser); // Ensure that they share the same object reference
            var serverRequest = new ServerModels.ListUsersCharactersRequest();

            serverRequest.PlayFabId = loginResult.PlayFabId;
            PlayFabServerAPI.GetAllUsersCharacters(serverRequest, ServerCharCallBack, PfSharedControllerEx.FailCallback("S_GetAllUsersCharacters"));
        }
Exemple #7
0
    public static void GetPlayerCharacters(Action callback = null)
    {
        ListUsersCharactersRequest request = new ListUsersCharactersRequest();

        //PlayFabClientAPI.GetAllUsersCharacters(request, OnGetPlayerCharactersSuccess, PF_Bridge.PlayFabErrorCallback);
        PlayFabClientAPI.GetAllUsersCharacters(request, (result) =>
        {
            playerCharacters = result.Characters;

            if (callback != null)
            {
                callback();
            }

            PF_Bridge.RaiseCallbackSuccess("Player Characters Retrieved", PlayFabAPIMethods.GetAllUsersCharacters, MessageDisplayStyle.none);
        }
                                               , PF_Bridge.PlayFabErrorCallback);
    }
Exemple #8
0
    public static void GetPlayerCharacters()
    {
        var request = new ListUsersCharactersRequest();

        PlayFabClientAPI.GetAllUsersCharacters(request, OnGetPlayerCharactersSuccess, PF_Bridge.PlayFabErrorCallback);
    }