Beispiel #1
0
        static void CreateStartMeni(IDrawningRectangle <SignConsole> location)
        {
            KeyPress.SetControl("Menu");
            var menu        = new KeyboardMenu <ButtonInConsole>("menu");
            var menuPrinter = new ConsolePrintMenu(location.Width, location.Height, location, menu);

            location.Register((0, 0), menuPrinter, menuPrinter.GetCoordinates());
            var printer = new BigPixelPrint(menuPrinter.Width, 5, menuPrinter, letters);

            menuPrinter.Register((0, 1), printer, printer.GetCoordinates());
            menuPrinter.SetWriter(printer);
            MenuKeySet(menu);

            var buttons = MenuInicialisation(menu, menuPrinter, new string[] { "Snake start", "Settings", "Exit" });

            buttons[0].IsPressed += () =>
            {
                menuPrinter.Hide();
                void act()
                {
                    menuPrinter.Load();
                    MenuKeySet(menu);
                }

                SnakeMenuLoad(location, act);
            };

            buttons[1].IsPressed += () =>
            {
                menuPrinter.Hide();
                void act()
                {
                    menuPrinter.Load();
                    MenuKeySet(menu);
                }

                CommonSettings(location, act);
            };

            buttons[2].IsPressed += () =>
            {
                menuPrinter.Close();
                location.CancelRegistration(menuPrinter);
                KeyPress.Close();
                MenuKeyClose();
                return;
            };

            menuPrinter.Load();
        }