Ejemplo n.º 1
0
 private static void OnAddOrUpdateContactEmailComplete(Task <PlayFabResult <AddOrUpdateContactEmailResult> > taskResult)
 {
     if (taskResult.Result.Error != null)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Failure calling PlayFab AddOrUpdateContactEmail");
         Console.WriteLine(PlayFabUtil.GenerateErrorReport(taskResult.Result.Error));
         Console.ForegroundColor = ConsoleColor.Gray;
     }
 }
Ejemplo n.º 2
0
 private static void OnAddUsernamePasswordCompleted(Task <PlayFabResult <AddUsernamePasswordResult> > taskResult)
 {
     if (taskResult.Result.Error != null)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Failure calling PlayFab AddUsernamePassword");
         Console.WriteLine(PlayFabUtil.GenerateErrorReport(taskResult.Result.Error));
         Console.ForegroundColor = ConsoleColor.Gray;
     }
 }
Ejemplo n.º 3
0
 private static void OnUpdateUserDataComplete(Task <PlayFabResult <UpdateUserDataResult> > taskResult)
 {
     if (taskResult.Result.Error != null)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Failure calling PlayFab UpdateUserData");
         Console.WriteLine(PlayFabUtil.GenerateErrorReport(taskResult.Result.Error));
         Console.ForegroundColor = ConsoleColor.Gray;
     }
 }
Ejemplo n.º 4
0
 private static void OnLoginComplete(Task <PlayFabResult <LoginResult> > taskResult)
 {
     if (taskResult.Result.Error != null)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Failure calling PlayFab Authentication");
         Console.WriteLine(PlayFabUtil.GenerateErrorReport(taskResult.Result.Error));
         Console.ForegroundColor = ConsoleColor.Gray;
     }
     else
     if (taskResult.Result.Result != null)
     {
         Console.WriteLine("Congratulations, you made your first successful API call!");
         _loginSuccessful = true;
     }
 }
Ejemplo n.º 5
0
    private void OnLoginComplete(PlayFabResult <LoginResult> taskResult)
    {
        var apiError = taskResult.Error;

        if (apiError != null)
        {
            Console.ForegroundColor = ConsoleColor.Red;  // Make the error more visible
            Console.WriteLine(PlayFabUtil.GenerateErrorReport(apiError));
            Console.ForegroundColor = ConsoleColor.Gray; // Reset to normal
        }
        else
        {
            IsConnected = true;
        }
        _running = false;
    }
Ejemplo n.º 6
0
        private void OnLoginComplete(PlayFabResult <LoginResult> taskResult)
        {
            var apiError  = taskResult.Error;
            var apiResult = taskResult.Result;

            if (apiError != null)
            {
                Console.ForegroundColor = ConsoleColor.Red; // Make the error more visible
                Console.WriteLine("Something went wrong with your first API call.  :(");
                Console.WriteLine("Here's some debug information:");
                Console.WriteLine(PlayFabUtil.GenerateErrorReport(apiError));
                Console.ForegroundColor = ConsoleColor.Gray; // Reset to normal
            }
            else if (apiResult != null)
            {
                Console.WriteLine("Congratulations, you made your first successful API call!");
            }
        }
Ejemplo n.º 7
0
 private static void ContinueWithContext <T>(Task <PlayFabResult <T> > srcTask, UUnitTestContext testContext, Action <PlayFabResult <T>, UUnitTestContext, string> continueAction, bool expectSuccess, string failMessage, bool endTest) where T : PlayFabResultCommon
 {
     srcTask.ContinueWith(task =>
     {
         var failed = true;
         try
         {
             if (expectSuccess)
             {
                 testContext.NotNull(task.Result, failMessage);
                 testContext.IsNull(task.Result.Error, PlayFabUtil.GenerateErrorReport(task.Result.Error));
                 testContext.NotNull(task.Result.Result, failMessage);
             }
             if (continueAction != null)
             {
                 continueAction.Invoke(task.Result, testContext, failMessage);
             }
             failed = false;
         }
         catch (UUnitSkipException uu)
         {
             // Silence the assert and ensure the test is marked as complete - The exception is just to halt the test process
             testContext.EndTest(UUnitFinishState.SKIPPED, uu.Message);
         }
         catch (UUnitException uu)
         {
             // Silence the assert and ensure the test is marked as complete - The exception is just to halt the test process
             testContext.EndTest(UUnitFinishState.FAILED, uu.Message + "\n" + uu.StackTrace);
         }
         catch (Exception e)
         {
             // Report this exception as an unhandled failure in the test
             testContext.EndTest(UUnitFinishState.FAILED, e.ToString());
         }
         if (!failed && endTest)
         {
             testContext.EndTest(UUnitFinishState.PASSED, null);
         }
     }
                          );
 }