Ejemplo n.º 1
0
 private static string GetBoardName(Leaderboard board, bool previousSeason = false)
 {
     if ((!previousSeason && CakeRaceMenu.CurrentCakeRaceWeek() % 2 != 0) || (previousSeason && CakeRaceMenu.CurrentCakeRaceWeek() % 2 == 0))
     {
         switch (board)
         {
         case PlayFabLeaderboard.Leaderboard.CakeRaceCupF:
         case PlayFabLeaderboard.Leaderboard.CakeRaceCupE:
         case PlayFabLeaderboard.Leaderboard.CakeRaceCupD:
         case PlayFabLeaderboard.Leaderboard.CakeRaceCupC:
         case PlayFabLeaderboard.Leaderboard.CakeRaceCupB:
         case PlayFabLeaderboard.Leaderboard.CakeRaceCupA:
             return(string.Format("{0}2", board.ToString()));
         }
     }
     return(board.ToString());
 }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
    private string GetCupAndSeasonTitle()
    {
        Localizer.LocaleParameters localeParameters = Singleton <Localizer> .Instance.Resolve("LEADERBOARDS_TITLE", null);

        Localizer.LocaleParameters localeParameters2 = Singleton <Localizer> .Instance.Resolve(string.Format("CUP_{0:00}_NAME", (int)CakeRaceMenu.GetCurrentLeaderboardCup()), null);

        return(string.Format(localeParameters.translation, localeParameters2.translation, CakeRaceMenu.CurrentCakeRaceWeek()));
    }
Ejemplo n.º 4
0
    protected override void Awake()
    {
        base.Awake();
        Transform transform = this.dialogRoot.transform.Find("TitleRibbon/TitleLabel");

        if (transform != null)
        {
            this.titleLabel = transform.GetComponentsInChildren <TextMesh>();
        }
        transform = this.dialogRoot.transform.Find("RewardContainer/RankLabel");
        if (transform != null)
        {
            this.rankLabel = transform.GetComponentsInChildren <TextMesh>();
        }
        transform = this.dialogRoot.transform.Find("RewardContainer/RewardLabel");
        if (transform != null)
        {
            this.rewardLabel = transform.GetComponentsInChildren <TextMesh>();
        }
        Localizer.LocaleParameters localeParameters = Singleton <Localizer> .Instance.Resolve(this.titleLocalizationKey, null);

        TextMeshHelper.UpdateTextMeshes(this.titleLabel, string.Format(localeParameters.translation, CakeRaceMenu.CurrentCakeRaceWeek() - 1), false);
    }