示例#1
0
        public LoadGameScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.LoadGameMenu)
        {
            _game = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _savedGameFont = _content.Load<SpriteFont>("load_game_menu/saved_game_font");
            _confirmationFont = _content.Load<SpriteFont>("shared_ui/confirmation_font");
            _savedGameButtons = new List<LabelTextureButton>();
            _deleteGameButtons = new List<TextureButton>();

            _container = new BluePane(
                this,
                UIAlignment.MiddleCenter,
                0,
                0,
                545,
                400);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                135,
                180,
                _content.Load<Texture2D>("shared_ui/cancel_button_over"),
                _content.Load<Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
                {
                    _game.closeLoadGameMenu();
                    _game.openMainMenu();
                });
        }
示例#2
0
        public LoadGameScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.LoadGameMenu)
        {
            _game    = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _savedGameFont         = _content.Load <SpriteFont>("load_game_menu/saved_game_font");
            _confirmationFont      = _content.Load <SpriteFont>("shared_ui/confirmation_font");
            _savedGameButtons      = new List <LabelTextureButton>();
            _deleteGameButtons     = new List <TextureButton>();

            _container = new BluePane(
                this,
                UIAlignment.MiddleCenter,
                0,
                0,
                545,
                400);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                135,
                180,
                _content.Load <Texture2D>("shared_ui/cancel_button_over"),
                _content.Load <Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
            {
                _game.closeLoadGameMenu();
                _game.openMainMenu();
            });
        }
示例#3
0
        override public void update()
        {
            base.update();

            // Handle button input
            for (int i = 0; i < _buttons.Count; i++)
            {
                TextureButton button = _buttons[i];

                if (button.hitTest(new Vector2(_newMouseState.X, _newMouseState.Y)))
                {
                    button.mouseOver();

                    if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                    {
                        button.activate();
                    }
                }
                else if (button.selected)
                {
                    button.mouseOut();
                }
            }

            base.update();
        }
        public PlayerCreationScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.PlayerCreation)
        {
            _game = game;
            _content = new ContentManager(game.Services, "Content");
            _titleFont = _content.Load<SpriteFont>("player_creation_screen/title_font");
            _letterFont = _content.Load<SpriteFont>("shared_ui/dialogue_font");
            _namePreview = new NamePreview(this, _letterFont, UIAlignment.MiddleCenter, -200, -122, _maxLetters);
            _nameInputPane = new NameInputPane(this, _letterFont, UIAlignment.MiddleCenter, 0, 98, 648, 320, _maxLetters);

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.MiddleCenter,
                0,
                -180,
                TextAlignment.Center,
                "Please choose a name",
                2);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                24,
                240,
                _content.Load<Texture2D>("shared_ui/cancel_button_over"),
                _content.Load<Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
                {
                    _game.closePlayerCreationScreen();
                    _game.openMainMenu();
                });

            _createButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                184,
                240,
                _content.Load<Texture2D>("player_creation_screen/create_button_over"),
                _content.Load<Texture2D>("player_creation_screen/create_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
                {
                    _game.closePlayerCreationScreen();
                    _screenSystem.addTransition(new ScreenFadeOutTransition(this, Color.Black, true, 0.05f, null, () =>
                    {
                        int playerSlot;
                        _game.startPersistentSystems();
                        _game.playerSystem.createPlayer();
                        playerSlot = DataManager.createPlayerData(_nameInputPane.name);
                        DataManager.loadPlayerData(playerSlot);
                        _game.loadLevel("dagny_house");
                        //_game.openWorldMap();
                    }));
                });
        }
示例#5
0
        public PlayerCreationScreen(LoderGame game) : base(game.screenSystem, ScreenType.PlayerCreation)
        {
            _game          = game;
            _content       = new ContentManager(game.Services, "Content");
            _titleFont     = _content.Load <SpriteFont>("player_creation_screen/title_font");
            _letterFont    = _content.Load <SpriteFont>("shared_ui/dialogue_font");
            _namePreview   = new NamePreview(this, _letterFont, UIAlignment.MiddleCenter, -200, -122, _maxLetters);
            _nameInputPane = new NameInputPane(this, _letterFont, UIAlignment.MiddleCenter, 0, 98, 648, 320, _maxLetters);

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.MiddleCenter,
                0,
                -180,
                TextAlignment.Center,
                "Please choose a name",
                2);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                24,
                240,
                _content.Load <Texture2D>("shared_ui/cancel_button_over"),
                _content.Load <Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
            {
                _game.closePlayerCreationScreen();
                _game.openMainMenu();
            });

            _createButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                184,
                240,
                _content.Load <Texture2D>("player_creation_screen/create_button_over"),
                _content.Load <Texture2D>("player_creation_screen/create_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
            {
                _game.closePlayerCreationScreen();
                _screenSystem.addTransition(new ScreenFadeOutTransition(this, Color.Black, true, 0.05f, null, () =>
                {
                    int playerSlot;
                    _game.startPersistentSystems();
                    _game.playerSystem.createPlayer();
                    playerSlot = DataManager.createPlayerData(_nameInputPane.name);
                    DataManager.loadPlayerData(playerSlot);
                    _game.loadLevel("dagny_house");
                    //_game.openWorldMap();
                }));
            });
        }
        public ConfirmationScreen(ScreenSystem screenSystem, SpriteFont font, string text, Action onCancel, Action onOkay)
            : base(screenSystem, ScreenType.Confirmation)
        {
            _spriteBatch = screenSystem.spriteBatch;
            _font        = font;
            _onCancel    = onCancel;
            _onOkay      = onOkay;

            Vector2 titleSize = _font.MeasureString(text);
            int     padding   = 16;

            _overlay = new Overlay(this, Color.Black);

            _pane = new StonePane(
                this,
                UIAlignment.MiddleCenter,
                0,
                -padding,
                (int)titleSize.X + padding * 2,
                100);


            _label = new Label(
                this,
                _font,
                UIAlignment.MiddleCenter,
                0,
                -50,
                TextAlignment.Center,
                text,
                2);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                (int)(titleSize.X / 2f) - 285,
                15,
                ResourceManager.getTexture("cancel_button_over"),
                ResourceManager.getTexture("cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () => { _onCancel(); });

            _okayButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                (int)(titleSize.X / 2f) - 125,
                15,
                ResourceManager.getTexture("okay_button_over"),
                ResourceManager.getTexture("okay_button"),
                new Rectangle(0, 0, 152, 33),
                () => { _onOkay(); });
        }
示例#7
0
        public ConfirmationScreen(ScreenSystem screenSystem, SpriteFont font, string text, Action onCancel, Action onOkay)
            : base(screenSystem, ScreenType.Confirmation)
        {
            _spriteBatch = screenSystem.spriteBatch;
            _font = font;
            _onCancel = onCancel;
            _onOkay = onOkay;

            Vector2 titleSize = _font.MeasureString(text);
            int padding = 16;

            _overlay = new Overlay(this, Color.Black);

            _pane = new StonePane(
                this,
                UIAlignment.MiddleCenter,
                0,
                -padding,
                (int)titleSize.X + padding * 2,
                100);

            _label = new Label(
                this,
                _font,
                UIAlignment.MiddleCenter,
                0,
                -50,
                TextAlignment.Center,
                text,
                2);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                (int)(titleSize.X / 2f) - 285,
                15,
                ResourceManager.getTexture("cancel_button_over"),
                ResourceManager.getTexture("cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () => { _onCancel(); });

            _okayButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                (int)(titleSize.X / 2f) - 125,
                15,
                ResourceManager.getTexture("okay_button_over"),
                ResourceManager.getTexture("okay_button"),
                new Rectangle(0, 0, 152, 33),
                () => { _onOkay(); });
        }
示例#8
0
        private void hitTestButton(TextureButton button)
        {
            if (button.hitTest(new Vector2(_newMouseState.X, _newMouseState.Y)))
            {
                button.mouseOver();

                if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                {
                    button.activate();
                }
            }
            else if (button.selected)
            {
                button.mouseOut();
            }
        }
        private void hitTestTextureButton(TextureButton button, Vector2 point)
        {
            if (button.hitTest(point))
            {
                button.mouseOver();

                if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                {
                    button.activate();
                }
            }
            else
            {
                if (button.selected)
                {
                    button.mouseOut();
                }
            }
        }
示例#10
0
        private bool hitTestTextureButton(TextureButton button)
        {
            if (button.hitTest(new Vector2(_newMouseState.X, _newMouseState.Y)))
            {
                if (!button.selected)
                {
                    button.mouseOver();
                }

                if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                {
                    button.activate();
                }

                return(true);
            }
            else if (button.selected)
            {
                button.mouseOut();
            }

            return(false);
        }
示例#11
0
        private void hitTestButton(TextureButton button)
        {
            if (button.hitTest(new Vector2(_newMouseState.X, _newMouseState.Y)))
            {
                button.mouseOver();

                if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                {
                    button.activate();
                }
            }
            else if (button.selected)
            {
                button.mouseOut();
            }
        }
示例#12
0
        private void createVideoElements()
        {
            _videoTitle = new Label(
                this,
                _categoryTitleFont,
                UIAlignment.MiddleCenter,
                -255,
                -160,
                TextAlignment.Left,
                "Video",
                3);

            _resolutionLabel = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                -255,
                -80,
                TextAlignment.Left,
                "Resolution",
                2,
                _optionsColor);

            _resolutionValue = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                200,
                -80,
                TextAlignment.Center,
                _currentResolution.text,
                2,
                _optionsColor);

            _resolutionPrevious = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                120,
                -80,
                _leftArrowsOver,
                _leftArrows,
                _leftArrows.Bounds,
                () => { selectPreviousResolution(); });

            _resolutionNext = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                264,
                -80,
                _rightArrowsOver,
                _rightArrows,
                _rightArrows.Bounds,
                () => { selectNextResolution(); });

            _fullscreenLabel = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                -255,
                -40,
                TextAlignment.Left,
                "Fullscreen",
                2,
                _optionsColor);

            _fullscreenValue = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                200,
                -40,
                TextAlignment.Center,
                _fullscreen ? "True" : "False",
                2,
                _optionsColor);

            _fullscreenPrevious = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                120,
                -40,
                _leftArrowsOver,
                _leftArrows,
                _leftArrows.Bounds,
                () => { toggleFullscreen(); });

            _fullscreenNext = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                264,
                -40,
                _rightArrowsOver,
                _rightArrows,
                _rightArrows.Bounds,
                () => { toggleFullscreen(); });
        }
示例#13
0
        private void createVideoElements()
        {
            _videoTitle = new Label(
                this,
                _categoryTitleFont,
                UIAlignment.MiddleCenter,
                -255,
                -160,
                TextAlignment.Left,
                "Video",
                3);

            _resolutionLabel = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                -255,
                -80,
                TextAlignment.Left,
                "Resolution",
                2,
                _optionsColor);

            _resolutionValue = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                200,
                -80,
                TextAlignment.Center,
                _currentResolution.text,
                2,
                _optionsColor);

            _resolutionPrevious = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                120,
                -80,
                _leftArrowsOver,
                _leftArrows,
                _leftArrows.Bounds,
                () => { selectPreviousResolution(); });

            _resolutionNext = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                264,
                -80,
                _rightArrowsOver,
                _rightArrows,
                _rightArrows.Bounds,
                () => { selectNextResolution(); });

            _fullscreenLabel = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                -255,
                -40,
                TextAlignment.Left,
                "Fullscreen",
                2,
                _optionsColor);

            _fullscreenValue = new Label(
                this,
                _optionsFont,
                UIAlignment.MiddleCenter,
                200,
                -40,
                TextAlignment.Center,
                _fullscreen ? "True" : "False",
                2,
                _optionsColor);

            _fullscreenPrevious = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                120,
                -40,
                _leftArrowsOver,
                _leftArrows,
                _leftArrows.Bounds,
                () => { toggleFullscreen(); });

            _fullscreenNext = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                264,
                -40,
                _rightArrowsOver,
                _rightArrows,
                _rightArrows.Bounds,
                () => { toggleFullscreen(); });
        }
示例#14
0
        private void hitTestTextureButton(TextureButton button, Vector2 point)
        {
            if (button.hitTest(point))
            {
                button.mouseOver();

                if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                    button.activate();
            }
            else
            {
                if (button.selected)
                    button.mouseOut();
            }
        }
示例#15
0
        private bool hitTestTextureButton(TextureButton button)
        {
            if (button.hitTest(new Vector2(_newMouseState.X, _newMouseState.Y)))
            {
                if (!button.selected)
                    button.mouseOver();

                if (_newMouseState.LeftButton == ButtonState.Pressed && _oldMouseState.LeftButton == ButtonState.Released)
                    button.activate();

                return true;
            }
            else if (button.selected)
            {
                button.mouseOut();
            }

            return false;
        }