Exemplo n.º 1
0
    private bool IsSaleOn(string saleItemKey, out int saleLeft)
    {
        GameConfigurationManager instance = Singleton <GameConfigurationManager> .Instance;
        ConfigData config = instance.GetConfig("iap_sale_items");

        if (!Singleton <IapManager> .Instance.HasProduct(this.saleItem))
        {
            saleLeft = -1;
            return(false);
        }
        if (config != null)
        {
            for (int i = 0; i < config.Keys.Length; i++)
            {
                if (config.Keys[i].StartsWith(saleItemKey))
                {
                    string[] array = config[config.Keys[i]].Split(new char[]
                    {
                        '-'
                    });
                    int saleTimeLeft = Shop.GetSaleTimeLeft(array[0], (array.Length <= 1) ? string.Empty : array[1]);
                    if (saleTimeLeft > 0 && !GameProgress.GetBool(config.Keys[i] + "_used", false, GameProgress.Location.Local, null))
                    {
                        saleLeft            = saleTimeLeft;
                        this.currentSaleKey = config.Keys[i];
                        return(true);
                    }
                }
            }
        }
        saleLeft = -1;
        return(false);
    }
Exemplo n.º 2
0
    public override void OnCollected()
    {
        int sandboxStarCollectCount = GameProgress.GetSandboxStarCollectCount(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey);

        if (sandboxStarCollectCount <= 1)
        {
            int num = Singleton <GameConfigurationManager> .Instance.GetValue <int>("star_box_snout_value", "amount");

            if (num > 0 && !Singleton <BuildCustomizationLoader> .Instance.IsOdyssey)
            {
                GameProgress.AddSandboxStar(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey, true);
                num = ((!Singleton <DoubleRewardManager> .Instance.HasDoubleReward) ? num : (num * 2));
                GameProgress.AddSnoutCoins(num);
                Singleton <PlayerProgress> .Instance.AddExperience(PlayerProgress.ExperienceType.PartBoxCollectedSandbox);

                base.ShowXPParticles();
                for (int i = 0; i < num; i++)
                {
                    SnoutCoinSingle.Spawn(base.transform.position - Vector3.forward, 1f * (float)i);
                }
            }
            else if (sandboxStarCollectCount < 1)
            {
                GameProgress.AddSandboxStar(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey, false);
            }
        }
        if (!this.isGhost)
        {
            GameProgress.AddPartBox(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey);
            GameProgress.AddSandboxParts(Singleton <GameManager> .Instance.CurrentSceneName, this.partType, this.count, true);
            if (this.partSprite != null)
            {
                this.partSpriteParent.transform.position          = base.transform.position - Vector3.forward * 2f;
                this.partSprite.GetComponent <Renderer>().enabled = true;
                if (this.partSprite.GetComponent <Animation>() != null && this.collectAnimation != null)
                {
                    this.partSprite.GetComponent <Animation>().Play(this.collectAnimation.name);
                }
            }
            if (this.tutoPage != null)
            {
                if (GameProgress.GetBool(this.TutorialShownKey, false, GameProgress.Location.Local, null))
                {
                    this.showTutorial = false;
                }
                else
                {
                    this.showTutorial = true;
                }
            }
        }
        if (PartBox.onCollected != null)
        {
            PartBox.onCollected();
        }
        if (this.onCollect != null)
        {
            this.onCollect(this);
        }
    }
Exemplo n.º 3
0
    public static void SetPartUsed(BasePart part, bool used)
    {
        string key = string.Format("{0}_isUsed", part.name);

        if (!used && !GameProgress.HasKey(key, GameProgress.Location.Local, null))
        {
            GameProgress.SetBool(key, used, GameProgress.Location.Local);
        }
        else if (used && !GameProgress.GetBool(key, false, GameProgress.Location.Local, null))
        {
            GameProgress.SetBool(key, used, GameProgress.Location.Local);
            PlayerProgress.ExperienceType experienceType = PlayerProgress.ExperienceType.NewCommonPartViewed;
            if (part.m_partTier == BasePart.PartTier.Rare)
            {
                experienceType = PlayerProgress.ExperienceType.NewRarePartViewed;
            }
            else if (part.m_partTier == BasePart.PartTier.Epic)
            {
                experienceType = PlayerProgress.ExperienceType.NewEpicPartViewed;
            }
            else if (part.m_partTier == BasePart.PartTier.Legendary)
            {
                experienceType = PlayerProgress.ExperienceType.NewLegendaryPartViewed;
            }
            Singleton <PlayerProgress> .Instance.AddExperience(experienceType);
        }
    }
Exemplo n.º 4
0
    private void Start()
    {
        if (GameProgress.GetBool("show_content_limit_popup", false, GameProgress.Location.Local, null))
        {
            GameProgress.DeleteKey("show_content_limit_popup", GameProgress.Location.Local);
            LevelInfo.DisplayContentLimitNotification();
        }
        Transform transform = base.transform.Find("RightButtons/SandboxToggle/SandBox_Toggle(Clone)");

        if (transform != null)
        {
            this.m_buttonToggleAnimation = transform.GetComponent <Animation>();
        }
        if (this.m_buttonToggleAnimation != null)
        {
            AnimationClip clip = this.m_buttonToggleAnimation.GetClip("Sandbox_Toggle");
            if (clip != null)
            {
                this.m_buttonToggleAnimation.clip = clip;
                AnimationState animationState = this.m_buttonToggleAnimation["Sandbox_Toggle"];
                animationState.enabled        = true;
                animationState.speed          = 0f;
                animationState.normalizedTime = ((!this.m_isRotated) ? 0.5f : 1f);
                this.m_buttonToggleAnimation.Play();
                this.m_buttonToggleAnimation.Sample();
                this.m_buttonToggleAnimation.Stop();
            }
        }
    }
Exemplo n.º 5
0
 private void Awake()
 {
     if (GameProgress.GetBool(this.key, false, GameProgress.Location.Local, null))
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
Exemplo n.º 6
0
    public void LoadLevel(string levelIndex)
    {
        if (this.startedLevelLoading)
        {
            return;
        }
        this.startedLevelLoading = true;
        this.SendStandardFlurryEvent("Select Level", levelIndex);
        int num = int.Parse(levelIndex);

        if (num >= 0)
        {
            if (this.m_oneTimeCutscene.enabled && !GameProgress.GetBool(this.m_oneTimeCutscene.saveId, false, GameProgress.Location.Local, null))
            {
                Singleton <GameManager> .Instance.LoadLevelAfterCutScene(this.m_levels[num], this.m_oneTimeCutscene.cutScene);

                GameProgress.SetBool(this.m_oneTimeCutscene.saveId, true, GameProgress.Location.Local);
            }
            else
            {
                Singleton <GameManager> .Instance.LoadLevel(num);
            }
            return;
        }
        this.startedLevelLoading = false;
    }
Exemplo n.º 7
0
 private void Start()
 {
     if (GameProgress.GetBool("show_content_limit_popup", false, GameProgress.Location.Local, null))
     {
         GameProgress.DeleteKey("show_content_limit_popup", GameProgress.Location.Local);
         LevelInfo.DisplayContentLimitNotification();
     }
 }
Exemplo n.º 8
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));
     }
 }
Exemplo n.º 9
0
    protected override void Start()
    {
        base.Start();
        this.m_disablingGoal = false;
        bool @bool = GameProgress.GetBool("SECRET_DISCOVERED_" + Singleton <GameManager> .Instance.CurrentSceneName, false, GameProgress.Location.Local, null);

        if (@bool)
        {
            this.DisableGoal(true);
        }
    }
Exemplo n.º 10
0
    protected override void Start()
    {
        base.Start();
        this.pls = base.GetComponent <PointLightSource>();
        bool @bool = GameProgress.GetBool("SECRET_DISCOVERED_" + Singleton <GameManager> .Instance.CurrentSceneName + "_statue", false, GameProgress.Location.Local, null);

        if (@bool)
        {
            this.DisableGoal(true);
        }
    }
Exemplo n.º 11
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;
    }
Exemplo n.º 12
0
 private void OnEnable()
 {
     this.InitAnimationStates(this.isButtonOut, new AnimationState[]
     {
         base.GetComponent <Animation>()["ToolBoxButtonSlide"],
         this.m_button.GetComponent <Animation>()["ToolBoxButton"]
     });
     this.m_button.transform.Find("Gear").transform.rotation = Quaternion.identity;
     this.EnableRendererRecursively(base.gameObject, this.isButtonOut);
     this.ActivateToggleList(!this.isButtonOut);
     this.m_powerupTutorialShown = GameProgress.GetBool("PowerupTutorialShown", false, GameProgress.Location.Local, null);
 }
Exemplo n.º 13
0
    private void InitializeConditions()
    {
        this.check = new ConditionCheck[this.conditionCount];
        string autoBuild           = Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available";
        bool   gameCenterAvailable = DeviceInfo.ActiveDeviceFamily == DeviceInfo.DeviceFamily.Ios;
        bool   chiefPigExploded    = GameProgress.GetBool("ChiefPigExploded", false, GameProgress.Location.Local, null);
        bool   iapEnabled          = Singleton <BuildCustomizationLoader> .Instance.IAPEnabled;
        bool   isCheat             = Singleton <BuildCustomizationLoader> .Instance.CheatsEnabled;
        bool   isDebug             = Singleton <BuildCustomizationLoader> .Instance.IsDevelopmentBuild;
        bool   lessCheats          = Singleton <BuildCustomizationLoader> .Instance.LessCheats;
        bool   boughtFoD           = GameProgress.GetSandboxUnlocked("S-F");

        this.check[0]  = (() => false);
        this.check[1]  = (() => this.m_levelManager != null && this.m_levelManager.ContraptionProto != null && this.m_levelManager.ContraptionProto.ValidateContraption() && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.ShowingUnlockedParts);
        this.check[2]  = (() => this.m_levelManager != null && this.m_levelManager.ContraptionRunning != null && this.m_levelManager.ContraptionRunning.HasEngine && this.m_levelManager.ContraptionRunning.EnginePoweredPartTypeCount() > 1);
        this.check[3]  = (() => true);
        this.check[4]  = (() => this.m_levelManager != null && this.m_levelManager.gameState == LevelManager.GameState.PausedWhileRunning);
        this.check[5]  = (() => this.m_levelManager != null && this.m_levelManager.ContraptionProto.DynamicPartCount() > 0);
        this.check[6]  = (() => false);
        this.check[7]  = (() => true);
        this.check[8]  = (() => this.m_levelManager.gameState == LevelManager.GameState.PausedWhileRunning);
        this.check[9]  = (() => true);
        this.check[10] = (() => true);
        this.check[11] = (() => true);
        this.check[12] = (() => true);
        this.check[13] = (() => false);
        this.check[14] = (() => this.m_levelManager != null && this.m_levelManager.m_autoBuildUnlocked && iapEnabled && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.ShowingUnlockedParts && !GameProgress.GetBool(autoBuild, false, GameProgress.Location.Local, null) && GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null));
        this.check[15] = (() => this.m_levelManager != null && this.m_levelManager.TutorialBookPage != null && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.ShowingUnlockedParts);
        this.check[16] = (() => (this.m_levelManager != null && this.m_levelManager.gameState == LevelManager.GameState.AutoBuilding) || this.m_levelManager.gameState == LevelManager.GameState.SuperAutoBuilding);
        this.check[17] = (() => this.m_levelManager != null && this.m_levelManager.ContraptionProto != null && this.m_levelManager.ContraptionProto.DynamicPartCount() > 0 && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.ShowingUnlockedParts);
        this.check[18] = (() => this.m_levelManager != null && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding);
        this.check[19] = (() => this.m_levelManager != null && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.ShowingUnlockedParts);
        this.check[20] = (() => iapEnabled);
        this.check[21] = (() => chiefPigExploded);
        this.check[22] = (() => this.m_levelManager != null && GameProgress.GetBool(autoBuild, false, GameProgress.Location.Local, null) && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding);
        this.check[23] = (() => this.m_levelManager != null && this.m_levelManager.m_sandbox);
        this.check[24] = (() => this.m_levelManager != null && this.m_levelManager.m_sandbox && this.m_levelManager.gameState != LevelManager.GameState.AutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.SuperAutoBuilding && this.m_levelManager.gameState != LevelManager.GameState.ShowingUnlockedParts);
        this.check[28] = (() => gameCenterAvailable);
        this.check[29] = (() => Singleton <BuildCustomizationLoader> .Instance.IsContentLimited);
        this.check[30] = (() => Singleton <BuildCustomizationLoader> .Instance.IsHDVersion);
        this.check[31] = (() => Singleton <BuildCustomizationLoader> .Instance.IsOdyssey);
        this.check[32] = (() => DeviceInfo.ActiveDeviceFamily == DeviceInfo.DeviceFamily.Ios);
        this.check[33] = (() => isCheat);
        this.check[34] = (() => isDebug);
        this.check[35] = (() => FreeLootCrate.FreeShopLootCrateCollected);
        this.check[36] = CustomizationManager.HasNewParts;
        this.check[37] = (() => lessCheats);
        this.check[38] = (() => Singleton <NetworkManager> .IsInstantiated() && Singleton <NetworkManager> .Instance.HasNetworkAccess);
        this.check[39] = (() => boughtFoD);
        this.check[40] = (() => Singleton <DailyChallenge> .Instance.HasChallenge && Singleton <DailyChallenge> .Instance.Left == 0);
        this.check[41] = (() => this.m_levelManager != null && this.m_levelManager.CurrentGameMode is CakeRaceMode);
        this.check[42] = (() => Singleton <TimeManager> .IsInstantiated() && Singleton <TimeManager> .Instance.CurrentTime.Month == 12);
    }
Exemplo n.º 14
0
    private void CheckWiggle()
    {
        bool @bool = GameProgress.GetBool("ChiefPigExploded", false, GameProgress.Location.Local, null);
        bool bool2 = GameProgress.GetBool("Kingpig_Visited", false, GameProgress.Location.Local, null);

        if (!Singleton <BuildCustomizationLoader> .Instance.IsChina)
        {
            base.gameObject.SetActive(@bool);
        }
        if (!bool2 || (this.HasDesserts() && KingPigFeedButton.LastDessertCount != KingPigFeedButton.CurrentDessertCount()))
        {
            this.Wiggle();
        }
    }
Exemplo n.º 15
0
    public void LoadStarLevel(string levelIndex)
    {
        this.SendStandardFlurryEvent("Select Level", levelIndex);
        if (this.m_oneTimeCutscene.enabled && !GameProgress.GetBool(this.m_oneTimeCutscene.saveId, false, GameProgress.Location.Local, null))
        {
            Singleton <GameManager> .Instance.LoadLevelAfterCutScene(this.m_levels[int.Parse(levelIndex)], this.m_oneTimeCutscene.cutScene);

            GameProgress.SetBool(this.m_oneTimeCutscene.saveId, true, GameProgress.Location.Local);
        }
        else
        {
            Singleton <GameManager> .Instance.LoadStarLevelTransition(this.m_levels[int.Parse(levelIndex)]);
        }
    }
Exemplo n.º 16
0
    protected override void ButtonAwake()
    {
        bool flag  = WorkshopMenu.FirstLootCrateCollected || WorkshopMenu.AnyLootCrateCollected;
        bool @bool = GameProgress.GetBool("Workshop_Visited", false, GameProgress.Location.Local, null);

        base.gameObject.SetActive(flag);
        if (flag && !@bool)
        {
            this.Wiggle();
        }
        else if (!flag && !@bool)
        {
            FreeLootCrate.OnFreeLootCrateCollected = (Action)Delegate.Combine(FreeLootCrate.OnFreeLootCrateCollected, new Action(this.ButtonAwake));
            IapManager.onPurchaseSucceeded        += this.OnItemPurchase;
        }
    }
Exemplo n.º 17
0
    public void UnlockSequence(bool forcePlayUnlock = false)
    {
        string key = string.Format("UnlockShown_{0}", base.gameObject.name);

        if (!string.IsNullOrEmpty(this.unlock) && (forcePlayUnlock || !GameProgress.GetBool(key, false, GameProgress.Location.Local, null)))
        {
            this.skeletonAnimation.state.ClearTracks();
            this.skeletonAnimation.state.AddAnimation(0, this.unlock, false, 0f);
            GameProgress.SetBool(key, true, GameProgress.Location.Local);
            if (!string.IsNullOrEmpty(this.unlockedIdle))
            {
                this.skeletonAnimation.state.AddAnimation(0, this.unlockedIdle, true, 0f);
            }
            this.idleSet = true;
            this.locked  = false;
        }
    }
Exemplo n.º 18
0
    private void Awake()
    {
        if (GameTime.IsPaused())
        {
            GameTime.Pause(false);
        }
        this.m_page = UserSettings.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_active_page", 0);
        if (GameProgress.GetBool("show_content_limit_popup", false, GameProgress.Location.Local, null))
        {
            GameProgress.DeleteKey("show_content_limit_popup", GameProgress.Location.Local);
            if (Singleton <BuildCustomizationLoader> .Instance.IsContentLimited)
            {
                if (this.m_page == 0)
                {
                    EventManager.SendOnNextUpdate(this, new PulseButtonEvent(UIEvent.Type.OpenUnlockFullVersionIapMenu, false));
                    LevelInfo.DisplayContentLimitNotification();
                }
            }
            else
            {
                LevelInfo.DisplayContentLimitNotification();
            }
        }
        this.Levels                = WPFMonoBehaviour.gameData.m_episodeLevels[this.EpisodeIndex].m_levelInfos;
        this.StarLevelLimits       = WPFMonoBehaviour.gameData.m_episodeLevels[this.EpisodeIndex].StarLevelLimits;
        this.m_pageCount           = Mathf.RoundToInt((float)(this.m_levels.Count / this.m_levelsPerPage));
        this.m_buttonGrid          = base.transform.Find("ButtonGrid").GetComponent <ButtonGrid>();
        this.m_currentScreenWidth  = Screen.width;
        this.m_currentScreenHeight = Screen.height;
        this.m_page                = Mathf.Min(this.m_page, this.m_pageCount);
        Singleton <GameManager> .Instance.OpenEpisode(this);

        this.CreateButtons();
        this.CreatePageDots();
        this.LayoutButtons(this.m_page);
        if (DeviceInfo.UsesTouchInput)
        {
            this.m_leftScroll.SetActive(false);
            this.m_rightScroll.SetActive(false);
        }
        if (GameProgress.TotalDessertCount() > 0)
        {
            EventManager.Send(new PulseButtonEvent(UIEvent.Type.None, true));
        }
    }
Exemplo n.º 19
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);
         }
     }
 }
Exemplo n.º 20
0
    public IEnumerator LoadLevelDelayed(string episodeBundleId, int levelIndex)
    {
        while (!Bundle.IsBundleLoaded(episodeBundleId))
        {
            yield return(null);
        }
        if (this.m_oneTimeCutscene.enabled && !GameProgress.GetBool(this.m_oneTimeCutscene.saveId, false, GameProgress.Location.Local, null))
        {
            Singleton <GameManager> .Instance.LoadLevelAfterCutScene(this.m_levels[levelIndex], this.m_oneTimeCutscene.cutScene);

            GameProgress.SetBool(this.m_oneTimeCutscene.saveId, true, GameProgress.Location.Local);
        }
        else
        {
            Singleton <GameManager> .Instance.LoadLevel(levelIndex);
        }
        yield break;
    }
Exemplo n.º 21
0
 public void OpenLeaderboardDialog()
 {
     if (this.leaderboardDialogPrefab == null)
     {
         return;
     }
     if (this.leaderboardDialog == null)
     {
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.leaderboardDialogPrefab, 15f * Vector3.back + Vector3.down, Quaternion.identity);
         this.leaderboardDialog = gameObject.GetComponent <LeaderboardDialog>();
     }
     this.leaderboardDialog.Open();
     if (!GameProgress.GetBool("leaderboard_opened", false, GameProgress.Location.Local, null))
     {
         GameProgress.SetBool("leaderboard_opened", true, GameProgress.Location.Local);
         Transform transform = this.leaderboardButton.transform.Find("NewContentTag");
         transform.gameObject.SetActive(false);
     }
 }
Exemplo n.º 22
0
 private void Start()
 {
     if (GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_Rotation_Tutorial_Completed", false, GameProgress.Location.Local, null))
     {
         this.m_state = RotationTutorial.State.Stopped;
         return;
     }
     EventManager.Connect(new EventManager.OnEvent <GameStateChanged>(this.ReceiveGameStateChanged));
     this.m_pointerVisual  = UnityEngine.Object.Instantiate <GameObject>(this.m_pointerPrefab);
     this.m_clickIndicator = UnityEngine.Object.Instantiate <GameObject>(this.m_clickIndicatorPrefab);
     this.m_rotationIcon   = UnityEngine.Object.Instantiate <GameObject>(this.m_rotationIconPrefab);
     this.m_clickIndicator.SetActive(false);
     this.SetRenderQueue(this.m_pointerVisual, 3002);
     this.SetRenderQueue(this.m_clickIndicator, 3002);
     this.SetRenderQueue(this.m_rotationIcon, 3002);
     this.m_pointer             = new Pointer(this.m_pointerVisual, this.m_clickIndicator, this.m_rotationIcon);
     this.m_acceptablePartsList = new List <BasePart.PartType>();
     this.m_acceptablePartsList.Add(BasePart.PartType.CokeBottle);
     this.m_acceptablePartsList.Add(BasePart.PartType.SpringBoxingGlove);
     this.m_acceptablePartsList.Add(BasePart.PartType.GrapplingHook);
 }
Exemplo n.º 23
0
    private void OnCollisionEnter(Collision col)
    {
        bool flag = false;

        foreach (ContactPoint contactPoint in col.contacts)
        {
            if (contactPoint.otherCollider.tag == "Contraption")
            {
                flag = true;
                break;
            }
        }
        if (flag)
        {
            this.m_contraptionHit = true;
            if (Singleton <SocialGameManager> .IsInstantiated() && !GameProgress.GetBool("bird_hit", false, GameProgress.Location.Local, null))
            {
                GameProgress.SetBool("bird_hit", true, GameProgress.Location.Local);
                Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.CANNON_FODDER", 100.0);
            }
        }
    }
Exemplo n.º 24
0
    private void PlaceDesserts(bool forceFillAllPlaces = false)
    {
        if (!GameProgress.GetBool("ChiefPigExploded", false, GameProgress.Location.Local, null) && !forceFillAllPlaces)
        {
            return;
        }
        GameObject gameObject = GameObject.Find("DessertPlaces");

        if (gameObject == null)
        {
            return;
        }
        if (forceFillAllPlaces || !this.levelManager.LoadDessertsPlacement(gameObject))
        {
            this.levelManager.UsedDessertPlaces.Clear();
            int            max   = base.gameData.m_desserts.Count - 1;
            DessertPlace[] array = UnityEngine.Object.FindObjectsOfType <DessertPlace>();
            if (array.Length > 0)
            {
                int num = array.Length - 1;
                while (--num >= 1)
                {
                    int          num2         = UnityEngine.Random.Range(0, num + 1);
                    DessertPlace dessertPlace = array[num];
                    array[num]  = array[num2];
                    array[num2] = dessertPlace;
                }
                int levelDessertsCount = this.levelManager.LevelDessertsCount;
                int num3 = (levelDessertsCount <= array.Length && !forceFillAllPlaces) ? levelDessertsCount : array.Length;
                int num4 = -1;
                if (UnityEngine.Random.Range(0, 100) == 50)
                {
                    num4 = UnityEngine.Random.Range(0, num3);
                }
                for (int i = 0; i < num3; i++)
                {
                    Transform  transform   = array[i].transform;
                    GameObject gameObject2 = base.gameData.m_desserts[UnityEngine.Random.Range(0, max)];
                    if (num4 == i)
                    {
                        gameObject2 = base.gameData.m_desserts[base.gameData.m_desserts.Count - 1];
                    }
                    else
                    {
                        gameObject2 = base.gameData.m_desserts[UnityEngine.Random.Range(0, max)];
                    }
                    GameObject gameObject3 = UnityEngine.Object.Instantiate(gameObject2, transform.position, transform.rotation);
                    gameObject3.name = gameObject2.name;
                    gameObject3.GetComponent <Dessert>().place = transform.GetComponent <DessertPlace>();
                    this.levelManager.UsedDessertPlaces.Add(transform.name, gameObject3.GetComponent <Dessert>().saveId);
                }
                if (this.levelManager.UsedDessertPlaces.Count > 0)
                {
                    int      num5   = 0;
                    string[] array2 = new string[this.levelManager.UsedDessertPlaces.Count];
                    foreach (KeyValuePair <string, string> x in this.levelManager.UsedDessertPlaces)
                    {
                        array2[num5] = x.Key + ":" + x.Value;
                        num5++;
                    }
                    string value = string.Join(";", array2);
                    string key   = Singleton <GameManager> .Instance.CurrentSceneName + "_dessert_placement";
                    GameProgress.SetString(key, value, GameProgress.Location.Local);
                }
            }
        }
    }
Exemplo n.º 25
0
    public override LevelManager.GameState SetGameState(LevelManager.GameState currentState, LevelManager.GameState newState)
    {
        LevelManager.GameState gameState = currentState;
        switch (newState)
        {
        case LevelManager.GameState.Building:
            if (GameTime.IsPaused())
            {
                GameTime.Pause(false);
            }
            if (currentState == LevelManager.GameState.Running || currentState == LevelManager.GameState.PausedWhileRunning)
            {
                base.StopRunningContraption();
                this.retries++;
                if (this.retries == 3 && !this.levelManager.m_sandbox && !this.tutorialBookOpened)
                {
                    int num = GameProgress.GetInt("Tutorial_Promotion_Count", 0, GameProgress.Location.Local, null);
                    if (num < 3 && !GameProgress.IsLevelCompleted(Singleton <GameManager> .Instance.CurrentSceneName) && GameProgress.GetInt(this.TutorialPromotionCount, 0, GameProgress.Location.Local, null) == 0)
                    {
                        this.openTutorial = true;
                        num++;
                        GameProgress.SetInt("Tutorial_Promotion_Count", num, GameProgress.Location.Local);
                        GameProgress.SetInt(this.TutorialPromotionCount, 1, GameProgress.Location.Local);
                    }
                }
                bool @bool = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null);
                bool bool2 = GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null);
                if (!this.levelManager.m_sandbox && this.retries % 5 == 0 && AdvertisementHandler.GetRewardNativeTexture() != null)
                {
                    int @int = GameProgress.GetInt("branded_reward_gifts_today", 0, GameProgress.Location.Local, null);
                    int num2 = 2;
                    if (Singleton <GameConfigurationManager> .IsInstantiated() && Singleton <GameConfigurationManager> .Instance.HasValue("branded_reward_gift_count", "count"))
                    {
                        num2 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("branded_reward_gift_count", "count");
                    }
                    if (@int < num2)
                    {
                        if (!GameProgress.HasKey("branded_reward_gift_time", GameProgress.Location.Local, null))
                        {
                            GameProgress.SetInt("branded_reward_gift_time", Singleton <TimeManager> .Instance.CurrentEpochTime, GameProgress.Location.Local);
                        }
                        GameProgress.SetInt("branded_reward_gifts_today", @int + 1, GameProgress.Location.Local);
                        this.openMechanicGift = true;
                    }
                }
            }
            if (this.levelManager.m_toolboxOpenUponShopActivation)
            {
                this.levelManager.InGameGUI.BuildMenu.ToolboxButton.OnPressed();
            }
            this.levelManager.SetupDynamicObjects();
            base.ContraptionProto.SetVisible(true);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(true, true);
            }
            if (GameProgress.GetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local, null) == SceneManager.GetActiveScene().name&& LightManager.enabledLightPositions != null && LightManager.enabledLightPositions.Count > 0)
            {
                PointLightSource[] array = UnityEngine.Object.FindObjectsOfType <PointLightSource>();
                for (int i = 0; i < array.Length; i++)
                {
                    if (LightManager.enabledLightPositions.Contains(array[i].transform.position))
                    {
                        array[i].isEnabled = true;
                    }
                }
                GameProgress.SetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local);
            }
            break;

        case LevelManager.GameState.Preview:
            this.levelManager.m_previewSpeed = 1f;
            this.levelManager.m_previewTime  = 0f;
            base.ContraptionProto.SetVisible(false);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, true);
            }
            break;

        case LevelManager.GameState.PreviewMoving:
            this.levelManager.m_previewTime = 0f;
            base.ContraptionProto.SetVisible(false);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, true);
            }
            this.levelManager.SetupDynamicObjects();
            break;

        case LevelManager.GameState.PreviewWhileBuilding:
            if (this.levelManager.EggRequired)
            {
                this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_eggTransportGoal);
            }
            else if (this.levelManager.PumpkinRequired)
            {
                this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_pumpkinTransportGoal);
            }
            else
            {
                this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_basicGoal);
            }
            this.levelManager.InGameGUI.PreviewMenu.SetChallenges(this.levelManager.Challenges);
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, true);
            }
            this.levelManager.PreviewCenter     = base.ContraptionProto.transform.position;
            this.levelManager.m_previewDragging = false;
            break;

        case LevelManager.GameState.PreviewWhileRunning:
            this.levelManager.PreviewCenter = base.ContraptionRunning.transform.position;
            GameTime.Pause(true);
            this.levelManager.m_previewDragging = false;
            break;

        case LevelManager.GameState.Running:
            if (GameTime.IsPaused())
            {
                GameTime.Pause(false);
            }
            this.levelManager.TimeElapsed = 0f;
            this.levelManager.PartsInGoal.Clear();
            this.levelManager.TimeStarted      = false;
            this.levelManager.PigStartPosition = base.ContraptionProto.FindPig().transform.position;
            if (this.levelManager.ConstructionUI)
            {
                this.levelManager.ConstructionUI.SetEnabled(false, false);
            }
            base.ContraptionRunning = base.ContraptionProto.Clone();
            base.ContraptionProto.SetVisible(false);
            if (base.ContraptionProto.HasRegularGlue)
            {
                if (!base.ContraptionProto.HasGluedParts)
                {
                    GameProgress.AddSuperGlue(1);
                }
                base.ContraptionProto.RemoveSuperGlue();
            }
            if (base.ContraptionProto.HasSuperMagnet)
            {
                base.ContraptionProto.HasSuperMagnet = false;
            }
            if (base.ContraptionProto.HasNightVision)
            {
                this.levelManager.LightManager.ToggleNightVision();
                base.ContraptionProto.HasNightVision = false;
            }
            base.ContraptionRunning.StartContraption();
            if (base.ContraptionProto.HasTurboCharge)
            {
                base.ContraptionProto.HasTurboCharge = false;
            }
            base.ContraptionRunning.SaveContraption(base.GetCurrentContraptionName());
            break;

        case LevelManager.GameState.Continue:
            if (GameTime.IsPaused())
            {
                GameTime.Pause(false);
            }
            if (gameState == LevelManager.GameState.Building || gameState == LevelManager.GameState.PausedWhileBuilding)
            {
                newState = LevelManager.GameState.Building;
            }
            else if (gameState == LevelManager.GameState.CustomizingPart)
            {
                newState = LevelManager.GameState.CustomizingPart;
            }
            else if (!this.levelManager.HasCompleted && gameState == LevelManager.GameState.LootCrateOpening)
            {
                newState = LevelManager.GameState.Running;
            }
            else
            {
                newState = ((!this.levelManager.HasCompleted) ? LevelManager.GameState.Running : LevelManager.GameState.Completed);
            }
            break;

        case LevelManager.GameState.Completed:
            this.levelManager.InGameGUI.ShowCurrentMenu(false);
            base.ContraptionRunning.TurnOffAllPoweredParts();
            this.levelManager.PlayVictorySound();
            if (this.levelManager.EggRequired)
            {
                this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_eggTransportGoal);
            }
            else if (this.levelManager.PumpkinRequired)
            {
                this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_pumpkinTransportGoal);
            }
            else
            {
                this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_basicGoal);
            }
            this.levelManager.InGameGUI.LevelCompleteMenu.SetChallenges(this.levelManager.Challenges);
            break;

        case LevelManager.GameState.PausedWhileRunning:
            GameTime.Pause(true);
            break;

        case LevelManager.GameState.PausedWhileBuilding:
            GameTime.Pause(true);
            break;

        case LevelManager.GameState.AutoBuilding:
            this.levelManager.StartAutoBuild(this.levelManager.m_oneStarContraption);
            break;

        case LevelManager.GameState.ShowingUnlockedParts:
            GameTime.Pause(false);
            this.levelManager.UnlockedParts     = new List <ConstructionUI.PartDesc>(this.levelManager.ConstructionUI.UnlockedParts);
            this.levelManager.UnlockedPartIndex = -1;
            this.levelManager.PartShowTimer     = 0f;
            break;

        case LevelManager.GameState.Snapshot:
            GameTime.Pause(true);
            this.levelManager.InGameGUI.ShowCurrentMenu(false);
            WPFMonoBehaviour.ingameCamera.TakeSnapshot(new Action(this.levelManager.HandleSnapshotFinished));
            break;

        case LevelManager.GameState.SuperAutoBuilding:
            this.levelManager.StartAutoBuild(this.levelManager.m_threeStarContraption[this.levelManager.CurrentSuperBluePrint]);
            if (Singleton <SocialGameManager> .IsInstantiated())
            {
                Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.CHIPS_FOR_WHIPS", 100.0);
            }
            break;
        }
        currentState = newState;
        return(currentState);
    }
Exemplo n.º 26
0
    protected override bool HandleUIEvent(UIEvent data)
    {
        switch (data.type)
        {
        case UIEvent.Type.Building:
            this.levelManager.ConstructionUI.transform.position   = this.levelManager.StartingPosition;
            this.levelManager.ContraptionProto.transform.position = this.levelManager.StartingPosition;
            this.levelManager.ConstructionUI.CheckUnlockedParts();
            break;

        case UIEvent.Type.LevelSelection:
            if (this.levelManager.gameState == LevelManager.GameState.PausedWhileBuilding)
            {
                if (this.levelManager.ContraptionProto.HasSuperGlue)
                {
                    GameProgress.AddSuperGlue(1);
                }
                if (this.levelManager.ContraptionProto.HasSuperMagnet)
                {
                    GameProgress.AddSuperMagnet(1);
                }
                if (this.levelManager.ContraptionProto.HasTurboCharge)
                {
                    GameProgress.AddTurboCharge(1);
                }
                if (this.levelManager.ContraptionProto.HasNightVision)
                {
                    GameProgress.AddNightVision(1);
                }
            }
            break;

        case UIEvent.Type.NextLevel:
            break;

        case UIEvent.Type.Pause:
            break;

        case UIEvent.Type.Blueprint:
            if (GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null))
            {
                if (this.levelManager.m_threeStarContraption.Count == 1)
                {
                    GameProgress.SetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", true, GameProgress.Location.Local);
                }
                this.levelManager.SetGameState(LevelManager.GameState.AutoBuilding);
            }
            break;

        case UIEvent.Type.ReplayLevel:
            break;

        case UIEvent.Type.ContinueFromPause:
            break;

        case UIEvent.Type.CloseMechanicInfo:
            this.levelManager.SetGameState(LevelManager.GameState.Building);
            break;

        case UIEvent.Type.CloseMechanicInfoAndUseMechanic:
            this.levelManager.SetGameState(LevelManager.GameState.Building);
            Singleton <GuiManager> .Instance.IsEnabled = false;
            this.levelManager.UseBlueprint             = true;
            break;

        case UIEvent.Type.SuperBlueprint:
            if (this.levelManager.SuperBluePrintsAllowed && this.levelManager.m_threeStarContraption.Count > 0 && this.levelManager.gameState == LevelManager.GameState.Building && WPFMonoBehaviour.ingameCamera.IsShowingBuildGrid(1f))
            {
                bool flag = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null);
                int  num  = GameProgress.BluePrintCount();
                if (num == 0 && !flag)
                {
                    Singleton <GuiManager> .Instance.IsEnabled = true;
                    this.levelManager.ShowPurchaseDialog(IapManager.InAppPurchaseItemType.BlueprintSingle);
                }
                else
                {
                    if (!flag && num > 0)
                    {
                        GameProgress.SetBluePrintCount(--num);
                        GameProgress.SetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", true, GameProgress.Location.Local);
                        flag = true;
                        GameProgress.Save();
                        EventManager.Send(new InGameBuildMenu.AutoBuildEvent(num, true));
                    }
                    GameObject superBuildSelection = this.levelManager.InGameGUI.BuildMenu.SuperBuildSelection;
                    if (flag && !superBuildSelection.gameObject.activeSelf)
                    {
                        GameObject autoBuildButton = this.levelManager.InGameGUI.BuildMenu.AutoBuildButton;
                        autoBuildButton.SetActive(false);
                        superBuildSelection.SetActive(true);
                    }
                    if (flag)
                    {
                        EventManager.Send(new UIEvent(UIEvent.Type.RotateSuperBluePrints));
                    }
                }
            }
            break;

        case UIEvent.Type.RotateSuperBluePrints:
        {
            int    count = this.levelManager.m_threeStarContraption.Count;
            string text  = "ABCDEFGH";
            this.levelManager.CurrentSuperBluePrint++;
            if (this.levelManager.CurrentSuperBluePrint >= count)
            {
                this.levelManager.CurrentSuperBluePrint = 0;
            }
            GameObject superBuildSelection2 = this.levelManager.InGameGUI.BuildMenu.SuperBuildSelection;
            if (superBuildSelection2 != null)
            {
                Transform transform  = superBuildSelection2.transform.Find("AmountText");
                Transform transform2 = superBuildSelection2.transform.Find("AmountTextShadow");
                if (transform.GetComponent <TextMesh>().text == string.Empty)
                {
                    this.levelManager.CurrentSuperBluePrint = 0;
                }
                transform.GetComponent <TextMesh>().text  = text[this.levelManager.CurrentSuperBluePrint].ToString();
                transform2.GetComponent <TextMesh>().text = text[this.levelManager.CurrentSuperBluePrint].ToString();
            }
            this.levelManager.SetGameState(LevelManager.GameState.SuperAutoBuilding);
            if (!this.levelManager.FirstTime)
            {
                this.levelManager.FastBuilding = true;
            }
            else
            {
                this.levelManager.FirstTime = false;
            }
            break;
        }

        case UIEvent.Type.CloseMechanicInfoAndUseSuperMechanic:
            this.levelManager.SetGameState(LevelManager.GameState.Building);
            if (this.levelManager.SuperBluePrintsAllowed && this.levelManager.m_threeStarContraption.Count > 0)
            {
                Singleton <GuiManager> .Instance.IsEnabled = false;
                this.levelManager.UseSuperBlueprint        = true;
            }
            else
            {
                Singleton <GuiManager> .Instance.IsEnabled = true;
            }
            break;
        }
        return(false);
    }
Exemplo n.º 27
0
 private ChallengeInfo LoadDailyChallenge(int index)
 {
     return(new ChallengeInfo(GameProgress.GetString(string.Format("DailyChallenge_{0}_LevelName", index), string.Empty, GameProgress.Location.Local, null), GameProgress.GetInt(string.Format("DailyChallenge_{0}_EpisodeIndex", index), -1, GameProgress.Location.Local, null), GameProgress.GetInt(string.Format("DailyChallenge_{0}_LevelIndex", index), -1, GameProgress.Location.Local, null), GameProgress.GetInt(string.Format("DailyChallenge_{0}_PositionIndex", index), -1, GameProgress.Location.Local, null), GameProgress.GetBool(string.Format("DailyChallenge_{0}_Collected", index), false, GameProgress.Location.Local, null), GameProgress.GetBool(string.Format("DailyChallenge_{0}_Revealed", index), Singleton <BuildCustomizationLoader> .Instance.IsOdyssey, GameProgress.Location.Local, null), GameProgress.GetBool(string.Format("DailyChallenge_{0}_AdRevealed", index), false, GameProgress.Location.Local, null)));
 }
Exemplo n.º 28
0
    private void Fly()
    {
        float magnitude = base.rigidbody.velocity.magnitude;

        if (this.m_previousSpeed - magnitude > 5f)
        {
            this.m_animation.Play("Hit");
            this.m_isCollided = true;
        }
        this.m_previousSpeed = magnitude;
        if (this.m_speedBoost > 0f && !this.m_boosted)
        {
            Vector3 position = this.m_target.transform.position;
            if (Vector3.SqrMagnitude(base.transform.position - position) < 0.5f * Vector3.SqrMagnitude(this.m_slingshotRestPosition - position))
            {
                this.m_boosted          = true;
                base.rigidbody.velocity = this.m_speedBoost * base.rigidbody.velocity;
            }
        }
        if (this.m_split > 0 && !this.m_splitDone)
        {
            Vector3 position2 = this.m_target.transform.position;
            if (Vector3.SqrMagnitude(base.transform.position - position2) < 0.5f * Vector3.SqrMagnitude(this.m_slingshotRestPosition - position2))
            {
                this.Split();
            }
        }
        SphereCollider sphereCollider = base.collider as SphereCollider;
        float          num            = 0.02f * base.rigidbody.velocity.magnitude;

        this.m_speed = 0.8f * this.m_speed + 0.2f * base.rigidbody.velocity.magnitude;
        if (this.m_speed < 0.75f && !this.m_collisionsRemoved)
        {
            base.gameObject.layer    = LayerMask.NameToLayer("Bird");
            this.m_collisionsRemoved = true;
            this.SetState(Bird.State.KnockedOut);
            num = 0f;
            if (sphereCollider)
            {
                sphereCollider.radius = this.ColliderRadius;
            }
            foreach (Collider collider in this.m_ignoredCollisions)
            {
                Physics.IgnoreCollision(base.collider, collider, false);
            }
            if (Singleton <SocialGameManager> .IsInstantiated() && !this.m_contraptionHit && !GameProgress.GetBool("bird_evaded", false, GameProgress.Location.Local, null))
            {
                GameProgress.SetBool("bird_evaded", true, GameProgress.Location.Local);
                Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.NER_NER", 100.0);
            }
        }
        if (sphereCollider && this.m_state == Bird.State.Fly)
        {
            float radius = Mathf.Max(0.75f * num, this.m_colliderRadius);
            sphereCollider.radius = radius;
        }
    }
Exemplo n.º 29
0
 private void OnEnable()
 {
     KeyListener.keyReleased += this.HandleKeyListenerKeyReleased;
     if (GameProgress.HasKey("CakeRaceUnlockShown", GameProgress.Location.Local, null) && !GameProgress.GetBool("CakeRaceUnlockShown", false, GameProgress.Location.Local, null))
     {
         this.ForceCakeRaceButton();
     }
 }
Exemplo n.º 30
0
    private void Awake()
    {
        if (string.IsNullOrEmpty(this.m_episodeBundleName))
        {
            GameManager.EpisodeType type = this.m_type;
            if (type != GameManager.EpisodeType.Normal)
            {
                if (type != GameManager.EpisodeType.Race)
                {
                    if (type == GameManager.EpisodeType.Sandbox)
                    {
                        this.m_episodeBundleName = "Episode_Sandbox_Levels";
                    }
                }
                else
                {
                    this.m_episodeBundleName = "Episode_Race_Levels";
                }
            }
            else
            {
                this.m_episodeBundleName = Bundle.GetAssetBundleID(this.m_episodeLevelsGameDataIndex);
            }
        }
        //if (this.m_contentLock)
        //{
        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_contentLock);

        gameObject.transform.parent        = base.gameObject.transform;
        gameObject.transform.localPosition = new Vector3(0f, -0.5f, 0f);
        gameObject.GetComponent <ContentLock>().Activate(false);
        //}

        /*if (!Bundle.HasBundle(this.m_episodeBundleName) && this.m_contentNotAvailable)
         * {
         *      Button component = base.GetComponent<Button>();
         *      if (component != null)
         *      {
         *              UnityEngine.Object.DestroyImmediate(component);
         *      }
         *      GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(this.m_contentNotAvailable);
         *      gameObject2.transform.parent = base.gameObject.transform;
         *      gameObject2.transform.localPosition = new Vector3(0f, -0.5f, 0f);
         *      if (this.m_hideOnContentNotAvailable != null)
         *      {
         *              for (int i = 0; i < this.m_hideOnContentNotAvailable.Length; i++)
         *              {
         *                      if (this.m_hideOnContentNotAvailable[i] != null)
         *                      {
         *                              this.m_hideOnContentNotAvailable[i].SetActive(false);
         *                      }
         *              }
         *      }
         * }*/
        if (this.m_newContent && Bundle.HasBundle(this.m_episodeBundleName) && GameProgress.GetBool(this.m_episodeBundleName + "_new_content", true, GameProgress.Location.Local, null))
        {
            Transform transform = base.transform.Find("NewTag");
            if (transform)
            {
                this.m_newContent = UnityEngine.Object.Instantiate <GameObject>(this.m_newContent);
                this.m_newContent.transform.parent        = transform;
                this.m_newContent.transform.localPosition = Vector3.zero;
            }
            else
            {
                this.m_newContent = null;
            }
        }
        Transform transform2 = base.transform.Find("Background");

        if (transform2 != null)
        {
            this.materialInstance       = transform2.GetComponent <Renderer>().material;
            this.materialInstance.color = this.m_bgcolor;
            AtlasMaterials.Instance.AddMaterialInstance(this.materialInstance);
        }
        int num  = 0;
        int num2 = 0;

        if (this.m_type == GameManager.EpisodeType.Sandbox)
        {
            num = this.CalculateSandboxStars();
            foreach (SandboxLevels.LevelData levelData in WPFMonoBehaviour.gameData.m_sandboxLevels.Levels)
            {
                num2 += levelData.m_starBoxCount;
            }
        }
        else if (this.m_type == GameManager.EpisodeType.Race)
        {
            num  = this.CalculateRaceLevelStars();
            num2 = 3 * WPFMonoBehaviour.gameData.m_raceLevels.Levels.Count;
        }
        else
        {
            num  = this.CalculateEpisodeStars();
            num2 = 3 * WPFMonoBehaviour.gameData.m_episodeLevels[this.m_episodeLevelsGameDataIndex].LevelInfos.Count;
            if ((this.pageTwoComingSoon || this.pageThreeComingSoon) && num2 >= 90)
            {
                num2 -= 45 * ((!this.pageTwoComingSoon || !this.pageThreeComingSoon || num2 < 135) ? 1 : 2);
            }
        }
        Transform transform3 = base.transform.Find("StarText");

        if (transform3 != null)
        {
            transform3.GetComponent <TextMesh>().text = string.Concat(new object[]
            {
                string.Empty,
                num,
                "/",
                num2
            });
        }
        Transform transform4 = base.transform.Find("EpisodeAnimation");

        if (transform4 != null)
        {
            transform4.gameObject.AddComponent <UnityEngine.Rendering.SortingGroup>().sortingOrder = 1;
        }
    }