public void lockAll()
    {
        //lock all is also only used during testing
        StaticVariables.unlockedMedium      = false;
        StaticVariables.unlockedLarge       = false;
        StaticVariables.unlockedHuge        = false;
        StaticVariables.highestUnlockedSize = 3;
        StaticVariables.showMed             = false;
        StaticVariables.showLarge           = false;
        StaticVariables.showHuge            = false;

        StaticVariables.unlockedNotes1 = false;
        StaticVariables.unlockedNotes2 = false;
        StaticVariables.unlockedResidentsChangeColor = false;
        StaticVariables.unlockedUndoRedo             = false;
        StaticVariables.unlockedRemoveAllOfNumber    = false;
        StaticVariables.unlockedClearPuzzle          = false;
        StaticVariables.unlockedHighlightBuildings   = false;

        StaticVariables.includeNotes1Button = false;
        StaticVariables.includeNotes2Button = false;
        StaticVariables.changeResidentColorOnCorrectRows = false;
        StaticVariables.includeUndoRedo           = false;
        StaticVariables.includeRemoveAllOfNumber  = false;
        StaticVariables.includeClearPuzzle        = false;
        StaticVariables.includeHighlightBuildings = false;

        StaticVariables.unlockedSkins = new List <Skin>();
        StaticVariables.skin          = InterfaceFunctions.getDefaultSkin();
        background.GetComponent <SpriteRenderer>().sprite = StaticVariables.skin.shopBackground;
        InterfaceFunctions.colorMenuButton(menuButton);
        updateButtons();
    }
Example #2
0
 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);
 }
Example #3
0
    public void highlightBuildType()
    {
        //if the build type is set to be included, then highlight it. otherwise, highlight the build button
        disselectBuildAndNotes();

        GameObject button;

        if (clickTileAction == "Toggle Note 1" && includeNote1Btn)
        {
            button = note1Button;
        }
        else if (clickTileAction == "Toggle Note 2" && includeNote2Btn)
        {
            button = note2Button;
        }
        else if (clickTileAction == "Clear Tile")
        {
            button = clearTileButton;
        }
        else
        {
            clickTileAction = "Apply Selected";
            button          = buildButton;
        }
        InterfaceFunctions.colorPuzzleButtonOn(button);
    }
Example #4
0
    private float minBuildingScale  = 0.5f;  //the smallest size that a building will be relative to the highest size. So if this is 0.5, then a #1 building will be half the dimensions of a #3 building on a small city (where the max building size is 3)

    public void initialize(int solution, Transform parent, int maxValue, GameManager gameManager)
    {
        //create the PuzzleTile object, called by PuzzleGenerator
        this.solution    = solution;
        this.maxValue    = maxValue;
        this.gameManager = gameManager;

        background = transform.GetChild(0).GetComponent <SpriteRenderer>();
        road       = transform.GetChild(1).GetComponent <SpriteRenderer>();
        building   = transform.GetChild(2).GetComponent <SpriteRenderer>();
        number     = transform.GetChild(3).GetComponent <SpriteRenderer>();
        redBorder  = transform.GetChild(4).GetComponent <SpriteRenderer>();

        // pick a random tile rotation direction
        if (randomRotation)
        {
            int[] directions = new int[] { 0, 90, 180, 270 };
            int   r          = StaticVariables.rand.Next(4);
            building.transform.Rotate(new Vector3(0, 0, directions[r]));
        }
        //set colors and sprites from the current skin
        setNumberColors();
        building.sprite = gameManager.skin.buildingSprite;
        road.color      = InterfaceFunctions.getColorFromString(gameManager.skin.streetColor);
    }
Example #5
0
 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);
 }
Example #6
0
 private void colorMenuButton()
 {
     //apply the current skin colors to the menu button
     if (!StaticVariables.isTutorial)
     {
         InterfaceFunctions.colorPuzzleButton(menuButton);
     }
 }
Example #7
0
        static void Main()
        {
            var section = InterfaceFunctions.ChooseSection <StructuresSections>();

            switch (section)
            {
            case StructuresSections.ICollection:
            case StructuresSections.IList:
            case StructuresSections.ISet:
            case StructuresSections.IDictionary:
            {
                ICollectionTest.MethodsOfICollection(section);
            }
            break;

            case StructuresSections.ITest:
            {
                IList <string> testList = new MyList <string>();
                testList.Add("Luka");
                testList.Add("Jernej");
                testList.Add("Borut");
                Console.WriteLine($"Imamo {testList.Count} elementov!");
            }
            break;

            case StructuresSections.TestSpeed:
            {
                TestSpeed.TestDataStructures(InterfaceFunctions.ChooseSection <TestAction>());
            }
            break;

            case StructuresSections.HanoiExample:
            {
                Console.WriteLine("Hanoi example ");
                HanoiType type = Hanoi.SelectHanoiType();

                Console.Write("Enter number of discs: ");
                int k = int.Parse(Console.ReadLine());

                Console.WriteLine($"Running case: {type} with {k} discs:");

                int numPegs = 4;         // Delali bomo samo s štirimi stolpi

                Stopwatch sw       = Stopwatch.StartNew();
                Hanoi     hanBasic = new Hanoi(k, numPegs, type);
                int       length   = hanBasic.ShortestPathForSmallDimension(out _);

                Console.WriteLine();
                Console.WriteLine($"\n\nDimension: {k}; Steps: {length}; Time: {sw.Elapsed.TotalSeconds}");
                Console.WriteLine();
            }
            break;
            }

            Console.WriteLine();
            Console.WriteLine("Končano");
            Console.ReadLine();
        }
Example #8
0
 private static void firstTimePlayingEver()
 {
     //if this is the first time that the player has opened the game, load the default values for some staticVariables elements
     StaticVariables.skin  = InterfaceFunctions.getDefaultSkin();
     StaticVariables.coins = 0;
     StaticVariables.highestUnlockedSize = 3;
     SaveGame();
     LoadGame();
 }
Example #9
0
        public static void BasicLINQSyntax()
        {
            switch (InterfaceFunctions.ChooseSection <BasicsSubsection>())
            {
            case BasicsSubsection.Basic:
            {
                // LINQ sintaksa je zelo podobna sintaksi SQL,
                // vendar ima malo spremenjen vrstni red
                // Select je vedno na koncu (lahko izberemo posamezne lastnosti)
                var queryGeneral = from animal in LINQDataSet.animals
                                   select animal;
                Console.WriteLine("\nSplošna poizvedba o vseh elementih");
                queryGeneral.ReadEnumerable();
            }
            break;

            case BasicsSubsection.Select:
            {
                // Izberemo lahko le nekatere lastnosti
                // in jih postavimo v nov (anonimen) objekt
                var queryGeneral2 = from animal in LINQDataSet.animals
                                    select new
                {
                    animal.Species,
                    animal.HasTail
                };                             // Pripravimo anonimen objekt. Več v Arh, Q19.
                Console.WriteLine("\nSplošna poizvedba z izbranimi lastnostmi");
                // Izpis anonimnega objekta zraven pripiše tudi imena lastnosti!
                queryGeneral2.ReadEnumerable();
            }
            break;

            case BasicsSubsection.Sort:
            {
                // Elemente lahko uredimo - uporabimo spremenljivko animal
                var queryOrdered = from animal in LINQDataSet.animals
                                   orderby animal.NumberOfLegs descending
                                   select animal;
                Console.WriteLine("\nSplošna urejena poizvedba");
                queryOrdered.ReadEnumerable();
            }
            break;

            case BasicsSubsection.Filter:
            {
                // Ali filtriramo - spet uporabimo spremenljivko animal
                var queryFiltered = from animal in LINQDataSet.animals
                                    where animal.HasTail && animal.NumberOfLegs <= 4         // Filtriranje
                                    orderby animal.Species
                                    select animal;;
                Console.WriteLine("\nSplošna filtrirana poizvedba");
                queryFiltered.ReadEnumerable();
            }
            break;
            }
            // Več o sintaksi z uporabo "join" in "group by" v Arh, Q51 in Arh, Q54.
        }
 private void unlockAllSkins()
 {
     //unlockAllSkins is also only used during testing
     foreach (Skin skin in StaticVariables.allSkins)
     {
         if (skin != InterfaceFunctions.getDefaultSkin() && !StaticVariables.unlockedSkins.Contains(skin))
         {
             StaticVariables.unlockedSkins.Add(skin);
         }
     }
 }
        /// <summary>
        /// Ker v metodi uporabljamo rezervirano besedo 'await', moramo
        /// metodi dodati določilo async.
        /// </summary>
        public static async void AsyncTest()
        {
            // Spet bomo uporabljali razred Task iz knjižnice System.Threading.Tasks
            // Task predstavlja operacijo, ki teče v ozadju (asinhrono ali v drugi niti)

            // Ponovimo primer iz drugega razdelka tega poglavja:
            Stopwatch sw             = Stopwatch.StartNew();
            var       backgroundTask = Task.Run(() => CountPrimes(InterfaceFunctions.ChooseSection <ExecutionType>()));


            // PRIMER 1: Ko dostopimo do rezultata, bo trenutna nit počakala na rezultat (enako kot pri metodi Wait).

            Console.WriteLine($"Task smo zagnali, zdaj čakamo na rezultat.");
            var result = backgroundTask.Result;

            Console.WriteLine($"Čakamo, da task konča izračun.");
            Console.WriteLine($"In čakamo...");
            Console.WriteLine($"In čakamo...");
            Console.WriteLine($"Našli smo {result} praštevil v {sw.Elapsed.TotalSeconds} sekundah.");



            // PRIMER 2: Namesto čakanja lahko uporabimo rezervirano besedo await,
            //           vendar nam v funkciji to ne spremeni obnašanja.
            //           Se  pa bo sprostila trenutna nit za ostale aktivnosti

            /*
             * Console.WriteLine($"Task smo zagnali, zdaj čakamo na rezultat.");
             * var result = await backgroundTask;
             * Console.WriteLine($"Čakamo, da task konča izračun.");
             * Console.WriteLine($"In čakamo...");
             * Console.WriteLine($"In čakamo...");
             * Console.WriteLine($"Našli smo {result} praštevil v {sw.Elapsed.TotalSeconds} sekundah.");
             * Console.WriteLine($"Do tukaj pridemo šele, ko imamo rezultat");
             */

            // PRIMER 3: Implementirajmo našo logiko v ločeni metodi
            //           Klic deluje podobno kot pri await - le da se izvajanje nadaljuje samo znotraj metode

            /*
             * Console.WriteLine($"Task smo zagnali, zdaj čakamo na rezultat.");
             * var result = ResultAsync();
             * Console.WriteLine($"Čakamo, da task konča izračun.");
             * Console.WriteLine($"In čakamo...");
             * Console.WriteLine($"In čakamo...");
             * Console.WriteLine($"Našli smo {result.Result} praštevil v {sw.Elapsed.TotalSeconds} sekundah.");
             * Console.WriteLine($"Do tukaj pridemo šele, ko imamo rezultat");
             */

            // Za konec velja pripomniti, da lahko z enim taskom opravimo več zaporednih opravil,
            // kar nam omogoča metoda ContinueWith. Ko se eno opravilo konča, lahko začnemo z naslednjim.
        }
    private void Start()
    {
        //set some private variables based on elements edited by the inspector
        ColorUtility.TryParseHtmlString(affordableCoinColor, out affordableColor);
        ColorUtility.TryParseHtmlString(unaffordableCoinColor, out unaffordableColor);
        ColorUtility.TryParseHtmlString(purchaseButtonExterior, out purchaseButtonExteriorColor);
        ColorUtility.TryParseHtmlString(purchaseButtonInterior, out purchaseButtonInteriorColor);
        ColorUtility.TryParseHtmlString(noPurchaseButtonExterior, out noPurchaseButtonExteriorColor);
        ColorUtility.TryParseHtmlString(noPurchaseButtonInterior, out noPurchaseButtonInteriorColor);
        sprite1s     = coinsBox1s.GetComponent <SpriteRenderer>();
        sprite10s    = coinsBox10s.GetComponent <SpriteRenderer>();
        sprite100s   = coinsBox100s.GetComponent <SpriteRenderer>();
        sprite1000s  = coinsBox1000s.GetComponent <SpriteRenderer>();
        sprite10000s = coinsBox10000s.GetComponent <SpriteRenderer>();
        blackSprite  = blackForeground.GetComponent <SpriteRenderer>();

        //show the amount of coins the player has, and also the cost of various upgrades
        displayCoinsAmount();
        displayCoinsOnButton(expandMedButton, medCityPrice);
        displayCoinsOnButton(expandLargeButton, largeCityPrice);
        displayCoinsOnButton(expandHugeButton, hugeCityPrice);
        displayCoinsOnButton(expandNotes1Button, notes1Price);
        displayCoinsOnButton(expandNotes2Button, notes2Price);
        displayCoinsOnButton(expandResidentColorButton, residentColorPrice);
        displayCoinsOnButton(expandUndoRedoButton, undoRedoPrice);
        displayCoinsOnButton(expandRemoveAllButton, removeAllPrice);
        displayCoinsOnButton(expandClearButton, clearPrice);
        displayCoinsOnButton(expandHighlightBuildingsButton, highlightBuildingsPrice);

        //show the cost of the various skins
        findSkinButtons();
        foreach (GameObject parent in skinButtons)
        {
            displayCoinsOnButton(parent.transform.Find("Expand Button").gameObject, getSkinPrice((InterfaceFunctions.getSkinFromName(parent.name))));
        }

        //update the buttons for the various upgrades to denote if they can be purchased right now
        updateButtons();

        //apply the cosmetics from the current skin
        background.GetComponent <SpriteRenderer>().sprite = StaticVariables.skin.shopBackground;
        InterfaceFunctions.colorMenuButton(menuButton);

        //starts the fade-in process, which is carried out in the Update function
        if (StaticVariables.isFading && StaticVariables.fadingTo == "shop")
        {
            fadeTimer = fadeInTime;
        }

        //determine the full scope of the scroll view, determined by what elements are expanded within the scrollview
        setScrollViewHeight();
    }
    public void unlockSkin(GameObject parent)
    {
        Skin skin = InterfaceFunctions.getSkinFromName(parent.name);

        if (canPurchase(StaticVariables.unlockedSkins.Contains(skin), getSkinPrice(skin)))
        {
            StaticVariables.unlockedSkins.Add(skin);
            StaticVariables.skin = skin;
            background.GetComponent <SpriteRenderer>().sprite = StaticVariables.skin.shopBackground;
            InterfaceFunctions.colorMenuButton(menuButton);
            doPurchase(getSkinPrice(skin));
        }
    }
    private void Start()
    {
        //apply the cosmetics from the current skin
        background.GetComponent <SpriteRenderer>().sprite = StaticVariables.skin.shopBackground;
        blackSprite = blackForeground.GetComponent <SpriteRenderer>();
        InterfaceFunctions.colorMenuButton(menuButton);

        //starts the fade-in process, which is carried out in the Update function
        if (StaticVariables.isFading && StaticVariables.fadingTo == "credits")
        {
            fadeTimer = fadeInTime;
        }
    }
    private void updateCurrentSkinText()
    {
        //updates the text on the "Current Skin" button
        currentSkinText.GetComponent <Text>().text = "CURRENT SKIN:\n" + StaticVariables.skin.skinName.ToUpper();
        GameObject parentBox = expandSkinButton.transform.parent.gameObject;

        for (int i = 1; i < parentBox.transform.childCount; i++)
        {
            bool isActive = (InterfaceFunctions.getSkinFromName(parentBox.transform.GetChild(i).name) == StaticVariables.skin);
            parentBox.transform.GetChild(i).Find("Button").Find("On").gameObject.SetActive(isActive);
            parentBox.transform.GetChild(i).Find("Button").Find("Off").gameObject.SetActive(!isActive);
        }
    }
Example #16
0
 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);
 }
Example #17
0
 public void hitClearButton()
 {
     //choose the clear tile selection mode
     clickTileAction = "Clear Tile";
     disselectNumber(prevClickedNumButton);
     disselectBuildAndNotes();
     foreach (PuzzleTile t in puzzleGenerator.puzzleTiles)
     {
         t.unhighlightBuildingNumber();
     }
     InterfaceFunctions.colorPuzzleButtonOn(clearTileButton);
     updateRemoveSelectedNumber();
     save();
 }
Example #18
0
    private List <Skin> getUnlockedSkins()
    {
        //parses the string containing the player's unlocked skins, specifically for loading
        List <Skin> skins = new List <Skin>();

        if (unlockedSkinNames != "")
        {
            string[] strings = unlockedSkinNames.Split(' ');
            foreach (string str in strings)
            {
                skins.Add(InterfaceFunctions.getSkinFromName(str));
            }
        }
        return(skins);
    }
    private void expandSkinButtons()
    {
        //expands the skin details button beneath the "Choose Skin" button
        GameObject parentBox = expandSkinButton.transform.parent.gameObject;

        parentBox.transform.Find("Basic").gameObject.SetActive(true);
        for (int i = 2; i < parentBox.transform.childCount; i++)
        {
            bool switchTo = StaticVariables.unlockedSkins.Contains(InterfaceFunctions.getSkinFromName(parentBox.transform.GetChild(i).name));
            parentBox.transform.GetChild(i).gameObject.SetActive(switchTo);
            parentBox.transform.GetChild(i).Find("Button").Find("Text").GetComponent <Text>().text = parentBox.transform.GetChild(i).name.ToUpper() + " SKIN";
        }
        resizeToFitChildren(parentBox, false);
        setScrollViewHeight();
    }
Example #20
0
 public void setNumberColors()
 {
     //sets the colors that the SideHintTile number can be, based off of the current skin.
     //the tutorial uses its own colors, which are the ones used in the basic skin
     if (!StaticVariables.isTutorial)
     {
         ColorUtility.TryParseHtmlString(StaticVariables.skin.citizenColor, out incorrectColor);
         ColorUtility.TryParseHtmlString(StaticVariables.skin.satisfiedCitizenColor, out correctColor);
     }
     else
     {
         ColorUtility.TryParseHtmlString(InterfaceFunctions.getDefaultSkin().citizenColor, out incorrectColor);
         ColorUtility.TryParseHtmlString(InterfaceFunctions.getDefaultSkin().satisfiedCitizenColor, out correctColor);
     }
 }
Example #21
0
    // ---------------------------------------------------
    //ALL OF THE FUNCTIONS THAT ARE USED TO LOAD PLAYER DATA
    // ---------------------------------------------------

    public void LoadData()
    {
        //takes all of the variables stored in the SaveData object and stores them into StaticVariables
        StaticVariables.coins = coins;
        StaticVariables.includeNotes1Button = includeNotes1;
        StaticVariables.includeNotes2Button = includeNotes2;
        StaticVariables.changeResidentColorOnCorrectRows = changeResidentColorOnCorrectRows;
        StaticVariables.highestUnlockedSize       = highestUnlockedSize;
        StaticVariables.includeUndoRedo           = includeUndoRedo;
        StaticVariables.includeRemoveAllOfNumber  = includeRemoveAllOfNumber;
        StaticVariables.includeClearPuzzle        = includeClearPuzzle;
        StaticVariables.includeHighlightBuildings = includeHighlightBuildings;

        StaticVariables.showMed   = showMed;
        StaticVariables.showLarge = showLarge;
        StaticVariables.showHuge  = showHuge;

        StaticVariables.unlockedMedium = unlockedMed;
        StaticVariables.unlockedLarge  = unlockedLarge;
        StaticVariables.unlockedHuge   = unlockedHuge;
        StaticVariables.unlockedNotes1 = unlockedNotes1;
        StaticVariables.unlockedNotes2 = unlockedNotes2;
        StaticVariables.unlockedResidentsChangeColor = unlockedResidentsChangeColor;
        StaticVariables.unlockedUndoRedo             = unlockedUndoRedo;
        StaticVariables.unlockedRemoveAllOfNumber    = unlockedRemoveAllOfNumber;
        StaticVariables.unlockedClearPuzzle          = unlockedClearPuzzle;
        StaticVariables.unlockedHighlightBuildings   = unlockedHighlightBuildings;

        StaticVariables.skin                  = InterfaceFunctions.getSkinFromName(skinName);
        StaticVariables.unlockedSkins         = getUnlockedSkins();
        StaticVariables.hidePurchasedUpgrades = hidePurchasedUpgrades;

        StaticVariables.hasBeatenTutorial = hasBeatenTutorial;

        //loads the player's puzzle states
        StaticVariables.hasSavedPuzzleState = hasSavedPuzzleState;
        if (hasSavedPuzzleState)
        {
            StaticVariables.previousPuzzleStates = getPuzzleStateListFromString(previousPuzzleStates, savedPuzzleSize);
            StaticVariables.currentPuzzleState   = new PuzzleState(currentPuzzleState, savedPuzzleSize);
            StaticVariables.nextPuzzleStates     = getPuzzleStateListFromString(nextPuzzleStates, savedPuzzleSize);
            StaticVariables.puzzleSolution       = puzzleSolution;
            StaticVariables.savedPuzzleSize      = savedPuzzleSize;
            StaticVariables.savedBuildNumber     = savedBuildNumber;
            StaticVariables.savedBuildType       = savedBuildType;
        }
    }
Example #22
0
 public void hitNote1Button()
 {
     //choose the note 1 selection mode
     if (clickTileAction == "Clear Tile")
     {
         selectNumber(prevClickedNumButton);
         foreach (PuzzleTile t in puzzleGenerator.puzzleTiles)
         {
             t.highlightIfBuildingNumber(selectedNumber);
         }
     }
     clickTileAction = "Toggle Note 1";
     disselectBuildAndNotes();
     InterfaceFunctions.colorPuzzleButtonOn(note1Button);
     updateRemoveSelectedNumber();
     save();
 }
Example #23
0
    private void createCorner(Vector2 p, float scale, int rot, Transform parent)
    {
        //add a street corner to the puzzle display. They serve no mechanical purpose and are just there to look nice
        GameObject corner = Instantiate(streetCorner);

        corner.transform.position    = p;
        corner.transform.localScale *= scale;
        corner.transform.Rotate(new Vector3(0, 0, rot));
        corner.transform.parent = parent;


        corner.GetComponent <SpriteRenderer>().color = InterfaceFunctions.getColorFromString(skin.streetColor);


        Vector3 pos = corner.transform.localPosition;

        pos.z = 0;
        corner.transform.localPosition = pos;
    }
Example #24
0
        static void Main(string[] args)
        {
            switch (InterfaceFunctions.ChooseSection <SerializationSections>())
            {
            case SerializationSections.Serialize:
                SerializationBasics.Serialize();
                break;

            case SerializationSections.Deserialize:
                SerializationBasics.Deserialize();
                break;

            case SerializationSections.Cyclic:
                CyclicDependencies.CyclicSerialization();
                break;
            }

            Console.ReadLine();
        }
Example #25
0
    public void initialize(int hintValue)
    {
        //creates the sideHintTile. Here goes all of the code that defines the private variables used later
        this.hintValue = hintValue;
        background     = transform.GetChild(0).GetComponent <SpriteRenderer>();
        arrow          = transform.GetChild(1).GetComponent <SpriteRenderer>();
        number         = transform.GetChild(2).GetComponent <SpriteRenderer>();
        redBorder      = transform.GetChild(3).GetComponent <SpriteRenderer>();

        setNumberColors();
        addNumberToTile(hintValue);

        Skin tempSkin = StaticVariables.skin;

        if (StaticVariables.isTutorial)
        {
            tempSkin = StaticVariables.allSkins[0];
        }
        background.GetComponent <SpriteRenderer>().color = InterfaceFunctions.getColorFromString(tempSkin.streetColor);
    }
Example #26
0
        static void Main()
        {
            switch (InterfaceFunctions.ChooseSection <LINQSections>())
            {
            case LINQSections.Basics:
            {
                Basics.BasicLINQSyntax();
            }
            break;

            case LINQSections.MethodSyntax:
            {
                Methods.MethodLINQSyntax();
            }
            break;

            case LINQSections.LambdaExpressions:
            {
                LambdaExpressions.LambdaTests();
            }
            break;
            }
            Console.ReadLine();
        }
    // ---------------------------------------------------
    //ALL OF THE FUNCTIONS THAT ARE USED TO UPDATE THE VISUALS FOR THE MAIN MENU SCENE
    // ---------------------------------------------------

    private void colorButtons()
    {
        //color all of the menu buttons to fit the current skin
        InterfaceFunctions.colorMenuButton(puzzleButtons.transform.Find("3").gameObject);
        InterfaceFunctions.colorMenuButton(puzzleButtons.transform.Find("4").gameObject);
        InterfaceFunctions.colorMenuButton(puzzleButtons.transform.Find("5").gameObject);
        InterfaceFunctions.colorMenuButton(puzzleButtons.transform.Find("6").gameObject);

        InterfaceFunctions.colorMenuButton(returnOrAbandonButtons.transform.Find("Popup").Find("Return").gameObject);
        InterfaceFunctions.colorMenuButton(returnOrAbandonButtons.transform.Find("Popup").Find("Abandon").gameObject);

        Color exter;
        Color inter;

        ColorUtility.TryParseHtmlString(StaticVariables.skin.resumePuzzleExterior, out exter);
        ColorUtility.TryParseHtmlString(StaticVariables.skin.resumePuzzleInterior, out inter);
        returnOrAbandonButtons.transform.Find("Popup").Find("Backdrop").Find("Border").GetComponent <SpriteRenderer>().color   = exter;
        returnOrAbandonButtons.transform.Find("Popup").Find("Backdrop").Find("Interior").GetComponent <SpriteRenderer>().color = inter;

        InterfaceFunctions.colorMenuButton(shopButton);
        InterfaceFunctions.colorMenuButton(tutorialButton);
        InterfaceFunctions.colorMenuButton(settingsButton);
        InterfaceFunctions.colorMenuButton(largeCenterTutorialButton);
    }
Example #28
0
 private void disselectNumber(GameObject btn)
 {
     //color chosen the number button to the "off" coloration from the current skin
     InterfaceFunctions.colorPuzzleButton(btn, skin);
 }
    private void updateButtons()
    {
        //updates every button's color to denote if the player can purchase it
        //each button has a price that must be met, and also some have a prerequisite purchase that must be made
        Color grey = Color.grey;

        updateButton(expandMedButton, StaticVariables.unlockedMedium, medCityPrice);
        updateButton(expandLargeButton, StaticVariables.unlockedLarge, largeCityPrice, StaticVariables.unlockedMedium);
        updateButton(expandHugeButton, StaticVariables.unlockedHuge, hugeCityPrice, StaticVariables.unlockedLarge);
        updateButton(expandNotes1Button, StaticVariables.unlockedNotes1, notes1Price);
        updateButton(expandNotes2Button, StaticVariables.unlockedNotes2, notes2Price, StaticVariables.unlockedNotes1);
        updateButton(expandResidentColorButton, StaticVariables.unlockedResidentsChangeColor, residentColorPrice);
        updateButton(expandUndoRedoButton, StaticVariables.unlockedUndoRedo, undoRedoPrice);
        updateButton(expandRemoveAllButton, StaticVariables.unlockedRemoveAllOfNumber, removeAllPrice, StaticVariables.unlockedUndoRedo);
        updateButton(expandClearButton, StaticVariables.unlockedClearPuzzle, clearPrice, StaticVariables.unlockedUndoRedo);
        updateButton(expandHighlightBuildingsButton, StaticVariables.unlockedHighlightBuildings, highlightBuildingsPrice);

        foreach (GameObject parent in skinButtons)
        {
            updateButton(parent.transform.Find("Expand Button").gameObject, StaticVariables.unlockedSkins.Contains(InterfaceFunctions.getSkinFromName(parent.name)), getSkinPrice((InterfaceFunctions.getSkinFromName(parent.name))));
        }

        //also update text shown when all upgrades of a single type have been purchased.
        //these texts should only appear if the player chooses to hide purchased upgrades
        bool allCities   = StaticVariables.unlockedMedium && StaticVariables.unlockedLarge && StaticVariables.unlockedHuge;
        bool allFeatures = StaticVariables.unlockedNotes1 && StaticVariables.unlockedNotes2 && StaticVariables.unlockedResidentsChangeColor && StaticVariables.unlockedUndoRedo && StaticVariables.unlockedRemoveAllOfNumber && StaticVariables.unlockedClearPuzzle && StaticVariables.unlockedHighlightBuildings;
        bool allSkins    = StaticVariables.unlockedSkins.Count + 1 == StaticVariables.allSkins.Length;
        bool allContent  = allCities && allFeatures && allSkins;

        unlockedAllFeaturesText.SetActive(allFeatures && allCities && StaticVariables.hidePurchasedUpgrades);
        unlockedAllSkinsText.SetActive(allSkins && StaticVariables.hidePurchasedUpgrades);
        unlockedEverythingText.SetActive(allContent);
        newFeaturesText.SetActive(true);
        cosmeticsText.SetActive(true);
        if (allContent && StaticVariables.hidePurchasedUpgrades)
        {
            unlockedAllFeaturesText.SetActive(false);
            unlockedAllSkinsText.SetActive(false);
            newFeaturesText.SetActive(false);
            cosmeticsText.SetActive(false);
        }

        //after all of that, resize the scroll view
        setScrollViewHeight();
    }
Example #30
0
    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);
        }
    }