Inheritance: PlayFab.SharedModels.PlayFabResultCommon
 private void ActionNode13_resultCallback(PlayFab.ClientModels.LoginResult result) {
     ActionNode13_result = result;
     // PublishEventNode
     var PublishEventNode15_Event = new UserLoggedIn();
     System.Publish(PublishEventNode15_Event);
     PublishEventNode15_Result = PublishEventNode15_Event;
 }
Exemple #2
0
 //Playfab account created with Facebook account
 private void OnCreatePlayfabFacebookAccountSuccess(PlayFab.ClientModels.LoginResult result)
 {
     Debug.Log("PlayFab Account created with Facebook. Session ticket: " + result.SessionTicket);
     mainLoginPanel.SetActive(false);
     usernameInputPanel.SetActive(true);
     FB.API("/me/picture?type=square&height=128&width=128", HttpMethod.GET, SetFBProfilePicToPlayfab);
     isOnline = true;
 }
 /// <summary>
 /// Login Successfully - Goes to next screen.
 /// </summary>
 /// <param name="result"></param>
 private void OnLoginSuccess(PlayFab.ClientModels.LoginResult result)
 {
     Debug.LogFormat("Logged In as: {0}", result.PlayFabId);
     StatusText.text = "";
     LoginPanel.SetActive(false);
     LoggedinPanel.SetActive(true);
     UserName.text = result.InfoResultPayload.AccountInfo.Username ?? result.PlayFabId;
 }
Exemple #4
0
 private void OnFrictionlessLoginMobileSuccess(PlayFab.ClientModels.LoginResult result)
 {
     Debug.Log("Loggged in, API called successfully. Login method: Device ID");
     mainLoginPanel.SetActive(false);
     gameModePanel.SetActive(true);
     GetPlayerCombinedInfo();
     LoggedInDialog.SetActive(true);
     isOnline = true;
 }
Exemple #5
0
 // When processing both results, we just set the message, explaining what's going on.
 private void OnPlayfabFacebookAuthComplete(LoginResult result)
 {
     SetMessage("PlayFab Facebook Auth Complete. Session ticket: " + result.SessionTicket);
     if (rememberMe)
     {
         SetPlayerPrefs(PlayFabSettings.TitleId, AccessToken.CurrentAccessToken.TokenString);
     }
     LoadSceneOnLoginSuccess();
 }
Exemple #6
0
 private void OnPlayfabDeviceAuthComplete(LoginResult result)
 {
     isLoggingIn = false;
     onSuccess.Invoke();
     SaveLoginType(LoginType.Device);
     IsLoggedIn  = true;
     PlayFabId   = result.PlayFabId;
     EntityToken = result.EntityToken;
 }
    private void OnLoginEmailSuccess(PlayFab.ClientModels.LoginResult result)
    {
        Debug.Log("Congratulations, API called successfully. Login method: Email");
        // GetPlayerCombinedInfo();
        Alerts a = new Alerts();

        StartCoroutine(a.CreateNewAlert(userName.text + ", you have logged in!"));
        SceneManager.LoadScene(SceneToLoad);
    }
        private void ActionNode13_resultCallback(PlayFab.ClientModels.LoginResult result)
        {
            ActionNode13_result = result;
            // PublishEventNode
            var PublishEventNode15_Event = new UserLoggedIn();

            System.Publish(PublishEventNode15_Event);
            PublishEventNode15_Result = PublishEventNode15_Event;
        }
Exemple #9
0
    private void OnPlayFabLoginResult(PlayFab.ClientModels.LoginResult result)
    {
        GameState.Instance.PlayFabUserId = result.PlayFabId;

        Debug.Log("User is now logged into PlayFab with the following result: " + result.PlayFabId);

        // TODO: Add the story scene and bulliten message scene (info message is something I might need all users to be aware ASAP)
        //       to the list of possible sceens shown right after splash
        GameManager.Instance.LoadNextScene(false, true);
    }
Exemple #10
0
 private void OnLoginEmailSuccess(PlayFab.ClientModels.LoginResult result)
 {
     Debug.Log("Congratulations, API called successfully. Login method: Email");
     LinkDevice();
     mainLoginPanel.SetActive(false);
     gameModePanel.SetActive(true);
     GetPlayerCombinedInfo();
     LoggedInDialog.SetActive(true);
     isOnline = true;
 }
    private void Callback_LoginSuccess(PlayFab.ClientModels.LoginResult result)
    {
        Debug.Log("Playfab ID: " + result.PlayFabId + "\nLast Login Time: " + result.LastLoginTime);

        //Populate database with player-specific information
        Database.Instance.InitPlayer();

        //Go to Main Menu
        MenuManager.Instance.GoToScreen("LoadingScreen");
    }
Exemple #12
0
 private void OnPlayfabFacebookAuthComplete(PlayFab.ClientModels.LoginResult result)
 {
     Debug.Log("PlayFab Facebook Auth Complete. Session ticket: " + result.SessionTicket);
     LinkDevice();
     mainLoginPanel.SetActive(false);
     FB.API("/me/picture?type=square&height=128&width=128", HttpMethod.GET, SetFBProfilePicToPlayfab);
     gameModePanel.SetActive(true);
     GetPlayerCombinedInfo();
     LoggedInDialog.SetActive(true);
     isOnline = true;
 }
Exemple #13
0
    //if new Guest account successfully created with this device id
    private void OnCreateLoginGuestSuccess(PlayFab.ClientModels.LoginResult result)
    {
        Debug.Log("Loggged in, API called successfully. Login method: Guest - Device ID");
        mainLoginPanel.SetActive(false);
        gameModePanel.SetActive(true);
        Text userName = LoggedInDialog.GetComponent <Text>();

        userName.text = "Guest";
        LoggedInDialog.SetActive(true);
        isOnline = true;
    }
    ///OnLoginSuccess(PlayFab.ClientModels.LoginResult)
    /// <summary>
    /// Message on successful Login
    /// </summary>
    /// <param name="result"></param>
    /// Pre-Condition: None.
    /// Post-Condition: Inform User that they have logged in.
    private void OnLoginSuccess(PlayFab.ClientModels.LoginResult result)
    {
        //Dubug Message
        Debug.LogFormat("Logged In as : {0}", result.PlayFabId);

        //Show our next screen if we logged in successfully.
        RegisterPanel.SetActive(false);
        SelectScene.SetActive(true);
        //Hide CurrentScene
        CurrentPanel.SetActive(false);
    }
Exemple #15
0
 private void OnLoginSuccess(LoginResult result)
 {
     Debug.Log("Congratulations, you have been logged in successfully!");
     if (validEmail && rememberMe)
     {
         PlayerPrefs.SetString("EMAIL", userEmail.text);
         PlayerPrefs.SetString("PASSWORD", userPassword.text);
         PlayerPrefs.SetInt("LOGINONCE", 1);
     }
     LoadSceneOnLoginSuccess();
 }
Exemple #16
0
    private void OnLoginSuccess(PlayFab.ClientModels.LoginResult result)
    {
        Debug.LogFormat("Logged In as: " + result.PlayFabId);

#if UNITY_FACEBOOK
        FB.API("/Me?fields=first_name", HttpMethod.GET, DisplayUserName);
#endif
#if !UNITY_FACEBOOK
        GetAccountInfo();
#endif
    }
    private void PlayFabLoginSucessCallBack(PlayFab.ClientModels.LoginResult playfabLoginResult)
    {
        Debug.Log("Sucesso ao Logar no PlayFab.");

        //Armazena o Id do PlayFab na classe estática e com isso é possível utilizar esses dados em outros scripts.
        FacebookAndPlayFabInfo.userPlayFabId = playfabLoginResult.PlayFabId;

        //Utiliza o SDK do Facebook para consultar os dados, indicando a função de callback. O valor "/me" indica
        //que estou buscando os dados do usuário que está logado. O valor HttpMethod.GET indica que a nossa chamada ao
        //facebook tem a intenção de somente coletar dados.
        FB.API("/me", HttpMethod.GET, CollectLoggedUserInfoCallback);
    }
    ///OnLoginSuccess(PlayFab.ClientModels.LoginResult)
    /// <summary>
    /// Message on successful Register
    /// </summary>
    /// <param name="result"></param>
    /// Pre-Condition: None.
    /// Post-Condition: Inform User that they have succesfully register a new PlayFab account.
    private void OnRegisterSuccess(PlayFab.ClientModels.LoginResult result)
    {
        //Dubug Message
        Debug.LogFormat("Created PlayFab ID as : {0}", result.PlayFabId);

        //Hide Register Panel, bring back the title screen
        RegisterPanel.SetActive(false);

        //Buttons for login and register
        LoginCarrot.gameObject.SetActive(true);
        RegisterCarrot.gameObject.SetActive(true);
    }
Exemple #19
0
    /// <summary>
    /// Login Successfully - Goes to next screen.
    /// </summary>
    /// <param name="result"></param>
    private void OnLoginSuccess(PlayFab.ClientModels.LoginResult result)
    {
        Debug.LogFormat("Logged In as: {0}", result.PlayFabId);
        Panel.SetActive(false);

        PlayFabManager.IsLoggedIn = true;
        PlayFabManager.LoadUserData();
        PlayFabManager.LoadAccountData();
        PlayFabManager.LoadTitleData();

        GameManager.GoToMainMenu();
    }
Exemple #20
0
        public static void LoginCallBack(LoginResult loginResult)
        {
            // CLIENT
            PfSharedModelEx.globalClientUser.playFabId = loginResult.PlayFabId;
            PfSharedControllerEx.PostEventMessage(PfSharedControllerEx.EventType.OnUserLogin, loginResult.PlayFabId, null, PfSharedControllerEx.Api.Client, false);
            var clientRequest = new ListUsersCharactersRequest();
            PlayFabClientAPI.GetAllUsersCharacters(clientRequest, ClientCharCallBack, PfSharedControllerEx.FailCallback("C_GetAllUsersCharacters"));

            // SERVER
            PfSharedModelEx.serverUsers.Add(loginResult.PlayFabId, PfSharedModelEx.globalClientUser); // Ensure that they share the same object reference
            var serverRequest = new ServerModels.ListUsersCharactersRequest();
            serverRequest.PlayFabId = loginResult.PlayFabId;
            PlayFabServerAPI.GetAllUsersCharacters(serverRequest, ServerCharCallBack, PfSharedControllerEx.FailCallback("S_GetAllUsersCharacters"));
        }
    /// <summary>
    /// Called on a successful login attempt
    /// </summary>
    /// <param name="result">Result object returned from PlayFab server</param>
    private static void OnLoginResult(PlayFab.ClientModels.LoginResult result) //LoginResult
    {
        PF_PlayerData.PlayerId = result.PlayFabId;
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer || Application.isEditor)
        {
            if (usedManualFacebook)
            {
                LinkDeviceId();
                usedManualFacebook = false;
            }
        }

        PF_Bridge.RaiseCallbackSuccess(string.Empty, PlayFabAPIMethods.GenericLogin, MessageDisplayStyle.none);
        if (OnLoginSuccess != null)
        {
            OnLoginSuccess(string.Format("SUCCESS: {0}", result.SessionTicket), MessageDisplayStyle.error);
        }
    }
Exemple #22
0
    private void OnPlayfabFacebookAuthComplete(LoginResult result)
    {
        // Store identity and session
        _playFabId     = result.PlayFabId;
        _sessionTicket = result.SessionTicket;

        RememberMeId = Guid.NewGuid().ToString();
        AuthType     = Authtypes.FaceBook;

        // Fire and forget, but link a custom ID to this PlayFab Account.
        PlayFabClientAPI.LinkCustomID(
            new LinkCustomIDRequest
        {
            CustomId  = RememberMeId,
            ForceLink = ForceLink
        },
            null, // Success callback
            null  // Failure callback
            );

        OnLoginSuccess(result);
    }
Exemple #23
0
    /// <summary>
    /// Called on a successful login attempt
    /// </summary>
    /// <param name="result">Result object returned from PlayFab server</param>
    private void OnLoginResult(PlayFab.ClientModels.LoginResult result) //LoginResult
    {
        //PF_PlayerData.PlayerId = result.PlayFabId;
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer || Application.isEditor)
        {
            //if (usedManualFacebook)
            //{
            //    LinkDeviceId();
            //    usedManualFacebook = false;
            //}
        }
        Debug.Log("OnLoginResult");
        GetUserAccountInfo();

        //PF_Bridge.RaiseCallbackSuccess(string.Empty, PlayFabAPIMethods.GenericLogin, MessageDisplayStyle.none);
        //PF_PubSub.currentEntity = new PlayFab.Sockets.Models.EntityKey() {
        //    Type = result.EntityToken.Entity.Type,
        //    Id = result.EntityToken.Entity.Id
        //};
        //PF_PubSub.InitializePubSub();
        //if (OnLoginSuccess != null)
        //    OnLoginSuccess(string.Format("SUCCESS: {0}", result.SessionTicket), MessageDisplayStyle.error);
    }
Exemple #24
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");
 }
Exemple #25
0
 private void OnSuccessLocal(LoginResult result)
 {
     callbacks.Add("OnSuccessLocal");
 }
Exemple #26
0
        private void TestStaticCallbacks_LocalCallback(LoginResult result)
        {
            var testContext = (UUnitTestContext)result.CustomData;
            // NOTE: This depends on the global callbacks happening before the local callback
            CheckCallbacks(testContext, "OnResponse_StaticGl", callbacks);
            CheckCallbacks(testContext, "OnResponse_StaticLogin", callbacks);
            testContext.IntEquals(2, callbacks.Count, string.Join(", ", callbacks.ToArray()));
            testContext.EndTest(UUnitFinishState.PASSED, null);

            EventStaticListener.Unregister();
        }
 // When processing both results, we just set the message, explaining what's going on.
 public void OnPlayfabFacebookAuthComplete(LoginResult result)
 {
     Debug.Log("PlayFab Facebook Auth Complete. Session ticket: " + result.SessionTicket);
     user.GetPlayerProfile();
 }
 private void LoginCallback(LoginResult result)
 {
     playFabId = result.PlayFabId;
     lastReceivedMessage = "Login Successful";
 }
Exemple #29
0
        private void TestInstCallbacks_GeneralOnlyCallback(LoginResult result)
        {
            var testContext = (UUnitTestContext)result.CustomData;
            testContext.True(callbacks.Contains("OnResponse_InstGl"), string.Join(", ", callbacks.ToArray())); // NOTE: This depends on the global callbacks happening before the local callback
            testContext.True(callbacks.Contains("OnResponse_InstLogin"), string.Join(", ", callbacks.ToArray())); // NOTE: This depends on the global callbacks happening before the local callback
            testContext.IntEquals(2, callbacks.Count, string.Join(", ", callbacks.ToArray()));
            testContext.EndTest(UUnitFinishState.PASSED, null);

            _listener.Unregister();
        }
Exemple #30
0
        private void AdvertLoginCallback(LoginResult result)
        {
            _playFabId = result.PlayFabId;
            var testContext = (UUnitTestContext)result.CustomData;
            testContext.True(PlayFabClientAPI.IsClientLoggedIn(), "User login failed");

            // TODO:
            // testContext.StringEquals(PlayFabSettings.AD_TYPE_ANDROID_ID + "_Successful", PlayFabSettings.AdvertisingIdType);
            testContext.EndTest(UUnitFinishState.PASSED, null);
        }
Exemple #31
0
 private void InvalidLoginCallback(LoginResult result)
 {
     ((UUnitTestContext)result.CustomData).Fail("Login was not expected to pass.");
 }
		// callback function if player login is successful
		public void OnLoginResult(LoginResult result){
			PlayFabGameBridge.gameState = 3;	// switch to playing the game; hide this dialog
			Time.timeScale = 1.0f;	// unpause...
			Application.LoadLevel (nextScene);
			PlayFabData.AuthKey = PlayFabClientAPI.AuthKey;
		}
 // callback function if player login is successful
 public void OnLoginResult(LoginResult result)
 {
     PlayFabGameBridge.gameState = 3;	// switch to playing the game; hide this dialog
     Time.timeScale = 1.0f;	// unpause...
     PlayFabData.AuthKey = result.SessionTicket;
 }
Exemple #34
0
 protected virtual void OnPlayFabLoginSuccess(PlayFab.ClientModels.LoginResult obj)
 {
     Debug.Log("MetaLoopGameManager OnPlayFabLoginSuccess, Downloading TitleData...");
     DownloadTitleData();
 }
Exemple #35
0
 void OnLogin(PlayFab.ClientModels.LoginResult result)
 {
     entityId   = result.EntityToken.Entity.Id;
     entityType = result.EntityToken.Entity.Type;
 }
 private static PlayFabClientAPI.LoginWithEmailAddressResponseCallback _onApiResponseStLogin = OnApiResponse_StLogin; // Static methods can be cast once and saved as a static variable
 private static void OnApiResponse_StLogin(string url, int callId, LoginWithEmailAddressRequest request, LoginResult result, PlayFabError error, object customData)
 {
     var delta = DateTime.UtcNow - CallTimes_StLogin[callId];
     Debug.Log(url + " completed in " + delta.TotalMilliseconds + " - _StLogin");
     CallTimes_StLogin.Remove(callId);
 }
        public static void LoginWithSteamResultAction(LoginResult result, CallRequestContainer requestContainer)
        {
            _authKey = result.SessionTicket ?? _authKey;
            MultiStepClientLogin(result.SettingsForUser.NeedsAttribution);

        }
Exemple #38
0
 protected void OnLoginSuccess(PlayFab.ClientModels.LoginResult result)
 {
     m_PlayFabID = result.PlayFabId;
     Debug.Log("PlayFabID: " + m_PlayFabID);
     GetPlayerData();
 }
 // When processing both results, we just set the message, explaining what's going on.
 private void OnPlayfabFacebookAuthComplete(LoginResult result)
 {
     SetMessage("PlayFab Facebook Auth Complete. Session ticket: " + result.SessionTicket);
 }
Exemple #40
0
        //process the login result and all user data retrieved from PlayFab, such as
        //user inventory with purchased products, virtual currency balances and title data
        private static void OnLoggedIn(PlayFab.ClientModels.LoginResult result)
        {
            instance.loginResult = null;
            userId = result.PlayFabId;
            bool skipPayload = result.InfoResultPayload == null ? true : false;

            if (IAPManager.isDebug)
            {
                Debug.Log("Got PlayFabID: " + userId + (result.NewlyCreated ? " (new account)" : " (existing account)"));
            }

            #if PLAYFAB_VALIDATION
            skipPayload = true;
            #endif

            if (skipPayload)
            {
                IAPManager.GetInstance().Initialize();
                if (loginSucceededEvent != null)
                {
                    loginSucceededEvent();
                }

                return;
            }

            instance.serverData = new JSONClass();

            List <ItemInstance> inventory = result.InfoResultPayload.UserInventory;
            if (inventory != null && inventory.Count != 0)
            {
                string itemId = null;
                for (int i = 0; i < inventory.Count; i++)
                {
                    itemId = inventory[i].ItemId;
                    IAPObject obj = IAPManager.GetIAPObject(itemId);

                    if (obj != null)
                    {
                        switch (obj.type)
                        {
                        case ProductType.Consumable:
                            if (obj.editorType == IAPType.Virtual)
                            {
                                instance.serverData[DBManager.playerKey][obj.id] = new SimpleJSON.JSONData((int)inventory[i].RemainingUses);
                            }
                            break;

                        default:
                            instance.serverData[DBManager.contentKey][obj.id].AsInt = 1;
                            break;
                        }
                    }
                }
            }

            Dictionary <string, int> virtualCurrency = result.InfoResultPayload.UserVirtualCurrency;
            if (virtualCurrency != null && virtualCurrency.Count != 0)
            {
                Dictionary <string, int> currency = DBManager.GetCurrencies();
                foreach (KeyValuePair <string, int> pair in virtualCurrency)
                {
                    //update local data in memory
                    foreach (KeyValuePair <string, int> cur in currency)
                    {
                        if (cur.Key.StartsWith(pair.Key, StringComparison.OrdinalIgnoreCase))
                        {
                            instance.serverData[DBManager.currencyKey][cur.Key].AsInt = pair.Value;
                            break;
                        }
                    }
                }
            }

            Dictionary <string, UserDataRecord> userData = result.InfoResultPayload.UserData;
            if (userData != null && userData.Count != 0)
            {
                string[] userKey = instance.accountParams.UserDataKeys.ToArray();
                for (int i = 0; i < userKey.Length; i++)
                {
                    if (userData.ContainsKey(userKey[i]) && !string.IsNullOrEmpty(userData[userKey[i]].Value))
                    {
                        JSONNode node = JSON.Parse(userData[userKey[i]].Value);
                        foreach (string groupKey in node.AsObject.Keys)
                        {
                            JSONArray array = node[groupKey].AsArray;

                            //it's a simple value, not an array (usually Player data)
                            if (array == null)
                            {
                                instance.serverData[userKey[i]][groupKey] = node[groupKey].Value;
                                continue;
                            }

                            //it's an array of values (usually Selected group data)
                            for (int j = 0; j < array.Count; j++)
                            {
                                instance.serverData[userKey[i]][groupKey][j] = array[j].Value;
                            }
                        }
                    }
                }
            }

            /*
             * //try to resolve easy conflicts automatically in case of empty data,
             * //but forward more complex conflicts to the user for resolution,
             * //or use pre-defined resolution scenario assigned in the inspector
             * if (string.IsNullOrEmpty(DBManager.Read()))
             * {
             *  //local data is empty: get and overwrite with server data
             *  GetInstance().HandleDataConflict(MergeConflictRule.UseServer);
             * }
             * else if (string.IsNullOrEmpty(instance.serverData.ToString()))
             * {
             *  //server data is empty: keep local and upload to server
             *  GetInstance().HandleDataConflict(MergeConflictRule.UseLocal);
             * }
             * else if (DBManager.Read() != instance.serverData.ToString())
             * {
             *
             *  Debug.Log("On Local: " + DBManager.Read());
             *  Debug.Log("On Server: " + instance.serverData.ToString());
             *  Debug.LogWarning("Merge Conflict detected.");
             *
             *  //conflict detected: local and server data is different
             *  //use pre-defined resolution rule, if any
             *  if (instance.mergeRule != MergeConflictRule.UserPrompt)
             *      GetInstance().HandleDataConflict(instance.mergeRule);
             *  else if (dataConflictEvent != null)
             *      dataConflictEvent();
             *
             *  return;
             * }
             */

            DBManager.Overwrite(instance.serverData.ToString());
            IAPManager.GetInstance().Initialize();

            if (loginSucceededEvent != null)
            {
                loginSucceededEvent();
            }
        }
Exemple #41
0
 private void LoginCallback(LoginResult result)
 {
     _playFabId = result.PlayFabId;
     var testContext = (UUnitTestContext)result.CustomData;
     testContext.True(PlayFabClientAPI.IsClientLoggedIn(), "User login failed");
     testContext.EndTest(UUnitFinishState.PASSED, null);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 protected virtual void OnLogInWithFacebookSuccess(LoginResult obj)
 {
     LobbyUIManager.instance.ShowRealCoinText();
     retryToLogIn = true;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 protected virtual void OnLogInWithCustomIDSuccess(LoginResult obj)
 {
     retryToLogIn = true;
 }
Exemple #44
0
 private static void OnPlayFabAuthSucess(LoginResult result)
 {
     PlayerPrefs.SetInt("PreviouslyLoggedIn", 1);
     UpdateUserTitleDisplayName(displayName);
     OnSuccess?.Invoke();
 }