Пример #1
0
        internal override void Draw(GameTime gameTime)
        {
            _batch.Begin(samplerState: SamplerState.PointClamp);

            _batch.DrawRectangle(Controller.ClientRectangle, Border.DefaultWhite);

            var(unit, startX, width, height) = Border.GetDefaultScreenValues();
            if (_showInfoText)
            {
                var offsetY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2 + unit * 8;
                var offsetX = startX + unit * 4;
                Border.Draw(_batch, offsetX, offsetY, 16, 10, Border.SCALE, Border.DefaultWhite);

                _fontRenderer.DrawText(_batch, _infoText, new Vector2(offsetX + unit, offsetY + unit * 2), Color.Black, Border.SCALE);
            }
            else
            {
                _optionsBox.Draw(_batch, Border.DefaultWhite);

                var offsetY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2 + unit * 12;
                Border.Draw(_batch, startX, offsetY, 15, 6, Border.SCALE, Border.DefaultWhite);
                var timeStr = DateHelper.GetDisplayDayOfWeek(DateTime.Now).ToUpper() + Environment.NewLine +
                              "   " + DateHelper.GetDisplayDaytime(World.DetermineDaytime()).PadRight(4).ToUpper() + DateTime.Now.ToString("h:mm").PadLeft(5);
                _fontRenderer.DrawText(_batch, timeStr, new Vector2(startX + unit, offsetY + unit * 2), Color.Black, Border.SCALE);
            }

            _batch.End();
        }
Пример #2
0
        private void DrawPhonePage(int startX, int unit, int width)
        {
            // background
            _batch.Draw(_phoneBackground, new Rectangle(
                            startX, 0,
                            (int)(_phoneBackground.Width * Border.SCALE),
                            (int)(_phoneBackground.Height * Border.SCALE)), Color.White);

            // reception
            // TODO: get reception from map file
            var hasReception = true;

            _batch.Draw(_reception, new Rectangle(
                            startX + width - unit * 3, unit,
                            (int)(16 * Border.SCALE),
                            (int)(16 * Border.SCALE)),
                        new Rectangle(hasReception ? 0 : 16, 0, 16, 16), Color.White);

            // contacts
            var visibleContacts = new Contact[CONTACTS_VISIBLE];
            var contacts        = Controller.ActivePlayer.Contacts;

            for (var i = 0; i < visibleContacts.Length; i++)
            {
                var index = i + _phoneScroll;
                if (contacts.Length > index)
                {
                    visibleContacts[i] = _phonebook.GetContact(contacts[index]);
                }
                else
                {
                    visibleContacts[i] = _emptyContact;
                }
            }
            var contactsText = string.Join(Environment.NewLine, visibleContacts.Select((c, i) =>
            {
                var selector = ">";
                if (_phoneOptionsBox.Visible || _deleteNumberOptionsBox.Visible)
                {
                    selector = "^>>";
                }
                return
                ((_phoneIndex == i ? selector : " ") +
                 c.name + ":" + Environment.NewLine +
                 "    " + c.title);
            }));

            _contactsFontRenderer.DrawText(_batch, contactsText,
                                           new Vector2(startX + unit, unit * 4),
                                           Color.Black, Border.SCALE);

            _phoneOptionsBox.Draw(_batch, TINTED_WHITE);
            _deleteNumberOptionsBox.Draw(_batch, TINTED_WHITE);
            _phoneTextbox.Draw(_batch, TINTED_WHITE);
        }
Пример #3
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

            _textbox.Draw(_batch, Border.DefaultWhite);
            _optionsBox.Draw(_batch, Border.DefaultWhite);
            _confirmationBox.Draw(_batch, Border.DefaultWhite);

            _batch.End();
        }
Пример #4
0
        internal override void Draw(GameTime gameTime)
        {
            _batch.Begin(samplerState: SamplerState.PointClamp);

            var backgroundColor = (int)(Border.DefaultWhite.R * _brightness);

            _batch.DrawRectangle(Controller.ClientRectangle, new Color(backgroundColor, backgroundColor, backgroundColor));

            _textbox.Draw(_batch, Border.DefaultWhite);

            var(unit, startX, width, height) = Border.GetDefaultScreenValues();
            var startY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2;

            if (_oakStage >= 0 && _oakStage < OAK_TOTAL_STAGES)
            {
                var oakWidth  = (int)(40 * Border.SCALE);
                var oakHeight = (int)(56 * Border.SCALE);
                _batch.Draw(_oak, new Rectangle(Controller.ClientRectangle.Width / 2 - oakWidth / 2, startY + unit * 4, oakWidth, oakHeight),
                            new Rectangle(_oakStage * 40, 0, 40, 56), Color.White);
            }
            if (_playerStage >= 0 && _playerStage < PLAYER_TOTAL_STAGES)
            {
                var playerWidth  = (int)(40 * Border.SCALE);
                var playerHeight = (int)(56 * Border.SCALE);
                _batch.Draw(_player,
                            new Rectangle(Controller.ClientRectangle.Width / 2 - playerWidth / 2 + (int)(_playerOffset * Border.SCALE), startY + unit * 4, playerWidth, playerHeight),
                            new Rectangle(_playerStage * 40, 0, 40, 56), Color.White);
            }
            if (_pokemonVisible && _pokemonAppearDelay == 0)
            {
                var texture       = _previewPokemon.GetFrontSprite();
                var pokemonWidth  = (int)(texture.Width * Border.SCALE);
                var pokemonHeight = (int)(texture.Height * Border.SCALE);

                var alpha = (int)(255 * _pokemonAlpha);
                _batch.Draw(texture,
                            new Rectangle(Controller.ClientRectangle.Width / 2 - pokemonWidth / 2, startY + unit * 4, pokemonWidth, pokemonHeight),
                            null, new Color(255, 255, 255, alpha), 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f);
            }

            _nameSelection.Draw(_batch, Border.DefaultWhite);
            if (_nameSelection.Visible)
            {
                Border.DrawCenter(_batch, _nameSelection.OffsetX + unit * 2, startY, 4, 1, Border.SCALE);
                _fontRenderer.DrawText(_batch, "NAME", new Vector2(_nameSelection.OffsetX + unit * 2, startY), Color.Black, Border.SCALE);
            }

            _batch.End();
        }
Пример #5
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

            // draw stats
            var unit   = (int)(Border.UNIT * Border.SCALE);
            var startX = (int)(Controller.ClientRectangle.Width / 2f + (-Border.SCREEN_WIDTH / 2f + 4) * unit);

            Border.Draw(_batch, startX, 0, 16, 10, Border.SCALE);

            _fontRenderer.DrawText(_batch, _infoText, new Vector2(startX + unit, unit * 2), Color.Black, Border.SCALE);

            _textbox.Draw(_batch, Border.DefaultWhite);
            _optionsBox.Draw(_batch, Border.DefaultWhite);

            _batch.End();
        }
Пример #6
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

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

            // item box
            Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, 12, Border.SCALE);

            // item list
            var visibleItems = _items
                               .Skip(_scrollIndex)
                               .Take(ITEMS_VISIBLE)
                               .Select(i =>
            {
                if (i is MachineItem machine)
                {
                    return(machine.MachineItemName);
                }
                else
                {
                    return(i.Name);
                }
            }).ToList();

            if (visibleItems.Count < ITEMS_VISIBLE)
            {
                visibleItems.Add("CANCEL");
            }
            var itemListText = "";

            for (var i = 0; i < visibleItems.Count; i++)
            {
                if (i == _index)
                {
                    if (DialogVisible)
                    {
                        itemListText += "^>>";
                    }
                    else
                    {
                        itemListText += ">";
                    }
                }
                else
                {
                    itemListText += " ";
                }

                var itemIndex = i + _scrollIndex;
                if (_items.Length <= itemIndex ||
                    !_items[itemIndex].IsQuantifyable)
                {
                    itemListText += visibleItems[i] + NewLine;
                }
                else
                {
                    var item = _items[itemIndex];
                    itemListText += visibleItems[i] + NewLine +
                                    new string(' ', 10) + "*" + item.Amount.ToString().PadLeft(2);
                }
                itemListText += NewLine;
            }
            _fontRenderer.LineGap = 0;
            _fontRenderer.DrawText(_batch, itemListText,
                                   new Vector2(startX + unit * 4, unit * 2), Color.Black, Border.SCALE);

            // up/down arrows
            if (_scrollIndex > 0)
            {
                _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit, unit, unit),
                            null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f);
            }
            if (_scrollIndex < _items.Length - ITEMS_VISIBLE + 1)
            {
                _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit * 10, unit, unit), Color.White);
            }

            // item description
            Border.Draw(_batch, startX, unit * 12, Border.SCREEN_WIDTH, 6, Border.SCALE);
            if (_items.Length > _index + _scrollIndex)
            {
                var description = _items[_index + _scrollIndex].Description;
                _fontRenderer.LineGap = 1;
                _fontRenderer.DrawText(_batch, description,
                                       new Vector2(startX + unit, unit * 14), Color.Black, Border.SCALE);
            }

            _textbox.Draw(_batch, Border.DefaultWhite);
            _optionsBox.Draw(_batch, Border.DefaultWhite);
            _amountSelector.Draw(_batch, Border.DefaultWhite);

            _batch.End();
        }
        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);
            Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, 4, Border.SCALE);
            Border.Draw(_batch, startX, unit * 4, 11, 10, Border.SCALE);
            Border.Draw(_batch, startX + unit * 11, unit * 7, 9, 7, Border.SCALE);
            Border.Draw(_batch, startX, unit * 14, Border.SCREEN_WIDTH, 4, Border.SCALE);

            // title
            var currentBox = Controller.ActivePlayer.Boxes[Controller.ActivePlayer.ActiveBoxIndex];

            _fontRenderer.DrawText(_batch, "CURRENT   " + currentBox.Name,
                                   new Vector2(startX + unit, unit * 2), Color.Black, Border.SCALE);

            // box list
            var visibleBoxes = Controller.ActivePlayer.Boxes
                               .Skip(_scrollIndex)
                               .Take(VISIBLE_BOXES)
                               .Select(b => b.Name).ToList();

            if (visibleBoxes.Count < VISIBLE_BOXES)
            {
                visibleBoxes.Add("CANCEL");
            }
            var boxListText = string.Join(NewLine, visibleBoxes.Select((b, i) =>
            {
                if (i == _index)
                {
                    if (_optionsBox.Visible)
                    {
                        return("^>>" + b);
                    }
                    else
                    {
                        return(">" + b);
                    }
                }
                else
                {
                    return(" " + b);
                }
            }));

            _fontRenderer.DrawText(_batch, boxListText,
                                   new Vector2(startX + unit, unit * 6), Color.Black, Border.SCALE);

            // box text
            if (StorageBox.BOX_COUNT > _index + _scrollIndex)
            {
                var selectedBox = Controller.ActivePlayer.Boxes[_index + _scrollIndex];
                var boxText     = "POKéMON" + NewLine +
                                  selectedBox.PokemonCount.ToString().PadLeft(3) + "/" + StorageBox.POKEMON_PER_BOX.ToString();
                _fontRenderer.DrawText(_batch, boxText,
                                       new Vector2(startX + unit * 12, unit * 9), Color.Black, Border.SCALE);
            }

            // message
            var message = "Choose a BOX.";

            if (_optionsBox.Visible)
            {
                message = "What^'s up?";
            }
            _fontRenderer.DrawText(_batch, message,
                                   new Vector2(startX + unit, unit * 16), Color.Black, Border.SCALE);

            _optionsBox.Draw(_batch, Border.DefaultWhite);

            _batch.End();
        }
Пример #8
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

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

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

            // pokemon list box
            Border.Draw(_batch, startX + unit * 8, 0, 12, 14, Border.SCALE);

            // title box
            Border.Draw(_batch, startX + unit * 8, 0, 12, 3, Border.SCALE);
            _fontRenderer.DrawText(_batch, _title,
                                   new Vector2(startX + unit * 10, unit), Color.Black, Border.SCALE);

            if (CanChangeBox)
            {
                _batch.Draw(_arrow, new Rectangle(
                                startX + unit * 8, unit,
                                (int)(_arrow.Width * Border.SCALE),
                                (int)(_arrow.Height * Border.SCALE)),
                            null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f);
                _batch.Draw(_arrow, new Rectangle(
                                startX + unit * 19, unit,
                                (int)(_arrow.Width * Border.SCALE),
                                (int)(_arrow.Height * Border.SCALE)), Color.White);
            }

            // pokemon list
            var visiblePokemon = _pokemon.Skip(_scrollIndex).Take(VISIBLE_POKEMON).Select(p => p.DisplayName).ToList();

            if (visiblePokemon.Count < VISIBLE_POKEMON)
            {
                visiblePokemon.Add("CANCEL");
            }
            var pokemonListText = string.Join(NewLine, visiblePokemon);

            _fontRenderer.DrawText(_batch, pokemonListText,
                                   new Vector2(startX + unit * 9, unit * 4), Color.Black, Border.SCALE);

            // selector
            if (!DialogVisible)
            {
                if (_isMoving)
                {
                    _batch.Draw(_moveSelector, new Rectangle(
                                    startX + unit * 9,
                                    unit * 3 + unit * 2 * _index,
                                    (int)(_moveSelector.Width * Border.SCALE),
                                    (int)(_moveSelector.Height * Border.SCALE)), Color.White);
                }
                else
                {
                    _batch.Draw(_selector, new Rectangle(
                                    (int)(startX + unit * 8 + 7 * Border.SCALE),
                                    (int)(unit * 3 + Border.SCALE + unit * 2 * _index),
                                    (int)(_selector.Width * Border.SCALE),
                                    (int)(_selector.Height * Border.SCALE)), Color.White);
                }
            }

            // portrait background
            var targetRect = new Rectangle(
                startX + unit, unit * 4,
                (int)(PokemonTextureManager.TEXTURE_SIZE * Border.SCALE),
                (int)(PokemonTextureManager.TEXTURE_SIZE * Border.SCALE));

            if (!_optionsBox.Visible && !_isMoving)
            {
                _batch.DrawRectangle(targetRect, POKEMON_PORTRAIT_BACKGROUND);
            }

            if ((_pokemon.Length > _index + _scrollIndex || _isMoving) && _showPokemon)
            {
                // pokemon portrait
                var       selectedPokemon = GetSelectedPokemon();
                Texture2D sprite;

                if (_optionsBox.Visible || _isMoving)
                {
                    sprite = selectedPokemon.GetFrontSprite();
                }
                else
                {
                    sprite = PokemonTextureManager.GetFront(selectedPokemon.Id, POKEMON_PORTRAIT_PALETTE, selectedPokemon.UnownLetter);
                }
                _batch.Draw(sprite, targetRect, Color.White);

                // pokemon info
                var levelStr = selectedPokemon.Level == Pokemon.MAX_LEVEL ?
                               Pokemon.MAX_LEVEL.ToString().PadRight(4) :
                               ("^:L" + selectedPokemon.Level).PadRight(6);
                var infoStr = levelStr + PokemonStatHelper.GetGenderChar(selectedPokemon.Gender) + NewLine +
                              selectedPokemon.Name;
                _fontRenderer.DrawText(_batch, infoStr,
                                       new Vector2(startX + unit, unit * 12), Color.Black, Border.SCALE);

                // draw item box if the pokemon holds an item
                var heldItem = selectedPokemon.HeldItem;
                if (heldItem != null)
                {
                    Texture2D icon;
                    if (heldItem.IsMail)
                    {
                        icon = _mailIcon;
                    }
                    else
                    {
                        icon = _itemIcon;
                    }
                    _batch.Draw(icon, new Rectangle(
                                    startX + unit * 7, unit * 12,
                                    (int)(Border.SCALE * _itemIcon.Width),
                                    (int)(Border.SCALE * _itemIcon.Height)), Color.White);
                }
            }

            // text box
            Border.Draw(_batch, startX, unit * 15, Border.SCREEN_WIDTH, 3, Border.SCALE);
            _fontRenderer.DrawText(_batch, _message,
                                   new Vector2(startX + unit, unit * 16), Color.Black, Border.SCALE);

            _optionsBox.Draw(_batch, Border.DefaultWhite);
            _confirmationBox.Draw(_batch, Border.DefaultWhite);

            _batch.End();
        }
Пример #9
0
        internal override void Draw(GameTime gameTime)
        {
            _preScreen.Draw(gameTime);

            _batch.Begin(samplerState: SamplerState.PointClamp);

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

            // border
            Border.Draw(_batch, startX + unit * 7, 0, 13, 12, Border.SCALE);

            // mail list
            var visibleMails = _mails
                               .Skip(_scrollIndex)
                               .Take(MAILS_VISIBLE)
                               .Select(m => m.Author)
                               .ToList();

            if (visibleMails.Count < MAILS_VISIBLE)
            {
                visibleMails.Add("CANCEL");
            }
            var listText = "";

            for (var i = 0; i < visibleMails.Count; i++)
            {
                if (i == _index)
                {
                    if (DialogVisible)
                    {
                        listText += "^>>";
                    }
                    else
                    {
                        listText += ">";
                    }
                }
                else
                {
                    listText += " ";
                }

                listText += visibleMails[i] + NewLine;
            }
            _fontRenderer.DrawText(_batch, listText,
                                   new Vector2(startX + unit * 8, unit * 2), Color.Black, Border.SCALE);

            // up/down arrows
            if (_scrollIndex > 0)
            {
                _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit, unit, unit),
                            null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f);
            }
            if (_scrollIndex < _mails.Length - MAILS_VISIBLE + 1)
            {
                _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit * 10, unit, unit), Color.White);
            }

            _textbox.Draw(_batch, Border.DefaultWhite);
            _optionsBox.Draw(_batch, Border.DefaultWhite);
            _confirmationBox.Draw(_batch, Border.DefaultWhite);

            _batch.End();
        }