コード例 #1
0
ファイル: EventTest.cs プロジェクト: yen-igaw/UnitySDK
 private void SharedErrorCallback(PlayFabError error)
 {
     ((UUnitTestContext)error.CustomData).Fail(error.GenerateErrorReport());
 }
コード例 #2
0
 /// <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());
 }
コード例 #3
0
 private void OnError(PlayFabError error)
 {
     PlayfabUtils.OnError(feedbackText, error.ErrorMessage);
 }
コード例 #4
0
 public static void OnError(PlayFabError obj)
 {
     Debug.Log(obj.GenerateErrorReport());
 }
コード例 #5
0
 void OnPlayfabError(PlayFabError error)
 {
     Debug.Log(error.Error.ToString());
     Debug.Log(error.ErrorMessage);
     Debug.Log(error.ErrorDetails);
 }
コード例 #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");
 }
コード例 #7
0
ファイル: EventTest.cs プロジェクト: gabrielamboss/Ulkoa
 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");
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #10
0
 void OnPlayFabError(PlayFabError error)
 {
     Debug.Log("Got an error: " + error.ErrorMessage);
 }
コード例 #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);
 }
コード例 #12
0
 private void OnPushDataError(PlayFabError obj)
 {
     Debug.LogError("PushDataError at UserData class!!");
 }
コード例 #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;
        }
コード例 #14
0
 static void HandleError(PlayFabError error)
 {
     Debug.Log(error.GenerateErrorReport());
 }
コード例 #15
0
ファイル: PlayFabEvents.cs プロジェクト: codermoon/RetroRun
 private void OnProcessingErrorEvent(PlayFabRequestCommon request, PlayFabError error)
 {
     //This just forwards the event.
     if (_instance.OnGlobalErrorEvent != null)
     {
         _instance.OnGlobalErrorEvent(request, error);
     }
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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();
 }
コード例 #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);
 }
コード例 #21
0
ファイル: PlayFabApiTest.cs プロジェクト: yen-igaw/UnitySDK
 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);
 }
コード例 #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);
 }
コード例 #23
0
 //PlayFab请求出错时调用,在控制台输出错误信息
 void OnPlayFabError(PlayFabError error)
 {
     Debug.LogError(error.ErrorDetails);
 }
コード例 #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);
 }
コード例 #25
0
 //PlayFab请求出错时调用,在控制台输出错误信息
 void OnPlayFabError(PlayFabError error)
 {
     Debug.LogError("Get an error:" + error.Error);
 }
コード例 #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);
 }
コード例 #27
0
ファイル: Server.cs プロジェクト: zimpzon/haps
    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
    }
コード例 #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);
 }
コード例 #29
0
 private void Error(PlayFabError obj)
 {
     throw new NotImplementedException();
 }
コード例 #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);
 }
コード例 #31
0
ファイル: EventTest.cs プロジェクト: yen-igaw/UnitySDK
        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, "");
        }
コード例 #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);
 }
コード例 #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);
 }
コード例 #34
0
        private void OnLoginFailure(PlayFabError error)
        {
            errorMessage.Value = error.ErrorMessage;

            Fsm.Event(failureEvent);
        }
コード例 #35
0
 private void SharedErrorCallback(PlayFabError error)
 {
     lastReceivedMessage = error.ErrorMessage;
 }
コード例 #36
0
ファイル: UserDataNetworkPuller.cs プロジェクト: kkaldas/LC2
 private void PullDataErrorCallback(PlayFabError obj)
 {
     Debug.LogError("GetDataError at UserData class!!");
 }
コード例 #37
0
 private static void SharedError_Global(PlayFabError error)
 {
     callbacks.Add("SharedError_Global");
     throw new Exception("Non-PlayFab callback error");
 }
コード例 #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));
 }
コード例 #39
0
ファイル: EventTest.cs プロジェクト: gabrielamboss/Ulkoa
 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");
 }
コード例 #40
0
ファイル: ClientApiTests.cs プロジェクト: bcjordan/UnitySDK
 private void SharedErrorCallback(PlayFabError error)
 {
     // This error was not expected.  Report it and fail.
     ((UUnitTestContext)error.CustomData).Fail(error.GenerateErrorReport());
 }
コード例 #41
0
ファイル: PlayFabApiTest.cs プロジェクト: yen-igaw/UnitySDK
 private void SharedErrorCallback(PlayFabError error)
 {
     // This error was not expected.  Report it and fail.
     ((UUnitTestContext)error.CustomData).Fail(error.GenerateErrorReport());
 }
コード例 #42
0
 private void OnPlayFabError(PlayFabError obj)
 {
     //      LogMessage(obj.GenerateErrorReport());
 }
コード例 #43
0
ファイル: PlayFabApiTest.cs プロジェクト: yen-igaw/UnitySDK
        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);
        }
コード例 #44
0
 private static void OnFailedUpdatePlayerStatistics(PlayFabError error)
 {
     Debug.Log("Failed Statistics Upload, Error Message: " + error.ErrorMessage);
 }