Ejemplo n.º 1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            var location = new Vector2(Bounds.X, Bounds.Y);

            spriteBatch.DrawString(Game1.smallFont, Text, location, Game1.textColor);
            location.Y += Game1.smallFont.MeasureString(Text).Y + _linePadding;

            _minusButton.Draw(spriteBatch, Value == Minimum ? Color.Gray : Color.White);
            var numberLocation = location;

            numberLocation.X += _minusButton.Bounds.Width * 3 + (int)Math.Ceiling(NumberSprite.getWidth(Value) * 1.5);
            numberLocation.Y += _linePadding;
            NumberSprite.draw(Value, spriteBatch, numberLocation, Color.SandyBrown, 1f, .85f, 1f, 0);

            _plusButton.Draw(spriteBatch, Value == Maximum ? Color.Gray : Color.White);
        }
Ejemplo n.º 2
0
        private void DrawPrestigePoints(SpriteBatch spriteBatch)
        {
            const string pointText    = "Prestige Points:";
            var          yOffset      = 5 * Game1.pixelZoom;
            var          yLocation    = yPositionOnScreen + yOffset + (Game1.tileSize * 3.15).Floor();
            var          textLocation = new Vector2(xPositionOnScreen + spaceToClearSideBorder / 2 + borderWidth, yLocation);

            spriteBatch.DrawString(Game1.dialogueFont, pointText, textLocation, Game1.textColor);
            var xPadding            = (Game1.pixelZoom * 4.25).Floor();
            var prestigePointWidth  = (NumberSprite.getWidth(PerSaveOptions.Instance.CostOfTierTwoPrestige) * 3.0).Ceiling();
            var pointNumberLocation = new Vector2(textLocation.X + Game1.dialogueFont.MeasureString(pointText).X + xPadding + prestigePointWidth, textLocation.Y + Game1.pixelZoom * 5);

            NumberSprite.draw(_prestige.PrestigePoints, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0);
            _professionButtonRowStartLocation = new Vector2(textLocation.X, textLocation.Y + Game1.dialogueFont.MeasureString(pointText).Y + _rowPadding);
            _prestigePointBonusLocation       = new Vector2(pointNumberLocation.X + prestigePointWidth + xPadding, yLocation);
        }
Ejemplo n.º 3
0
        public IntegerEditor(string text, int startingNumber, int minimum, int maximum, Vector2 location, ClickCallback onClickCallback)
        {
            if (maximum <= minimum)
            {
                throw new ArgumentException($"{nameof(minimum)} value cannot exceed {nameof(maximum)} value.");
            }
            _onClick = onClickCallback;
            Value    = startingNumber.Clamp(minimum, maximum);
            Minimum  = minimum;
            Maximum  = maximum;
            Text     = text;
            var buttonYOffset = (int)Math.Ceiling(Game1.smallFont.MeasureString(text).Y) + _linePadding;

            _minusButton = new TextureButton(new Rectangle((int)Math.Floor(location.X), (int)Math.Floor(location.Y) + buttonYOffset, PixelsWide * Game1.pixelZoom, PixelsHigh * Game1.pixelZoom), Game1.mouseCursors, OptionsPlusMinus.minusButtonSource, MinusButtonClicked);
            var plusButtonOffset = (int)Math.Ceiling(NumberSprite.getWidth(Maximum) * 1.5) + _minusButton.Bounds.Width * 4;

            _plusButton = new TextureButton(new Rectangle((int)Math.Floor(location.X) + plusButtonOffset, (int)Math.Floor(location.Y) + buttonYOffset, PixelsWide * Game1.pixelZoom, PixelsHigh * Game1.pixelZoom), Game1.mouseCursors, OptionsPlusMinus.plusButtonSource, PlusButtonClicked);
            var maxWidth = new[] { _plusButton.Bounds.X + _plusButton.Bounds.Width - (int)Math.Floor(location.X), (int)Math.Ceiling(Game1.smallFont.MeasureString(text).X) }.Max();
            var maxHeight = buttonYOffset + new[] { _minusButton.Bounds.Height, _plusButton.Bounds.Height, NumberSprite.getHeight() }.Max();

            Bounds = new Rectangle((int)Math.Floor(location.X), (int)Math.Floor(location.Y), maxWidth, maxHeight);
        }
Ejemplo n.º 4
0
        private void DrawLevelTenProfessionCost(SpriteBatch spriteBatch)
        {
            var firstRowBottomLocation = _professionButtonRowStartLocation.Y + GetRowHeight <TierOneProfession>();
            var costTextLocation       = new Vector2(_professionButtonRowStartLocation.X, firstRowBottomLocation + CostTextYOffset <TierTwoProfession>() + _rowPadding);

            spriteBatch.DrawString(Game1.dialogueFont, CostText, costTextLocation, Game1.textColor);
            var pointNumberLocation = new Vector2(costTextLocation.X + Game1.dialogueFont.MeasureString(CostText).X + (NumberSprite.getWidth(PerSaveOptions.Instance.CostOfTierTwoPrestige) * 3.0).Ceiling(), costTextLocation.Y + Game1.pixelZoom * 5);

            NumberSprite.draw(PerSaveOptions.Instance.CostOfTierTwoPrestige, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0);
        }
Ejemplo n.º 5
0
        private void DrawLevelFiveProfessionCost(SpriteBatch spriteBatch)
        {
            var costTextLocation = _professionButtonRowStartLocation;

            costTextLocation.Y += CostTextYOffset <TierOneProfession>();
            spriteBatch.DrawString(Game1.dialogueFont, CostText, costTextLocation, Game1.textColor);
            var pointNumberLocation = new Vector2(costTextLocation.X + Game1.dialogueFont.MeasureString(CostText).X + (NumberSprite.getWidth(PerSaveOptions.Instance.CostOfTierOnePrestige) * 3.0).Ceiling(), costTextLocation.Y + Game1.pixelZoom * 5);

            NumberSprite.draw(PerSaveOptions.Instance.CostOfTierOnePrestige, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0);
            if (_leftProfessionStartingXLocation == 0)
            {
                _leftProfessionStartingXLocation = pointNumberLocation.X.Ceiling() + NumberSprite.digitWidth;
            }
        }
Ejemplo n.º 6
0
        private void DrawPrestigePoints(SpriteBatch spriteBatch)
        {
            const string pointText    = "Prestige Points:";
            var          yOffset      = 5 * Game1.pixelZoom;
            var          textLocation = new Vector2(xPositionOnScreen + spaceToClearSideBorder / 2 + borderWidth,
                                                    yPositionOnScreen + yOffset + (int)Math.Floor(Game1.tileSize * 3.15));

            spriteBatch.DrawString(Game1.dialogueFont, pointText, textLocation, Game1.textColor);
            var pointNumberLocation = new Vector2(textLocation.X + Game1.dialogueFont.MeasureString(pointText).X + (int)Math.Floor(Game1.pixelZoom * 4.25) + NumberSprite.getWidth(_prestige.PrestigePoints), textLocation.Y + Game1.pixelZoom * 5);

            NumberSprite.draw(_prestige.PrestigePoints, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0);
            _professionButtonRowStartLocation = new Vector2(textLocation.X, textLocation.Y + Game1.dialogueFont.MeasureString(pointText).Y + _rowPadding);
        }