Exemple #1
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);
        }
Exemple #2
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();
        }
        public MessageScene()
        {
            this.Bounds = new UniRectangle(
                new UniScalar(0.1f, 0),
                new UniScalar(0.2f, 0),
                new UniScalar(0.8f, 0),
                new UniScalar(0.6f, 0));
            this.EnableDragging = true;
            this.Title          = "Сообщение";

            UniVector size =
                new UniVector(
                    new UniScalar(0.8f, 0),
                    new UniScalar(0.55f, 0));
            UniVector location =
                new UniVector(
                    new UniScalar(0.1f, 0),
                    new UniScalar(0.15f, 0));

            this.LbText = new GuiLabelControl
            {
                Name   = "LbText",
                Bounds = new UniRectangle(location, size)
            };

            size = new UniVector(
                new UniScalar(0.8f, 0),
                new UniScalar(0.2f, 0));
            location = new UniVector(
                new UniScalar(0.1f, 0),
                new UniScalar(0.75f, 0));

            this.BtnOk = new GuiButtonControl
            {
                Name   = "btnOk",
                Bounds = new UniRectangle(location, size),
                Text   = "OK"
            };
            this.BtnOk.Pressed += (sender, e) => this.Close();

            this.Children.Add(this.LbText);
            this.Children.Add(this.BtnOk);
        }
        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);
        }