/// <summary> /// updates the player's highscore on login /// </summary> /// <param name="result"></param> private void UpdatePlayerHighscore(GetLeaderboardAroundPlayerResult result) { for (int i = 0; i < result.Leaderboard.Count; i++) { if (Auth.playFabId == result.Leaderboard[i].PlayFabId.ToString()) { PlayerPrefs.SetInt(PlayerPrefsStrings.playerAccountHighscore, result.Leaderboard[i].StatValue); } } }
private void OnGetLeaderboardAroundPlayerSuccess(GetLeaderboardAroundPlayerResult result) { Debug.Log($"自分の順位周辺のランキング(リーダーボード)の取得に成功しました"); //result.Leaderboardに各順位の情報(PlayerLeaderboardEntry)が入っている _rankingText.text = ""; foreach (var entry in result.Leaderboard) { _rankingText.text += $"\n順位 : {entry.Position}, スコア : {entry.StatValue}, 名前 : {entry.DisplayName}"; } }
private IEnumerator WaitPopUpAndTryRankReward(GetLeaderboardAroundPlayerResult result) { WaitForSeconds wfs = new WaitForSeconds(0.1f); while (this.lootCrateSlots.IsPopUpOpen()) { yield return(wfs); } this.OnRankFetched(result); yield break; }
private void GetPlayerStatsResult(GetLeaderboardAroundPlayerResult result) { if (result.Leaderboard.Count > 1) { Debug.LogError("too much profiles returned"); } if (PlayerProfileComponent != null) { PlayerProfileModel Prof = result.Leaderboard [0].Profile; PlayerData data = new PlayerData(); data.dispName = Prof.DisplayName; data.avatar = Prof.AvatarUrl; LocalPlayer.ParsePlayfabStats(Prof.Statistics, data); PlayerProfileComponent.LoadPlayerProfile(data); } }
void OnLeaderboardAroundPlayerGet(GetLeaderboardAroundPlayerResult result) { string timeString = ((float)result.Leaderboard[0].StatValue / 100 * -1).ToString(); if (result.Leaderboard[0].StatValue % 100 == 0) { timeString += ".00"; } else if (result.Leaderboard[0].StatValue % 10 == 0) { timeString += "0"; } currentPlayerRecord = timeString; currentPlayerPosition = (result.Leaderboard[0].Position + 1).ToString(); isUpdated2 = true; }
public void OnLeaderboardGet(GetLeaderboardAroundPlayerResult res) { foreach (Transform item in tableTransform) { Destroy(item.gameObject); } foreach (var item in res.Leaderboard) { GameObject newItem = Instantiate(tableItemPrefab, tableTransform); Text[] texts = newItem.GetComponentsInChildren <Text>(); texts[0].text = (item.Position + 1).ToString(); texts[1].text = item.DisplayName; texts[2].text = item.StatValue.ToString(); if (item.PlayFabId == loginManager.playerData.accountInfo.playfabId) { texts[0].color = Color.yellow; texts[1].color = Color.yellow; texts[2].color = Color.yellow; } } PlayfabUtils.OnSuccess(feedbackText, "Leaderboard Updated!"); }
/// <summary> /// Also displays the player in the end if player is not found in top 100 /// </summary> /// <param name="result"></param> private void OnGetLeaderBoardAroundPlayer(GetLeaderboardAroundPlayerResult result) { debugReporter.text = debugReporter.text + "\n" + "OnGetLeaderBoardAroundPlayer() : Success leaderboard retrieve"; PlayerLeaderboardEntry player = new PlayerLeaderboardEntry(); for (int i = 0; i < result.Leaderboard.Count; i++) { if (Auth.playFabId == result.Leaderboard[i].PlayFabId.ToString()) { player = result.Leaderboard[i]; PlayerPrefs.SetInt(PlayerPrefsStrings.playerAccountHighscore, player.StatValue); } } LeaderboardListing playerStatsListing = playerLeaderboardListing.GetComponent <LeaderboardListing>(); playerStatsListing.playerName.text = player.DisplayName.ToString(); playerStatsListing.playerScore.text = player.StatValue.ToString(); playerStatsListing.playerRank.text = (player.Position + 1).ToString(); loadingAnimation.SetActive(false); }
private void OnPlayerLeaderboardResult(GetLeaderboardAroundPlayerResult result) { this.currentPlayerLeaderboard = result.Leaderboard; }
void ResultPlayerLeaderboardPosition(GetLeaderboardAroundPlayerResult result) { osTrackController.RecievePlayerLeaderboardPosition(result.Leaderboard[0].Position); }
private void OnRankFetched(GetLeaderboardAroundPlayerResult result) { if (!CakeRaceMenu.IsCakeRaceMenuOpen) { return; } if (this.lootCrateSlots.IsPopUpOpen()) { base.StartCoroutine(this.WaitPopUpAndTryRankReward(result)); return; } if (result.Leaderboard == null || (result.Leaderboard.Count > 0 && (result.Leaderboard[0].StatValue <= 0 || result.Leaderboard[0].Position >= 500))) { this.TryToShowCupEndAnimation(false); this.TryToUnlockCakeRaceLockScreen(); return; } GameObject go = UnityEngine.Object.Instantiate <GameObject>(this.seasonEndDialogPopup, Vector3.zero, Quaternion.identity); go.transform.position += Vector3.back * 20f; this.seasonEndDialog = go.GetComponent <LeaderboardSeasonEndDialog>(); this.seasonEndDialog.SetLoading(true); this.seasonEndDialog.onClose += delegate() { UnityEngine.Object.Destroy(go); }; int currentCupIndex = (int)this.rewardPendingCup; int rank = result.Leaderboard[0].Position + 1; int @int = GameProgress.GetInt("cake_race_highest_rank", 0, GameProgress.Location.Local, null); if (@int <= 0 || rank < @int) { GameProgress.SetInt("cake_race_highest_rank", rank, GameProgress.Location.Local); } string text = string.Empty; if (rank != 1) { if (rank != 2) { if (rank == 3) { text = "cake_race_bronze_trophies_won"; } } else { text = "cake_race_silver_trophies_won"; } } else { text = "cake_race_gold_trophies_won"; } if (!string.IsNullOrEmpty(text)) { int int2 = GameProgress.GetInt(text, 0, GameProgress.Location.Local, null); GameProgress.SetInt(text, int2 + 1, GameProgress.Location.Local); } int seasonSnoutCoinReward = CakeRaceMenu.GetSeasonSnoutCoinReward(currentCupIndex, rank); if (seasonSnoutCoinReward > 0) { GameProgress.AddSnoutCoins(seasonSnoutCoinReward); int int3 = GameProgress.GetInt("cake_race_coins_won", 0, GameProgress.Location.Local, null); GameProgress.SetInt("cake_race_coins_won", int3 + seasonSnoutCoinReward, GameProgress.Location.Local); } LootCrateType crateType = CakeRaceMenu.GetSeasonCrateReward(currentCupIndex, rank); if (crateType != LootCrateType.None) { this.seasonEndDialog.onClose += delegate() { LootCrate.SpawnLootCrateOpeningDialog(crateType, 1, WPFMonoBehaviour.s_hudCamera, new Dialog.OnClose(this.OnDialogClosed), new LootCrate.AnalyticData(string.Format("{0}_reward", (PlayFabLeaderboard.Leaderboard)currentCupIndex), "0", LootCrate.AdWatched.NotApplicaple)); }; } else { this.seasonEndDialog.onClose += this.OnDialogClosed; } this.seasonEndDialog.SetCrateRankAndReward(crateType, rank, seasonSnoutCoinReward); this.isRewardingPlayer = false; }
// 나의 순위 호출 함수 성공 콜백 private void GetMyRankingSuccess(GetLeaderboardAroundPlayerResult result) { // Ranking을 표시 MiniGameController.instance.ResultUIrankingLabel.text = "Ranking " + (result.Leaderboard[0].Position + 1).ToString(); }
/** * Initialises the entry list and calls success. */ private void OnUserSuccess(GetLeaderboardAroundPlayerResult result) { InitialiseEntries(result.Leaderboard); m_request.OnSuccess(); }