private void Button2_Pressed(object sender, System.EventArgs e)
        {
            if (_gui.Screen.Desktop.Children.Any(i => i.Name == "window"))
            {
                return;
            }

            var window = new GuiWindowControl
            {
                Name           = "window",
                Bounds         = new UniRectangle(new UniVector(new UniScalar(0.5f, -100), new UniScalar(0.5f, -60)), new UniVector(new UniScalar(200), new UniScalar(120))),
                Title          = "Color picker",
                EnableDragging = true
            };

            var choice1 = new GuiChoiceControl
            {
                Name     = "choiceBlack",
                Bounds   = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 30), new UniScalar(10), new UniScalar(10)),
                Text     = "Black",
                Selected = true
            };
            var choice2 = new GuiChoiceControl
            {
                Name     = "choiceGray",
                Bounds   = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 45), new UniScalar(10), new UniScalar(10)),
                Text     = "Gray",
                Selected = false
            };
            var choice3 = new GuiChoiceControl
            {
                Name     = "choiceWhite",
                Bounds   = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 60), new UniScalar(10), new UniScalar(10)),
                Text     = "White",
                Selected = false
            };
            var button1 = new GuiButtonControl
            {
                Name   = "confirm",
                Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(1.0f, -40), new UniScalar(0f, 80), new UniScalar(0f, 30)),
                Text   = "Confirm"
            };
            var button2 = new GuiButtonControl
            {
                Name   = "cancel",
                Bounds = new UniRectangle(new UniScalar(1.0f, -90), new UniScalar(1.0f, -40), new UniScalar(0f, 80), new UniScalar(0f, 30)),
                Text   = "Cancel"
            };

            button1.Pressed += DialogueConfirm_Pressed;
            button2.Pressed += DialogueCancel_Pressed;

            window.Children.Add(choice1);
            window.Children.Add(choice2);
            window.Children.Add(choice3);
            window.Children.Add(button1);
            window.Children.Add(button2);

            _gui.Screen.Desktop.Children.Add(window);
        }
示例#2
0
        private void Initialize()
        {
            this.Bounds = new UniRectangle(new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 0.0f), new UniScalar(1.0f, 1.0f), new UniScalar(1.0f, 1.0f));

            _mainMenuButton = new GuiButtonControl
            {
                Name   = "MainMenuButton",
                Bounds = new UniRectangle(new UniScalar(0.9f, -30), new UniScalar(0.9f, 20), 100, 24),
                Text   = "Main Menu"
            };
            _mainMenuButton.Pressed += (sender, e) => { GameController.Instance.MainMenu(); };

            _optionsButton = new GuiButtonControl {
                Name   = "OptionsButton",
                Bounds = new UniRectangle(new UniScalar(0.9f, -30), new UniScalar(0.9f, -8), 100, 24),
                Text   = "Options"
            };
            _optionsButton.Pressed += Options;

            Children.Add(_mainMenuButton);
            Children.Add(_optionsButton);

            _optionsWindow = new GuiWindowControl()
            {
                Name   = "OptionsWindow",
                Bounds = new UniRectangle(
                    new UniScalar(0.3f, 0.0f), new UniScalar(0.3f, 0.0f), new UniScalar(0.3f, 0.0f),
                    new UniScalar(0.3f, 0.0f)),
                Title = "Options"
            };
        }
示例#3
0
        public TitleState()
        {
            background = AppContentManager.Load <Texture2D>("Title/Title");


            if (gui == null)
            {
                inputListener = new InputListenerComponent(GameApp);
                inputManager  = new MonoGame.Extended.NuclexGui.GuiInputService(inputListener);
                gui           = new GuiManager(GameApp.Services, inputManager);
                gui.Initialize();
            }
            gui.Screen   = new GuiScreen();
            btnStartGame = new GuiButtonControl
            {
                Name   = "Start Game",
                Bounds = new UniRectangle(new UniVector(new UniScalar(540), new UniScalar(200)), new UniVector(new UniScalar(200), new UniScalar(70))),
                Text   = "Start Game"
            };
            btnQuitGame = new GuiButtonControl
            {
                Name   = "Quit Game",
                Bounds = new UniRectangle(new UniVector(new UniScalar(540), new UniScalar(300)), new UniVector(new UniScalar(200), new UniScalar(70))),
                Text   = "Quit Game"
            };
            btnQuitGame.Pressed += BtnQuitGame_Pressed;
            gui.Screen.Desktop.Children.Add(btnQuitGame);

            windowStarting = new GuiWindowControl()
            {
                Name   = "Starting",
                Bounds = new UniRectangle(new UniVector(new UniScalar(240), new UniScalar(200)), new UniVector(new UniScalar(800), new UniScalar(100))),
                Title  = "Starting Game..."
            };

            btnStartGame.Pressed += OnStartGamePressed;
            gui.Screen.Desktop.Children.Add(btnStartGame);

            lblStatus = new GuiLabelControl()
            {
                Bounds = new UniRectangle(new UniVector(new UniScalar(10), new UniScalar(0)), new UniVector(new UniScalar(800), new UniScalar(100))),
                Text   = ""
            };

            windowStarting.Children.Add(lblStatus);
        }
示例#4
0
        /// <summary>
        /// Create a game interface from a given game
        /// </summary>
        /// <param name="Game">Game object that is being played</param>
        public GameState(Game.Game Game, Microsoft.Xna.Framework.Game MonogameGame)
        {
            this.G = Game;

            this.G.TellStory = ShowStory;

            MapTileSprites       = AppContentManager.Load <Texture2D>("MapTiles");
            PCSprites            = AppContentManager.Load <Texture2D>("CharacterSprites");
            MomentumSprite       = AppContentManager.Load <Texture2D>("UiElements/MomentumMarker");
            SpentMomentumSprite  = AppContentManager.Load <Texture2D>("UiElements/SpentMomentumMarker");
            HpSprite             = AppContentManager.Load <Texture2D>("UiElements/HpMarker");
            MovementArrowsSprite = AppContentManager.Load <Texture2D>("UiElements/Arrows");
            MonsterDetailsFont   = AppContentManager.Load <SpriteFont>("UiElements/MonsterDisplay");
            StateFont            = AppContentManager.Load <SpriteFont>("UiElements/TurnState");

            arrowWidth  = MovementArrowsSprite.Width / 9;
            arrowHeight = MovementArrowsSprite.Height / 3;

            minimap           = new Minimap(Game, MonogameGame);
            minimap.showCrime = true;

            gui.Screen = new GuiScreen();

            storyWindow = new GuiWindowControl()
            {
                Name   = "StoryWindow",
                Bounds = new UniRectangle(new UniVector(new UniScalar(190), new UniScalar(200)), new UniVector(new UniScalar(900), new UniScalar(200))),
            };

            storyText = new GuiLabelControl()
            {
                Name   = "StoryText",
                Bounds = new UniRectangle(new UniVector(new UniScalar(10), new UniScalar(0)), new UniVector(new UniScalar(500), new UniScalar(120))),
            };
            storyWindow.Children.Add(storyText);

            storyButton = new GuiButtonControl()
            {
                Bounds = new UniRectangle(new UniVector(new UniScalar(375), new UniScalar(120)), new UniVector(new UniScalar(150), new UniScalar(70))),
                Text   = "Continue"
            };
            storyWindow.Children.Add(storyButton);
            storyButton.Pressed += StoryButton_Pressed;

            G.StartGame();
        }
示例#5
0
        private void Button3_Pressed(object sender, EventArgs e)
        {
            if (_gui.Screen.Desktop.Children.Any(i => i.Name == "window"))
            {
                return;
            }

            var window = new GuiWindowControl
            {
                Name           = "window",
                Bounds         = new UniRectangle(new UniVector(new UniScalar(0.5f, -100), new UniScalar(0.5f, -60)), new UniVector(new UniScalar(200), new UniScalar(160))),
                Title          = "Labels with Styles",
                EnableDragging = true
            };

            var labelTitle = new GuiLabelControl
            {
                Name   = "label-title",
                Bounds = new UniRectangle(new UniScalar(10), new UniScalar(45), new UniScalar(10), new UniScalar(10)),
                Text   = "Title",
                Style  = "label-title"
            };
            var label1 = new GuiLabelControl
            {
                Name   = "label1",
                Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 70), new UniScalar(10), new UniScalar(10)),
                Text   = "Heading 1",
                Style  = "label-h1",
            };
            var label2 = new GuiLabelControl
            {
                Name   = "label2",
                Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 90), new UniScalar(10), new UniScalar(10)),
                Text   = "Heading 2",
                Style  = "label-h2",
            };
            var label3 = new GuiLabelControl
            {
                Name   = "label3",
                Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 105), new UniScalar(10), new UniScalar(10)),
                Text   = "Heading 3",
                Style  = "label-h3"
            };

            var button1 = new GuiButtonControl
            {
                Name   = "confirm",
                Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(1.0f, -40), new UniScalar(0f, 80), new UniScalar(0f, 30)),
                Text   = "Confirm"
            };
            var button2 = new GuiButtonControl
            {
                Name   = "cancel",
                Bounds = new UniRectangle(new UniScalar(1.0f, -90), new UniScalar(1.0f, -40), new UniScalar(0f, 80), new UniScalar(0f, 30)),
                Text   = "Cancel"
            };

            button1.Pressed += DialogueConfirm_Pressed;
            button2.Pressed += DialogueCancel_Pressed;

            window.Children.Add(labelTitle);
            window.Children.Add(label1);
            window.Children.Add(label2);
            window.Children.Add(label3);
            window.Children.Add(button1);
            window.Children.Add(button2);

            _gui.Screen.Desktop.Children.Add(window);
        }