Beispiel #1
0
        public void CheckPlayersValue(int index)
        {
            needToRenderPlayerMenu = false;
            needToRenderDiceMenu   = true;
            int diceCount = 1;

            if (needToRenderDiceMenu)
            {
                diceSelectionMenu.Render();

                key = Console.ReadKey(true).Key;
                do
                {
                    key = Console.ReadKey(true).Key;
                    switch (key)
                    {
                    case ConsoleKey.Add:
                    {
                        diceCount++;
                        break;
                    }

                    case ConsoleKey.Subtract:
                    {
                        diceCount--;
                        break;
                    }
                    }
                    DiceTotalCheck(index, diceCount);
                } while (needToRenderDiceMenu);
            }
        }
Beispiel #2
0
        public void ActivateDiceSelectionMenu()
        {
            do
            {
                diceSelectionMenu.Render();
waitForKeyPress:                 //so that console doesn't render if not needed
                ConsoleKeyInfo pressedKey = Console.ReadKey(true);
                switch (pressedKey.Key)
                {
                case ConsoleKey.OemPlus:
                    diceSelectionMenu.IncreaseDicesCount();
                    break;

                case ConsoleKey.OemMinus:
                    diceSelectionMenu.ReduceDicesCount();
                    break;

                case ConsoleKey.Enter:
                    game = new GameController(diceSelectionMenu.DiceCount, this);
                    game.InitGame();
                    game.StartGame();
                    break;

                case ConsoleKey.Escape:
                    ActivatePlayerSelectionMenu();
                    break;

                default:
                    goto waitForKeyPress;
                }
            } while (true);
        }
Beispiel #3
0
        // Kauliuko meniu pasirinkimo valdymas
        public void DiceSelectionMenu()
        {
            bool needToRender = true;

            while (needToRender)
            {
                diceSelectionMenu.Render();
                ConsoleKeyInfo pressedChar = Console.ReadKey(true);
                switch (pressedChar.Key)
                {
                case ConsoleKey.UpArrow:
                    diceSelectionMenu.MoreDices();
                    break;

                case ConsoleKey.DownArrow:
                    diceSelectionMenu.LessDices();
                    break;

                case ConsoleKey.Enter:
                    bool enter = true;
                    while (enter)
                    {
                        DiceGame dice = new DiceGame(playerSelectionMenu.buttonIndex, diceSelectionMenu.diceAmount);
                        dice.Render();
                    }
                    break;
                }
            }
            Console.Clear();
        }
Beispiel #4
0
        public void SelectDice()
        {
            selectionMenu.Render();
            diceNumber = 1;
            Render();

            ConsoleKeyInfo pressedChar;

            do
            {
                pressedChar = Console.ReadKey(true);
                int hashCode = pressedChar.Key.GetHashCode();

                switch (pressedChar.Key)
                {
                case ConsoleKey.Add:
                    diceNumber++;
                    break;

                case ConsoleKey.Subtract:
                    diceNumber--;
                    break;

                default:
                    break;
                }
                if (diceNumber > 0)
                {
                    Render();
                }
            }while (pressedChar.Key != ConsoleKey.Enter && pressedChar.Key != ConsoleKey.Escape);
            if (pressedChar.Key == ConsoleKey.Escape)
            {
                GoodByeMenu goodBye = new GoodByeMenu();
                goodBye.Render();
            }
        }
Beispiel #5
0
 public static void DiceMenuRender()
 {
     diceMenu = new DiceSelectionMenu();
     diceMenu.Render();
 }