示例#1
0
    private void LayoutButtons(int activePage)
    {
        int page = this.m_page;

        this.m_page = activePage;
        if (page != this.m_page)
        {
            this.OnPageChanged();
        }
        float   num     = Mathf.Clamp((float)Screen.width / 7f, (float)(80 * Screen.width) / 1024f, (float)(160 * Screen.height) / 768f);
        Vector2 vector  = new Vector2(((float)Screen.width - num * (float)(this.m_buttonGrid.horizontalCount - 1)) / 2f, (float)Screen.height * 0.75f);
        Vector2 vector2 = new Vector2(num, (float)Screen.height * 0.22f);
        int     num2    = Screen.width / 4;

        this.m_rightDragLimit = -WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(new Vector3((float)(Screen.width * this.m_pageCount - num2), 0f, 0f)).x;
        this.m_leftDragLimit  = -WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(new Vector3((float)num2, 0f, 0f)).x;
        int num3 = Screen.width * this.m_page;

        this.m_buttonGrid.transform.position = new Vector3(-WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(new Vector3((float)(Screen.width / 2 + num3), 0f, 0f)).x, this.m_buttonGrid.transform.localPosition.y, this.m_buttonGrid.transform.localPosition.z);
        for (int i = this.m_buttonGrid.transform.childCount - 1; i >= 0; i--)
        {
            int     num4      = i % this.m_levelsPerPage / 5;
            int     num5      = i % 5;
            int     num6      = i / this.m_levelsPerPage;
            int     num7      = Screen.width * num6;
            Button  component = this.m_buttonGrid.transform.GetChild(i).GetComponent <Button>();
            Vector3 position  = new Vector3(vector.x + (float)num5 * vector2.x + (float)num7 - (float)num3, vector.y - (float)num4 * vector2.y, 20f);
            Vector3 position2 = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(position);
            if (!GameProgress.GetFullVersionUnlocked() && this.m_episodeLevelsGameDataIndex > 0 && num6 == 0 && num4 == 0)
            {
                position2.z -= 10f;
            }
            component.transform.position = position2;
        }
        for (int j = 0; j < this.m_dotsList.Count; j++)
        {
            if (j == this.m_page)
            {
                this.m_dotsList[j].Enable();
            }
            else
            {
                this.m_dotsList[j].Disable();
            }
        }
        if (this.m_extraDarkLayerRight)
        {
            Vector3 localPosition = this.m_extraDarkLayerRight.transform.localPosition;
            localPosition.x = WPFMonoBehaviour.hudCamera.ScreenToWorldPoint(new Vector3((float)Screen.width * 1.5f, 0f, 0f)).x;
            this.m_extraDarkLayerRight.transform.localPosition = localPosition;
        }
    }
示例#2
0
    public static bool IsContentLimited(int episodeIndex, int levelIndex = 0)
    {
        bool flag = GameProgress.GetFullVersionUnlocked() || (episodeIndex == 0 && levelIndex < 15) || (episodeIndex == -1 && levelIndex < 4) || (episodeIndex > 0 && levelIndex < 5);

        if (Singleton <BuildCustomizationLoader> .Instance.IsChina && episodeIndex >= 0)
        {
            if (!LevelInfo.IsStarLevel(episodeIndex, levelIndex) && levelIndex + 1 - (levelIndex + 1) / 5 + 1 == GameProgress.GetMinimumLockedLevel(episodeIndex) && LevelInfo.GetStars(episodeIndex, levelIndex) == 3)
            {
                GameProgress.SetMinimumLockedLevel(episodeIndex, GameProgress.GetMinimumLockedLevel(episodeIndex) + 1);
            }
            flag = (episodeIndex >= 0 && levelIndex + 1 - (levelIndex + 1) / 5 < GameProgress.GetMinimumLockedLevel(episodeIndex));
            if (LevelInfo.IsStarLevel(episodeIndex, levelIndex))
            {
                flag = true;
            }
        }
        return(!flag);
    }
示例#3
0
    private void Start()
    {
        Condition condition = this.m_condition;

        if (condition != BuildCustomizationSpecificObject.Condition.IsContentLimited)
        {
            if (condition != BuildCustomizationSpecificObject.Condition.IsContentLimitedHasFieldOfDreams)
            {
                if (condition == BuildCustomizationSpecificObject.Condition.HasLeaderboards)
                {
                    this.DestroyIf(true);
                }
            }
            else
            {
                this.DestroyIf(GameProgress.GetFullVersionUnlocked() || !GameProgress.GetSandboxUnlocked("S-F"));
            }
        }
        else
        {
            this.DestroyIf(GameProgress.GetFullVersionUnlocked());
        }
    }
示例#4
0
    private void Awake()
    {
        this.episodeSelector = CompactEpisodeSelector.Instance;
        if (this.buttonLock == null)
        {
            this.buttonLock = base.GetComponentInChildren <ButtonLock>();
        }
        SandboxLevelButton component = base.GetComponent <SandboxLevelButton>();

        if (component != null)
        {
            if (!GameProgress.GetSandboxUnlocked(component.m_sandboxIdentifier))
            {
                GameProgress.SetSandboxUnlocked(component.m_sandboxIdentifier, true);
            }
            this.buttonUnlockKey = string.Format("SandboxLevelButton_{0}", component.m_sandboxIdentifier);
            bool flag = GameProgress.GetFullVersionUnlocked() || GameProgress.GetSandboxUnlocked(component.m_sandboxIdentifier) || (component.m_sandboxIdentifier.Equals("S-F") && GameProgress.GetSandboxUnlocked("S-F"));
            if (flag)
            {
                if (GameProgress.GetButtonUnlockState(this.buttonUnlockKey) == GameProgress.ButtonUnlockState.Locked)
                {
                    this.episodeSelector.StartCoroutine(this.UnlockSequence());
                }
            }
            else
            {
                GameProgress.SetButtonUnlockState(this.buttonUnlockKey, GameProgress.ButtonUnlockState.Locked);
                Transform transform = base.transform.Find("StarSet");
                if (transform != null)
                {
                    transform.gameObject.SetActive(false);
                }
            }
            return;
        }
        SandboxSkullLevelButton component2 = base.GetComponent <SandboxSkullLevelButton>();

        if (component2 != null)
        {
            if (!GameProgress.GetSandboxUnlocked(component2.m_sandboxIdentifier))
            {
                GameProgress.SetSandboxUnlocked(component2.m_sandboxIdentifier, true);
            }
            this.buttonUnlockKey = string.Format("SandboxLevelButton_{0}", component2.m_sandboxIdentifier);
            bool flag2 = GameProgress.GetFullVersionUnlocked() || GameProgress.GetSandboxUnlocked(component2.m_sandboxIdentifier);
            if (flag2)
            {
                if (GameProgress.GetButtonUnlockState(this.buttonUnlockKey) == GameProgress.ButtonUnlockState.Locked)
                {
                    this.episodeSelector.StartCoroutine(this.UnlockSequence());
                }
                else
                {
                    GameProgress.SetButtonUnlockState(this.buttonUnlockKey, GameProgress.ButtonUnlockState.Locked);
                    Transform transform2 = base.transform.Find("StarSet");
                    if (transform2 != null)
                    {
                        transform2.gameObject.SetActive(false);
                    }
                }
            }
        }
    }