Ejemplo n.º 1
0
    public void Request(Action <string> onReceiveDisplayName)
    {
        var connectingView = ConnectingView.Show();

        PlayFabClientAPI.GetPlayerProfile(
            new GetPlayerProfileRequest(),
            _result => {
            var playerProfile = _result.PlayerProfile;
            Debug.Log(string.Format("{0}:{1}", playerProfile.PlayerId, playerProfile.DisplayName));

            connectingView.Close();
            if (onReceiveDisplayName != null)
            {
                onReceiveDisplayName(playerProfile.DisplayName);
            }
        },
            _error => {
            var report = _error.GenerateErrorReport();
            Debug.LogError(report);

            connectingView.Close();
            ErrorDialogView.Show("GetPlayerProfile failed", report, () => {
                Request(onReceiveDisplayName);
            }, true);
        });
    }
Ejemplo n.º 2
0
    public void Request(Action <List <PlayerLeaderboardEntry> > onReceiveLeaderboard, Action onCancel = null)
    {
        var connectingView = ConnectingView.Show();

        var request = new GetLeaderboardRequest {
            MaxResultsCount = MaxEntriesCount,
            StatisticName   = StatisticName,
        };

        PlayFabClientAPI.GetLeaderboard(
            request,
            _result => {
            DebugLogLeaderboard(_result);

            connectingView.Close();
            onReceiveLeaderboard?.Invoke(_result.Leaderboard);
        },
            _error => {
            var report = _error.GenerateErrorReport();
            Debug.LogError(report);

            connectingView.Close();
            ErrorDialogView.Show("GetLeaderboard failed", report, () => {
                Request(onReceiveLeaderboard, onCancel);
            }, onCancel);
        });
    }
Ejemplo n.º 3
0
    public void OnClickOk()
    {
        connectingView = ConnectingView.Show();

        var request = new UpdateUserTitleDisplayNameRequest {
            DisplayName = displayNameInputField.text
        };

        PlayFabClientAPI.UpdateUserTitleDisplayName(request, OnUpdateSuccess, OnUpdateFailure);
    }
Ejemplo n.º 4
0
    void GetTitleData(Action <Dictionary <string, string> > onSuccess)
    {
        var connectingView = ConnectingView.Show();

        PlayFabClientAPI.GetTitleData(
            new GetTitleDataRequest(),
            _result => {
            DebugLogTitleData(_result);

            connectingView.Close();
            onSuccess?.Invoke(_result.Data);
        },
            _error => {
            var report = _error.GenerateErrorReport();
            Debug.LogError(report);

            connectingView.Close();
            ErrorDialogView.Show("GetTitleData failed", report, () => {
                GetTitleData(onSuccess);
            }, true);
        });
    }