コード例 #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 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();
                }));
            });
        }