コード例 #1
0
ファイル: ButtonLock.cs プロジェクト: mrdivdiz/bpvita
 private void UpdateState()
 {
     GameProgress.ButtonUnlockState buttonUnlockState = GameProgress.GetButtonUnlockState(this.m_buttonId);
     if (buttonUnlockState == GameProgress.ButtonUnlockState.Unlocked)
     {
         base.gameObject.SetActive(false);
     }
     else if (buttonUnlockState == GameProgress.ButtonUnlockState.UnlockNow)
     {
         this.Unlock();
     }
     else
     {
         base.gameObject.SetActive(true);
         if (base.transform.parent.GetComponent <TooltipInfo>() == null)
         {
             base.transform.parent.GetComponent <Button>().Lock(true);
         }
     }
 }
コード例 #2
0
 private void OnEnable()
 {
     if (this.m_sandboxSelector != null && this.m_sandboxIdentifier.Equals("S-F") && GameProgress.GetSandboxUnlocked(this.m_sandboxIdentifier))
     {
         UnlockSandboxSequence          component         = base.GetComponent <UnlockSandboxSequence>();
         GameProgress.ButtonUnlockState buttonUnlockState = GameProgress.GetButtonUnlockState("SandboxLevelButton_" + this.m_sandboxIdentifier);
         if (component == null && buttonUnlockState == GameProgress.ButtonUnlockState.Locked)
         {
             base.gameObject.AddComponent <UnlockSandboxSequence>();
         }
         Button component2 = base.GetComponent <Button>();
         component2.MethodToCall.SetMethod(this.m_sandboxSelector, "LoadSandboxLevel", this.m_sandboxIdentifier);
         string str = WPFMonoBehaviour.gameData.m_sandboxLevels.GetLevelData(this.m_sandboxIdentifier).m_starBoxCount.ToString();
         this.m_starsText.text = GameProgress.SandboxStarCount(this.m_sandboxSelector.FindLevelFile(this.m_sandboxIdentifier)).ToString() + "/" + str;
         for (int i = 0; i < this.hideOnContentUnlocked.Length; i++)
         {
             this.hideOnContentUnlocked[i].SetActive(false);
         }
         for (int j = 0; j < this.hideOnContentLocked.Length; j++)
         {
             this.hideOnContentLocked[j].SetActive(true);
         }
     }
 }
コード例 #3
0
    private void Start()
    {
        if (this.isBigSandboxButton && base.transform.parent != null)
        {
            this.m_sandboxSelector = base.transform.parent.GetComponent <SandboxSelector>();
        }
        if (this.m_sandboxSelector == null && base.transform.parent != null && base.transform.parent.parent != null)
        {
            this.m_sandboxSelector = base.transform.parent.parent.GetComponent <SandboxSelector>();
        }
        this.starSet = base.transform.Find("StarSet");
        if (this.starSet != null && !this.isBigSandboxButton)
        {
            this.starSet.parent = base.transform.parent;
        }
        UnlockSandboxSequence component = base.GetComponent <UnlockSandboxSequence>();
        bool flag      = GameProgress.GetSandboxUnlocked(this.m_sandboxIdentifier);
        bool isOdyssey = Singleton <BuildCustomizationLoader> .Instance.IsOdyssey;

        if (isOdyssey && (this.m_sandboxIdentifier.Equals("S-M") || this.m_sandboxIdentifier.Equals("S-F")))
        {
            flag = true;
        }
        if (!flag && this.m_sandboxIdentifier.Equals("S-M"))
        {
            UnityEngine.Debug.LogError("SandboxLevelButton S-M");
            int cost = this.GetUnlockPrice(this.m_sandboxIdentifier);
            this.AddSMSandboxUnlockDialog(base.GetComponent <Button>(), cost, this.m_sandboxIdentifier, () => GameProgress.SnoutCoinCount() >= cost);
        }
        else if (!flag && this.m_sandboxIdentifier.Equals("S-F"))
        {
            this.AddBuyFieldOfDreamsButton(base.GetComponent <Button>());
        }
        else if (!flag && !isOdyssey)
        {
            if (SandboxLevelButton.sandboxUnlockDialog == null)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Singleton <GameManager> .Instance.gameData.m_sandboxUnlockDialog);
                gameObject.transform.position          = new Vector3(0f, 0f, -10f);
                SandboxLevelButton.sandboxUnlockDialog = gameObject.GetComponent <SandboxUnlockDialog>();
                SandboxLevelButton.sandboxUnlockDialog.Close();
            }
            int cost = this.GetUnlockPrice(this.m_sandboxIdentifier);
            this.AddSandboxUnlockDialog(base.GetComponent <Button>(), SandboxLevelButton.sandboxUnlockDialog, this.m_sandboxIdentifier, cost, () => GameProgress.SnoutCoinCount() >= cost);
        }
        else if (!flag && isOdyssey)
        {
            TooltipInfo component2 = base.GetComponent <TooltipInfo>();
            if (component2 != null)
            {
                this.setTooltipButton = base.GetComponent <Button>();
                this.setTooltipButton.MethodToCall.SetMethod(component2, "Show");
            }
        }
        GameProgress.ButtonUnlockState buttonUnlockState = GameProgress.GetButtonUnlockState("SandboxLevelButton_" + this.m_sandboxIdentifier);
        if (flag)
        {
            if (component == null && buttonUnlockState == GameProgress.ButtonUnlockState.Locked)
            {
                base.gameObject.AddComponent <UnlockSandboxSequence>();
            }
            Button component3 = base.GetComponent <Button>();
            component3.MethodToCall.SetMethod(this.m_sandboxSelector, "LoadSandboxLevel", this.m_sandboxIdentifier);
            string str = WPFMonoBehaviour.gameData.m_sandboxLevels.GetLevelData(this.m_sandboxIdentifier).m_starBoxCount.ToString();
            this.m_starsText.text = GameProgress.SandboxStarCount(this.m_sandboxSelector.FindLevelFile(this.m_sandboxIdentifier)).ToString() + "/" + str;
            for (int i = 0; i < this.hideOnContentUnlocked.Length; i++)
            {
                this.hideOnContentUnlocked[i].SetActive(false);
            }
        }
        else if (!flag && this.m_starsText != null)
        {
            string arg = WPFMonoBehaviour.gameData.m_sandboxLevels.GetLevelData(this.m_sandboxIdentifier).m_starBoxCount.ToString();
            this.m_starsText.text = string.Format("{0}/{1}", 0, arg);
            for (int j = 0; j < this.hideOnContentLocked.Length; j++)
            {
                this.hideOnContentLocked[j].SetActive(false);
            }
        }
    }
コード例 #4
0
    private void Start()
    {
        if (base.transform.parent != null)
        {
            this.m_sandboxSelector = base.transform.parent.GetComponent <SandboxSelector>();
        }
        this.starSet    = base.transform.Find("StarSet");
        this.collectSet = base.transform.Find("Set");
        this.m_Limit    = 10;
        bool            isOdyssey       = Singleton <BuildCustomizationLoader> .Instance.IsOdyssey;
        bool            flag            = false;
        string          collectable     = string.Empty;
        string          arg             = string.Empty;
        CollectableType collectableType = this.collectableType;

        if (collectableType != CollectableType.Skull)
        {
            if (collectableType == CollectableType.Statue)
            {
                flag        = (GameProgress.SecretStatueCount() >= this.m_Limit || GameProgress.GetSandboxUnlocked(this.m_sandboxIdentifier));
                collectable = "Statues";
                arg         = "[statue]";
            }
        }
        else
        {
            flag        = (GameProgress.SecretSkullCount() >= this.m_Limit || GameProgress.GetSandboxUnlocked(this.m_sandboxIdentifier));
            collectable = "Skulls";
            arg         = "[skull]";
        }
        GameProgress.ButtonUnlockState buttonUnlockState = GameProgress.GetButtonUnlockState("SandboxLevelButton_" + this.m_sandboxIdentifier);
        if (flag && buttonUnlockState == GameProgress.ButtonUnlockState.Locked && base.GetComponent <UnlockSandboxSequence>() == null)
        {
            base.gameObject.AddComponent <UnlockSandboxSequence>();
        }
        if (flag)
        {
            Button component = base.GetComponent <Button>();
            component.MethodToCall.SetMethod(this.m_sandboxSelector.gameObject.GetComponent <SandboxSelector>(), "LoadSandboxLevel", this.m_sandboxIdentifier);
            if (this.collectSet != null)
            {
                this.collectSet.gameObject.SetActive(false);
            }
            if (this.starSet != null)
            {
                this.starSet.gameObject.SetActive(true);
            }
            string str = WPFMonoBehaviour.gameData.m_sandboxLevels.GetLevelData(this.m_sandboxIdentifier).m_starBoxCount.ToString();
            this.m_starsText.text = GameProgress.SandboxStarCount(this.m_sandboxSelector.FindLevelFile(this.m_sandboxIdentifier)).ToString() + "/" + str;
        }
        else
        {
            if (this.starSet != null)
            {
                this.starSet.gameObject.SetActive(false);
            }
            int             num = 0;
            CollectableType collectableType2 = this.collectableType;
            if (collectableType2 != CollectableType.Skull)
            {
                if (collectableType2 == CollectableType.Statue)
                {
                    num = GameProgress.SecretStatueCount();
                }
            }
            else
            {
                num = GameProgress.SecretSkullCount();
            }
            this.m_Text.text = string.Format("{0} {1}/{2}", arg, num, this.m_Limit);
            this.m_Text.SendMessage("TextUpdated", SendMessageOptions.DontRequireReceiver);
            if (isOdyssey)
            {
                TooltipInfo component2 = base.GetComponent <TooltipInfo>();
                if (component2 != null)
                {
                    Button component3 = base.GetComponent <Button>();
                    component3.MethodToCall.SetMethod(component2, "Show");
                    component3.Lock(false);
                }
            }
            else
            {
                string id   = (this.collectableType != CollectableType.Statue) ? "sandbox_unlock_skull_collectable" : "sandbox_unlock_statue_collectable";
                int    num2 = Singleton <VirtualCatalogManager> .Instance.GetProductPrice(id);

                if (num2 <= 0)
                {
                    num2 = 50;
                }
                int cost = (this.m_Limit - num) * num2;
                this.AddUnlockPopup(base.GetComponent <Button>(), this.m_sandboxIdentifier, collectable, num, this.m_Limit, cost, () => GameProgress.SnoutCoinCount() >= cost);
            }
        }
    }
コード例 #5
0
ファイル: RaceLevelButton.cs プロジェクト: mrdivdiz/bpvita
    private void Start()
    {
        bool flag       = false;
        bool flag2      = false;
        bool flag3      = GameProgress.GetRaceLevelUnlocked(this.m_raceLevelIdentifier) || GameProgress.AllLevelsUnlocked();
        bool flag4      = LevelInfo.IsContentLimited(-1, this.m_levelNumber);
        bool flag5      = GameProgress.IsLevelAdUnlocked(this.m_raceLevelIdentifier);
        int  levelIndex = this.m_raceLevelSelector.m_raceLevels.GetLevelIndex(this.m_raceLevelIdentifier);

        if (levelIndex > 0)
        {
            RaceLevels.LevelData levelData = this.m_raceLevelSelector.m_raceLevels.Levels[levelIndex - 1];
            int @int = GameProgress.GetInt(levelData.SceneName + "_stars", 0, GameProgress.Location.Local, null);
            if (GameProgress.GetRaceLevelUnlocked(levelData.m_identifier) && @int > 0)
            {
                flag = true;
            }
            if (GameProgress.GetRaceLevelUnlocked(levelData.m_identifier) || GameProgress.AllLevelsUnlocked())
            {
                flag2 = true;
            }
        }
        if (!Singleton <BuildCustomizationLoader> .Instance.IsOdyssey && flag2 && !flag3)
        {
            int cost = Singleton <VirtualCatalogManager> .Instance.GetProductPrice("road_hogs_level_unlock");

            this.AddRoadHogsUnlockDialog(base.GetComponent <Button>(), this.m_raceLevelIdentifier, cost, () => GameProgress.SnoutCoinCount() >= cost);
        }
        else if (!flag3)
        {
            Animation animation = base.gameObject.AddComponent <Animation>();
            animation.AddClip(this.shake, this.shake.name);
            ButtonAnimation buttonAnimation = base.gameObject.AddComponent <ButtonAnimation>();
            buttonAnimation.PlayWholeAnimation    = true;
            buttonAnimation.ActivateAnimationName = this.shake.name;
            base.gameObject.AddComponent <InactiveButton>();
        }
        if (!flag4 && flag && !flag3)
        {
            GameProgress.SetRaceLevelUnlocked(this.m_raceLevelIdentifier, true);
        }
        if (flag4 && (flag || flag2 || flag5))
        {
            flag4 = false;
        }
        GameProgress.ButtonUnlockState buttonUnlockState = GameProgress.GetButtonUnlockState("RaceLevelButton_" + this.m_raceLevelIdentifier);
        if (flag3 && buttonUnlockState == GameProgress.ButtonUnlockState.Locked && !flag4)
        {
            base.StartCoroutine(this.UnlockNowSequence());
        }
        if ((flag3 && !flag4) || !base.transform.Find("Lock"))
        {
            Button component = base.GetComponent <Button>();
            component.MethodToCall.SetMethod(this.m_raceLevelSelector.gameObject.GetComponent <RaceLevelSelector>(), "LoadRaceLevel", this.m_raceLevelIdentifier);
            string       sceneName = WPFMonoBehaviour.gameData.FindRaceLevel(this.m_raceLevelIdentifier).SceneName;
            int          int2      = GameProgress.GetInt(this.m_raceLevelSelector.FindLevelFile(this.m_raceLevelIdentifier) + "_stars", 0, GameProgress.Location.Local, null);
            bool         flag6     = GameProgress.HasCollectedSnoutCoins(sceneName, 0);
            bool         flag7     = GameProgress.HasCollectedSnoutCoins(sceneName, 1);
            bool         flag8     = GameProgress.HasCollectedSnoutCoins(sceneName, 2);
            GameObject[] array     = new GameObject[]
            {
                component.transform.Find("StarSet/Star1").gameObject,
                component.transform.Find("StarSet/Star2").gameObject,
                component.transform.Find("StarSet/Star3").gameObject,
                component.transform.Find("CoinSet/Star1").gameObject,
                component.transform.Find("CoinSet/Star2").gameObject,
                component.transform.Find("CoinSet/Star3").gameObject
            };
            int num = 0;
            if (flag6)
            {
                num++;
            }
            if (flag7)
            {
                num++;
            }
            if (flag8)
            {
                num++;
            }
            for (int i = 0; i < 3; i++)
            {
                bool flag9  = i + 1 <= int2;
                bool flag10 = i + 1 <= num || Singleton <BuildCustomizationLoader> .Instance.IsOdyssey;
                array[i].SetActive(flag9 && !flag10);
                array[i + 3].SetActive(flag9 && flag10);
            }
            string sceneName2 = this.m_raceLevelSelector.m_raceLevels.GetLevelData(this.m_raceLevelIdentifier).SceneName;
            if (GameProgress.HasBestTime(sceneName2))
            {
                float    num2     = Mathf.Clamp(GameProgress.GetBestTime(sceneName2), 0f, 3599.99f);
                TimeSpan timeSpan = TimeSpan.FromSeconds((double)num2);
                base.transform.Find("BestTime").GetComponent <TextMesh>().text = string.Format("{0:D2}:{1:D2}.{2:D2}", timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10);
                base.transform.Find("BestTime").gameObject.SetActive(true);
                base.transform.Find("TimeBG").gameObject.SetActive(true);
            }
        }
        else
        {
            base.transform.Find("StarSet").gameObject.SetActive(false);
            base.transform.Find("CoinSet").gameObject.SetActive(false);
            base.transform.Find("BestTime").gameObject.SetActive(false);
            base.transform.Find("TimeBG").gameObject.SetActive(false);
        }
    }