コード例 #1
0
ファイル: GameManager.cs プロジェクト: chilscher/Cityscapes
 public void setRemoveAllAndClearButtons()
 {
     //show the appropriate remove-all and clear buttons. You can have either one, or both turned on
     removeAllAndClearButtons.SetActive(false);
     onlyRemoveAllButton.SetActive(false);
     onlyClearButton.SetActive(false);
     removeAllOfNumberButton = onlyRemoveAllButton.transform.GetChild(0).gameObject;
     clearPuzzleButton       = onlyClearButton.transform.GetChild(0).gameObject;
     if (!StaticVariables.isTutorial)
     {
         if (StaticVariables.includeRemoveAllOfNumber && StaticVariables.includeClearPuzzle)
         {
             removeAllOfNumberButton = removeAllAndClearButtons.transform.Find("Remove All").gameObject;
             clearPuzzleButton       = removeAllAndClearButtons.transform.Find("Clear Puzzle").gameObject;
             removeAllAndClearButtons.SetActive(true);
         }
         else if (StaticVariables.includeRemoveAllOfNumber)
         {
             onlyRemoveAllButton.SetActive(true);
         }
         else if (StaticVariables.includeClearPuzzle)
         {
             onlyClearButton.SetActive(true);
         }
     }
     InterfaceFunctions.colorPuzzleButton(removeAllOfNumberButton);
     InterfaceFunctions.colorPuzzleButton(clearPuzzleButton);
 }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: chilscher/Cityscapes
 public void setUndoRedoButtons()
 {
     //show the undo and redo buttons if they are toggled on
     InterfaceFunctions.colorPuzzleButton(undoRedoButtons.transform.Find("Undo"));
     InterfaceFunctions.colorPuzzleButton(undoRedoButtons.transform.Find("Redo"));
     undoRedoButtons.SetActive(StaticVariables.includeUndoRedo);
 }
コード例 #3
0
ファイル: GameManager.cs プロジェクト: chilscher/Cityscapes
 private void colorMenuButton()
 {
     //apply the current skin colors to the menu button
     if (!StaticVariables.isTutorial)
     {
         InterfaceFunctions.colorPuzzleButton(menuButton);
     }
 }
コード例 #4
0
ファイル: GameManager.cs プロジェクト: chilscher/Cityscapes
 public void disselectBuildAndNotes()
 {
     //select the clear tile button and disselect the others
     InterfaceFunctions.colorPuzzleButton(buildButton);
     if (includeNote1Btn)
     {
         InterfaceFunctions.colorPuzzleButton(note1Button);
     }
     if (includeNote2Btn)
     {
         InterfaceFunctions.colorPuzzleButton(note2Button);
     }
     InterfaceFunctions.colorPuzzleButton(clearTileButton);
 }
コード例 #5
0
ファイル: GameManager.cs プロジェクト: chilscher/Cityscapes
 private void disselectNumber(GameObject btn)
 {
     //color chosen the number button to the "off" coloration from the current skin
     InterfaceFunctions.colorPuzzleButton(btn, skin);
 }
コード例 #6
0
ファイル: GameManager.cs プロジェクト: chilscher/Cityscapes
    private void Start()
    {
        //choose which skin to use
        skin = StaticVariables.skin;
        if (StaticVariables.isTutorial)
        {
            skin = basicSkin;
        }
        //set up the fade-in timer
        if (StaticVariables.isFading && StaticVariables.fadingTo == "puzzle")
        {
            fadeTimer = fadeInTime;
        }
        blackSprite   = blackForeground.GetComponent <SpriteRenderer>();
        winPopupScale = winCanvas.transform.GetChild(1).localScale.x;

        size            = StaticVariables.size;
        includeNote1Btn = StaticVariables.includeNotes1Button;
        includeNote2Btn = StaticVariables.includeNotes2Button;

        ColorUtility.TryParseHtmlString(skin.mainMenuButtonExterior, out winBackgroundColorExterior);
        ColorUtility.TryParseHtmlString(skin.mainMenuButtonInterior, out winBackgroundColorInterior);

        hideNumberButtons();

        colorMenuButton();

        if (StaticVariables.isTutorial)   //set up the tutorial. uses tutorialmanager
        {
            originalPuzzleScale = puzzlePositioning.transform.localScale.x;
            setTutorialNumberButtons();
            tutorialCanvas.SetActive(true);
            puzzleCanvas.SetActive(false);
            //hide menu button if it is your first time playing the tutorial
            tutorialCanvas.transform.Find("Menu").gameObject.SetActive(StaticVariables.hasBeatenTutorial);

            tutorialManager             = new TutorialManager();
            tutorialManager.gameManager = this;
            tutorialManager.startTutorial();
        }

        else if (!StaticVariables.isTutorial)   //continue with the puzzle generation and setup
        {
            tutorialCanvas.SetActive(false);
            puzzleCanvas.SetActive(true);
            //load a puzzle if you already have one saved, otherwise generate a new one based on the size
            if (StaticVariables.hasSavedPuzzleState)
            {
                puzzleGenerator.restoreSavedPuzzle(StaticVariables.puzzleSolution, size);
                loadPuzzleStates();
            }
            else
            {
                puzzleGenerator.createPuzzle(size);
                selectedNumber  = size; //you automatically start with the highest building size selected
                clickTileAction = "Apply Selected";
            }
            //set up the visuals of the screen based on the puzzle size and what tools you have unlocked
            drawFullPuzzle();
            setRemoveAllAndClearButtons();
            setNumberButtons();
            highlightSelectedNumber();
            if (clickTileAction == "Clear Tile")
            {
                disselectNumber(prevClickedNumButton);
            }

            hidePositioningObjects();
            setSelectionModeButtons();
            setUndoRedoButtons();
            highlightBuildType();
            //apply the current skin
            puzzleBackground.GetComponent <SpriteRenderer>().sprite = skin.puzzleBackground;
            InterfaceFunctions.colorPuzzleButton(winCanvas.transform.Find("Win Popup").Find("Menu"));
            InterfaceFunctions.colorPuzzleButton(winCanvas.transform.Find("Win Popup").Find("Another Puzzle"));
            InterfaceFunctions.colorPuzzleButton(winCanvas.transform.Find("Win Popup").Find("Shop"));
            winCanvas.transform.Find("Win Popup").Find("Win Popup Background Exterior").GetComponent <SpriteRenderer>().color = winBackgroundColorExterior;
            winCanvas.transform.Find("Win Popup").Find("Win Popup Background Interior").GetComponent <SpriteRenderer>().color = winBackgroundColorInterior;
            //set up the win popup process
            Color c = winCanvas.transform.Find("Black Background").GetComponent <SpriteRenderer>().color;
            c.a = fadeToWinDarknessRatio;
            winCanvas.transform.Find("Black Background").GetComponent <SpriteRenderer>().color = c;
            showCorrectCityArtOnWinScreen();
            int coins = 0;
            switch (size)
            {
            case 3: coins = coinsFor3Win; break;

            case 4: coins = coinsFor4Win; break;

            case 5: coins = coinsFor5Win; break;

            case 6: coins = coinsFor6Win; break;
            }
            int onesDigit = coins % 10;
            int tensDigit = (coins / 10) % 10;

            coinsBox1s.GetComponent <SpriteRenderer>().sprite  = numberSprites[onesDigit];
            coinsBox10s.GetComponent <SpriteRenderer>().sprite = numberSprites[tensDigit];

            //set the first puzzle state, and you are ready to start playing!
            currentPuzzleState = new PuzzleState(puzzleGenerator);
        }
    }