private void OnGetUserCurrency(GetUserCombinedInfoResult result) { PlayFabGameBridge.Instance.userBalance = result.VirtualCurrency["GC"]; PlayFabGameBridge.Instance.startUserBalance = result.VirtualCurrency["GC"]; goldAmmountText.text = PlayFabGameBridge.Instance.userBalance.ToString("0000") + " G"; }
/// <summary> /// Called if playerdata is succesfully retrieved. Saves the player data and loads the MainMenu scene. /// </summary> /// <param name="result">GetUserCombinedInfoResult provided by the Playfab server.</param> public void OnGetUserInfoResult(GetUserCombinedInfoResult result) { PhotonControl.pObject.SetPlayerData(result.AccountInfo, result.Data); isConnected = true; }
/// <summary> /// Getting user combined info successfully completed. /// </summary> /// <param name="result">User combined info.</param> private void OnGetUserCombinedInfoResult(GetUserCombinedInfoResult result) { playerID = result.PlayFabId; playerUsername = result.AccountInfo.Username; int currency = result.VirtualCurrency["1"]; if (!result.Data.ContainsKey(GameConstants.accountLevelKey)) { Dictionary<string, string> playerData = new Dictionary<string, string>(); playerData.Add(GameConstants.accountLevelKey, "0"); playerData.Add(GameConstants.accountExpKey, "0"); playerData.Add(GameConstants.facebookPictureKey, playerPictureURL); UpdateUserDataRequest request = new UpdateUserDataRequest(); request.Data = playerData; request.Permission = UserDataPermission.Public; PlayFabClientAPI.UpdateUserData(request, OnAddDataSuccess, OnAddDataError); } else { int level = int.Parse(result.Data[GameConstants.accountLevelKey].Value); int exp = int.Parse(result.Data[GameConstants.accountExpKey].Value); bool boughtShe = result.Data.ContainsKey(GameConstants.boughtSheKey); this.GetUserStatistics(); OnLoginCompletedCallback(result.Inventory, playerDisplayName, currency, level, exp, boughtShe); } }