Esempio n. 1
0
    public void OnGUI()
    {
        switch (GameState)
        {
        case GameStateType.ESCMENU:
            //print ("Escape menu is active");
            if (GUI.Button(new Rect(Screen.width / 2 - 120, Screen.height / 4 - 20, 120, 20), "Create Your Deck"))
            {
                CreatingDeck = !CreatingDeck;
            }
            if (CreatingDeck)
            {
                int cardAddHorizPos        = Screen.width / 4;
                int cardAddVertStartingPos = Screen.height / 6;
                PlayerName = GUI.TextField(new Rect(cardAddHorizPos, cardAddVertStartingPos - 20, 200, 20), PlayerName, 25);
                if (GUI.Button(new Rect(cardAddHorizPos, cardAddVertStartingPos, 60, 20), "Imp"))
                {
                    SetCardForPlayer(PlayerName, "Imp");
                }
                if (GUI.Button(new Rect(cardAddHorizPos + 60, cardAddVertStartingPos, 60, 20), "Imp"))
                {
                    RemoveCardForPlayer(PlayerName, "Imp");
                }

                if (GUI.Button(new Rect(cardAddHorizPos, cardAddVertStartingPos + 20, 60, 20), "Caster"))
                {
                    SetCardForPlayer(PlayerName, "Caster");
                }
                if (GUI.Button(new Rect(cardAddHorizPos + 60, cardAddVertStartingPos + 20, 60, 20), "Caster"))
                {
                    RemoveCardForPlayer(PlayerName, "Caster");
                }

                if (GUI.Button(new Rect(cardAddHorizPos, cardAddVertStartingPos + 40, 60, 20), "Ogre"))
                {
                    SetCardForPlayer(PlayerName, "Ogre");
                }
                if (GUI.Button(new Rect(cardAddHorizPos + 60, cardAddVertStartingPos + 40, 60, 20), "Ogre"))
                {
                    RemoveCardForPlayer(PlayerName, "Ogre");
                }

                if (GUI.Button(new Rect(cardAddHorizPos, cardAddVertStartingPos + 60, 60, 20), "Teleport"))
                {
                    SetCardForPlayer(PlayerName, "Teleport");
                }
                if (GUI.Button(new Rect(cardAddHorizPos + 60, cardAddVertStartingPos + 60, 60, 20), "Teleport"))
                {
                    RemoveCardForPlayer(PlayerName, "Teleport");
                }

                if (GUI.Button(new Rect(cardAddHorizPos, cardAddVertStartingPos + 80, 60, 20), "Heal"))
                {
                    SetCardForPlayer(PlayerName, "Heal");
                }
                if (GUI.Button(new Rect(cardAddHorizPos + 60, cardAddVertStartingPos + 80, 60, 20), "Heal"))
                {
                    RemoveCardForPlayer(PlayerName, "Heal");
                }

                if (GUI.Button(new Rect(cardAddHorizPos, cardAddVertStartingPos + 100, 60, 20), "Fireball"))
                {
                    SetCardForPlayer(PlayerName, "Fireball");
                }
                if (GUI.Button(new Rect(cardAddHorizPos + 60, cardAddVertStartingPos + 100, 60, 20), "Fireball"))
                {
                    RemoveCardForPlayer(PlayerName, "Fireball");
                }
            }
            break;

        case GameStateType.PLAYING:
            //print ("GameState Playing GUI stuff");
            MageController currentPlayer = Board.GetCurrentPlayer();
            SpellType[]    localHand     = currentPlayer.Hand;
            int            HandSize      = localHand.GetLength(0);

            for (int i = 0; i < HandSize; i++)
            {
                if (DisplayCard(i, localHand[i].ToString()))
                {
                    CurrentSpell = localHand[i];
                }
            }
            if (GUI.Button(new Rect(10, 10, 100, 90), "Finish Turn"))
            {
                print("Calling advance player function from gui");
                Board.AdvancePlayer();
            }
            break;

        case GameStateType.INIT:
            print("INIT state in PlayerInputHandler.OnGUI");
            break;
        }
    }