Exemplo n.º 1
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _overlay          = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/searchOverlay.png");
            _search           = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/search.png");
            _arrow            = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/arrow.png");
            _noResultsOverlay = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/noResultsOverlay.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            // load type selections
            var type1Options = new List <string>();
            var type2Options = new List <string>
            {
                "----"
            };

            for (var i = 0; i < Pokemon.TYPES_AMOUNT; i++)
            {
                type1Options.Add(((PokemonType)(i + 1)).ToString().ToUpper());
                type2Options.Add(((PokemonType)(i + 1)).ToString().ToUpper());
            }
            _type1Options = type1Options.ToArray();
            _type2Options = type2Options.ToArray();
        }
Exemplo n.º 2
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.BufferUp            = 1;
            _optionsBox.BufferRight         = 4;
            _optionsBox.CanCancel           = false;
            _optionsBox.CloseAfterSelection = false;

            var options = new List <string>()
            {
                "NEW GAME", "OPTION"
            };

            if (PlayerData.SaveFileExists())
            {
                // load player file if it exists
                Controller.ActivePlayer = new Player();
                Controller.ActivePlayer.Load();

                options.Insert(0, "CONTINUE");
            }
            _optionsBox.Show(options.ToArray());
            _optionsBox.OptionSelected += OptionSelected;

            var unit   = Border.UNIT * Border.SCALE;
            var offset = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2;

            _optionsBox.OffsetY = (int)(_optionsBox.Height * unit + offset);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
        }
Exemplo n.º 3
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _itemIcon     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokemon/item.png");
            _mailIcon     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokemon/mail.png");
            _selector     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Computer/selector.png");
            _moveSelector = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Computer/moveSelector.png");
            _arrow        = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Computer/arrow.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.OffsetY            -= (int)(Border.SCALE * Border.UNIT * 3);
            _optionsBox.OffsetX            += (int)(Border.SCALE * Border.UNIT * 9);
            _optionsBox.OptionSelected     += OptionSelected;
            _optionsBox.CloseAfterSelection = false;

            _confirmationBox = new OptionsBox();
            _confirmationBox.LoadContent();
            _confirmationBox.OffsetY -= (int)(Border.SCALE * Border.UNIT);
            _confirmationBox.OffsetX += (int)(Border.SCALE * Border.UNIT * 14);

            _message = DEFAULT_MESSAGE;
        }
Exemplo n.º 4
0
        internal override void LoadContent()
        {
            _sceneTarget = RenderTargetManager.CreateScreenTarget();

            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _player          = Controller.Content.LoadDirect <Texture2D>("Textures/Battle/player.png");
            _pokeballOpening = Controller.Content.LoadDirect <Texture2D>("Textures/Battle/pokeballOpening.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _battleTextbox = new Textbox();
            _battleTextbox.LoadContent();
            _battleTextbox.OffsetY = StartY + (int)(12 * Border.UNIT * Border.SCALE);

            _enemyPokemonStatus = new EnemyPokemonStatus();
            _enemyPokemonStatus.LoadContent();
            _playerPokemonStatus = new PlayerPokemonStatus();
            _playerPokemonStatus.LoadContent();
            _playerStatus = new PlayerStatus();
            _playerStatus.LoadContent();
            _pokemonStats = new PokemonStats();
            _pokemonStats.LoadContent();
        }
Exemplo n.º 5
0
        public void LoadContent()
        {
            _texture         = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Battle/playerState.png");
            _partyIndicators = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Battle/partyIndicators.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
        }
Exemplo n.º 6
0
        internal override void LoadContent()
        {
            _batch        = new SpriteBatch(Controller.GraphicsDevice);
            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
            _fontRenderer.LineGap = 0;

            _optionsText = GetOptionsText();
        }
Exemplo n.º 7
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _overlay = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/optionOverlay.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
        }
Exemplo n.º 8
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _pokeball = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/pokeball.png");
            _unknown  = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/unknownPokemon.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
        }
Exemplo n.º 9
0
 internal override void LoadContent()
 {
     _batch        = new SpriteBatch(Controller.GraphicsDevice);
     _map          = Controller.Content.LoadDirect <Texture2D>($"Textures/UI/TownMap/{_region}.png");
     _selector     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/TownMap/selector.png");
     _player       = Controller.Content.LoadDirect <Texture2D>("Textures/UI/TownMap/player.png");
     _fontRenderer = new PokemonFontRenderer();
     _fontRenderer.LoadContent();
     _fontRenderer.LineGap = 0;
 }
Exemplo n.º 10
0
        } = false;                                                 // increases the own pokemon level display by 1 to simulate a level up

        public void LoadContent()
        {
            _texture = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Battle/playerPokemonState.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _hpState  = GetTargetHPState();
            _expState = GetTargetExpState();
        }
Exemplo n.º 11
0
        public void LoadContent()
        {
            _texture         = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Battle/enemyPokemonState.png");
            _caughtIndicator = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Battle/caughtIndicator.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _hpState = GetTargetHPState();
        }
Exemplo n.º 12
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            var backgroundFile = MAIL_BACKGROUNDS[_mail.Template];

            _background = Controller.Content.LoadDirect <Texture2D>($"Textures/UI/Mail/{backgroundFile}");
        }
Exemplo n.º 13
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _background = Controller.Content.LoadDirect <Texture2D>("Textures/UI/TrainerCard/background.png");
            _badges     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/TrainerCard/badges.png");
            _leaders    = Controller.Content.LoadDirect <Texture2D>("Textures/UI/TrainerCard/leaders.png");
            _pageLabels = Controller.Content.LoadDirect <Texture2D>("Textures/UI/TrainerCard/pageLabels.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
        }
Exemplo n.º 14
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _border       = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Naming/border.png");
            _selector     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Naming/selector.png");
            _placeholders = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Naming/placeholders.png");
            _selectorMenu = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Naming/selectorMenu.png");
        }
Exemplo n.º 15
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _pages  = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokemon/summaryPages.png");
            _expBar = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokemon/expBar.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _hpbar = new HPBar();
            _hpbar.LoadContent();
        }
Exemplo n.º 16
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _overlay        = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/detailsOverlay.png");
            _pageIndicators = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/pageIndicators.png");
            _footprints     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/footprints.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            // initialize first entry
            InitializeEntry();
        }
Exemplo n.º 17
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _mapJohto      = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/mapJohto.png");
            _mapKanto      = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/mapKanto.png");
            _nestIndicator = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/nestIndicator.png");
            _player        = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokedex/player.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            LoadMapEntries();
        }
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.BufferUp            = 1;
            _optionsBox.OffsetX            += (int)(Border.SCALE * Border.UNIT * 11);
            _optionsBox.OffsetY            -= (int)(Border.SCALE * Border.UNIT * 3);
            _optionsBox.OptionSelected     += OptionSelected;
            _optionsBox.CloseAfterSelection = false;
        }
Exemplo n.º 19
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _arrow           = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/arrow.png");
            _buttons         = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/buttons.png");
            _switchButton    = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/switchButton.png");
            _timeBox         = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/time.png");
            _mapOverlay      = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/mapOverlay.png");
            _phoneBackground = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/phoneBackground.png");
            _reception       = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Pokegear/reception.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _contactsFontRenderer = new PokemonFontRenderer();
            _contactsFontRenderer.LoadContent();
            _contactsFontRenderer.LineGap = 0;

            _exitTextbox = new Textbox();
            _exitTextbox.LoadContent();
            _exitTextbox.ShowAndSkip("Press any button\nto exit.");
            _exitTextbox.OffsetY = (int)(Border.SCREEN_HEIGHT * Border.SCALE * Border.UNIT - Textbox.HEIGHT * Border.UNIT * Border.SCALE);

            _phoneTextbox = new Textbox();
            _phoneTextbox.LoadContent();
            _phoneTextbox.ShowAndSkip("Whom do you want\nto call?");
            _phoneTextbox.OffsetY = (int)(Border.SCREEN_HEIGHT * Border.SCALE * Border.UNIT - Textbox.HEIGHT * Border.UNIT * Border.SCALE);

            _phoneOptionsBox = new OptionsBox();
            _phoneOptionsBox.LoadContent();
            _phoneOptionsBox.OffsetY     = _phoneTextbox.OffsetY;
            _phoneOptionsBox.OffsetX    += (int)(Border.SCALE * Border.UNIT * 9);
            _phoneOptionsBox.BufferUp    = 1;
            _phoneOptionsBox.BufferRight = 1;

            _deleteNumberOptionsBox = new OptionsBox();
            _deleteNumberOptionsBox.LoadContent();
            _deleteNumberOptionsBox.OffsetY  = _phoneTextbox.OffsetY;
            _deleteNumberOptionsBox.OffsetX += (int)(Border.SCALE * Border.UNIT * 14);

            // TODO: get correct location from world
            _mapScreen = new TownMapScreen(null, "kanto", "Pallet Town");
            _mapScreen.LoadContent();

            _phonebook = Phonebook.Load();
        }
Exemplo n.º 20
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _textbox = new Textbox();
            _textbox.LoadContent();
            _textbox.Show("Would you like to\nsave the game?");
            _textbox.Finished += TextboxFinished;

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.OptionSelected += SelectedQuestion;

            var unit = (int)(Border.UNIT * Border.SCALE);

            _optionsBox.OffsetY = unit * 12;
            _textbox.OffsetY    = unit * 12;
        }
Exemplo n.º 21
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _oak        = Controller.Content.LoadDirect <Texture2D>("Textures/UI/NewGame/oak.png");
            _player     = Controller.Content.LoadDirect <Texture2D>("Textures/UI/NewGame/player.png");
            _namingIcon = Controller.Content.LoadDirect <Texture2D>("Textures/UI/NewGame/namingIcon.png");

            _random         = new Random();
            _previewPokemon = Pokemon.Get(POKEMON_PREVIEW_IDS[_random.Next(0, POKEMON_PREVIEW_IDS.Length)], 1);

            _textbox = new Textbox();
            _textbox.LoadContent();
            _textbox.OffsetY = GameController.RENDER_HEIGHT / 2 - (int)(Border.SCALE * Border.UNIT * Border.SCREEN_HEIGHT) / 2 + (int)(12 * Border.UNIT * Border.SCALE);

            _nameSelection = new OptionsBox();
            _nameSelection.LoadContent();
            _nameSelection.BufferUp  = 1;
            _nameSelection.CanCancel = false;
        }
Exemplo n.º 22
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _arrow = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Computer/arrow2.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _textbox = new Textbox();
            _textbox.LoadContent();
            _textbox.OffsetY = (int)(Border.SCREEN_HEIGHT * Border.SCALE * Border.UNIT - Textbox.HEIGHT * Border.UNIT * Border.SCALE);

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.BufferUp = 1;

            _confirmationBox = new OptionsBox();
            _confirmationBox.LoadContent();
            _confirmationBox.OffsetX += (int)(Border.SCALE * Border.UNIT * 14);
            _confirmationBox.OffsetY  = _textbox.OffsetY;

            SetMails();
        }
Exemplo n.º 23
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _arrow = Controller.Content.LoadDirect <Texture2D>("Textures/UI/Computer/arrow2.png");

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();

            _textbox = new Textbox();
            _textbox.LoadContent();
            _textbox.OffsetY = (int)(Border.SCREEN_HEIGHT * Border.SCALE * Border.UNIT - Textbox.HEIGHT * Border.UNIT * Border.SCALE);

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.OffsetY  = _textbox.OffsetY;
            _optionsBox.OffsetX += (int)(Border.SCALE * Border.UNIT * 14);

            _amountSelector = new AmountSelector();
            _amountSelector.LoadContent();
            _amountSelector.OffsetY = _textbox.OffsetY - (int)(Border.SCALE * Border.UNIT * AmountSelector.HEIGHT);

            SetItems();
        }
Exemplo n.º 24
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

            var(unit, startX, width, height) = Border.GetDefaultScreenValues();

            Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE);

            // draw border
            // vertical
            for (var i = 0; i < Border.SCREEN_HEIGHT; i++)
            {
                _batch.Draw(_border, new Rectangle(startX, unit * i, unit, unit), Color.White);
                _batch.Draw(_border, new Rectangle(startX + unit * 19, unit * i, unit, unit), Color.White);
            }

            var verticalOffset = (5 - ActiveCharset.Length / CHARS_PER_LINE) * 2;
            // horizontal
            var horizontalBars = new[] { 0, 5 + verticalOffset, 15, 17 };

            for (var i = 1; i < Border.SCREEN_WIDTH - 1; i++)
            {
                foreach (var y in horizontalBars)
                {
                    _batch.Draw(_border, new Rectangle(startX + i * unit, unit * y, unit, unit), Color.White);
                }
            }

            // title
            _fontRenderer.DrawText(_batch, _title,
                                   new Vector2(startX + unit * 5, unit * 2), Color.Black, Border.SCALE);

            // icon
            if (_icon != null)
            {
                _batch.Draw(_icon, new Rectangle(
                                startX + 2 * unit, (int)(unit * 1.5),
                                (int)(Border.SCALE * _iconFrameSize),
                                (int)(Border.SCALE * _iconFrameSize)),
                            new Rectangle(_iconFrame * _iconFrameSize, 0, _iconFrameSize, _iconFrameSize),
                            Color.White);
            }

            // name
            _fontRenderer.DrawText(_batch, _name,
                                   new Vector2(startX + unit * 5, unit * (4 + verticalOffset)), Color.Black, Border.SCALE);
            var nameLength = PokemonFontRenderer.PrintableCharAmount(_name);

            for (var i = nameLength; i < _maxLength; i++)
            {
                var textureOffset = i > nameLength ? 1 : 0;
                _batch.Draw(_placeholders,
                            new Rectangle(
                                startX + unit * 5 + unit * i, unit * (4 + verticalOffset),
                                (int)(_placeholders.Height * Border.SCALE),
                                (int)(_placeholders.Height * Border.SCALE)),
                            new Rectangle(textureOffset * 8, 0, 8, 8), Color.White);
            }

            // char list
            var charListText = "";

            for (var i = 0; i < ActiveCharset.Length; i++)
            {
                charListText += ActiveCharset[i];
                if ((i + 1) % CHARS_PER_LINE == 0)
                {
                    charListText += NewLine;
                }
                else
                {
                    charListText += " ";
                }
            }
            _fontRenderer.DrawText(_batch, charListText,
                                   new Vector2(startX + unit * 2, unit * (6 + verticalOffset)), Color.Black, Border.SCALE);

            // menu
            var menuText = "";

            if (_isLower)
            {
                menuText += "UPPER";
            }
            else
            {
                menuText += "lower";
            }
            menuText += "  DEL   END";
            _fontRenderer.DrawText(_batch, menuText,
                                   new Vector2(startX + unit * 2, unit * 16), Color.Black, Border.SCALE);

            // selector
            if (_selectorVisible)
            {
                if (_menuActive)
                {
                    _batch.Draw(_selectorMenu, new Rectangle(
                                    startX + unit * 2 + unit * _menuIndex * 6,
                                    (int)(unit * 16 - Border.SCALE),
                                    (int)(_selectorMenu.Width * Border.SCALE),
                                    (int)(_selectorMenu.Height * Border.SCALE)), Color.White);
                }
                else
                {
                    _batch.Draw(_selector, new Rectangle(
                                    (int)(startX + unit * _charX * 2 + unit * 2 - Border.SCALE),
                                    (int)(unit * _charY * 2 + unit * (6 + verticalOffset) - Border.SCALE),
                                    (int)(_selector.Width * Border.SCALE),
                                    (int)(_selector.Height * Border.SCALE)), Color.White);
                }
            }

            _batch.End();
        }
Exemplo n.º 25
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

            var(unit, startX, width, height) = Border.GetDefaultScreenValues();

            Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE);

            // borders
            for (var x = 0; x < Border.SCREEN_WIDTH; x++)
            {
                for (var y = 0; y < 6; y++)
                {
                    if (y == 0 || x == 0 || x == Border.SCREEN_WIDTH - 1 || y == 5)
                    {
                        _batch.Draw(_border, new Rectangle(startX + x * unit, y * unit, unit, unit), Color.White);
                    }
                }
            }

            // compose icon
            _batch.Draw(_icon, new Rectangle(
                            startX, 0,
                            (int)(Border.SCALE * _icon.Height),
                            (int)(Border.SCALE * _icon.Height)),
                        new Rectangle(_iconFrame * 16, 0, 16, 16),
                        Color.White);

            // message
            var lines = Mail.GetLinesFromMessage(_message);

            _fontRenderer.DrawText(_batch, lines[0],
                                   new Vector2(startX + unit * 2, unit * 2), Color.Black, Border.SCALE);
            if (lines[1] != null)
            {
                _fontRenderer.DrawText(_batch, lines[1],
                                       new Vector2(startX + unit * 2, unit * 4), Color.Black, Border.SCALE);
            }

            // placeholders
            var messageLength = PokemonFontRenderer.PrintableCharAmount(_message);

            for (var i = messageLength; i < Mail.MESSAGE_MAX_LENGTH; i++)
            {
                var y = 0;
                var x = i;
                if (x >= Mail.MESSAGE_CHARS_PER_LINE)
                {
                    y++;
                    x -= Mail.MESSAGE_CHARS_PER_LINE;
                }
                var textureOffset = i > messageLength ? 1 : 0;
                _batch.Draw(_placeholders,
                            new Rectangle(
                                startX + unit * 2 + unit * x, unit * 2 + y * unit * 2,
                                (int)(_placeholders.Height * Border.SCALE),
                                (int)(_placeholders.Height * Border.SCALE)),
                            new Rectangle(textureOffset * 8, 0, 8, 8), Color.White);
            }

            // char list
            var charListText = "";

            for (var i = 0; i < ActiveCharset.Length; i++)
            {
                charListText += ActiveCharset[i];
                if ((i + 1) % CHARS_PER_LINE == 0)
                {
                    charListText += Environment.NewLine;
                }
                else
                {
                    charListText += " ";
                }
            }
            _fontRenderer.DrawText(_batch, charListText,
                                   new Vector2(startX + unit, unit * 7), Color.Black, Border.SCALE);

            // menu
            var menuText = "";

            if (_isLower)
            {
                menuText += "UPPER";
            }
            else
            {
                menuText += "lower";
            }
            menuText += "  DEL   END";
            _fontRenderer.DrawText(_batch, menuText,
                                   new Vector2(startX + unit, unit * 17), Color.Black, Border.SCALE);

            // selector
            if (_selectorVisible)
            {
                if (_menuActive)
                {
                    _batch.Draw(_selectorMenu, new Rectangle(
                                    startX + unit + unit * _menuIndex * 6,
                                    (int)(unit * 17 - Border.SCALE),
                                    (int)(_selectorMenu.Width * Border.SCALE),
                                    (int)(_selectorMenu.Height * Border.SCALE)), Color.White);
                }
                else
                {
                    _batch.Draw(_selector, new Rectangle(
                                    (int)(startX + unit * _charX * 2 + unit - Border.SCALE),
                                    (int)(unit * _charY * 2 + unit * 7 - Border.SCALE),
                                    (int)(_selector.Width * Border.SCALE),
                                    (int)(_selector.Height * Border.SCALE)), Color.White);
                }
            }

            _batch.End();
        }
Exemplo n.º 26
0
        internal override void Update(GameTime gameTime)
        {
            _selectorDelay--;
            if (_selectorDelay == 0)
            {
                _selectorDelay   = SELECTOR_FLICKER_DELAY;
                _selectorVisible = !_selectorVisible;
            }

            if (_iconFrames > 1)
            {
                _iconFrameDelay--;
                if (_iconFrameDelay == 0)
                {
                    _iconFrameDelay = ICON_ANIMATION_DELAY;
                    _iconFrame++;
                    if (_iconFrame == _iconFrames)
                    {
                        _iconFrame = 0;
                    }
                }
            }

            if (GameboyInputs.RightPressed())
            {
                if (_menuActive)
                {
                    _menuIndex++;
                    // wrap around to the beginning of the line
                    if (_menuIndex == MENU_OPTIONS_COUNT)
                    {
                        _menuIndex = 0;
                    }
                }
                else
                {
                    _charX++;
                    // wrap around to the beginning of the line
                    if (_charX == CHARS_PER_LINE)
                    {
                        _charX = 0;
                    }
                }
            }
            else if (GameboyInputs.LeftPressed())
            {
                if (_menuActive)
                {
                    _menuIndex--;
                    // wrap around to the end of the line
                    if (_menuIndex == -1)
                    {
                        _menuIndex = MENU_OPTIONS_COUNT - 1;
                    }
                }
                else
                {
                    _charX--;
                    // wrap around to the end of the line
                    if (_charX == -1)
                    {
                        _charX = CHARS_PER_LINE - 1;
                    }
                }
            }
            else if (GameboyInputs.DownPressed())
            {
                if (_menuActive)
                {
                    _charY = 0;
                    if (MenuColumn != _menuIndex)
                    {
                        _charX = _menuIndex * 3;
                    }
                    _menuActive = false;
                }
                else
                {
                    _charY++;
                    if (_charY == ActiveCharset.Length / CHARS_PER_LINE)
                    {
                        _menuActive = true;
                        _menuIndex  = MenuColumn;
                    }
                }
            }
            else if (GameboyInputs.UpPressed())
            {
                if (_menuActive)
                {
                    _charY = ActiveCharset.Length / CHARS_PER_LINE - 1;
                    if (MenuColumn != _menuIndex)
                    {
                        _charX = _menuIndex * 3;
                    }
                    _menuActive = false;
                }
                else
                {
                    _charY--;
                    if (_charY == -1)
                    {
                        _menuActive = true;
                        _menuIndex  = MenuColumn;
                    }
                }
            }

            if (GameboyInputs.BPressed())
            {
                BackspaceName();
            }
            else if (GameboyInputs.APressed())
            {
                if (_menuActive)
                {
                    switch (_menuIndex)
                    {
                    case 0:     // upper/lower switch
                        _isLower = !_isLower;
                        break;

                    case 1:     // DEL
                        BackspaceName();
                        break;

                    case 2:     // END
                        Close();
                        break;
                    }
                }
                else
                {
                    var nameLength = PokemonFontRenderer.PrintableCharAmount(_name);
                    if (nameLength < _maxLength)
                    {
                        var activeChar = ActiveCharset[_charX + _charY * CHARS_PER_LINE];
                        _name     += activeChar;
                        nameLength = PokemonFontRenderer.PrintableCharAmount(_name);
                        if (nameLength == _maxLength)
                        {
                            // select END button
                            _menuActive = true;
                            _menuIndex  = 2;
                        }
                    }
                }
            }
            else if (GameboyInputs.StartPressed())
            {
                // select END button
                _menuActive = true;
                _menuIndex  = 2;
            }
            else if (GameboyInputs.SelectPressed())
            {
                // switch upper/lower
                _isLower = !_isLower;
            }
        }
Exemplo n.º 27
0
 public void LoadContent()
 {
     _fontRenderer = new PokemonFontRenderer();
     _fontRenderer.LoadContent();
     _texture = Controller.Content.LoadDirect <Texture2D>("Textures/UI/World/locationSign.png");
 }
Exemplo n.º 28
0
 public void LoadContent()
 {
     _fontRenderer = new PokemonFontRenderer();
     _fontRenderer.LoadContent();
 }