Beispiel #1
0
        public void Render()
        {
            bool needToRender = true;

            do
            {
                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo pressedChar = Console.ReadKey(true);
                    switch (pressedChar.Key)
                    {
                    case ConsoleKey.R:
                        Console.Clear();
                        needToRender = false;
                        GUIController.RenderPlayerselectionMenu();
                        break;

                    case ConsoleKey.M:
                        Console.Clear();
                        needToRender = false;
                        GUIController.RenderMainMenu();
                        break;

                    case ConsoleKey.Q:
                        Console.Clear();
                        needToRender = false;
                        break;
                    }
                }
            } while (needToRender);
        }
Beispiel #2
0
        public static void Render()
        {
            GUIController guiController = new GUIController();

            bool needToRender = true;

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

                    switch (pressedChar.Key)
                    {
                    case ConsoleKey.P:
                        Console.Clear();
                        GUIController.RenderPlayerselectionMenu();
                        needToRender = false;
                        break;

                    case ConsoleKey.Q:
                        needToRender = false;
                        break;
                    }
                }
            } while (needToRender);
        }
Beispiel #3
0
        public void Render()
        {
            bool needToRender = true;

            Console.Clear();
            PrintInfo(_playerCount, diceCount);

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

                    switch (pressedChar.Key)
                    {
                    case ConsoleKey.Add:
                        diceCount++;
                        if (diceCount > maxDice)
                        {
                            diceCount = maxDice;
                        }
                        break;

                    case ConsoleKey.Subtract:
                        diceCount--;
                        if (diceCount < minDice)
                        {
                            diceCount = minDice;
                        }
                        break;

                    case ConsoleKey.Enter:
                        GUIController.RenderResults(_playerCount, diceCount);
                        needToRender = false;;
                        break;
                    }

                    Console.Clear();
                    PrintInfo(_playerCount, diceCount);
                }
            } while (needToRender);
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            Console.CursorVisible = false;

            GUIController.RenderMainMenu();
        }
Beispiel #5
0
        public void Render()
        {
            bool needToRender = true;
            int  index        = 0;


            for (int j = 1; j < menuItem.Count; j++)
            {
                menuItem[j].SetInActive();
                menuItem[j].Render();
            }
            Console.SetCursorPosition(0, 0);

            do
            {
                while (needToRender)
                {
                    ConsoleKeyInfo pressedKey = Console.ReadKey(true);
                    int            hashCode   = pressedKey.Key.GetHashCode();
                    Console.SetCursorPosition(0, 0);

                    for (int j = 0; j < menuItem.Count; j++)
                    {
                        menuItem[j].SetInActive();
                        menuItem[j].Render();
                    }

                    switch (pressedKey.Key)
                    {
                    case ConsoleKey.RightArrow:
                        index++;
                        if (index > 5)
                        {
                            index = 0;
                        }
                        menuItem[index].SetActive();
                        menuItem[index].Render();
                        break;

                    case ConsoleKey.LeftArrow:
                        index--;
                        if (index < 0)
                        {
                            index = 5;
                        }
                        menuItem[index].SetActive();
                        menuItem[index].Render();
                        break;

                    case ConsoleKey.DownArrow:
                        index += 3;
                        if (index > 5)
                        {
                            index -= 3;
                        }
                        break;

                    case ConsoleKey.UpArrow:
                        index -= 3;
                        if (index < 0)
                        {
                            index += 3;
                        }
                        break;

                    case ConsoleKey.Enter:
                        needToRender = false;
                        Console.Clear();
                        GUIController.RenderDiceSelection(index);
                        break;
                    }
                    if (pressedKey.Key != ConsoleKey.RightArrow || pressedKey.Key != ConsoleKey.LeftArrow ||
                        pressedKey.Key != ConsoleKey.UpArrow || pressedKey.Key != ConsoleKey.DownArrow ||
                        pressedKey.Key != ConsoleKey.Enter)
                    {
                        menuItem[index].SetActive();
                        menuItem[index].Render();
                    }
                }
            } while (needToRender);
        }