Ejemplo n.º 1
0
        /// <summary>
        /// Constructor of the <c>InventoryScreen</c> class.
        /// </summary>
        /// <param name="gameScreen">Reference to the main screen of the game.</param>
        /// <param name="name">Name of the screen.</param>
        /// <param name="backgroundTextureName">Name of the background texture.</param>
        /// <param name="player">Reference to the player.</param>
        public InventoryScreen(MainGameScreen gameScreen, string name,
                               string backgroundTextureName, Player player)
        {
            GameGraphicsDevice = EngineManager.GameGraphicsDevice;

            Name = name;

            _gameScreen = gameScreen;

            _player = player;

            TransitionOnTime  = TimeSpan.FromSeconds(0.5f);
            TransitionOffTime = TimeSpan.FromSeconds(0.5f);

            Input.Continuous = false;

            IsPopup = true;

            _backgroundTextureName = backgroundTextureName;

            _inside         = false;
            _currentElement = InventoryParts.Exit;

            Vector2 viewportSize = new Vector2(
                GameSettings.DefaultInstance.ResolutionWidth,
                GameSettings.DefaultInstance.ResolutionHeight);

            _backgroundPosition   = new Vector2();
            _backgroundPosition.X = viewportSize.X / 8f;
            _backgroundPosition.Y = viewportSize.Y / 8f;

            _closeButtonPosition   = new Vector2();
            _closeButtonPosition.X = viewportSize.X * 6f / 8f;
            _closeButtonPosition.Y = viewportSize.Y * 6f / 8f;
        }
        /// <summary>
        /// Constructor of the <c>GameMenuScreen</c> class.
        /// </summary>
        /// <param name="gameScreen">Reference to the main game screen.</param>
        /// <param name="name">Name of screen.</param>
        /// <param name="menuEntriesSeparation">Separation between the entries.</param>
        public GameMenuScreen(MainGameScreen gameScreen, string name, float menuEntriesSeparation)
        {
            GameGraphicsDevice = EngineManager.GameGraphicsDevice;

            Name = name;

            _gameScreen = gameScreen;

            TransitionOnTime  = TimeSpan.FromSeconds(0.5f);
            TransitionOffTime = TimeSpan.FromSeconds(0.5f);

            Input.Continuous = false;

            IsPopup = true;

            _selectedEntry = 0;

            _menuEntries = new List <MenuEntry>();
            _menuEntries.Add(new MenuEntry(StringHelper.DefaultInstance.Get("menu_ingame_continue")));
            _menuEntries.Add(new MenuEntry(StringHelper.DefaultInstance.Get("menu_ingame_save")));
            _menuEntries.Add(new MenuEntry(StringHelper.DefaultInstance.Get("menu_ingame_lastsave")));
            _menuEntries.Add(new MenuEntry(StringHelper.DefaultInstance.Get("menu_ingame_exit")));

            Vector2 viewportSize = new Vector2(
                GameSettings.DefaultInstance.ResolutionWidth,
                GameSettings.DefaultInstance.ResolutionHeight);

            _menuEntrySize = ScreenManager.FontEntries.MeasureString(
                StringHelper.DefaultInstance.Get("menu_ingame_lastsave"));

            _menuEntriesSeparation = _menuEntrySize.Y * 0.9f;

            _initialPosition.X = (viewportSize.X - _menuEntrySize.X) / 2;
            _initialPosition.Y = (viewportSize.Y / 2f) - ((_menuEntrySize.Y * 4f + _menuEntriesSeparation * 5f) / 2f);
            _currentPosition   = _initialPosition;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor of the <c>DeadScreen</c> class.
        /// </summary>
        /// <param name="gameScreen">Reference to the screen where the user interacts.</param>
        /// <param name="name">Name of the screen.</param>
        public DeadScreen(MainGameScreen gameScreen, string name)
        {
            GameGraphicsDevice = EngineManager.GameGraphicsDevice;

            Name = name;

            _gameScreen = gameScreen;

            TransitionOnTime  = TimeSpan.FromSeconds(0.5f);
            TransitionOffTime = TimeSpan.FromSeconds(0.5f);

            Input.Continuous = false;

            IsPopup = true;

            _selectedEntry = 0;

            _titleSize = ScreenManager.FontEntries.MeasureString(
                StringHelper.DefaultInstance.Get("dead_screen_message"));
            _menuEntrySizeY = ScreenManager.FontEntries.MeasureString(
                StringHelper.DefaultInstance.Get("dead_screen_yes"));
            _menuEntrySizeN = ScreenManager.FontEntries.MeasureString(
                StringHelper.DefaultInstance.Get("dead_screen_no"));
        }