internal static void Draw(SpriteBatch sb) { if (SubText != null) { if (!SubText.update(Game1.currentGameTime)) { SubText.draw(sb, SubPos); } else { SubText = null; } } if (BoxedTimer > Game1.currentGameTime.TotalGameTime.TotalMilliseconds && !String.IsNullOrEmpty(BoxedText)) { SpriteFont font = Game1.smallFont; int margin = Game1.tileSize * 1 / 3; var box = font.MeasureString(BoxedText); int width = (int)box.X + 2 * margin; //60 is "cornerSize" * 3 on SDV source int height = Math.Max(60, (int)box.Y + 2 * margin); IClickableMenu.drawTextureBox(sb, (int)BoxedlPos.X, (int)BoxedlPos.Y, width, height, Color.White); Vector2 tPos = new Vector2(BoxedlPos.X + margin, BoxedlPos.Y + margin + 4); sb.DrawString(font, BoxedText, tPos + new Vector2(2, 2), Game1.textShadowColor); sb.DrawString(font, BoxedText, tPos, Game1.textColor); } }
public override void draw(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.uiViewport.Width, Game1.uiViewport.Height), Color.Black * 0.5f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen, yPositionOnScreen), new Rectangle(128, 1184, 160, 112), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.95f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 320, yPositionOnScreen + 224 + 4), new Rectangle(120, 1234, 8, 16), Color.White, (float)arrowRotation, new Vector2(4f, 15f), 4f, SpriteEffects.None, 0.96f); if (resultText != null) { resultText.draw(b, new Vector2((float)(xPositionOnScreen + 320) - resultText.textWidth, yPositionOnScreen - 64)); } }
private void Display_RenderedWorld(object sender, StardewModdingAPI.Events.RenderedWorldEventArgs e) { for (int i = animations.Count - 1; i >= 0; i--) { animations[i].draw(e.SpriteBatch, false, 0, 0, 1f); } if (sparklingText != null && lastUser != null) { sparklingText.draw(e.SpriteBatch, Game1.GlobalToLocal(Game1.viewport, lastUser.Position + new Vector2(-64f, -352f))); } }
public override void draw(SpriteBatch b) { if ((fadeTimer <= 0 || !fadeIntoBlack) && state != 3) { if (heldItem != null) { Game1.StartWorldDrawInUI(b); for (int y = Game1.viewport.Y / 64 - 1; y < (Game1.viewport.Y + Game1.viewport.Height) / 64 + 2; y++) { for (int x = Game1.viewport.X / 64 - 1; x < (Game1.viewport.X + Game1.viewport.Width) / 64 + 1; x++) { if ((Game1.currentLocation as LibraryMuseum).isTileSuitableForMuseumPiece(x, y)) { b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x, y) * 64f), Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 29), Color.LightGreen); } } } Game1.EndWorldDrawInUI(b); } if (!holdingMuseumPiece) { base.draw(b, drawUpperPortion: false, drawDescriptionArea: false); } if (!hoverText.Equals("")) { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont); } if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 8, Game1.getOldMouseY() + 8), 1f); } drawMouse(b); if (sparkleText != null) { sparkleText.draw(b, Utility.ModifyCoordinatesForUIScale(Game1.GlobalToLocal(Game1.viewport, globalLocationOfSparklingArtifact))); } } b.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, Game1.uiViewport.Width, Game1.uiViewport.Height), Color.Black * blackFadeAlpha); }
public override void draw(SpriteBatch b) { Game1.StartWorldDrawInUI(b); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen - (flipBubble ? 44 : 20) + 104, yPositionOnScreen - 16 + 314) + everythingShake, new Rectangle(652, 1685, 52, 157), Color.White * 0.6f * scale, 0f, new Vector2(26f, 78.5f) * scale, 4f * scale, flipBubble ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.001f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 70, yPositionOnScreen + 296) + everythingShake, new Rectangle(644, 1999, 37, 150), Color.White * scale, 0f, new Vector2(18.5f, 74f) * scale, 4f * scale, SpriteEffects.None, 0.01f); if (scale == 1f) { b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 64, yPositionOnScreen + 12 + (int)bobberBarPos) + barShake + everythingShake, new Rectangle(682, 2078, 9, 2), bobberInBar ? Color.White : (Color.White * 0.25f * ((float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 100.0), 2) + 2f)), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.89f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 64, yPositionOnScreen + 12 + (int)bobberBarPos + 8) + barShake + everythingShake, new Rectangle(682, 2081, 9, 1), bobberInBar ? Color.White : (Color.White * 0.25f * ((float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 100.0), 2) + 2f)), 0f, Vector2.Zero, new Vector2(4f, bobberBarHeight - 16), SpriteEffects.None, 0.89f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 64, yPositionOnScreen + 12 + (int)bobberBarPos + bobberBarHeight - 8) + barShake + everythingShake, new Rectangle(682, 2085, 9, 2), bobberInBar ? Color.White : (Color.White * 0.25f * ((float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 100.0), 2) + 2f)), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.89f); b.Draw(Game1.staminaRect, new Rectangle(xPositionOnScreen + 124, yPositionOnScreen + 4 + (int)(580f * (1f - distanceFromCatching)), 16, (int)(580f * distanceFromCatching)), Utility.getRedToGreenLerpColor(distanceFromCatching)); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 18, yPositionOnScreen + 514) + everythingShake, new Rectangle(257, 1990, 5, 10), Color.White, reelRotation, new Vector2(2f, 10f), 4f, SpriteEffects.None, 0.9f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 64 + 18, (float)(yPositionOnScreen + 12 + 24) + treasurePosition) + treasureShake + everythingShake, new Rectangle(638, 1865, 20, 24), Color.White, 0f, new Vector2(10f, 10f), 2f * treasureScale, SpriteEffects.None, 0.85f); if (treasureCatchLevel > 0f && !treasureCaught) { b.Draw(Game1.staminaRect, new Rectangle(xPositionOnScreen + 64, yPositionOnScreen + 12 + (int)treasurePosition, 40, 8), Color.DimGray * 0.5f); b.Draw(Game1.staminaRect, new Rectangle(xPositionOnScreen + 64, yPositionOnScreen + 12 + (int)treasurePosition, (int)(treasureCatchLevel * 40f), 8), Color.Orange); } b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 64 + 18, (float)(yPositionOnScreen + 12 + 24) + bobberPosition) + fishShake + everythingShake, new Rectangle(614 + (bossFish ? 20 : 0), 1840, 20, 20), Color.White, 0f, new Vector2(10f, 10f), 2f, SpriteEffects.None, 0.88f); if (sparkleText != null) { sparkleText.draw(b, new Vector2(xPositionOnScreen - 16, yPositionOnScreen - 64)); } } if (Game1.player.fishCaught != null && Game1.player.fishCaught.Count() == 0) { Vector2 pos = new Vector2(xPositionOnScreen + (flipBubble ? (width + 64 + 8) : (-200)), yPositionOnScreen + 192); if (!Game1.options.gamepadControls) { b.Draw(Game1.mouseCursors, pos, new Rectangle(644, 1330, 48, 69), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); } else { b.Draw(Game1.controllerMaps, pos, Utility.controllerMapSourceRect(new Rectangle(681, 0, 96, 138)), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f); } } Game1.EndWorldDrawInUI(b); }
public override void draw(SpriteBatch b) { base.draw(b); Vector2 txtpos2 = new Vector2(64f, Game1.uiViewport.Height - 64); Vector2 txtsize = new Vector2(64f, 64f); txtpos2 = Utility.makeSafe(txtpos2, txtsize); bool draw_ready_status = false; if (completePause >= 0) { if (Game1.saveOnNewDay) { saveText.draw(b, txtpos2); } } else if (margin < 0 || Game1.IsClient) { if (Game1.IsMultiplayer) { _stringBuilder.Clear(); _stringBuilder.Append(Game1.content.LoadString("Strings\\UI:ReadyCheck", Game1.newDaySync.numReadyForSave(), Game1.getOnlineFarmers().Count)); for (int i = 0; i < _ellipsisCount; i++) { _stringBuilder.Append("."); } b.DrawString(Game1.dialogueFont, _stringBuilder, txtpos2, Color.White); draw_ready_status = true; } } else if (!Game1.IsMultiplayer) { _stringBuilder.Clear(); _stringBuilder.Append(Game1.content.LoadString("Strings\\StringsFromCSFiles:SaveGameMenu.cs.11381")); for (int k = 0; k < _ellipsisCount; k++) { _stringBuilder.Append("."); } b.DrawString(Game1.dialogueFont, _stringBuilder, txtpos2, Color.White); } else { _stringBuilder.Clear(); _stringBuilder.Append(Game1.content.LoadString("Strings\\UI:ReadyCheck", Game1.newDaySync.numReadyForSave(), Game1.getOnlineFarmers().Count)); for (int j = 0; j < _ellipsisCount; j++) { _stringBuilder.Append("."); } b.DrawString(Game1.dialogueFont, _stringBuilder, txtpos2, Color.White); draw_ready_status = true; } if (completePause > 0) { draw_ready_status = false; } if (Game1.newDaySync != null && Game1.newDaySync.hasSaved()) { draw_ready_status = false; } if (Game1.IsMultiplayer && draw_ready_status && Game1.options.showMPEndOfNightReadyStatus) { Game1.player.team.endOfNightStatus.Draw(b, txtpos2 + new Vector2(0f, -32f), 4f, 0.99f, PlayerStatusList.HorizontalAlignment.Left, PlayerStatusList.VerticalAlignment.Bottom); } hasDrawn = true; }