Пример #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend);
            var vHeight = HarvestMoon.Instance.Graphics.GraphicsDevice.Viewport.Height;

            var gRect = _goldSprite.GetBoundingRectangle(new Transform2(new Vector2(0, 0)));

            gRect = _goldSprite.GetBoundingRectangle(
                new Transform2(
                    new Vector2(0 + gRect.Width + gRect.Width * 0.5f,
                                vHeight - gRect.Height)));
            var gSize = new Vector2(gRect.Width, gRect.Height);

            spriteBatch.Draw(_goldSprite, gRect.Position, 0, new Vector2(2, 2));

            spriteBatch.End();

            spriteBatch.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend);
            var rectangle = _dayToolSprite.GetBoundingRectangle(new Transform2(new Vector2(0, 0)));

            spriteBatch.Draw(_dayToolSprite, new Vector2(rectangle.Width, rectangle.Height), 0, new Vector2(2, 2));
            var currentTool = HarvestMoon.Instance.GetCurrentTool();
            var otherTool   = HarvestMoon.Instance.GetOtherTool();

            if (currentTool != default(string))
            {
                if (currentTool != "none")
                {
                    var currentToolSprite = _holdingItemSprites[currentTool];

                    spriteBatch.Draw(currentToolSprite, new Vector2(28, 32));
                }
            }

            if (otherTool != default(string) && otherTool != currentTool)
            {
                if (otherTool != "none")
                {
                    var currentToolSprite = _holdingItemSprites[otherTool];

                    spriteBatch.Draw(currentToolSprite, new Vector2(82, 32));
                }
            }

            DrawHeart(spriteBatch, _staminaSprites[0], 0, new Vector2(128, 16));
            DrawHeart(spriteBatch, _staminaSprites[1], 60, new Vector2(128 + 28, 16));
            DrawHeart(spriteBatch, _staminaSprites[2], 120, new Vector2(128, 16 + 26));
            DrawHeart(spriteBatch, _staminaSprites[3], 180, new Vector2(128 + 28, 16 + 26));

            spriteBatch.End();

            var numberDaySeasonText = HarvestMoon.Instance.DayNumber.ToString() + ", " + new string(HarvestMoon.Instance.DayName.Take(3).ToArray()) + ", " + HarvestMoon.Instance.Season;

            _numberDaySeasonParagraph.Text = numberDaySeasonText;

            var goldText = HarvestMoon.Instance.Gold.ToString() + "G";

            _goldParagraph.Text = goldText;

            float scaleX = HarvestMoon.Instance.Graphics.GraphicsDevice.Viewport.Width / 640.0f;
            float scaleY = HarvestMoon.Instance.Graphics.GraphicsDevice.Viewport.Height / 480.0f;

            _goldParagraph.Offset = new Vector2((gRect.Width / 2 + 32) * scaleX, (gRect.Height / 2 + 12) * scaleY);

            UserInterface.Active.Draw(spriteBatch);
        }