private IEnumerator AnimEnableCup(PlayFabLeaderboard.Leaderboard cup, bool enable) { this.Init(null); if (this.cups == null) { yield break; } int cupIndex = (int)cup; cupIndex--; if (cupIndex >= 0 && cupIndex < this.cups.Length && this.cups[cupIndex] != null) { Transform currentCupGraphics = this.cups[cupIndex].Find("BarYou"); Transform shine = this.cups[cupIndex].Find("Shine"); if (currentCupGraphics.gameObject.activeSelf == enable) { yield break; } if (!enable && shine) { shine.gameObject.SetActive(true); shine.transform.localScale = Vector3.one; yield return(base.StartCoroutine(CoroutineRunner.DeltaAction(0.5f, false, delegate(float t) { shine.transform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, t); }))); shine.gameObject.SetActive(false); } else if (enable && shine) { shine.gameObject.SetActive(true); shine.transform.localScale = Vector3.zero; yield return(base.StartCoroutine(CoroutineRunner.DeltaAction(0.5f, false, delegate(float t) { shine.transform.localScale = Vector3.Lerp(Vector3.one, Vector3.zero, t); }))); GameObject icon = this.cups[cupIndex].Find("CupIcon").gameObject; Animation animation = (!icon) ? null : icon.GetComponent <Animation>(); animation.Play(); } if (currentCupGraphics != null) { currentCupGraphics.gameObject.SetActive(enable); } } yield break; }
private IEnumerator PlayCupAdvanceAnimation(PlayFabLeaderboard.Leaderboard newCup, Action callback) { int oldCupIndex = newCup - PlayFabLeaderboard.Leaderboard.CakeRaceCupF; for (int i = 0; i <= this.cups.Length; i++) { this.EnableCup((PlayFabLeaderboard.Leaderboard)i, false); } this.EnableCup((PlayFabLeaderboard.Leaderboard)oldCupIndex, true); yield return(new WaitForSeconds(0.75f)); yield return(base.StartCoroutine(this.AnimEnableCup((PlayFabLeaderboard.Leaderboard)oldCupIndex, false))); yield return(base.StartCoroutine(this.AnimEnableCup(newCup, true))); if (callback != null) { callback(); } yield break; }
private void ReportCupScore(int cupIndex) { int num = 0; for (int i = 0; i < 7; i++) { string text = string.Format("cake_race_track_{0}_pb_replay", i); if (GameProgress.HasKey(text, GameProgress.Location.Local, null)) { CakeRaceReplay cakeRaceReplay = new CakeRaceReplay(GameProgress.GetString(text, string.Empty, GameProgress.Location.Local, null)); if (cakeRaceReplay.IsValid) { int num2 = CakeRaceReplay.TotalScore(cakeRaceReplay); num += num2; UnityEngine.Debug.LogWarning("[CakeRaceMode] Track (" + text + ") score " + num2.ToString()); } } } PlayFabLeaderboard.Leaderboard board = (PlayFabLeaderboard.Leaderboard)cupIndex; UnityEngine.Debug.LogWarning("[CakeRaceMode] ReportCupScore [" + board.ToString() + "] " + num.ToString()); Singleton <PlayFabManager> .Instance.Leaderboard.AddScore(board, num, new Action <UpdatePlayerStatisticsResult>(this.OnCupScoreReported), new Action <PlayFabError>(this.OnCupScoreError)); }
private void EnableCup(PlayFabLeaderboard.Leaderboard cup, bool enable) { this.Init(null); if (this.cups == null) { return; } int num = cup - PlayFabLeaderboard.Leaderboard.CakeRaceCupF; if (num >= 0 && num < this.cups.Length && this.cups[num] != null) { Transform transform = this.cups[num].Find("BarYou"); Transform transform2 = this.cups[num].Find("Shine"); if (transform) { transform.gameObject.SetActive(enable); } if (transform2) { transform2.gameObject.SetActive(enable); } } }
private void RewardCupPlayer(PlayFabLeaderboard.Leaderboard currentLeaderboard) { this.rewardPendingCup = currentLeaderboard; this.isRewardingPlayer = true; Singleton <PlayFabManager> .Instance.Leaderboard.GetLeaderboardAroundPlayer(this.rewardPendingCup, new Action <GetLeaderboardAroundPlayerResult>(this.OnRankFetched), new Action <PlayFabError>(this.OnRankError), true, 1); }
private void OnCakeRaceWeekFetched(string week, string daysLeft) { if (!CakeRaceMenu.IsCakeRaceMenuOpen) { return; } this.fetchingWeeklyTrackData = false; int num = GameProgress.GetInt("cake_race_current_cup", (int)PlayFabLeaderboard.LowestCup(), GameProgress.Location.Local, null); int num2; if (int.TryParse(week, out num2)) { int num3 = CakeRaceMenu.CurrentCakeRaceWeek(); GameProgress.SetInt("cake_race_current_week", num2, GameProgress.Location.Local); if (!CakeRaceMenu.IsTutorial && num3 != num2) { PlayFabLeaderboard.Leaderboard currentLeaderboardCup = CakeRaceMenu.GetCurrentLeaderboardCup(); Singleton <CakeRaceKingsFavorite> .Instance.ClearCurrentFavorite(); CakeRaceMode.ClearPersonalBestData(); CakeRaceMenu.ClearCloudTrackData(); int cupIndexFromPlayerLevel = CakeRaceMenu.GetCupIndexFromPlayerLevel(); if (num != cupIndexFromPlayerLevel) { num = cupIndexFromPlayerLevel; GameProgress.SetInt("cake_race_current_cup", num, GameProgress.Location.Local); GameProgress.SetBool("cake_race_show_cup_animation", true, GameProgress.Location.Local); } if (GameProgress.HasKey("cake_race_current_cup", GameProgress.Location.Local, null)) { this.RewardCupPlayer(currentLeaderboardCup); } else { GameProgress.SetInt("cake_race_current_cup", num, GameProgress.Location.Local); base.StartCoroutine(this.WaitPopUpAndShowCupEndAnimation()); } } } else { num2 = 0; } string str = "[CakeRaceMenu] current cup is "; PlayFabLeaderboard.Leaderboard leaderboard = (PlayFabLeaderboard.Leaderboard)num; UnityEngine.Debug.LogWarning(str + leaderboard.ToString()); int num4 = 0; if (Singleton <GameConfigurationManager> .Instance.HasValue("cake_race", "week_offset")) { num4 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("cake_race", "week_offset"); } CakeRaceMenu.CurrentSeasonIndex = Mathf.Clamp(num2 + num4, 0, int.MaxValue) % CakeRaceMenu.WeeklyTrackIdentifiers.Length; if (!CakeRaceMenu.AllSeasonTracks.ContainsKey(CakeRaceMenu.CurrentSeasonIndex)) { CakeRaceMenu.CurrentSeasonIndex = 0; } if (this.HasWeeklyData()) { this.SetInfoLabel("Ready to go"); } else { this.SetInfoLabel("Error fetching tracks"); } this.UpdateDaysLeft(); if (!this.isRewardingPlayer) { this.TryToUnlockCakeRaceLockScreen(); } }