Ejemplo n.º 1
0
    private IEnumerator Start()
    {
        for (int i = 0; i < this.m_comicStrips.Count; i++)
        {
            ComicStrip comicStrip = this.m_comicStrips[i];
            float      x          = comicStrip.m_strip.GetComponent <UnmanagedSprite>().Size.x;
            this.m_startPos     = -10f * (float)Screen.width / (float)Screen.height + 0.5f * x + 4f * (float)Screen.width / (float)Screen.height;
            this.m_startPos_3_2 = -15f + 0.5f * x + 6f;
            comicStrip.m_strip.transform.position = new Vector3(this.m_startPos, 0f, (float)i);
            float num = 0f;
            this.m_comicStrips[i].m_strip.GetComponent <Renderer>().material.SetColor("_Color", new Color(1f, 1f, 1f, num));
            this.FadeChildren(num, this.m_comicStrips[i], false);
        }
        this.m_continueButton.SetActive(GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_played", 0, GameProgress.Location.Local, null) == 1);
        if (ScreenPlacement.IsAspectRatioNarrowerThan(4f, 3f))
        {
            this.m_continueButton.transform.Translate(-2.5f, 0f, 0f);
        }
        base.StartCoroutine(this.UpdateStrips());
        yield return(null);

        if (this.m_soundTrack && this.m_currentStrip == 0)
        {
            Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.m_soundTrack);
        }
        for (int j = 0; j < this.m_currentStrip; j++)
        {
            this.m_time += this.GetComicPageTime(j);
        }
        yield break;
    }
Ejemplo n.º 2
0
 private void LoadData()
 {
     this.PendingExperience = GameProgress.GetInt("player_pending_experience", -1, GameProgress.Location.Local, null);
     this.Experience        = GameProgress.GetInt("player_experience", 0, GameProgress.Location.Local, null);
     this.Level             = GameProgress.GetInt("player_level", 1, GameProgress.Location.Local, null);
     this.FirePlayerProgressEvent();
 }
Ejemplo n.º 3
0
    private void UpdatePlayerStats()
    {
        for (int i = 0; i < 3; i++)
        {
            int num = 0;
            if (i != 0)
            {
                if (i != 1)
                {
                    if (i == 2)
                    {
                        num = GameProgress.GetInt("cake_race_bronze_trophies_won", 0, GameProgress.Location.Local, null);
                    }
                }
                else
                {
                    num = GameProgress.GetInt("cake_race_silver_trophies_won", 0, GameProgress.Location.Local, null);
                }
            }
            else
            {
                num = GameProgress.GetInt("cake_race_gold_trophies_won", 0, GameProgress.Location.Local, null);
            }
            this.trophyIcons[i].gameObject.SetActive(num > 0);
            TextMeshHelper.UpdateTextMeshes(this.trophyAmountLabels[i], (num <= 0) ? string.Empty : num.ToString(), false);
        }
        int @int = GameProgress.GetInt("cake_race_coins_won", 0, GameProgress.Location.Local, null);

        TextMeshHelper.UpdateTextMeshes(this.totalCoinsWonLabel, string.Format("[snout] {0}", @int), false);
        TextMeshSpriteIcons.EnsureSpriteIcon(this.totalCoinsWonLabel);
        int int2 = GameProgress.GetInt("cake_race_highest_rank", 0, GameProgress.Location.Local, null);

        TextMeshHelper.UpdateTextMeshes(this.highestRankLabel, (int2 <= 0) ? "-" : int2.ToString(), false);
    }
Ejemplo n.º 4
0
    private IEnumerator Init()
    {
        if (this.alienConverter.IsAlienMachine && this.alienConverter.RoutineShown)
        {
            this.alienConverter.ConvertToAlien();
            this.UpdateAlienPartSilhouette();
            this.UpdateLiquidTank((float)this.currentMachineScrapAmount, (float)AlienCustomizationManager.GetPrice(), true);
        }
        this.SetMachineScrapAmount(GameProgress.GetInt("Machine_scrap_amount", 0, GameProgress.Location.Local, null));
        this.currentMachineScrapAmount = this.targetMachineScrapAmount;
        this.UpdateMachineScrapLabel();
        this.pullChainButton.LockDragging(true);
        this.pullChainButton.SetPositionOffset(Vector3.up * 10f);
        this.machineAnimation.state.End   += this.OnMachineAnimationEnd;
        this.machineAnimation.state.Start += this.OnMachineAnimationStart;
        this.machineAnimation.state.Event += this.OnAnimationEvent;
        this.SetMachineAnimation(this.introAnimationName, false, false, true);
        this.machineAnimation.timeScale = 0f;
        yield return(new WaitForSeconds(0.1f));

        if (WorkshopMenu.isDestroyed)
        {
            yield break;
        }
        this.machineAnimation.timeScale = 1f;
        Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.gameData.commonAudioCollection.machineIntro);

        int idleAnimationIndex = (int)this.GetPartTierFromAmount(GameProgress.GetInt("Machine_scrap_amount", 0, GameProgress.Location.Local, null));

        this.SetMachineAnimation(this.idleAnimationNames[idleAnimationIndex], true, true, true);
        if (this.collectRewardButton != null)
        {
            this.collectRewardButton.SetActive(false);
        }
        yield return(new WaitForSeconds(1f));

        if (WorkshopMenu.isDestroyed)
        {
            yield break;
        }
        this.SetMachineIdleSound(idleAnimationIndex);
        float fade = 1f;

        while (fade > 0f)
        {
            fade -= Time.deltaTime;
            this.pullChainButton.SetPositionOffset(Vector3.up * fade * 10f);
            yield return(null);

            if (WorkshopMenu.isDestroyed)
            {
                yield break;
            }
        }
        this.pullChainButton.LockDragging(false);
        this.introPlaying = false;
        yield break;
    }
Ejemplo n.º 5
0
    public void Continue()
    {
        if (this.m_cutsceneType != ComicPlayer.Type.EpisodeStart && this.m_cutsceneType != ComicPlayer.Type.CakeRace && LevelInfo.CanAdUnlockNextLevel(null))
        {
            Singleton <GameManager> .Instance.LoadLevelSelection(Singleton <GameManager> .Instance.CurrentEpisode, false);

            return;
        }
        switch (this.m_cutsceneType)
        {
        case ComicPlayer.Type.EpisodeStart:
            if (GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_played", 0, GameProgress.Location.Local, null) == 1)
            {
                Singleton <GameManager> .Instance.LoadLevelSelection(Singleton <GameManager> .Instance.CurrentEpisode, false);
            }
            else
            {
                Singleton <GameManager> .Instance.LoadLevel(0);
            }
            break;

        case ComicPlayer.Type.EpisodeEnd:
            Singleton <GameManager> .Instance.LoadEpisodeSelection(false);

            break;

        case ComicPlayer.Type.EpisodeOneTime:
            Singleton <GameManager> .Instance.LoadLevel(Singleton <GameManager> .Instance.CurrentLevel);

            break;

        case ComicPlayer.Type.EpisodeContinue:
            if (Singleton <GameManager> .Instance.IsCutsceneStartedFromLevelSelection || (Singleton <BuildCustomizationLoader> .Instance.IsChina && GameProgress.GetInt("scenario_31_stars", 0, GameProgress.Location.Local, null) != 3))
            {
                Singleton <GameManager> .Instance.LoadLevelSelection(Singleton <GameManager> .Instance.CurrentEpisode, false);
            }
            else if (LevelInfo.ValidLevelIndex(Singleton <GameManager> .Instance.CurrentEpisodeIndex, Singleton <GameManager> .Instance.NextLevel()))
            {
                Singleton <GameManager> .Instance.LoadNextLevelAfterCutScene();
            }
            else
            {
                Singleton <GameManager> .Instance.LoadLevelSelection(Singleton <GameManager> .Instance.CurrentEpisode, false);
            }
            break;

        case ComicPlayer.Type.DailyChallenge:
            Singleton <GameManager> .Instance.LoadEpisodeSelection(false);

            break;

        case ComicPlayer.Type.CakeRace:
            Singleton <GameManager> .Instance.LoadCakeRaceMenu(false);

            break;
        }
        GameProgress.SetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_played", 1, GameProgress.Location.Local);
    }
Ejemplo n.º 6
0
 private void TryToShowCupEndAnimation(bool forceShow = false)
 {
     if (forceShow || GameProgress.GetBool("cake_race_show_cup_animation", false, GameProgress.Location.Local, null))
     {
         GameProgress.SetBool("cake_race_show_cup_animation", false, GameProgress.Location.Local);
         this.OpenLeaderboardDialog();
         this.leaderboardDialog.ShowCupAnimation(GameProgress.GetInt("cake_race_current_cup", (int)PlayFabLeaderboard.LowestCup(), GameProgress.Location.Local, null));
     }
 }
Ejemplo n.º 7
0
 public void CheckForAncestorPigAchievement()
 {
     if (Singleton <SocialGameManager> .IsInstantiated() && Singleton <GameManager> .Instance.IsInGame())
     {
         int revealedAncestorPigs = GameProgress.GetInt("Revealed_Ancestor_Pigs", 0, GameProgress.Location.Local, null) + 1;
         GameProgress.SetInt("Revealed_Ancestor_Pigs", revealedAncestorPigs, GameProgress.Location.Local);
         Singleton <SocialGameManager> .Instance.TryReportAchievementProgress("grp.SOMEONES_THERE", 100.0, (int limit) => revealedAncestorPigs > limit);
     }
 }
Ejemplo n.º 8
0
    private void TryReportAchievements()
    {
        int @int = GameProgress.GetInt(this.crateID + this.crateType.ToString(), 0, GameProgress.Location.Local, null);

        if (@int == 1 && this.crateID.Equals("FreeShopCrate") && Singleton <SocialGameManager> .IsInstantiated())
        {
            Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.FREE_CRATE", 100.0);
        }
    }
Ejemplo n.º 9
0
    private int CalculateEpisodeStars()
    {
        int num = 0;

        foreach (EpisodeLevelInfo episodeLevelInfo in WPFMonoBehaviour.gameData.m_episodeLevels[this.m_episodeLevelsGameDataIndex].LevelInfos)
        {
            num += GameProgress.GetInt(episodeLevelInfo.sceneName + "_stars", 0, GameProgress.Location.Local, null);
        }
        return(num);
    }
Ejemplo n.º 10
0
    private int CalculateRaceLevelStars()
    {
        int num = 0;

        foreach (RaceLevels.LevelData levelData in WPFMonoBehaviour.gameData.m_raceLevels.Levels)
        {
            num += GameProgress.GetInt(levelData.SceneName + "_stars", 0, GameProgress.Location.Local, null);
        }
        return(num);
    }
Ejemplo n.º 11
0
    private int GetTimeOffset()
    {
        if (GameProgress.HasKey("TimeOffset", GameProgress.Location.Local, null))
        {
            return(GameProgress.GetInt("TimeOffset", 0, GameProgress.Location.Local, null));
        }
        int num = (int)DateTime.Now.Subtract(this.ServerTime).TotalSeconds;

        GameProgress.SetInt("TimeOffset", num, GameProgress.Location.Local);
        return(num);
    }
Ejemplo n.º 12
0
    public static void GetStarLevelStars(int episodeIndex, int levelIndex, out int current, out int limit)
    {
        List <string> levelNames = LevelInfo.GetLevelNames(episodeIndex);

        current = 0;
        for (int i = 1; i < 5; i++)
        {
            current += GameProgress.GetInt(levelNames[levelIndex - i] + "_stars", 0, GameProgress.Location.Local, null);
        }
        limit = LevelInfo.GetStarLevelLimit(episodeIndex, levelIndex);
    }
Ejemplo n.º 13
0
    private void SetupTutorials()
    {
        if (this.initialized)
        {
            return;
        }
        this.mode = (Mode)GameProgress.GetInt("Workshop_Tutorial", 0, GameProgress.Location.Local, null);
        switch (this.mode)
        {
        case WorkshopTutorial.Mode.None:
            this.scrapInsertTutorial  = this.ScrapInsertTutorial();
            this.startMachineTutorial = this.StartMachineTutorial();
            this.pointer.Show(false);
            if (!GameProgress.GetBool("Workshop_Visited", false, GameProgress.Location.Local, null))
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(WPFMonoBehaviour.gameData.m_workshopIntroduction);
                gameObject.transform.position = new Vector3(0f, 0f, -5f);
            }
            else
            {
                this.OnPopupWatched();
            }
            base.StartCoroutine(this.WaitFor(() => this.machineReady && this.popupWatched, delegate
            {
                this.SwitchMode(WorkshopTutorial.Mode.ScrapInsert);
            }));
            break;

        case WorkshopTutorial.Mode.WatchPopup:
            this.scrapInsertTutorial  = this.ScrapInsertTutorial();
            this.startMachineTutorial = this.StartMachineTutorial();
            this.pointer.Show(false);
            base.StartCoroutine(this.WaitFor(() => this.machineReady, delegate
            {
                this.SwitchMode(WorkshopTutorial.Mode.ScrapInsert);
            }));
            break;

        case WorkshopTutorial.Mode.ScrapInsert:
            this.scrapInsertTutorial  = this.ScrapInsertTutorial();
            this.startMachineTutorial = this.StartMachineTutorial();
            this.pointer.Show(false);
            base.StartCoroutine(this.WaitFor(() => this.machineReady, delegate
            {
                this.SwitchMode(WorkshopTutorial.Mode.StartMachine);
            }));
            break;

        case WorkshopTutorial.Mode.StartMachine:
            UnityEngine.Object.Destroy(base.gameObject);
            break;
        }
        this.initialized = true;
    }
Ejemplo n.º 14
0
    private void Awake()
    {
        string text = "show_count_" + this.key;
        int    @int = GameProgress.GetInt(text, 0, GameProgress.Location.Local, null);

        if (@int >= this.showTimes)
        {
            UnityEngine.Object.Destroy(base.gameObject);
            return;
        }
        GameProgress.SetInt(text, @int + 1, GameProgress.Location.Local);
    }
Ejemplo n.º 15
0
    private void UnlockLevel(Button button, int index, bool isJoker)
    {
        button.transform.Find("LevelNumber").GetComponent <TextMesh>().text = LevelSelector.DifferentiatedLevelLabel(index);
        button.transform.Find("Lock").gameObject.SetActive(false);
        button.MethodToCall.SetMethod(base.gameObject.GetComponent <LevelSelector>(), (!isJoker) ? "LoadLevel" : "LoadStarLevel", index.ToString());
        ButtonAnimation component = button.GetComponent <ButtonAnimation>();

        if (component != null)
        {
            component.RemoveInputListener();
        }
        string sceneName = this.Levels[index].sceneName;
        int    @int      = GameProgress.GetInt(sceneName + "_stars", 0, GameProgress.Location.Local, null);
        bool   flag      = GameProgress.HasCollectedSnoutCoins(sceneName, 0);
        bool   flag2     = GameProgress.HasCollectedSnoutCoins(sceneName, 1);
        bool   flag3     = GameProgress.HasCollectedSnoutCoins(sceneName, 2);

        GameObject[] array = new GameObject[]
        {
            button.transform.Find("StarSet/Star1").gameObject,
            button.transform.Find("StarSet/Star2").gameObject,
            button.transform.Find("StarSet/Star3").gameObject,
            button.transform.Find("CoinSet/Star1").gameObject,
            button.transform.Find("CoinSet/Star2").gameObject,
            button.transform.Find("CoinSet/Star3").gameObject
        };
        int num = 0;

        if (flag)
        {
            num++;
        }
        if (flag2)
        {
            num++;
        }
        if (flag3)
        {
            num++;
        }
        for (int i = 0; i < 3; i++)
        {
            bool flag4 = i + 1 <= @int;
            bool flag5 = i + 1 <= num || Singleton <BuildCustomizationLoader> .Instance.IsOdyssey;
            array[i].SetActive(flag4 && !flag5);
            array[i + 3].SetActive(flag4 && flag5);
        }
        if (isJoker)
        {
            GameObject gameObject = button.transform.Find("StarSetsLocked").gameObject;
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 16
0
    private void RemoveScrap(int removeAmount)
    {
        int @int = GameProgress.GetInt("Machine_scrap_amount", 0, GameProgress.Location.Local, null);

        if (@int >= removeAmount)
        {
            GameProgress.SetInt("Machine_scrap_amount", @int - removeAmount, GameProgress.Location.Local);
            EventManager.Send(new CraftingMachineEvent(WorkshopMenu.CraftingMachineAction.RemoveScrap, GameProgress.GetInt("Machine_scrap_amount", 0, GameProgress.Location.Local, null)));
        }
        else
        {
            this.ResetScrap(false);
        }
    }
Ejemplo n.º 17
0
    public void LoadNextLevel()
    {
        if (this.m_currentEpisodeType == GameManager.EpisodeType.Race)
        {
            this.LoadRaceLevel(this.NextRaceLevel());
            return;
        }
        int  num   = this.NextLevel();
        bool flag  = LevelInfo.IsLevelUnlocked(this.CurrentEpisodeIndex, num);
        bool flag2 = true;
        bool flag3 = false;
        bool flag4 = num % 5 == 0;
        int  num2  = num / 5;
        bool flag5 = GameProgress.IsLevelAdUnlocked(LevelInfo.GetLevelNames(this.CurrentEpisodeIndex)[num2 * 5]);
        bool flag6 = LevelInfo.IsLevelUnlocked(this.CurrentEpisodeIndex, num2 * 5);

        if (flag4 && !flag5 && !flag6)
        {
            EventManager.Send(new UIEvent(UIEvent.Type.LevelSelection));
        }
        else if (LevelInfo.IsContentLimited(this.CurrentEpisodeIndex, num) && Singleton <BuildCustomizationLoader> .Instance.IsChina && GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_stars", 0, GameProgress.Location.Local, null) != 3 && GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_stars", 0, GameProgress.Location.Local, null) != 0)
        {
            LevelInfo.DisplayContentLimitNotification();
            GameProgress.SetBool("show_content_limit_popup", true, GameProgress.Location.Local);
            EventManager.Send(new UIEvent(UIEvent.Type.LevelSelection));
        }
        else if (flag3 && !flag2 && flag)
        {
            EventManager.Send(new UIEvent(UIEvent.Type.LevelSelection));
        }
        else
        {
            if (Singleton <BuildCustomizationLoader> .Instance.IsChina && GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_stars", 0, GameProgress.Location.Local, null) == 3 && GameProgress.GetMinimumLockedLevel(this.CurrentEpisodeIndex) <= this.CurrentLevel + 1)
            {
                GameProgress.SetMinimumLockedLevel(this.CurrentEpisodeIndex, GameProgress.GetMinimumLockedLevel(this.CurrentEpisodeIndex) + 1);
            }
            this.m_currentLevel = num;
            this.LoadLevel(this.CurrentLevel);
        }
        if (this.m_currentEpisode != string.Empty)
        {
            int num3 = this.m_currentLevel / 15;
            int num4 = this.m_currentLevel / 5;
            if (num4 % 3 == 2 && this.m_currentLevel % 5 == 3 && !flag2)
            {
                num3++;
            }
            UserSettings.SetInt(this.m_currentEpisode + "_active_page", num3);
        }
    }
Ejemplo n.º 18
0
    public static void SetPartNew(BasePart part, bool isNew)
    {
        string key = string.Format("{0}_isNew", part.name);

        if (isNew && !GameProgress.HasKey(key, GameProgress.Location.Local, null))
        {
            GameProgress.SetBool(key, isNew, GameProgress.Location.Local);
            GameProgress.SetInt("NewParts", GameProgress.GetInt("NewParts", 0, GameProgress.Location.Local, null) + 1, GameProgress.Location.Local);
        }
        else if (!isNew && GameProgress.HasKey(key, GameProgress.Location.Local, null) && GameProgress.GetBool(key, false, GameProgress.Location.Local, null))
        {
            GameProgress.SetBool(key, isNew, GameProgress.Location.Local);
            GameProgress.SetInt("NewParts", GameProgress.GetInt("NewParts", 0, GameProgress.Location.Local, null) - 1, GameProgress.Location.Local);
        }
    }
Ejemplo n.º 19
0
    public bool CurrentStarLevelUnlocked()
    {
        int num  = 0;
        int num2 = this.m_currentLevel / 5 * 5;

        if (this.m_levels.Count < 5)
        {
            return(false);
        }
        for (int i = num2; i < num2 + 4; i++)
        {
            num += GameProgress.GetInt(this.m_levels[i].sceneName + "_stars", 0, GameProgress.Location.Local, null);
        }
        return(num >= this.m_starlevelLimits[(num2 + 4) / 5]);
    }
Ejemplo n.º 20
0
    public override void OnDataLoadedStart()
    {
        PartListing.Create().Close();
        int @int = GameProgress.GetInt("branded_reward_gift_time", 0, GameProgress.Location.Local, null);
        int num  = 86400;

        if (Singleton <GameConfigurationManager> .IsInstantiated() && Singleton <GameConfigurationManager> .Instance.HasValue("branded_reward_cooldown", "time"))
        {
            num = Singleton <GameConfigurationManager> .Instance.GetValue <int>("branded_reward_cooldown", "time");
        }
        if (@int > 0 && Singleton <TimeManager> .Instance.CurrentEpochTime - @int > num)
        {
            GameProgress.DeleteKey("branded_reward_gift_time", GameProgress.Location.Local);
            GameProgress.DeleteKey("branded_reward_gifts_today", GameProgress.Location.Local);
        }
    }
Ejemplo n.º 21
0
    public void StartRace()
    {
        if (CakeRaceMenu.WinCount < 0 || !this.HasWeeklyData())
        {
            this.SetInfoLabel("Error getting cake race data");
            this.UpdateWeeklyTracks();
            return;
        }
        CakeRaceMenu.FindNewPlayer    = false;
        CakeRaceMenu.UseDefaultReplay = false;
        DateTime serverTime = Singleton <TimeManager> .Instance.ServerTime;
        DateTime value      = serverTime;

        if (!GameProgress.HasKey("cake_race_first_day", GameProgress.Location.Local, null))
        {
            GameProgress.SetString("cake_race_first_day", value.ToShortDateString(), GameProgress.Location.Local);
        }
        else
        {
            value = DateTime.Parse(GameProgress.GetString("cake_race_first_day", string.Empty, GameProgress.Location.Local, null));
        }
        TimeSpan timeSpan = serverTime.Subtract(value);
        DateTime value2   = serverTime;

        if (GameProgress.HasKey("cake_race_last_played", GameProgress.Location.Local, null))
        {
            value2 = DateTime.Parse(GameProgress.GetString("cake_race_last_played", DateTime.MinValue.ToShortDateString(), GameProgress.Location.Local, null));
        }
        GameProgress.SetString("cake_race_last_played", serverTime.ToShortDateString(), GameProgress.Location.Local);
        int num = GameProgress.GetInt("cake_race_days_played", 1, GameProgress.Location.Local, null);

        if (serverTime.Subtract(value2).TotalHours > 12.0)
        {
            GameProgress.SetInt("cake_race_days_played", ++num, GameProgress.Location.Local);
        }
        this.GenerateNewWeeklyTrackIndex();
        if (CakeRaceMenu.IsTutorial)
        {
            CakeRaceMenu.UseDefaultReplay = true;
            this.OnReplayFetched(null);
        }
        else
        {
            this.FindOpponent();
        }
    }
Ejemplo n.º 22
0
 public static void AddLootCrateToFreeSlot(LootCrateType crateType)
 {
     for (int i = 0; i < LootCrateSlots.SlotsAvailable; i++)
     {
         if (!LootCrateSlots.IsSlotOccupied(i))
         {
             LootCrateSlots.AddLootCrateToSlot(i, crateType);
             int num = GameProgress.GetInt("loot_crates_added_to_slots", 0, GameProgress.Location.Local, null);
             GameProgress.SetInt("loot_crates_added_to_slots", ++num, GameProgress.Location.Local);
             if (LootCrateSlots.instance != null)
             {
                 LootCrateSlots.instance.ShowFullBubble(LootCrateSlots.AreSlotsFull());
             }
             return;
         }
     }
     LootCrateSlots.overflowCrateType = crateType;
 }
Ejemplo n.º 23
0
 public void CheckForTNTAchievement()
 {
     if (Singleton <SocialGameManager> .IsInstantiated())
     {
         int brokenTNTs = GameProgress.GetInt("Broken_TNTs", 0, GameProgress.Location.Local, null) + 1;
         GameProgress.SetInt("Broken_TNTs", brokenTNTs, GameProgress.Location.Local);
         List <string> list = new List <string>
         {
             "grp.BOOM_BOOM_III",
             "grp.BOOM_BOOM_II",
             "grp.BOOM_BOOM_I"
         };
         foreach (string achievementId in list)
         {
             Singleton <SocialGameManager> .Instance.TryReportAchievementProgress(achievementId, 100.0, (int limit) => brokenTNTs >= limit);
         }
     }
 }
Ejemplo n.º 24
0
 private void Awake()
 {
     base.SetAsPersistant();
     if (!GameProgress.GetBool("AppRaterDisabled", false, GameProgress.Location.Local, null))
     {
         int num = GameProgress.GetInt("AppRaterInterval", 0, GameProgress.Location.Local, null);
         num++;
         if (num >= 15)
         {
             base.StartCoroutine(this.ShowRatingPrompt());
             GameProgress.SetInt("AppRaterInterval", 0, GameProgress.Location.Local);
         }
         else
         {
             GameProgress.SetInt("AppRaterInterval", num, GameProgress.Location.Local);
         }
     }
 }
Ejemplo n.º 25
0
 private void FindOpponent()
 {
     if (this.HasWeeklyData())
     {
         Singleton <GuiManager> .Instance.enabled = false;
         this.SetInfoLabel("Searching for opponent");
         string currentSeasonID = CakeRaceMode.GetCurrentSeasonID();
         string key             = string.Format("Season_{0}_wins", currentSeasonID);
         string key2            = string.Format("Season_{0}_losses", currentSeasonID);
         int    @int            = GameProgress.GetInt(key, 0, GameProgress.Location.Local, null);
         int    int2            = GameProgress.GetInt(key2, 0, GameProgress.Location.Local, null);
         Singleton <PlayFabManager> .Instance.MatchMaking.FindOpponentReplay(this.GetWeeklyTrackIndex(), Singleton <PlayerProgress> .Instance.Level, @int - int2, new Action <string>(this.OnReplayFetched));
     }
     else
     {
         this.SetInfoLabel("Error fetching tracks");
         this.UpdateWeeklyTracks();
     }
 }
Ejemplo n.º 26
0
    public override void InitGameMode()
    {
        base.CurrentConstructionGridRows = this.levelManager.m_constructionGridRows;
        int num           = 1;
        int newGridHeight = 1;

        for (int i = 0; i < base.CurrentConstructionGridRows.Count; i++)
        {
            if (base.CurrentConstructionGridRows[i] != 0)
            {
                int numberOfHighestBit = WPFMonoBehaviour.GetNumberOfHighestBit(base.CurrentConstructionGridRows[i]);
                if (numberOfHighestBit + 1 > num)
                {
                    num = numberOfHighestBit + 1;
                }
                newGridHeight = i + 1;
            }
        }
        int     newGridXMin = -(num - 1) / 2;
        int     newGridXMax = num / 2;
        Vector3 position    = (!this.levelStart) ? Vector3.zero : this.levelStart.transform.position;

        this.levelManager.CreateGrid(num, newGridHeight, newGridXMin, newGridXMax, position);
        if (this.levelManager.ConstructionUI)
        {
            if (GameProgress.HasKey(SchematicButton.LastLoadedSlotKey, GameProgress.Location.Local, null))
            {
                base.CurrentContraptionIndex = GameProgress.GetInt(SchematicButton.LastLoadedSlotKey, 0, GameProgress.Location.Local, null);
            }
            base.BuildContraption(WPFPrefs.LoadContraptionDataset(base.GetCurrentContraptionName()));
        }
        foreach (ConstructionUI.PartDesc partDesc in this.levelManager.ConstructionUI.PartDescriptors)
        {
            EventManager.Send(new PartCountChanged(partDesc.part.m_partType, partDesc.CurrentCount));
        }
        GameObject gameObject = new GameObject("CollectibleStash");

        gameObject.transform.parent = this.levelManager.transform;
        this.FindChallenges();
        this.levelManager.m_CollectedDessertsCount = 0;
        this.PlaceDesserts(false);
        this.InitializeChallenges();
    }
Ejemplo n.º 27
0
    public void GiveReward()
    {
        int @int = GameProgress.GetInt(this.crateID + this.crateType.ToString(), 0, GameProgress.Location.Local, null);

        if (@int <= 0)
        {
            GameProgress.SetInt(this.crateID + this.crateType.ToString(), @int + 1, GameProgress.Location.Local);
            WorkshopMenu.AnyLootCrateCollected = true;
            if (FreeLootCrate.OnFreeLootCrateCollected != null)
            {
                FreeLootCrate.OnFreeLootCrateCollected();
            }
            Camera hudCamera = Singleton <GuiManager> .Instance.FindCamera();

            LootCrate.SpawnLootCrateOpeningDialog(this.crateType, 1, hudCamera, null, new LootCrate.AnalyticData(this.crateID, "free", LootCrate.AdWatched.NotApplicaple));
            this.TryReportAchievements();
        }
        base.gameObject.SetActive(false);
    }
Ejemplo n.º 28
0
    public bool CurrentEpisodeThreeStarredSpecialLevels()
    {
        if (this.m_currentEpisodeType != GameManager.EpisodeType.Normal)
        {
            return(false);
        }
        if (!this.IsEpisodeCompletable())
        {
            return(false);
        }
        bool flag = true;
        int  num  = 4;

        while (num < this.m_levels.Count && flag)
        {
            flag &= (GameProgress.GetInt(this.m_levels[num].sceneName + "_stars", 0, GameProgress.Location.Local, null) == 3);
            num  += 5;
        }
        return(flag);
    }
Ejemplo n.º 29
0
    public void Continue()
    {
        Type cutsceneType = this.m_cutsceneType;

        if (cutsceneType != Cutscene.Type.EpisodeStart)
        {
            if (cutsceneType == Cutscene.Type.EpisodeEnd)
            {
                Singleton <GameManager> .Instance.LoadEpisodeSelection(false);
            }
        }
        else if (GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_played", 0, GameProgress.Location.Local, null) == 1)
        {
            Singleton <GameManager> .Instance.LoadLevelSelection(Singleton <GameManager> .Instance.CurrentEpisode, false);
        }
        else
        {
            Singleton <GameManager> .Instance.LoadLevel(0);
        }
        GameProgress.SetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_played", 1, GameProgress.Location.Local);
    }
Ejemplo n.º 30
0
    private void UpdateWinCount()
    {
        if (CakeRaceMenu.WinCount >= 0)
        {
            this.SetWinCount(CakeRaceMenu.WinCount);
            return;
        }
        string key = "Statistics_" + PlayFabLeaderboard.Leaderboard.CakeRaceWins.ToString();

        if (GameProgress.HasKey(key, GameProgress.Location.Local, null))
        {
            this.SetWinCount(GameProgress.GetInt(key, 0, GameProgress.Location.Local, null));
        }
        else if (Singleton <PlayFabManager> .Instance.Initialized)
        {
            Singleton <PlayFabManager> .Instance.Leaderboard.GetScore(PlayFabLeaderboard.Leaderboard.CakeRaceWins, new Action <GetPlayerStatisticsResult>(this.OnWinCountSuccess), new Action <PlayFabError>(this.OnWinCountError));
        }
        else
        {
            this.SetWinCount(0);
        }
    }