示例#1
0
        public void Draw(SpriteBatch spriteBatch, Rectangle contentRect)
        {
            for (var buttonIndex = 0; buttonIndex < _buttons.Length; buttonIndex++)
            {
                var button        = _buttons[buttonIndex];
                var buttonOffsetX = BUTTON_WIDTH * buttonIndex;
                button.Rect = new Rectangle(
                    contentRect.Left + buttonOffsetX,
                    contentRect.Top,
                    BUTTON_WIDTH,
                    BUTTON_HEIGHT);

                button.Draw(spriteBatch);
            }

            if (_autoplayHintIsShown)
            {
                var titleTextSizeVector = _uiContentStorage.GetHintTitleFont().MeasureString(_autoplayModeButtonTitle);

                var autoplayButtonRect = _autoplayModeButton.Rect;

                var hintRectangle = new Rectangle(
                    autoplayButtonRect.Left,
                    autoplayButtonRect.Top - (int)titleTextSizeVector.Y - (HINT_TEXT_SPACING * 2),
                    (int)titleTextSizeVector.X + (HINT_TEXT_SPACING * 2),
                    (int)titleTextSizeVector.Y + (HINT_TEXT_SPACING * 2));

                spriteBatch.Draw(_uiContentStorage.GetButtonTexture(), hintRectangle, Color.DarkSlateGray);

                spriteBatch.DrawString(_uiContentStorage.GetHintTitleFont(),
                                       _autoplayModeButtonTitle,
                                       new Vector2(hintRectangle.Left + HINT_TEXT_SPACING, hintRectangle.Top + HINT_TEXT_SPACING),
                                       Color.Wheat);
            }
        }
示例#2
0
        private void DrawHintIfSelected(SpriteBatch spriteBatch)
        {
            if (_selectedCondition != null && _selectedConditionIconIndex != null)
            {
                var personConditionHintText = GetConditionHintText(_selectedCondition);

                var hintFont               = _uiContentStorage.GetHintTitleFont();
                var titleTextSizeVector    = hintFont.MeasureString(personConditionHintText);
                var selectedConditionIndex = _selectedConditionIconIndex.Value;
                var hintXPosition          = selectedConditionIndex * (ICON_SIZE + ICON_SPACING) + _screenX;

                const int Y_POSITION_UNDER_ICON_SEQUENCE = ICON_SIZE + ICON_SPACING;
                const int HINT_TEXT_SPACING = 8;
                var       hintRectangle     = new Rectangle(hintXPosition, Y_POSITION_UNDER_ICON_SEQUENCE + _screenY,
                                                            (int)titleTextSizeVector.X + HINT_TEXT_SPACING * 2,
                                                            (int)titleTextSizeVector.Y + HINT_TEXT_SPACING * 2);

                var conditionHintBackgroundTexture = _uiContentStorage.GetHintBackgroundTexture();
                spriteBatch.Draw(conditionHintBackgroundTexture, hintRectangle, Color.DarkSlateGray);

                spriteBatch.DrawString(hintFont, personConditionHintText,
                                       new Vector2(hintRectangle.Left + HINT_TEXT_SPACING, hintRectangle.Top + HINT_TEXT_SPACING),
                                       Color.Wheat);
            }
        }
示例#3
0
        private void DrawCombatActHint(CombatActButton button, SpriteBatch spriteBatch)
        {
            var combatActHintText = CombatActHelper.GetActHintText(button.CombatAct);

            var titleTextSizeVector = _uiContentStorage.GetHintTitleFont().MeasureString(combatActHintText);

            var autoplayButtonRect = button.Rect;

            var hintRectangle = new Rectangle(
                autoplayButtonRect.Left,
                autoplayButtonRect.Top - (int)titleTextSizeVector.Y - (HINT_TEXT_SPACING * 2),
                (int)titleTextSizeVector.X + (HINT_TEXT_SPACING * 2),
                (int)titleTextSizeVector.Y + (HINT_TEXT_SPACING * 2));

            spriteBatch.Draw(_uiContentStorage.GetButtonTexture(), hintRectangle, Color.DarkSlateGray);

            spriteBatch.DrawString(_uiContentStorage.GetHintTitleFont(),
                                   combatActHintText,
                                   new Vector2(hintRectangle.Left + HINT_TEXT_SPACING, hintRectangle.Top + HINT_TEXT_SPACING),
                                   Color.Wheat);
        }
示例#4
0
        private void DrawContainerHintIfSelected(SpriteBatch spriteBatch)
        {
            if (_hoverContainerItem is null)
            {
                return;
            }

            var inventoryTitle      = PropHelper.GetPropHintText(_hoverContainerItem.Prop);
            var hintTitleFont       = _uiContentStorage.GetHintTitleFont();
            var titleTextSizeVector = hintTitleFont.MeasureString(inventoryTitle);

            const int HINT_TEXT_SPACING = 8;
            var       hintRectangle     = new Rectangle(
                _hoverContainerItem.UiRect.Left,
                _hoverContainerItem.UiRect.Bottom + EQUIPMENT_ITEM_SPACING,
                (int)titleTextSizeVector.X + (HINT_TEXT_SPACING * 2),
                (int)titleTextSizeVector.Y + (HINT_TEXT_SPACING * 2));

            spriteBatch.Draw(_uiContentStorage.GetButtonTexture(), hintRectangle, Color.DarkSlateGray);

            spriteBatch.DrawString(hintTitleFont, inventoryTitle,
                                   new Vector2(hintRectangle.Left + HINT_TEXT_SPACING, hintRectangle.Top + HINT_TEXT_SPACING),
                                   Color.Wheat);
        }
        private void DrawHintIfSelected(SpriteBatch spriteBatch)
        {
            if (_selectedAttributeItem is null)
            {
                return;
            }

            var attributeDescription = GetAttributeDescription(_selectedAttributeItem.Attribute);
            var hintTitleFont        = _uiContentStorage.GetHintTitleFont();
            var titleTextSizeVector  = hintTitleFont.MeasureString(attributeDescription);

            const int HINT_TEXT_SPACING = 8;
            var       hintRectangle     = new Rectangle(
                _selectedAttributeItem.UiRect.Left,
                _selectedAttributeItem.UiRect.Bottom + ATTRIBUTE_ITEM_SPACING,
                (int)titleTextSizeVector.X + (HINT_TEXT_SPACING * 2),
                (int)titleTextSizeVector.Y + (HINT_TEXT_SPACING * 2));

            spriteBatch.Draw(_uiContentStorage.GetButtonTexture(), hintRectangle, Color.DarkSlateGray);

            spriteBatch.DrawString(hintTitleFont, attributeDescription,
                                   new Vector2(hintRectangle.Left + HINT_TEXT_SPACING, hintRectangle.Top + HINT_TEXT_SPACING),
                                   Color.Wheat);
        }