Пример #1
0
 public override void Draw(SpriteBatch b, Point offset)
 {
     if (Visible)
     {
         Sprite.draw(b, false, offset.X + Area.X, offset.Y + Area.Y);
     }
 }
Пример #2
0
 public override void draw(SpriteBatch b)
 {
     if (width < 16 || height < 16)
     {
         return;
     }
     if (transitioning)
     {
         drawBox(b, transitionX, transitionY, transitionWidth, transitionHeight);
         drawMouse(b);
         return;
     }
     if (isQuestion)
     {
         drawBox(b, x, y - (heightForQuestions - height), width, heightForQuestions);
         SpriteText.drawString(b, getCurrentString(), x + 8, y + 12 - (heightForQuestions - height), characterIndexInDialogue, width - 16);
         if (characterIndexInDialogue >= getCurrentString().Length - 1)
         {
             int responseY = y - (heightForQuestions - height) + SpriteText.getHeightOfString(getCurrentString(), width - 16) + 48;
             for (int i = 0; i < responses.Count; i++)
             {
                 if (i == selectedResponse)
                 {
                     IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(375, 357, 3, 3), x + 4, responseY - 8, width - 8, SpriteText.getHeightOfString(responses[i].responseText, width) + 16, Color.White, 4f, drawShadow: false);
                 }
                 SpriteText.drawString(b, responses[i].responseText, x + 8, responseY, 999999, width, 999999, (selectedResponse == i) ? 1f : 0.6f);
                 responseY += SpriteText.getHeightOfString(responses[i].responseText, width) + 16;
             }
         }
     }
     else
     {
         drawBox(b, x, y, width, height);
         if (!isPortraitBox() && !isQuestion)
         {
             SpriteText.drawString(b, getCurrentString(), x + 8, y + 8, characterIndexInDialogue, width);
         }
     }
     if (isPortraitBox() && !isQuestion)
     {
         drawPortrait(b);
         if (!isQuestion)
         {
             SpriteText.drawString(b, getCurrentString(), x + 8, y + 8, characterIndexInDialogue, width - 460 - 24);
         }
     }
     if (dialogueIcon != null && characterIndexInDialogue >= getCurrentString().Length - 1)
     {
         dialogueIcon.draw(b, localPosition: true);
     }
     if (hoverText.Length > 0)
     {
         SpriteText.drawStringWithScrollBackground(b, hoverText, friendshipJewel.Center.X - SpriteText.getWidthOfString(hoverText) / 2, friendshipJewel.Y - 64);
     }
     drawMouse(b);
 }
Пример #3
0
 public void draw(SpriteBatch b)
 {
     for (int i = 0; i < cars.Count; i++)
     {
         cars[i].draw(b, new Vector2(position.X - (float)((i + 1) * 512), 2592f), wheelRotation);
     }
     if (whistleSteam != null)
     {
         whistleSteam.draw(b);
     }
 }
Пример #4
0
 public override void draw(SpriteBatch b)
 {
     if (!base.isMoving)
     {
         base.draw(b);
         if (shippingBinLid != null && (int)daysOfConstructionLeft <= 0)
         {
             shippingBinLid.draw(b, localPosition: false, 0, 0, (float)alpha * (((int)newConstructionTimer > 0) ? ((1000f - (float)(int)newConstructionTimer) / 1000f) : 1f));
         }
     }
 }
Пример #5
0
 public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
 {
     base.draw(spriteBatch, x, y, alpha);
     if (screen != null)
     {
         screen.update(Game1.currentGameTime);
         screen.draw(spriteBatch);
         if (screenOverlay != null)
         {
             screenOverlay.update(Game1.currentGameTime);
             screenOverlay.draw(spriteBatch);
         }
     }
 }
Пример #6
0
        /// <summary>
        /// Reimplements the operations pertaining to the drawing of the Farmhouse, Greenhouse, Mailbox, and
        /// the note on the grandpa shrine to accomidate for repositioning based on the information provided by
        /// the custom farm's content pack.
        /// </summary>
        /// <param name="__instance">The instance of the Farm</param>
        /// <param name="b">From original method. The spritebatch used to draw.</param>
        public static void Postfix(Farm __instance, SpriteBatch b)
        {
            int x;

            if (__instance.Name != "Farm")
            {
                return;
            }
            NetRectangle            house      = (NetRectangle)Traverse.Create(__instance).Field("houseSource").GetValue();
            NetRectangle            greenhouse = (NetRectangle)Traverse.Create(__instance).Field("greenhouseSource").GetValue();
            TemporaryAnimatedSprite binLid     = (TemporaryAnimatedSprite)Traverse.Create(__instance).Field("shippingBinLid").GetValue();

            //Farmhouse & Farmhouse Shadows
            b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, customManager.FarmHouseCoords(64f, 568f)), new Rectangle?(Building.leftShadow), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-05f);
            for (x = 2; x < 9; x++)
            {
                b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, customManager.FarmHouseCoords(x * 64f, 568f)), new Rectangle?(Building.middleShadow), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-05f);
            }
            b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, customManager.FarmHouseCoords(x * 64, 568f)), new Rectangle?(Building.rightShadow), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-05f);
            b.Draw(Farm.houseTextures, Game1.GlobalToLocal(Game1.viewport, customManager.FarmHouseCoords()), new Rectangle?(house), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, customManager.FarmHouseLayerDepth());

            //Green House
            b.Draw(Farm.houseTextures, Game1.GlobalToLocal(Game1.viewport, customManager.GreenHouseCoords()), new Rectangle?(greenhouse), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, customManager.GreenHouseLayerDepth());

            //Mailbox Notification ("!" symbol when new mail arrives).
            if (Game1.mailbox.Count > 0)
            {
                float yOffset = 4f * (float)Math.Round(Math.Sin(DateTime.Now.TimeOfDay.TotalMilliseconds / 250.0), 2);

                b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, customManager.MailboxNotification(0f, yOffset, false)),
                       new Rectangle?(new Rectangle(141, 465, 20, 24)), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, customManager.MailBoxNotifyLayerDepth(false));
                b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, customManager.MailboxNotification(0.5626f * 64f, yOffset + 40f, true)),
                       new Rectangle?(new Rectangle(189, 423, 15, 13)), Color.White, 0f, new Vector2(7f, 6f), 4f, SpriteEffects.None, customManager.MailBoxNotifyLayerDepth(true));
            }

            //Shipping Bin Animation
            if (binLid != null)
            {
                binLid.draw(b, false, 0, 0, 1f);
            }

            //Shrine note
            if (!__instance.hasSeenGrandpaNote)
            {
                b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, customManager.GrandpaShrineCoords()), new Rectangle?(new Rectangle(575, 1972, 11, 8)), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.0448009968f);
            }
            return;
        }
Пример #7
0
        public override void draw(SpriteBatch b)
        {
            b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f);
            base.draw(b);
            Game1.dayTimeMoneyBox.drawMoneyBox(b);
            b.Draw(_content.Load <Texture2D>("assets/bgpatch.png"), new Vector2(GeodeSpot.bounds.X, GeodeSpot.bounds.Y),
                   new Rectangle(0, 0, 140, 78), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f);
            if (GeodeSpot.item != null)
            {
                if (_geodeDestructionAnimation == null)
                {
                    GeodeSpot.item.drawInMenu(b,
                                              new Vector2(GeodeSpot.bounds.X + 253 + (GeodeSpot.item.ParentSheetIndex == 275 ? -8 : 0),
                                                          GeodeSpot.bounds.Y + 118 + (GeodeSpot.item.ParentSheetIndex == 275 ? 8 : 0)), 1f);
                }
                else
                {
                    _geodeDestructionAnimation.draw(b, true);
                }

                foreach (var fluffSprite in _fluffSprites)
                {
                    fluffSprite.draw(b, true);
                }

                if (_geodeTreasure != null && _delayBeforeShowArtifactTimer <= 0f)
                {
                    _geodeTreasure.drawInMenu(b,
                                              new Vector2(GeodeSpot.bounds.X + 253, GeodeSpot.bounds.Y + 118 + _yPositionOfGem), 1f);
                }

                _sparkle?.draw(b, true);
            }

            _clint.draw(b, new Vector2(GeodeSpot.bounds.X + 384, GeodeSpot.bounds.Y + 64), 0.877f);
            if (!hoverText.Equals(""))
            {
                drawHoverText(b, hoverText, Game1.smallFont);
            }

            heldItem?.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 8, Game1.getOldMouseY() + 8), 1f);
            if (!Game1.options.hardwareCursor)
            {
                drawMouse(b);
            }
        }
Пример #8
0
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f);
     draw(b, true, true, -1, -1, -1);
     Game1.dayTimeMoneyBox.drawMoneyBox(b, -1, -1);
     b.Draw(Content.Load <Texture2D>("assets/bgpatch.png"), new Vector2(geodeSpot.bounds.X, geodeSpot.bounds.Y), new Rectangle?(new Rectangle(0, 0, 140, 78)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f);
     if (geodeSpot.item != null)
     {
         if (geodeDestructionAnimation == null)
         {
             geodeSpot.item.drawInMenu(b, new Vector2(geodeSpot.bounds.X + 253 + (geodeSpot.item.ParentSheetIndex == 275 ? -8 : 0), geodeSpot.bounds.Y + 118 + (geodeSpot.item.ParentSheetIndex == 275 ? 8 : 0)), 1f);
         }
         else
         {
             geodeDestructionAnimation.draw(b, true, 0, 0, 1f);
         }
         foreach (TemporaryAnimatedSprite fluffSprite in fluffSprites)
         {
             fluffSprite.draw(b, true, 0, 0, 1f);
         }
         if (geodeTreasure != null && (double)delayBeforeShowArtifactTimer <= 0.0)
         {
             geodeTreasure.drawInMenu(b, new Vector2(geodeSpot.bounds.X + 253, geodeSpot.bounds.Y + 118 + yPositionOfGem), 1f);
         }
         if (sparkle != null)
         {
             sparkle.draw(b, true, 0, 0, 1f);
         }
     }
     clint.draw(b, new Vector2(geodeSpot.bounds.X + 384, geodeSpot.bounds.Y + 64), 0.877f);
     if (!hoverText.Equals(""))
     {
         drawHoverText(b, hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null, null);
     }
     if (heldItem != null)
     {
         heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 8, Game1.getOldMouseY() + 8), 1f);
     }
     if (Game1.options.hardwareCursor)
     {
         return;
     }
     drawMouse(b);
 }
Пример #9
0
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f);
     base.draw(b);
     Game1.dayTimeMoneyBox.drawMoneyBox(b);
     b.Draw(Game1.mouseCursors, new Vector2(geodeSpot.bounds.X, geodeSpot.bounds.Y), new Rectangle(0, 512, 140, 78), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f);
     if (geodeSpot.item != null)
     {
         if (geodeDestructionAnimation == null)
         {
             geodeSpot.item.drawInMenu(b, new Vector2(geodeSpot.bounds.X + 360 + (((int)geodeSpot.item.parentSheetIndex == 275) ? (-8) : 0), geodeSpot.bounds.Y + 160 + (((int)geodeSpot.item.parentSheetIndex == 275) ? 8 : 0)), 1f);
         }
         else
         {
             geodeDestructionAnimation.draw(b, localPosition: true);
         }
         foreach (TemporaryAnimatedSprite fluffSprite in fluffSprites)
         {
             fluffSprite.draw(b, localPosition: true);
         }
         if (geodeTreasure != null && delayBeforeShowArtifactTimer <= 0f)
         {
             geodeTreasure.drawInMenu(b, new Vector2(geodeSpot.bounds.X + 360, geodeSpot.bounds.Y + 160 + yPositionOfGem), 1f);
         }
         if (sparkle != null)
         {
             sparkle.draw(b, localPosition: true);
         }
     }
     clint.draw(b, new Vector2(geodeSpot.bounds.X + 384, geodeSpot.bounds.Y + 64), 0.877f);
     if (!hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont);
     }
     if (heldItem != null)
     {
         heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 8, Game1.getOldMouseY() + 8), 1f);
     }
     if (!Game1.options.hardwareCursor)
     {
         drawMouse(b);
     }
 }
Пример #10
0
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * 0.5f);
     this.draw(b, false, false);
     Game1.drawDialogueBox(this.ItemsToGrabMenu.xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder, this.ItemsToGrabMenu.yPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder, this.ItemsToGrabMenu.width + IClickableMenu.borderWidth * 2 + IClickableMenu.spaceToClearSideBorder * 2, this.ItemsToGrabMenu.height + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth * 2, false, true);
     this.ItemsToGrabMenu.draw(b);
     poof?.draw(b, true);
     if (!this.hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont);
     }
     heldItem?.drawInMenu(b, new Vector2((float)(Game1.getOldMouseX() + Game1.pixelZoom * 4), (float)(Game1.getOldMouseY() + Game1.pixelZoom * 4)), 1f);
     this.drawMouse(b);
     if (this.ItemsToGrabMenu.descriptionTitle == null || this.ItemsToGrabMenu.descriptionTitle.Length <= 1)
     {
         return;
     }
     IClickableMenu.drawHoverText(b, this.ItemsToGrabMenu.descriptionTitle, Game1.smallFont, Game1.tileSize / 2 + (this.heldItem != null ? Game1.tileSize / 4 : -Game1.tileSize / 3), Game1.tileSize / 2 + (this.heldItem != null ? Game1.tileSize / 4 : -Game1.tileSize / 3));
 }
Пример #11
0
 public override void draw(SpriteBatch b)
 {
     if (sandDuggy.Value != null)
     {
         sandDuggy.Value.Draw(b);
     }
     if (farmhouseRestored.Value && shippingBinLid != null)
     {
         shippingBinLid.draw(b);
     }
     if (farmhouseMailbox.Value && Game1.mailbox.Count > 0)
     {
         float yOffset          = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2);
         Point mailbox_position = new Point(81, 40);
         float draw_layer       = (float)((mailbox_position.X + 1) * 64) / 10000f + (float)(mailbox_position.Y * 64) / 10000f;
         float xOffset          = -8f;
         b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(mailbox_position.X * 64) + xOffset, (float)(mailbox_position.Y * 64 - 96 - 48) + yOffset)), new Microsoft.Xna.Framework.Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, draw_layer + 1E-06f);
         b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(mailbox_position.X * 64 + 32 + 4) + xOffset, (float)(mailbox_position.Y * 64 - 64 - 24 - 8) + yOffset)), new Microsoft.Xna.Framework.Rectangle(189, 423, 15, 13), Color.White, 0f, new Vector2(7f, 6f), 4f, SpriteEffects.None, draw_layer + 1E-05f);
     }
     base.draw(b);
 }
Пример #12
0
        public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1)
        {
            SetScreenScale();
            TemporaryAnimatedSprite sprite = (TemporaryAnimatedSprite)typeof(TV).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this);

            if (sprite != null)
            {
                spriteBatch.Draw(backgroundTexture, ModEntry.api.GetScreenRectangle(), Color.White);
                sprite.scale = GetScale(sprite.sourceRect);
                typeof(TV).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(this, sprite);
                sprite.update(Game1.currentGameTime);
                sprite.draw(spriteBatch, true, 0, 0, 1f);
                TemporaryAnimatedSprite sprite2 = (TemporaryAnimatedSprite)typeof(TV).GetField("screenOverlay", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this);
                if (sprite2 != null)
                {
                    sprite2.scale = GetScale(sprite2.sourceRect);
                    typeof(TV).GetField("screenOverlay", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(this, sprite2);
                    sprite2.update(Game1.currentGameTime);
                    sprite2.draw(spriteBatch, true, 0, 0, 1f);
                }
            }
        }
Пример #13
0
 public override void draw(SpriteBatch spriteBatch)
 {
     base.draw(spriteBatch);
     if (minecartSteam != null)
     {
         minecartSteam.draw(spriteBatch);
     }
     if ((bool)oreBoulderPresent)
     {
         spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, boulderPosition), boulderSourceRect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.0001f);
     }
     if ((bool)railroadAreaBlocked)
     {
         spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, railroadBlockRect), raildroadBlocksourceRect, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.0193f);
     }
     if ((bool)landslide)
     {
         spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, landSlideRect), landSlideSourceRect, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.0192f);
         spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(new Vector2(landSlideRect.X + 192 - 20, landSlideRect.Y + 192 + 20) + new Vector2(32f, 24f)), Game1.shadowTexture.Bounds, Color.White, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, 0.0224f);
         spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(new Vector2(landSlideRect.X + 192 - 20, landSlideRect.Y + 128)), new Microsoft.Xna.Framework.Rectangle(288 + (((int)(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 1600.0 % 2.0) != 0) ? ((int)(Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 400.0 / 100.0) * 19) : 0), 1349, 19, 28), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.0256f);
         spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(new Vector2(landSlideRect.X + 256 - 20, landSlideRect.Y + 128)), new Microsoft.Xna.Framework.Rectangle(335, 1410, 21, 21), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.0128f);
     }
 }
Пример #14
0
 public override void draw(SpriteBatch spriteBatch)
 {
     base.draw(spriteBatch);
     spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((int)busPosition.X, (int)busPosition.Y)), busSource, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (busPosition.Y + 192f) / 10000f);
     if (busDoor != null)
     {
         busDoor.draw(spriteBatch);
     }
     if (drivingOff || drivingBack)
     {
         if (drivingOff && warpedToDesert)
         {
             Game1.player.faceDirection(3);
             Game1.player.blinkTimer = -1000;
             Game1.player.FarmerRenderer.draw(spriteBatch, new FarmerSprite.AnimationFrame(117, 99999, 0, secondaryArm: false, flip: true), 117, new Microsoft.Xna.Framework.Rectangle(48, 608, 16, 32), Game1.GlobalToLocal(new Vector2((int)(busPosition.X + 4f), (int)(busPosition.Y - 8f)) + pamOffset * 4f), Vector2.Zero, (busPosition.Y + 192f + 4f) / 10000f, Color.White, 0f, 1f, Game1.player);
             spriteBatch.Draw(Game1.mouseCursors2, Game1.GlobalToLocal(Game1.viewport, new Vector2((int)busPosition.X, (int)busPosition.Y - 40) + pamOffset * 4f), transparentWindowSource, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (busPosition.Y + 192f + 8f) / 10000f);
         }
         else
         {
             spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((int)busPosition.X, (int)busPosition.Y) + pamOffset * 4f), pamSource, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (busPosition.Y + 192f + 4f) / 10000f);
         }
     }
 }
Пример #15
0
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.uiViewport.Width, Game1.uiViewport.Height), Color.Black * 0.5f);
     base.draw(b, drawUpperPortion: false, drawDescriptionArea: false);
     Game1.drawDialogueBox(ItemsToGrabMenu.xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder, ItemsToGrabMenu.yPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder, ItemsToGrabMenu.width + IClickableMenu.borderWidth * 2 + IClickableMenu.spaceToClearSideBorder * 2, ItemsToGrabMenu.height + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth * 2, speaker: false, drawOnlyBox: true);
     ItemsToGrabMenu.draw(b);
     if (poof != null)
     {
         poof.draw(b, localPosition: true);
     }
     if (!hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont);
     }
     if (heldItem != null)
     {
         heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 16, Game1.getOldMouseY() + 16), 1f);
     }
     drawMouse(b);
     if (ItemsToGrabMenu.descriptionTitle != null && ItemsToGrabMenu.descriptionTitle.Length > 1)
     {
         IClickableMenu.drawHoverText(b, ItemsToGrabMenu.descriptionTitle, Game1.smallFont, 32 + ((heldItem != null) ? 16 : (-21)), 32 + ((heldItem != null) ? 16 : (-21)));
     }
 }
Пример #16
0
        private static bool DrawPrefix(Farm __instance, TemporaryAnimatedSprite ___shippingBinLid, SpriteBatch b)
        {
            if (__instance.modData.ContainsKey("AlternativeTextureName"))
            {
                var textureModel = AlternativeTextures.textureManager.GetSpecificTextureModel(__instance.modData["AlternativeTextureName"]);
                if (textureModel is null)
                {
                    return(true);
                }

                var textureVariation = Int32.Parse(__instance.modData["AlternativeTextureVariation"]);
                if (textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation))
                {
                    return(true);
                }

                // Initial vanilla logic
                BaseDrawReversePatch(__instance, b);
                foreach (KeyValuePair <long, FarmAnimal> pair in __instance.animals.Pairs)
                {
                    pair.Value.draw(b);
                }
                Point   entry_position_tile  = __instance.GetMainFarmHouseEntry();
                Vector2 entry_position_world = Utility.PointToVector2(entry_position_tile) * 64f;
                b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(entry_position_tile.X - 5, entry_position_tile.Y + 2) * 64f), Building.leftShadow, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-05f);
                for (int x = 1; x < 8; x++)
                {
                    b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(entry_position_tile.X - 5 + x, entry_position_tile.Y + 2) * 64f), Building.middleShadow, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-05f);
                }
                b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(entry_position_tile.X + 3, entry_position_tile.Y + 2) * 64f), Building.rightShadow, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-05f);

                // Custom farmhouse logic
                Color house_draw_color = Color.White;
                if (__instance.frameHouseColor.HasValue)
                {
                    house_draw_color           = __instance.frameHouseColor.Value;
                    __instance.frameHouseColor = null;
                }

                Texture2D house_texture = textureModel.GetTexture(textureVariation);
                if (__instance.paintedHouseTexture != null)
                {
                    house_texture = __instance.paintedHouseTexture;
                }

                Vector2 house_draw_position = new Vector2(entry_position_world.X - 384f, entry_position_world.Y - 440f);
                b.Draw(house_texture, Game1.GlobalToLocal(Game1.viewport, house_draw_position), new Rectangle(0, 0, 160, 144), house_draw_color, 0f, Vector2.Zero, 4f, SpriteEffects.None, (house_draw_position.Y + 230f) / 10000f);

                // Do rest of vanilla logic
                if (Game1.mailbox.Count > 0)
                {
                    float yOffset          = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2);
                    Point mailbox_position = Game1.player.getMailboxPosition();
                    float draw_layer       = (float)((mailbox_position.X + 1) * 64) / 10000f + (float)(mailbox_position.Y * 64) / 10000f;
                    b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(mailbox_position.X * 64, (float)(mailbox_position.Y * 64 - 96 - 48) + yOffset)), new Microsoft.Xna.Framework.Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, draw_layer + 1E-06f);
                    b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(mailbox_position.X * 64 + 32 + 4, (float)(mailbox_position.Y * 64 - 64 - 24 - 8) + yOffset)), new Microsoft.Xna.Framework.Rectangle(189, 423, 15, 13), Color.White, 0f, new Vector2(7f, 6f), 4f, SpriteEffects.None, draw_layer + 1E-05f);
                }
                if (___shippingBinLid != null)
                {
                    ___shippingBinLid.draw(b);
                }
                if (!__instance.hasSeenGrandpaNote)
                {
                    Point grandpa_shrine = __instance.GetGrandpaShrinePosition();
                    b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((grandpa_shrine.X + 1) * 64, grandpa_shrine.Y * 64)), new Microsoft.Xna.Framework.Rectangle(575, 1972, 11, 8), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.0448009968f);
                }
                return(false);
            }

            return(true);
        }
Пример #17
0
        public void Draw(SpriteBatch b)
        {
            try
            {
                Game1.spriteBatch.End();
                Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, depthStencilState: Mod.StencilBrighten);

                Rectangle display = new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height);
                b.Draw(Game1.staminaRect, display, Game1.staminaRect.Bounds, this.c, 0f, Vector2.Zero, SpriteEffects.None, 0f);

                Color[] tints = new[]
                {
                    new Color(255, 200, 200),
                    new Color(170, 255, 170),
                    new Color(150, 150, 255)
                };
                Vector2[] posMods = new[]
                {
                    new Vector2(0, 0),
                    new Vector2(starTexRect.Width / 3 * 1, starTexRect.Height / 3 * 1),
                    new Vector2(starTexRect.Width / 3 * 2, starTexRect.Height / 3 * 2),
                };
                float[] posMult = new[] { 0.1f, 0.3f, 0.5f };


                float incrx = Game1.viewport.Width / starTexRect.Width;
                float incry = Game1.viewport.Height / starTexRect.Height;

                for (int i = 0; i < 3; ++i)
                {
                    float sx = -(((Game1.viewport.X + offset.X) * posMult[i] + posMods[i].X) % (starTexRect.Width * Game1.pixelZoom));
                    float sy = -(((Game1.viewport.Y + offset.Y) * posMult[i] + posMods[i].Y) % (starTexRect.Height * Game1.pixelZoom));
                    for (int ix = -1; ix <= incrx + 1; ++ix)
                    {
                        for (int iy = -1; iy <= incry + 1; ++iy)
                        {
                            float rx = sx + ix * starTexRect.Width * Game1.pixelZoom;
                            float ry = sy + iy * starTexRect.Height * Game1.pixelZoom;

                            b.Draw(Game1.mouseCursors, new Vector2(rx, ry), starTexRect, tints[i], 0, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.001f * i);
                        }
                    }
                }

                if (planet != null)
                {
                    planet.Position = new Vector2(Game1.viewport.Width / 2 - planet.Texture.Width / 16 /* * 2 */, 100);
                    planet.interval = 200;
                    planet.draw(b, localPosition: true);
                }

                Game1.spriteBatch.End();
                Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, depthStencilState: Mod.StencilDarken);
            }
            catch (Exception e)
            {
                SpaceShared.Log.Error("Exception: " + e);
                Game1.spriteBatch.End();
                Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp);
            }
        }
Пример #18
0
 public void draw(SpriteBatch b)
 {
     sprite.draw(b, localPosition: true);
 }
Пример #19
0
        }        //update

        public void draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(
                texture: Game1.mouseCursors,
                position: Game1.GlobalToLocal(Game1.viewport, new Vector2((int)busPosition.X, (int)busPosition.Y)),
                sourceRectangle: busSource,
                color: Color.White,
                rotation: 0f,
                origin: Vector2.Zero,
                scale: 4f,
                effects: SpriteEffects.None,
                layerDepth: (busPosition.Y + 192f) / 10000f
                );

            if (busDoor != null)
            {
                busDoor.draw(spriteBatch);
            }

            if (drivingOff || driving_here)
            {
                if (drivingOff && warped_here)
                {
                    Game1.player.faceDirection(3);
                    Game1.player.blinkTimer = -1000;

                    Game1.player.FarmerRenderer.draw(
                        b: spriteBatch,
                        animationFrame: new FarmerSprite.AnimationFrame(
                            117,
                            99999,
                            0,
                            secondaryArm: false,
                            flip: true),
                        currentFrame: 117,
                        sourceRect: new Microsoft.Xna.Framework.Rectangle(48, 608, 16, 32),
                        position: Game1.GlobalToLocal(new Vector2((int)(busPosition.X + 4f), (int)(busPosition.Y - 8f)) + driverOffset * 64f),
                        origin: Vector2.Zero,
                        layerDepth: (busPosition.Y + 192f + 4f) / 10000f,
                        overrideColor: Color.White,
                        rotation: 0f,
                        scale: 1f,
                        who: Game1.player
                        );

                    spriteBatch.Draw(
                        texture: Game1.mouseCursors2,
                        position: Game1.GlobalToLocal(
                            Game1.viewport,
                            new Vector2((int)busPosition.X, (int)busPosition.Y) + windowOffset * 4f
                            ),
                        sourceRectangle: transparentWindowSource,
                        color: Color.White,
                        rotation: 0f,
                        origin: Vector2.Zero,
                        scale: 4f,
                        effects: SpriteEffects.None,
                        layerDepth: (busPosition.Y + 192f + 8f) / 10000f
                        );
                }
                else
                {
                    spriteBatch.Draw(
                        texture: Game1.mouseCursors,
                        position: Game1.GlobalToLocal(
                            Game1.viewport,
                            new Vector2((int)busPosition.X, (int)busPosition.Y) + driverOffset * 64f),
                        sourceRectangle: pamSource,
                        color: Color.White,
                        rotation: 0f,
                        origin: Vector2.Zero,
                        scale: 4f,
                        effects: SpriteEffects.None,
                        layerDepth: (busPosition.Y + 192f + 4f) / 10000f
                        );
                }
            }
        }        //draw
Пример #20
0
        public override void draw(SpriteBatch b, int x, int y, float alpha = 1f)
        {
            if (!isTVOn)
            {
                return;
            }

            // Use this as a convenient point to intercept and wrap CustomTVMod's
            // question response handler.
            if (Game1.activeClickableMenu != null &&
                Game1.currentLocation.afterQuestion != null &&
                !hasWrappedAfterDialogues)
            {
                var originalCallback = Game1.currentLocation.afterQuestion;
                Game1.currentLocation.afterQuestion =
                    (Farmer who, string answer) =>
                {
                    hasWrappedAfterDialogues = false;
                    if (answer == "leave")
                    {
                        turnOffTV();
                    }
                    originalCallback(who, answer);
                };
                hasWrappedAfterDialogues = true;
            }

            // Draw the device itself. Calculate how far off course it landed.
            deviceSprite.update(Game1.currentGameTime);
            deviceSprite.draw(b, false, Game1.viewport.X, Game1.viewport.Y);
            int fudge = (int)(deviceSprite.Position.Y - getDevicePosition().Y);

            // Draw the light on the power button.
            lightSprite.update(Game1.currentGameTime);
            lightSprite.draw(b, false, Game1.viewport.X,
                             Game1.viewport.Y + fudge);

            // Draw the screen elements from the base class.
            if (screen != null)
            {
                screen.update(Game1.currentGameTime);
                screen.draw(b, false, Game1.viewport.X,
                            Game1.viewport.Y + fudge);

                if (screenOverlay != null)
                {
                    screenOverlay.update(Game1.currentGameTime);
                    screenOverlay.draw(b, false, Game1.viewport.X,
                                       Game1.viewport.Y + fudge);
                }

                // Ensure the static has been tamped down.
                if (staticSprite.alpha > 0.05f)
                {
                    staticSprite.alpha = 0.05f;
                }
            }

            // Draw the static over the screen.
            if (Config.Static && (Config.Animate || screen != null))
            {
                staticSprite.update(Game1.currentGameTime);
                staticSprite.draw(b, false, Game1.viewport.X,
                                  Game1.viewport.Y + fudge);
            }
        }
Пример #21
0
        /// <summary>Draw the menu to the screen.</summary>
        /// <param name="spriteBatch">The sprite batch to which to draw.</param>
        public override void draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f);

            // menu background
            Game1.drawDialogueBox(xPositionOnScreen - Game1.tileSize / 4, yPositionOnScreen - Game1.tileSize - Game1.tileSize / 4, width + Game1.tileSize / 2, height + Game1.tileSize + Game1.tileSize / 2, false, true);

            // tabs
            {
                // check selected tab
                bool isCustomiseTab    = this.m_curTab == (int)MenuTab.Customise;
                bool isFavoriteTab     = this.m_curTab == (int)MenuTab.Favorites || this.m_curTab == (int)MenuTab.FavoritesExtras;
                bool isAboutTab        = this.m_curTab == (int)MenuTab.About;
                bool isMainOutfitsTab  = this.m_curTab == (int)MenuTab.Favorites;
                bool isExtraOutfitsTab = this.m_curTab == (int)MenuTab.FavoritesExtras;

                // get tab positions
                Vector2 character      = new Vector2(xPositionOnScreen + 45 + 64 * 0, yPositionOnScreen - Game1.tileSize + (isCustomiseTab ? 9 : 0));
                Vector2 favorites      = new Vector2(xPositionOnScreen + 45 + 64 * 1, yPositionOnScreen - Game1.tileSize + (isFavoriteTab ? 9 : 0));
                Vector2 about          = new Vector2(xPositionOnScreen + 45 + 64 * 2, yPositionOnScreen - Game1.tileSize + (isAboutTab ? 9 : 0));
                Vector2 quickFavorites = new Vector2(xPositionOnScreen - (isMainOutfitsTab ? 57 : 64), yPositionOnScreen + Game1.tileSize / 2);
                Vector2 extraFavorites = new Vector2(xPositionOnScreen - (isExtraOutfitsTab ? 57 : 64), yPositionOnScreen + Game1.tileSize / 2 + 64);

                // customise tab
                spriteBatch.Draw(Game1.mouseCursors, character, new Rectangle(16, 368, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.0001f);
                Game1.player.FarmerRenderer.drawMiniPortrat(spriteBatch, new Vector2(xPositionOnScreen + 53, yPositionOnScreen - Game1.tileSize + (Game1.player.isMale ? (isCustomiseTab ? 19 : 10) : (isCustomiseTab ? 16 : 7))), 0.00011f, 3f, 2, Game1.player);
                // favorite tab
                spriteBatch.Draw(Game1.mouseCursors, favorites, new Rectangle(16, 368, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.0001f);
                m_tabMenus[(int)MenuTab.ManageFavorites].draw(spriteBatch);
                // about tab
                spriteBatch.Draw(Game1.mouseCursors, about, new Rectangle(16, 368, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.0001f);
                m_tabMenus[(int)MenuTab.About].draw(spriteBatch);
                // favorite subtabs
                if (isFavoriteTab)
                {
                    spriteBatch.Draw(m_menuTextures, quickFavorites, new Rectangle(52, 202, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.0001f);
                    spriteBatch.Draw(m_menuTextures, extraFavorites, new Rectangle(52, 202, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.0001f);
                    m_tabMenus[(int)MenuTab.Favorites].draw(spriteBatch);
                    m_tabMenus[(int)MenuTab.FavoritesExtras].draw(spriteBatch);
                }
            }

            // cancel button
            this.CancelButton.draw(spriteBatch);

            // tab floaters
            if (m_globalConfig.ShowIntroBanner)
            {
                FloatingNew?.draw(spriteBatch, true, 400, 950);
            }
            if (this.ShowFavTabArrow)
            {
                FavTabArrow?.draw(spriteBatch, true, 400, 950);
            }

            // tab contents
            m_tabs[m_curTab].draw(spriteBatch);

            // hovertext
            IClickableMenu.drawHoverText(spriteBatch, this.HoverText, Game1.smallFont);
        }