private void LayoutPuzzle()
    {
        switch (puzzleLevel)
        {
        case 0:
            SetButtonList(level1Button, puzzleLevel1);
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level1Button, level1Animator);
            break;

        case 1:
            SetButtonList(level2Button, puzzleLevel2);
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level2Button, level2Animator);
            break;

        case 2:
            SetButtonList(level3Button, puzzleLevel3);
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level3Button, level3Animator);
            break;

        case 3:
            SetButtonList(level4Button, puzzleLevel4);
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level4Button, level4Animator);
            break;

        case 4:
            SetButtonList(level5Button, puzzleLevel5);
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level5Button, level5Animator);
            break;
        }
    }
Example #2
0
    void LayoutPuzzle()
    {
        switch (puzzleLevel)
        {
        case 0:

            foreach (Button btn in level1Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.transform.SetParent(puzzleLevel1, false);
                }

                if (selectedPuzzle == "Candy Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[0];
                }
                else if (selectedPuzzle == "Transport Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[1];
                }
                else if (selectedPuzzle == "Fruit Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[2];
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level1Buttons, level1Anims);
            break;

        case 1:

            foreach (Button btn in level2Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.transform.SetParent(puzzleLevel2, false);
                }

                if (selectedPuzzle == "Candy Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[0];
                }
                else if (selectedPuzzle == "Transport Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[1];
                }
                else if (selectedPuzzle == "Fruit Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[2];
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level2Buttons, level2Anims);
            break;

        case 2:

            foreach (Button btn in level3Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.transform.SetParent(puzzleLevel3, false);
                }

                if (selectedPuzzle == "Candy Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[0];
                }
                else if (selectedPuzzle == "Transport Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[1];
                }
                else if (selectedPuzzle == "Fruit Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[2];
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level3Buttons, level3Anims);
            break;

        case 3:

            foreach (Button btn in level4Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.transform.SetParent(puzzleLevel4, false);
                }

                if (selectedPuzzle == "Candy Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[0];
                }
                else if (selectedPuzzle == "Transport Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[1];
                }
                else if (selectedPuzzle == "Fruit Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[2];
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level4Buttons, level4Anims);
            break;

        case 4:

            foreach (Button btn in level5Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.transform.SetParent(puzzleLevel5, false);
                }

                if (selectedPuzzle == "Candy Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[0];
                }
                else if (selectedPuzzle == "Transport Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[1];
                }
                else if (selectedPuzzle == "Fruit Puzzle")
                {
                    btn.image.sprite = puzzleButtonsBacksideImages[2];
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level5Buttons, level5Anims);
            break;
        }
    }
    void LayoutPuzzle()
    {
        switch (puzzleLevel)
        {
        case 0:
            foreach (Button btn in level1Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.gameObject.transform.SetParent(puzzleLevel1, false);
                    btn.GetComponentInChildren <Text>().text = "";

                    if (selectedPuzzle == "Game1 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[0];
                    }
                    else if (selectedPuzzle == "Game2 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[1];
                    }
                    else if (selectedPuzzle == "Game3 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[2];
                    }
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level1Buttons, level1Anims);


            break;

        case 1:
            foreach (Button btn in level2Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.gameObject.transform.SetParent(puzzleLevel2, false);
                    btn.GetComponentInChildren <Text>().text = "";

                    if (selectedPuzzle == "Game1 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[0];
                    }
                    else if (selectedPuzzle == "Game2 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[1];
                    }
                    else if (selectedPuzzle == "Game3 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[2];
                    }
                }
            }

            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level2Buttons, level2Anims);
            break;

        case 2:
            foreach (Button btn in level3Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.gameObject.transform.SetParent(puzzleLevel3, false);
                    btn.GetComponentInChildren <Text>().text = "";

                    if (selectedPuzzle == "Game1 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[0];
                    }
                    else if (selectedPuzzle == "Game2 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[1];
                    }
                    else if (selectedPuzzle == "Game3 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[2];
                    }
                }
            }
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level3Buttons, level3Anims);
            break;

        case 3:
            foreach (Button btn in level4Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.gameObject.transform.SetParent(puzzleLevel4, false);
                    btn.GetComponentInChildren <Text>().text = "";

                    if (selectedPuzzle == "Game1 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[0];
                    }
                    else if (selectedPuzzle == "Game2 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[1];
                    }
                    else if (selectedPuzzle == "Game3 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[2];
                    }
                }
            }
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level4Buttons, level4Anims);
            break;

        case 4:
            foreach (Button btn in level5Buttons)
            {
                if (!btn.gameObject.activeInHierarchy)
                {
                    btn.gameObject.SetActive(true);
                    btn.gameObject.transform.SetParent(puzzleLevel5, false);
                    btn.GetComponentInChildren <Text>().text = "";

                    if (selectedPuzzle == "Game1 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[0];
                    }
                    else if (selectedPuzzle == "Game2 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[1];
                    }
                    else if (selectedPuzzle == "Game3 Puzzle")
                    {
                        btn.image.sprite = puzzleButtonsBacksideImages[2];
                    }
                }
            }
            setupPuzzleGame.SetPuzzleButtonsAndAnimators(level5Buttons, level5Anims);
            break;
        }
    }