コード例 #1
0
ファイル: UserMenu.cs プロジェクト: emmaculatej/maze_game
        public void Create(List <String> items, Point position, string title, int selected = 0,
                           ConsoleColor borderColour   = ConsoleColor.Yellow, ConsoleColor textColour = ConsoleColor.Gray,
                           ConsoleColor selectedColour = ConsoleColor.Blue)
        {
            MenuItems     = items;
            SelectedIndex = selected;
            Position      = position;
            Title         = title;

            BorderColour   = borderColour;
            TextColour     = textColour;
            SelectedColour = selectedColour;

            UserMenuBox = new DialogueBox();
            int maxWidth = title.Length;

            foreach (string item in items)
            {
                if (item.Length > maxWidth)
                {
                    maxWidth = item.Length;
                }
            }

            MenuSize = new Size(maxWidth + 4, items.Count + 4);
            UserMenuBox.Create(position, MenuSize, borderColour, ConsoleColor.Black, title);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: emmaculatej/maze_game
        static void Main(string[] args)
        {
            // Introduction to the Game
            DialogueBox mazeIntroduction = new DialogueBox();

            mazeIntroduction.Create(new Point(1, 1), new Size(14, 14), ConsoleColor.White, ConsoleColor.Black, "Welcome to the Maze!");
            mazeIntroduction.Draw();


            //Box maze_area = new Box();
            //maze_area.Create(new Point(5, 5), new Size(100, 20), ConsoleColor.White, ConsoleColor.Black);
            //maze_area.Draw();

            List <string> items = new List <string>()
            {
                "Item1", "Item2", "Item3"
            };

            UserMenu menu = new UserMenu();

            menu.Create(items, new Point(5, 5), "Main Menu");
            while (true)
            {
                menu.Draw();

                if (menu.Update())
                {
                    Console.Write("Get Ready...");
                    break;
                }
            }

            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: dolanmiu/maze_game
        static void Main(string[] args)
        {
            // Introduction to the Game
            DialogueBox mazeIntroduction = new DialogueBox();

            mazeIntroduction.Create(new Point(1, 1), new Size(10, 10), ConsoleColor.White, ConsoleColor.Black, "Welcome to the Maze!");
            mazeIntroduction.Draw();


            //Box maze_area = new Box();
            //maze_area.Create(new Point(5, 5), new Size(100, 20), ConsoleColor.White, ConsoleColor.Black);
            //maze_area.Draw();

            Console.ReadLine();
        }