/// <summary> /// Updates the deck list dropdown. /// </summary> private void UpdateDeckList(PlayFab.ClientModels.GetUserDataResult result) { if (Database.Instance.decks.currentDeckListVersion != result.DataVersion && result.Data["Decks"].Value != null) { Database.Instance.decks.CreateDeckList(result.Data["Decks"].Value); } Database.Instance.decks.currentDeckListVersion = result.DataVersion; //Update dropdown if (Database.Instance.decks.GetDeckNames().Count > 0) { deckDropdown.interactable = true; deckDropdown.ClearOptions(); deckDropdown.AddOptions(Database.Instance.decks.GetDeckNames()); loadDeckButton.interactable = true; deleteDeckButton.interactable = true; } else { deckDropdown.interactable = false; deckDropdown.ClearOptions(); List <string> noOption = new List <string> { "No Saved Decks Found" }; deckDropdown.AddOptions(noOption); loadDeckButton.interactable = false; deleteDeckButton.interactable = false; } }
protected virtual void succesfullUserDataQuerry(GetUserDataResult result) { Debug.Log("Got the following userData:"); foreach (var entry in result.Data) { Debug.Log(entry.Key + ": " + entry.Value); } }
private void LoadPlayerData(GetUserDataResult result) { Debug.Log ("Player data loaded."); if (result.Data.ContainsKey ("TotalKills")) PlayFabGameBridge.totalKills = int.Parse (result.Data ["TotalKills"].Value); else PlayFabGameBridge.totalKills = 0; totalKillsOld = PlayFabGameBridge.totalKills; }
protected override void succesfullUserDataQuerry(GetUserDataResult result) { Dictionary<string, UserDataRecord> data = result.Data; player.Username = data["UserName"].Value; player.Currency = Int32.Parse(data["Currency"].Value); player.IsPremium = Boolean.Parse(data["IsPremium"].Value); player.PremiumCredit = Int32.Parse(data["PremiumCredit"].Value); player.StoreDeckNameList = JsonUtility.FromJson<StringListWrapper>(data["StoreDeckNameList"].Value); player.DeckList = JsonUtility.FromJson<DeckListWrapper>(data["DeckList"].Value); }
void OnPlayerInfoLoaded(GetUserDataResult result) { UserDataRecord dataRecord; result.Data.TryGetValue(GameConstants.facebookPictureKey,out dataRecord); if (dataRecord != null) { string pictureURL = dataRecord.Value; StartCoroutine(LoadPicutre(pictureURL)); } }
static void get_user_data_successful(GetUserDataResult result){ if (result.Data.ContainsKey("shipColor")){ shipColor = result.Data["shipColor"].Value; } if (result.Data.ContainsKey("hasGreenShip")){ hasGreenShip = (result.Data["hasGreenShip"].Value == "true"); } if (result.Data.ContainsKey("highScore")){ highScore = float.Parse(result.Data["highScore"].Value); } save_user_data(); on_data_loaded(); }
private void OnGetdataSuccess(PlayFab.ClientModels.GetUserDataResult obj) { Debug.Log("가져오기 성공"); if (obj.Data.ContainsKey("Info")) { //가져올 정보가 있을때 var yourObject = JsonUtility.FromJson <UserInfo>(obj.Data["Info"].Value); DataManager.Instance.userinfo = yourObject; //선택된 부품 프리팹 가져오기 SelecPrefabs(); } else { //플레이팹 아이디가 존재해서 성공 콜백은 넘어왔지만 키값에 대응하는 정보가 없으면 처음 로그인 상요자이므로 기본정보 Set해주기 SetData(DataManager.Instance.userinfo); Debug.Log("유저 기본정보 세팅"); //가져올 정보가 없을때 -> 기본 데이터 세팅한다 최초 로그인한 회원인 상태이다. } //키가 없다고 에러가 뜨면 -> 기본 정보 세팅 }
private void SetPlayerData(GetUserDataResult result) { Debug.Log("Player stats loaded"); if (result.Data.ContainsKey("WonRaces")) { PlayFabGameBridge.Instance.wonRaces = int.Parse(result.Data["WonRaces"].Value); } if (result.Data.ContainsKey("TotalRaces")) { PlayFabGameBridge.Instance.totalRaces = int.Parse(result.Data["TotalRaces"].Value); } else { PlayFabGameBridge.Instance.wonRaces = 0; PlayFabGameBridge.Instance.totalRaces = 0; } }
private void OnGetdataSuccess(PlayFab.ClientModels.GetUserDataResult obj) { Debug.Log("가져오기 성공"); if (obj.Data.ContainsKey("Info")) { //가져올 정보가 있을때 var yourObject = JsonUtility.FromJson <UserInfo>(obj.Data["Info"].Value); GameManager.Get.userinfo = yourObject; //선택된 부품 프리팹 가져오기 GameManager.Get.SelecPrefabs(); } else { SetData(GameManager.Get.userinfo); Debug.Log("유저 기본정보 세팅"); //가져올 정보가 없을때 -> 기본 데이터 세팅한다 최초 로그인한 회원인 상태이다. } //키가 없다고 에러가 뜨면 -> 기본 정보 세팅 }
private void Callback_DeckListUpdated(PlayFab.ClientModels.GetUserDataResult result) { if (Database.Instance.decks.currentDeckListVersion != result.DataVersion) { Database.Instance.decks.CreateDeckList(result.Data["Decks"].Value); } Database.Instance.decks.currentDeckListVersion = result.DataVersion; foreach (UnityEngine.UI.Dropdown deckDropdown in deckDropdowns) { //Update dropdown if (Database.Instance.decks.decks.Count > 0) { deckDropdown.interactable = true; deckDropdown.ClearOptions(); List <string> deckNames = new List <string>(); foreach (scr_Deck_Data.Save_Data deck in Database.Instance.decks.decks) { deckNames.Add(deck.deckName); } deckDropdown.AddOptions(deckNames); playButton.interactable = true; } else { deckDropdown.interactable = false; deckDropdown.ClearOptions(); List <string> noOption = new List <string> { "No Saved Decks Found" }; deckDropdown.AddOptions(noOption); playButton.interactable = false; } } }
protected override void succesfullUserDataQuerry(GetUserDataResult result) { Dictionary<string, UserDataRecord> data = result.Data; deckList = JsonUtility.FromJson<DeckListWrapper>(data["DeckList"].Value); }
private void GetUserDataCallback2(GetUserDataResult result) { var testContext = (UUnitTestContext)result.CustomData; UserDataRecord userDataRecord; int actualValue = 0; // Default if the data isn't present if (result.Data.TryGetValue(TEST_DATA_KEY, out userDataRecord)) int.TryParse(userDataRecord.Value, out actualValue); testContext.IntEquals(_testInteger, actualValue); testContext.NotNull(userDataRecord, "UserData record not found"); DateTime timeUpdated = userDataRecord.LastUpdated; DateTime minTest = DateTime.UtcNow - TimeSpan.FromMinutes(5); DateTime maxTest = DateTime.UtcNow + TimeSpan.FromMinutes(5); testContext.True(minTest <= timeUpdated && timeUpdated <= maxTest); testContext.True(Math.Abs((DateTime.UtcNow - timeUpdated).TotalMinutes) < 5); // Make sure that this timestamp is recent - This must also account for the difference between local machine time and server time testContext.EndTest(UUnitFinishState.PASSED, null); }
private void GetUserDataCallback1(GetUserDataResult result) { var testContext = (UUnitTestContext)result.CustomData; UserDataRecord userDataRecord; _testInteger = 0; // Default if the data isn't present if (result.Data.TryGetValue(TEST_DATA_KEY, out userDataRecord)) int.TryParse(userDataRecord.Value, out _testInteger); _testInteger = (_testInteger + 1) % 100; // This test is about the Expected value changing - but not testing more complicated issues like bounds var updateRequest = new UpdateUserDataRequest { Data = new Dictionary<string, string> { { TEST_DATA_KEY, _testInteger.ToString() } } }; PlayFabClientAPI.UpdateUserData(updateRequest, PlayFabUUnitUtils.ApiCallbackWrapper<UpdateUserDataResult>(testContext, UpdateUserDataCallback), SharedErrorCallback, testContext); }
private void GetUserDataCallback(GetUserDataResult result) { lastReceivedMessage = "User Data Received"; if (!result.Data.TryGetValue(TEST_DATA_KEY, out testCounterReturn)) { testCounterReturn = new UserDataRecord(); testCounterReturn.Value = "0"; } }
protected override void succesfullUserDataQuerry(GetUserDataResult result) { Dictionary<string, UserDataRecord> data = result.Data; if (data.ContainsKey("MatchList")) matchList = JsonUtility.FromJson<MatchListWrapper>(data["MatchList"].Value); }
/// <summary> /// Callback used when getting user data scceeded. /// </summary> /// <param name="result">User data</param> void OnGetUserDataSuccess(GetUserDataResult result) { //int accountLevel = int.Parse(result.Data[GameConstants.accountLevelKey].Value); //int accountExp = int.Parse(result.Data[GameConstants.accountExpKey].Value); //OnLoginCompletedCallback(accountLevel, accountExp); this.UpdateUserDisplayName(); }