Exemplo n.º 1
0
 private void SharedErrorCallback(PlayFabError error)
 {
     ((UUnitTestContext)error.CustomData).Fail(error.GenerateErrorReport());
 }
 /// <summary>
 /// Callback to handle unsuccessful server interaction.
 /// </summary>
 /// <param name="response">Server response</param>
 private void EventSentErrorCallback(PlayFabError response)
 {
     Debug.LogWarning("Failed to send session data. Error: " + response.GenerateErrorReport());
 }
Exemplo n.º 3
0
 private void OnError(PlayFabError error)
 {
     PlayfabUtils.OnError(feedbackText, error.ErrorMessage);
 }
Exemplo n.º 4
0
 public static void OnError(PlayFabError obj)
 {
     Debug.Log(obj.GenerateErrorReport());
 }
Exemplo n.º 5
0
 void OnPlayfabError(PlayFabError error)
 {
     Debug.Log(error.Error.ToString());
     Debug.Log(error.ErrorMessage);
     Debug.Log(error.ErrorDetails);
 }
Exemplo n.º 6
0
 private static void SuccessCallback_Global(string urlPath, int callId, object request, PlayFabResultCommon result, PlayFabError error, object customData)
 {
     callbacks.Add("SuccessCallback_Global");
     throw new Exception("Non-PlayFab callback error");
 }
Exemplo n.º 7
0
 private static PlayFabClientAPI.LoginWithCustomIDResponseCallback _onResponseLogin = OnResponse_StaticLogin; // Static methods can be cast once and saved as a static variable
 private static void OnResponse_StaticLogin(string url, int callId, LoginWithCustomIDRequest request, LoginResult result, PlayFabError error, object customData)
 {
     callbacks.Add("OnResponse_StaticLogin");
 }
Exemplo n.º 8
0
 /// <summary>
 /// Callback called when an error occurs.
 /// </summary>
 /// <param name="error">Error information</param>
 void OnAddDataError(PlayFabError error)
 {
     Debug.Log("Add data error: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Callback called when an error occurs.
 /// </summary>
 /// <param name="error">Error information</param>
 void OnGetUserDataError(PlayFabError error)
 {
     Debug.Log("Get user data error: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 10
0
 void OnPlayFabError(PlayFabError error)
 {
     Debug.Log("Got an error: " + error.ErrorMessage);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Callback called when an error occurs.
 /// </summary>
 /// <param name="error">Error information</param>
 void OnLoginError(PlayFabError error)
 {
     Debug.Log("Login error: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 12
0
 private void OnPushDataError(PlayFabError obj)
 {
     Debug.LogError("PushDataError at UserData class!!");
 }
Exemplo n.º 13
0
        public static void HandleResults(string responseStr, string errorStr, out ResultType result, out PlayFabError error)
        {
            result = null;
            error  = null;

            if (errorStr != null)
            {
                error = new PlayFabError();
                if (PlayFabSettings.GlobalErrorHandler != null)
                {
                    PlayFabSettings.GlobalErrorHandler(error);
                }
                return;
            }

            ResultContainer <ResultType> resultEnvelope = new ResultContainer <ResultType>();

            try
            {
                JsonConvert.PopulateObject(responseStr, resultEnvelope, Util.JsonSettings);
            }
            catch (Exception e)
            {
                error              = new PlayFabError();
                error.Error        = PlayFabErrorCode.Unknown;
                error.ErrorMessage = e.ToString();
                if (PlayFabSettings.GlobalErrorHandler != null)
                {
                    PlayFabSettings.GlobalErrorHandler(error);
                }
                return;
            }

            if (resultEnvelope.errorCode.HasValue)
            {
                PlayFabErrorCode errorEnum;
                try
                {
                    errorEnum = (PlayFabErrorCode)resultEnvelope.errorCode.Value;
                }
                catch
                {
                    errorEnum = PlayFabErrorCode.Unknown;
                }

                error = new PlayFabError
                {
                    HttpCode     = resultEnvelope.code,
                    HttpStatus   = resultEnvelope.status,
                    Error        = errorEnum,
                    ErrorMessage = resultEnvelope.errorMessage,
                    ErrorDetails = resultEnvelope.errorDetails
                };
                if (PlayFabSettings.GlobalErrorHandler != null)
                {
                    PlayFabSettings.GlobalErrorHandler(error);
                }

                return;
            }

            result = resultEnvelope.data;
        }
Exemplo n.º 14
0
 static void HandleError(PlayFabError error)
 {
     Debug.Log(error.GenerateErrorReport());
 }
Exemplo n.º 15
0
 private void OnProcessingErrorEvent(PlayFabRequestCommon request, PlayFabError error)
 {
     //This just forwards the event.
     if (_instance.OnGlobalErrorEvent != null)
     {
         _instance.OnGlobalErrorEvent(request, error);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// Callback to be called when leaderboard fails loading.
 /// </summary>
 /// <param name="error">Error info.</param>
 void OnGetLeaderboardError(PlayFabError error)
 {
     Debug.LogError("Error getting leaderboard. Error: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 17
0
 private static PlayFabSettings.ResponseCallback<object, PlayFabResultCommon> _onApiResponseStLogin2 = OnApiResponse_StLogin2; // Static methods can be cast once and saved as a static variable
 private static void OnApiResponse_StLogin2(string url, int callId, object request, PlayFabResultCommon result, PlayFabError error, object customData)
 {
     var delta = DateTime.UtcNow - CallTimes_StLogin[callId];
     Debug.Log(url + " completed in " + delta.TotalMilliseconds + " - _StLogin");
     CallTimes_StLogin.Remove(callId);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Catalog items failed to load.
 /// </summary>
 /// <param name="error">Error details.</param>
 void OnCatalogItemsError(PlayFabError error)
 {
     Debug.LogError("Error loading store items: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 19
0
 private void SharedErrorCallback(PlayFabError error)
 {
     TempSb.Length = 0;
     TempSb.Append(error.ErrorMessage);
     if (error.ErrorDetails != null)
         foreach (var pair in error.ErrorDetails)
             foreach (var msg in pair.Value)
                 TempSb.Append("\n").Append(pair.Key).Append(": ").Append(msg);
     lastReceivedMessage = TempSb.ToString();
 }
Exemplo n.º 20
0
 /// <summary>
 /// Purchase with virtual currency failed.
 /// </summary>
 /// <param name="error">Error details.</param>
 void OnPurchaseError(PlayFabError error)
 {
     Debug.LogError("Error buying item: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 21
0
 private void ExpectedLoginErrorCallback(PlayFabError error)
 {
     var errorReport = error.GenerateErrorReport().ToLower();
     var testContext = (UUnitTestContext)error.CustomData;
     testContext.False(errorReport.Contains("successful"), errorReport);
     testContext.True(errorReport.Contains("password"), errorReport);
     testContext.EndTest(UUnitFinishState.PASSED, null);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Consuming item failed.
 /// </summary>
 /// <param name="error">Error details.</param>
 void OnConsumeItemError(PlayFabError error)
 {
     Debug.LogError("Error consuming item: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 23
0
 //PlayFab请求出错时调用,在控制台输出错误信息
 void OnPlayFabError(PlayFabError error)
 {
     Debug.LogError(error.ErrorDetails);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Updating kill stats failed.
 /// </summary>
 /// <param name="error">Error details.</param>
 void OnUpdateStatsError(PlayFabError error)
 {
     Debug.LogError("Error updating stat: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 25
0
 //PlayFab请求出错时调用,在控制台输出错误信息
 void OnPlayFabError(PlayFabError error)
 {
     Debug.LogError("Get an error:" + error.Error);
 }
Exemplo n.º 26
0
 /// <summary>
 /// Getting user statistics failed.
 /// </summary>
 /// <param name="error">Error details.</param>
 void OnGetUserStatisticsError(PlayFabError error)
 {
     Debug.LogError("Error getting stats: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 27
0
    IEnumerator ExecuteApiCallWithRetry <TResult>(
        Action <Action <TResult>, Action <PlayFabError> > apiAction,
        float busyIndicatorAfterSec = 1.0f,
        float messageBoxAfterSec    = 4.0f,
        float fakeApiLatency        = 0.0f,
        int fakeFailureCount        = 0)
    {
        if (OfflineMode)
        {
            LastResult = null;
            yield break;
        }

        if (busyIndicatorAfterSec <= 0)
        {
            BusyScript.Instance.Show();
        }

        float   startTime        = Time.time;
        float   timeWaited       = 0;
        int     attempts         = 0;
        TResult result           = default(TResult);
        int     fakeFailuresLeft = fakeFailureCount;

        while (true)
        {
            attempts++;

            bool  callComplete     = false;
            bool  callSuccess      = false;
            float apiCallRetryTime = 2.0f;

            Action <TResult> onSuccess = callResult =>
            {
                Debug.Log(callResult);
                result       = callResult;
                callComplete = true;
                callSuccess  = true;
            };

            Action <PlayFabError> onError = error =>
            {
                string fullMsg = error.ErrorMessage;
                if (error.ErrorDetails != null)
                {
                    foreach (var pair in error.ErrorDetails)
                    {
                        foreach (var eachMsg in pair.Value)
                        {
                            fullMsg += "\n" + pair.Key + ": " + eachMsg;
                        }
                    }
                }

                DebugText.SetLine("PF", error);
                Debug.Log(fullMsg);
                callComplete = true;
            };

            float fakeLatency = fakeApiLatency + AdditionalGlobalLatency;
            if (fakeLatency > 0.0f)
            {
                yield return(new WaitForSeconds(fakeLatency));
            }

            if (fakeFailuresLeft > 0 || SimulateConnectionLoss)
            {
                fakeFailuresLeft--;
                PlayFabError fakeError = new PlayFabError();
                fakeError.Error        = FakeErrorCode;
                fakeError.ErrorMessage = "Fake error for testing";
                fakeError.HttpCode     = 404;
                onError(fakeError);
            }
            else
            {
                apiAction(onSuccess, onError);
            }

            while (!callComplete)
            {
                yield return(null);

                timeWaited = Time.time - startTime;

                // Ensure indicator shown after initial delay
                if (timeWaited > busyIndicatorAfterSec)
                {
                    BusyScript.Instance.Show();
                }
            }

            if (callSuccess)
            {
                break;
            }

            timeWaited = Time.time - startTime;
            if (timeWaited >= messageBoxAfterSec)
            {
                BusyScript.Instance.Hide();
                string message = "Hov, der er noget galt med forbindelsen!\n\nTryk <#ffffff>OK</color> for at prøve igen"; // i8n
                var    wait    = MessageBox.Instance.Show(message, MessageBox.Buttons.Ok, fadeInBackground: false);
                yield return(wait);
            }

            if (timeWaited >= busyIndicatorAfterSec)
            {
                BusyScript.Instance.Show();
            }

            // Wait a bit so user can't spam retry
            yield return(new WaitForSeconds(apiCallRetryTime));
        }

        DebugText.RemoveLine("PF");

        BusyScript.Instance.Hide();

        float timeTotal = Time.time - startTime;

        Debug.LogFormat("API ms: {0}", timeTotal);
        LastResult = result;
        yield return(result); // For CoroutineWithData
    }
Exemplo n.º 28
0
 /// <summary>
 /// Callback received when ingame news loading returns an error.
 /// </summary>
 /// <param name="error">Error details.</param>
 void OnGameNewsLoadFailed(PlayFabError error)
 {
     Debug.LogError("Error getting game news: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 29
0
 private void Error(PlayFabError obj)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 30
0
 /// <summary>
 /// Event called when push notification has failed to send.
 /// </summary>
 /// <param name="error">Error details.</param>
 private void OnSendPushNotificationError(PlayFabError error)
 {
     Debug.LogError("Error sending push notification: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 31
0
        private static void SharedError_Single(PlayFabError error)
        {
            callbacks.Add("SharedError_Single");

            var testContext = (UUnitTestContext)error.CustomData;
            // NOTE: This depends on the global callbacks happening before the local callback
            CheckCallbacks(testContext, "SharedError_Single", callbacks);
            CheckCallbacks(testContext, "SharedError_Global", callbacks);
            testContext.IntEquals(2, callbacks.Count, string.Join(",", callbacks.ToArray()));
            testContext.EndTest(UUnitFinishState.PASSED, "");
        }
Exemplo n.º 32
0
 /// <summary>
 /// Event called when title data load fails.
 /// </summary>
 /// <param name="error">Error data.</param>
 private void OnTitleDataLoadError(PlayFabError error)
 {
     Debug.LogError("Error getting title data: " + error.Error + " " + error.ErrorMessage);
 }
Exemplo n.º 33
0
 private void OnApiResponse_InstLogin(string url, int callId, LoginWithEmailAddressRequest request, LoginResult result, PlayFabError error, object customData)
 {
     var delta = DateTime.UtcNow - CallTimes_InstLogin[callId];
     Debug.Log(url + " completed in " + delta.TotalMilliseconds + " - _InstLogin");
     CallTimes_InstLogin.Remove(callId);
 }
        private void OnLoginFailure(PlayFabError error)
        {
            errorMessage.Value = error.ErrorMessage;

            Fsm.Event(failureEvent);
        }
 private void SharedErrorCallback(PlayFabError error)
 {
     lastReceivedMessage = error.ErrorMessage;
 }
Exemplo n.º 36
0
 private void PullDataErrorCallback(PlayFabError obj)
 {
     Debug.LogError("GetDataError at UserData class!!");
 }
Exemplo n.º 37
0
 private static void SharedError_Global(PlayFabError error)
 {
     callbacks.Add("SharedError_Global");
     throw new Exception("Non-PlayFab callback error");
 }
Exemplo n.º 38
0
 /// <summary>
 /// Called after a failed GetContentUploadUrl request
 /// </summary>
 /// <param name="result">Error details</param>
 void OnPlayFabError(PlayFabError error)
 {
     Debug.LogWarning(string.Format("PLAYFAB ERROR: [{0}] -- {1}", error.Error, error.ErrorMessage));
 }
Exemplo n.º 39
0
 private static PlayFabSettings.ResponseCallback<object, PlayFabResultCommon> _onResponseGl = OnResponse_StaticGl; // Generic callbacks have to use the generic signature - Static methods can be cast once and saved as a static variable
 private static void OnResponse_StaticGl(string url, int callId, object request, object result, PlayFabError error, object customData)
 {
     callbacks.Add("OnResponse_StaticGl");
 }
Exemplo n.º 40
0
 private void SharedErrorCallback(PlayFabError error)
 {
     // This error was not expected.  Report it and fail.
     ((UUnitTestContext)error.CustomData).Fail(error.GenerateErrorReport());
 }
Exemplo n.º 41
0
 private void SharedErrorCallback(PlayFabError error)
 {
     // This error was not expected.  Report it and fail.
     ((UUnitTestContext)error.CustomData).Fail(error.GenerateErrorReport());
 }
 private void OnPlayFabError(PlayFabError obj)
 {
     //      LogMessage(obj.GenerateErrorReport());
 }
Exemplo n.º 43
0
        private void ExpectedRegisterErrorCallback(PlayFabError error)
        {
            var expectedEmailMsg = "email address is not valid.";
            var expectedPasswordMsg = "password must be between";

            var errorReport = error.GenerateErrorReport().ToLower();
            var testContext = (UUnitTestContext)error.CustomData;
            testContext.True(errorReport.Contains(expectedEmailMsg), errorReport);
            testContext.True(errorReport.Contains(expectedPasswordMsg), errorReport);
            testContext.EndTest(UUnitFinishState.PASSED, null);
        }
Exemplo n.º 44
0
 private static void OnFailedUpdatePlayerStatistics(PlayFabError error)
 {
     Debug.Log("Failed Statistics Upload, Error Message: " + error.ErrorMessage);
 }