public LobbyScreen(ContentManager Content)
        {
            content = new ContentManager(Content.ServiceProvider, "Content"); // TODO has to be disposed
            pixel   = content.Load <Texture2D>("pixel");
            players = new Dictionary <string, LobbyPlayer>();

            int i = 0;

            guis = new List <MenuGuiManager>();
            foreach (KeyValuePair <PlayerControllerIndex, InputController> kvp in Input.Controllers)
            {
                PlayerControllerIndex index = kvp.Key;
                MenuGuiManager        gui   = new MenuGuiManager(index);
                guis.Add(gui);

                string inputButtonText = (index == PlayerControllerIndex.Keyboard) ? "[Enter]" : "(A)";
                int    y      = 200 + i * 75;
                Button button = new Button(100, y, 150, 60, $"Press {inputButtonText} to join");
                gui.AddButton(button);
                button.Click += (source, args) =>
                {
                    gui.RemoveButton(button);
                    client.RequestNewPlayer((int)index);
                };

                i++;
            }
        }
        public void Initialize(GraphicsDevice GraphicsDevice, ContentManager Content)
        {
            gui = new MenuGuiManager();
            gui.AddButton(new Button(100, 100, 230, 110, "create"));
            gui.AddButton(new Button(100, 250, 230, 110, "join"));
            gui.AddButton(new Button(350, 250, 115, 55, "pathfinding"));
            gui.AddButton(new Button(490, 250, 115, 55, "biomes"));
            gui.AddButton(new Button(120, 400, 115, 55, "quit game"));

            gui.GetButton(0).NextButtonUp   = gui.GetButton(4);
            gui.GetButton(0).NextButtonDown = gui.GetButton(1);
            gui.GetButton(0).Click         += (source, args) => ScreenManager.PushScreen(new ServerLobbyScreen(Content));

            gui.GetButton(1).NextButtonUp    = gui.GetButton(0);
            gui.GetButton(1).NextButtonDown  = gui.GetButton(4);
            gui.GetButton(1).NextButtonRight = gui.GetButton(2);
            gui.GetButton(1).NextButtonLeft  = gui.GetButton(3);
            gui.GetButton(1).Click          += (source, args) => ScreenManager.PushScreen(new LobbyScreen(Content));

            gui.GetButton(2).NextButtonLeft  = gui.GetButton(1);
            gui.GetButton(2).NextButtonRight = gui.GetButton(3);
            gui.GetButton(2).Click          += (source, args) => ScreenManager.PushScreen(new PathfinderScreen());

            gui.GetButton(3).NextButtonLeft  = gui.GetButton(2);
            gui.GetButton(3).NextButtonRight = gui.GetButton(1);
            gui.GetButton(3).Click          += (source, args) => ScreenManager.PushScreen(new BiomeDrawScreen());

            gui.GetButton(4).NextButtonUp   = gui.GetButton(1);
            gui.GetButton(4).NextButtonDown = gui.GetButton(0);
            gui.GetButton(4).Click         += (source, args) => System.Environment.Exit(0);
        }
        public void Initialize(GraphicsDevice GraphicsDevice, ContentManager Content)
        {
            gui = new MenuGuiManager();
            gui.AddButton(new Button(300, 350, 200, 90, "Back to the lobby"));

            void BackToLobby(object source, EventArgs args)
            {
                ScreenManager.PopScreen();
            }

            gui.BackButtonPressed  += BackToLobby;
            gui.GetButton(0).Click += BackToLobby;
        }
Beispiel #4
0
 public void Initialize(GraphicsDevice GraphicsDevice, ContentManager Content)
 {
     gui = new MenuGuiManager();
     gui.AddButton(new Button(100, 200, 230, 110, buttonStr));
     gui.GetButton(0).Click += (source, args) => ScreenManager.GoBackToMainMenu();
 }