コード例 #1
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();
                    }));
                });
        }
コード例 #2
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(); });
        }
コード例 #3
0
ファイル: LoadingScreen.cs プロジェクト: klutch/StasisEngine
        public LoadingScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.Loading)
        {
            _textures = new List<Texture2D>();
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            for (int i = 0; i < 10; i++)
            {
                _textures.Add(_content.Load<Texture2D>(string.Format("loading_screen/gear_{0}", i)));
            }
            _background = _content.Load<Texture2D>("loading_screen/background");
            _titleFont = _content.Load<SpriteFont>("loading_screen/title");
            _messageFont = _content.Load<SpriteFont>("loading_screen/message");

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.TopLeft,
                32,
                32,
                TextAlignment.Left,
                "Loading",
                4);
            _title.layerDepth = 0.1f;

            _message = new Label(
                this,
                _messageFont,
                UIAlignment.BottomRight,
                -50,
                -90,
                TextAlignment.Right,
                "Loading level data...",
                2);
            _message.layerDepth = 0.1f;

            _progressBar = new ProgressBar(
                this,
                UIAlignment.BottomRight,
                -590,
                -64);
            _progressBar.layerDepth = 0.1f;
        }
コード例 #4
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(); });
        }
コード例 #5
0
 private void createControlsElements()
 {
     _controlsTitle = new Label(
         this,
         _categoryTitleFont,
         UIAlignment.MiddleCenter,
         -255,
         -160,
         TextAlignment.Left,
         "Controls",
         3);
 }
コード例 #6
0
 private void createAudioElements()
 {
     _audioTitle = new Label(
         this,
         _categoryTitleFont,
         UIAlignment.MiddleCenter,
         -255,
         -160,
         TextAlignment.Left,
         "Audio",
         3);
 }