Ejemplo n.º 1
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);
        }
    }