Beispiel #1
0
 private void OnLoginError(PlayFabError error)
 {
     if (error.Error == PlayFabErrorCode.InvalidParams && error.ErrorDetails.ContainsKey("Password"))
     {
         InfoText.color = ErrorColor;
         InfoText.text  = _WrongPassword;
         InfoText.gameObject.SetActive(true);
         Tween.Delay(1.5f, () => { InfoText.gameObject.SetActive(false); });
     }
     else if (error.Error == PlayFabErrorCode.InvalidParams && error.ErrorDetails.ContainsKey("Username") ||
              error.Error == PlayFabErrorCode.InvalidUsername || error.Error == PlayFabErrorCode.AccountNotFound)
     {
         var request = new RegisterPlayFabUserRequest
         {
             TitleId  = PlayFabSettings.TitleId,
             Username = Login.text,
             Password = Password.text,
             RequireBothUsernameAndEmail = false
         };
         PlayFabClientAPI.RegisterPlayFabUser(request, OnRegisterResult, OnLoginError);
     }
     else if (error.Error == PlayFabErrorCode.AccountBanned)
     {
         Application.Quit();
     }
     else
     {
         InfoText.color = ErrorColor;
         InfoText.text  = $"Error {error.HttpCode}: {error.ErrorMessage}";
         InfoText.gameObject.SetActive(true);
         Tween.Delay(1.5f, () => { InfoText.gameObject.SetActive(false); });
     }
 }
Beispiel #2
0
 private void OnLoginResult(LoginResult result) //LoginResult
 {
     InfoText.color = PositiveColor;
     InfoText.text  = $"{_LoggedIn} <b>{Login.text}</b>";
     InfoText.gameObject.SetActive(true);
     PlayerPrefs.SetString("Nick", Login.text);
     Tween.Delay(1.5f, LoadGame);
 }
Beispiel #3
0
 public void FadeAway()
 {
     Tween.Delay(2f, () =>
     {
         GameOverText.gameObject.SetActive(false);
         FadeScreen.DOFade(0f, FadeDuration).OnComplete(() =>
         {
             World.Active.GetExistingSystem <EnemyMovementSystem>().Enabled  = true;
             World.Active.GetExistingSystem <EnemyShootingSystem>().Enabled  = true;
             World.Active.GetExistingSystem <PlayerMovementSystem>().Enabled = true;
             World.Active.GetExistingSystem <PlayerShootingSystem>().Enabled = true;
             World.Active.GetExistingSystem <PlayerTurningSystem>().Enabled  = true;
             World.Active.GetExistingSystem <ZoneShrinkingSystem>().Enabled  = true;
         });
     });
 }
Beispiel #4
0
    private void LogInOrRegister()
    {
        var user     = Login.text;
        var password = Password.text;

        if (user.Length > 0 && password.Length > 0)
        {
            var request = new LoginWithPlayFabRequest
            {
                Username = user,
                Password = password,
                TitleId  = PlayFabSettings.TitleId
            };

            PlayFabClientAPI.LoginWithPlayFab(request, OnLoginResult, OnLoginError);
        }
        else
        {
            InfoText.color = ErrorColor;
            InfoText.text  = _MissingInfo;
            InfoText.gameObject.SetActive(true);
            Tween.Delay(1.5f, () => { InfoText.gameObject.SetActive(false); });
        }
    }