public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, Single scaleSize, Single transparency, Single layerDepth, StackDrawType drawStackNumber, Color color, Boolean drawShadow) { this.orgCall(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); }
public static bool Prefix(StardewValley.Object __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (!__instance.bigCraftable.Value) { return(true); } var entry = Mod.entries.SingleOrDefault(cle => cle.Name == __instance.Name); if (entry == null) { return(true); } if (__instance.IsRecipe) { transparency = 0.5f; scaleSize *= 0.75f; } bool flag = (drawStackNumber == StackDrawType.Draw && __instance.maximumStackSize() > 1 && __instance.Stack > 1 || drawStackNumber == StackDrawType.Draw_OneInclusive) && (double)scaleSize > 0.3 && __instance.Stack != int.MaxValue; if (__instance.IsRecipe) { flag = false; } float scale = Math.Min(4f * 16 / entry.Texture.Width, 4f * 16 / entry.Texture.Height); spriteBatch.Draw(entry.Texture, location + new Vector2(32, 32), null, color * transparency, 0, new Vector2(entry.Texture.Width / 2, entry.Texture.Height / 2), scale, SpriteEffects.None, layerDepth); if (flag) { Utility.drawTinyDigits(__instance.Stack, spriteBatch, location + new Vector2(( float )(64 - Utility.getWidthOfTinyDigitString(__instance.Stack, 3f * scaleSize)) + 3f * scaleSize, ( float )(64.0 - 18.0 * ( double )scaleSize + 2.0)), 3f * scaleSize, 1f, color); } if (!__instance.IsRecipe) { return(false); } spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(16f, 16f), new Microsoft.Xna.Framework.Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 451, 16, 16)), color, 0.0f, Vector2.Zero, 3f, SpriteEffects.None, layerDepth + 0.0001f); return(false); }
/// <summary> /// Replace base behaviour by drawing from our custom <see cref="ModEntry.SpriteSheet"/> instead of <see cref="Game1.toolSpriteSheet"/>. /// </summary> public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { const int size = 16; spriteBatch.Draw( texture: ModEntry.SpriteSheet, position: location + new Vector2(size) / 2 * Game1.pixelZoom, sourceRectangle: CookingTool.CookingToolSourceRectangle(upgradeLevel: this.UpgradeLevel), color: color * transparency, rotation: 0f, origin: new Vector2(size) / 2, scale: Game1.pixelZoom * scaleSize, effects: SpriteEffects.None, layerDepth: layerDepth); }
public static bool Prefix_Tool_drawInMenu(Tool __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (!(__instance is Raft)) { return(true); } spriteBatch.Draw(Game1.toolSpriteSheet, location + new Vector2(32f, 32f), new Rectangle(16, 0, 16, 16), color * transparency, 0.0f, new Vector2(8f, 8f), 4f * scaleSize, SpriteEffects.None, layerDepth); return(false); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (seed != null) { Base.ParentSheetIndex = FullSaveIndex.Index; } try { Link.CallUnlinked <SObject> (o => o.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow)); } finally { Base.ParentSheetIndex = TileIndex; } }
public static void DrawInMenuCorrected( this Item item, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow, IDrawOrigin origin ) { IDrawingProperties drawingProperties = item switch { // BigCraftable SObject { bigCraftable : { Value : true } } => new BigCraftableDrawingProperties(),
public override void drawInMenu( SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (drawShadow) { spriteBatch.Draw(Game1.shadowTexture, location + new Vector2(32f, 48f), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), color * 0.5f, 0.0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 3f, SpriteEffects.None, layerDepth - 0.0001f); } spriteBatch.Draw(DeepWoodsTextures.Textures.Festivals, location + new Vector2(32 * scaleSize, 32 * scaleSize), new Microsoft.Xna.Framework.Rectangle?(Game1.getSourceRectForStandardTileSheet(DeepWoodsTextures.Textures.Festivals, this.eggTileIndex, 16, 16)), color * transparency, 0.0f, new Vector2(8f, 8f) * scaleSize, 4f * scaleSize, SpriteEffects.None, layerDepth); if (drawStackNumber == StackDrawType.Draw && scaleSize > 0.3 && this.Stack > 1) { Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2(64 - Utility.getWidthOfTinyDigitString(this.stack.Value, 3 * scaleSize) + 3 * scaleSize, 64 - 18 * scaleSize + 2), 3 * scaleSize, 1, color); } }
/// <summary> /// Repositioned icon in inventory while daggered /// </summary> /// <param name="spriteBatch"></param> /// <param name="location"></param> /// <param name="scaleSize"></param> /// <param name="transparency"></param> /// <param name="layerDepth"></param> /// <param name="drawStackNumber"></param> /// <param name="color"></param> /// <param name="drawShadow"></param> public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { float coolDownLevel = 1f; float addedScale = 0f; spriteBatch.Draw(Tool.weaponsTexture, location + new Vector2(32f, 32f), Game1.getSourceRectForStandardTileSheet(Tool.weaponsTexture, base.IndexOfMenuItemView, 16, 16), color * transparency, 0f, new Vector2(8f, 8f), 4f * (scaleSize + addedScale), SpriteEffects.None, layerDepth); if (coolDownLevel > 0f && (Game1.activeClickableMenu == null || scaleSize != 1f)) { spriteBatch.Draw(Game1.staminaRect, new Rectangle((int)location.X, (int)location.Y + (64 - (int)(coolDownLevel * 64f)), 64, (int)(coolDownLevel * 64f)), Color.Red * 0.66f); } }
public override void drawInMenu(SpriteBatch b, Vector2 loc, float scale, float transparency, float depth, StackDrawType stackDrawType, Color color, bool shadow) { b.Draw(Texture, loc + new Vector2(32, 29), null, Color.White * transparency, 0, new Vector2(8, 8), scale * 4, SpriteEffects.None, depth); if (stackDrawType == StackDrawType.Hide || this.attachments == null || this.attachments[0] == null) { return; } Utility.drawTinyDigits(this.attachments[0].Stack, b, loc + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(this.attachments[0].Stack, 3f * scale)) + 3f * scale, (float)(64.0 - 18.0 * (double)scale + 2.0)), 3f * scale, 1f, Color.White); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { transparency = 0.5f; scaleSize *= 0.75f; this.craftedCache.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { this.updateInfo(); this.info.animationManager.draw(spriteBatch, location, color * transparency, 4f * scaleSize, SpriteEffects.None, layerDepth); //base.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); if (this.energyTexture == null) { this.initializeEnergyTexture(); } spriteBatch.Draw(this.energyTexture, new Rectangle((int)location.X + 8, (int)location.Y + Game1.tileSize / 2, (int)((Game1.tileSize - 16) * this.GetEnergyManager().energyPercentRemaining), (int)16), new Rectangle(0, 0, 1, 1), EnergyUtilities.GetEnergyRemainingColor(this.GetEnergyManager()), 0f, Vector2.Zero, SpriteEffects.None, layerDepth); }
private static bool Object_drawInMenu_Prefix(Object __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (!customChestTypesDict.ContainsKey(__instance.ParentSheetIndex)) { return(true); } bool shouldDrawStackNumber = ((drawStackNumber == StackDrawType.Draw && __instance.maximumStackSize() > 1 && __instance.Stack > 1) || drawStackNumber == StackDrawType.Draw_OneInclusive) && scaleSize > 0.3 && __instance.Stack != int.MaxValue; float extraSize = (customChestTypesDict[__instance.ParentSheetIndex].texture.Height > customChestTypesDict[__instance.ParentSheetIndex].texture.Width ? customChestTypesDict[__instance.ParentSheetIndex].texture.Height : customChestTypesDict[__instance.ParentSheetIndex].texture.Width) / 32f; Rectangle sourceRect = new Rectangle(0, 0, customChestTypesDict[__instance.ParentSheetIndex].texture.Width, customChestTypesDict[__instance.ParentSheetIndex].texture.Height); spriteBatch.Draw(customChestTypesDict[__instance.ParentSheetIndex].texture, location + new Vector2(32f / extraSize, 32f / extraSize), new Microsoft.Xna.Framework.Rectangle?(sourceRect), color * transparency, 0f, new Vector2(8f, 16f), 4f * (((double)scaleSize < 0.2) ? scaleSize : (scaleSize / 2f)) / extraSize, SpriteEffects.None, layerDepth); if (shouldDrawStackNumber) { Utility.drawTinyDigits(__instance.stack, spriteBatch, location + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(__instance.stack, 3f * scaleSize)) + 3f * scaleSize, 64f - 18f * scaleSize + 2f), 3f * scaleSize, 1f, color); } return(false); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { base.drawInMenu(spriteBatch, location + (Game1.player.hasWateringCanEnchantment ? new Vector2(0f, -4f) : new Vector2(0f, -12f)), scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); if (drawStackNumber != 0 && !Game1.player.hasWateringCanEnchantment) { spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(4f, 44f), new Rectangle(297, 420, 14, 5), Color.White * transparency, 0f, Vector2.Zero, 4f, SpriteEffects.None, layerDepth + 0.0001f); spriteBatch.Draw(Game1.staminaRect, new Rectangle((int)location.X + 8, (int)location.Y + 64 - 16, (int)((float)waterLeft / (float)waterCanMax * 48f), 8), Color.DodgerBlue * 0.7f * transparency); } }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { CheckParentSheetIndex(); if (Base?.heldObject?.Value?.Stack is int stack) { Base.heldObject.Value.Stack = Base.Stack; } Base?.heldObject?.Value?.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { spriteBatch.Draw(ringTexture, location + new Vector2(32f, 32f) * scaleSize, new Rectangle(0, 0, 16, 16), color * transparency, 0f, new Vector2(8f, 8f) * scaleSize, scaleSize * 3f, SpriteEffects.None, layerDepth); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { var tex = this.Data.pack.GetTexture(this.Data.Texture, 16, 16); spriteBatch.Draw(tex.Texture, location + new Vector2((int)(32f * scaleSize), (int)(32f * scaleSize)), tex.Rect, color * transparency, 0f, new Vector2(8f, 8f) * scaleSize, 4f * scaleSize, SpriteEffects.None, layerDepth); }
/// <summary>Draw the correct texture based on <see cref="SObject.preservedParentSheetIndex"/> or <see cref="SObject.Name"/>.</summary> private static bool Prefix(SObject __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, Color color, StackDrawType drawStackNumber, bool drawShadow, int stackNumber) { if (!ModEntry.Instance.GetDrawInfo(__instance, out Texture2D spriteSheet, out Rectangle position, out Rectangle iconPosition)) { return(true); } bool flag; if (Constants.TargetPlatform == GamePlatform.Android) { if (__instance.IsRecipe) { transparency = 0.5f; } flag = (((drawStackNumber == StackDrawType.Draw) && (__instance.maximumStackSize() > 1) && (__instance.Stack > 1)) || (drawStackNumber == StackDrawType.Draw_OneInclusive)) && (scaleSize > 0.3) && (__instance.Stack != int.MaxValue) && (__instance.maximumStackSize() > 1) && (scaleSize > 0.3) && (__instance.Stack != int.MaxValue) && (__instance.Stack > 1); if (__instance.IsRecipe) { flag = false; } int itemSlotSize = (int)typeof(StardewValley.Item).GetProperty("itemSlotSize", BindingFlags.Instance | BindingFlags.Public).GetValue(__instance); if (__instance.bigCraftable.Value) { Microsoft.Xna.Framework.Rectangle rectForBigCraftable = SObject.getSourceRectForBigCraftable(__instance.ParentSheetIndex); spriteBatch.Draw(Game1.bigCraftableSpriteSheet, location + new Vector2((float)(itemSlotSize / 2), (float)(itemSlotSize / 2)), new Rectangle?(rectForBigCraftable), Color.White * transparency, 0f, new Vector2(8f, 16f), (float)(4f * ((scaleSize < 0.2) ? scaleSize : (scaleSize / 2f))), SpriteEffects.None, layerDepth); if (flag) { Utility.drawTinyDigits((stackNumber == -1) ? (__instance.Stack) : stackNumber, spriteBatch, location + new Vector2(itemSlotSize - Utility.getWidthOfTinyDigitString((stackNumber == -1) ? (__instance.Stack) : stackNumber, 3f * scaleSize) - (3f * scaleSize), itemSlotSize - (24f * scaleSize)), 3f * scaleSize, layerDepth, Color.White); } if (color != Color.White) { spriteBatch.Draw(Game1.bigCraftableSpriteSheet, location + new Vector2((float)(itemSlotSize / 2), (float)(itemSlotSize / 2)), new Rectangle?(rectForBigCraftable), color * transparency, 0f, new Vector2(8f, 16f), (float)(4f * ((scaleSize < 0.2) ? scaleSize : (scaleSize / 2f))), SpriteEffects.None, layerDepth); } } else { if ((scaleSize == 1f) && __instance.ParentSheetIndex != 590) { spriteBatch.Draw(Game1.shadowTexture, location + new Vector2(Game1.tileSize / 2, Game1.tileSize * 3 / 4), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), Color.White * 0.5f, 0.0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 3f, SpriteEffects.None, layerDepth - 0.0001f); } spriteBatch.Draw(spriteSheet, location + new Vector2((int)(itemSlotSize / 2 * (double)scaleSize), (int)(itemSlotSize / 2 * (double)scaleSize)), new Microsoft.Xna.Framework.Rectangle?(position), Color.White * transparency, 0.0f, new Vector2(8f, 8f) * scaleSize, Game1.pixelZoom * scaleSize, SpriteEffects.None, layerDepth); if (flag) { Utility.drawTinyDigits((stackNumber == -1) ? (__instance.Stack) : stackNumber, spriteBatch, location + new Vector2(itemSlotSize - Utility.getWidthOfTinyDigitString((stackNumber == -1) ? (__instance.Stack) : stackNumber, 3f * scaleSize) - (3f * scaleSize), itemSlotSize - (24f * scaleSize)), 3f * scaleSize, layerDepth, Color.White); } if (color != Color.White) { spriteBatch.Draw(spriteSheet, location + new Vector2((int)(itemSlotSize / 2 * (double)scaleSize), (int)(itemSlotSize / 2 * (double)scaleSize)), new Microsoft.Xna.Framework.Rectangle?(position), color * transparency, 0.0f, new Vector2(8f, 8f) * scaleSize, Game1.pixelZoom * scaleSize, SpriteEffects.None, layerDepth); } //By popular demand, don't show icons near the mouse cursor, which are drawn with lowered transparency. if (transparency >= 1 && iconPosition != Rectangle.Empty) { spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(itemSlotSize / 6 * scaleSize, itemSlotSize / 6 * scaleSize), new Microsoft.Xna.Framework.Rectangle?(iconPosition), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (3f / 2f) * scaleSize, SpriteEffects.None, layerDepth); } if (drawStackNumber != StackDrawType.Hide && (__instance.Quality > 0)) { if (__instance.Quality >= 4) { Math.Cos((Game1.currentGameTime.TotalGameTime.Milliseconds * 3.1415926535897931) / 512.0); } spriteBatch.Draw(Game1.mouseCursors, location + new Vector2((itemSlotSize / 2) - (30f * scaleSize), itemSlotSize - (24f * scaleSize)), new Rectangle?((__instance.quality < 4) ? new Rectangle(0x152 + ((__instance.Quality - 1) * 8), 400, 8, 8) : new Rectangle(0x15a, 0x187, 8, 8)), Color.White * transparency, 0f, new Vector2(4f, 4f), (float)(3f * scaleSize), SpriteEffects.None, layerDepth); } if (__instance.Category == -22 && __instance.uses.Value > 0) { float power = ((float)(FishingRod.maxTackleUses - __instance.uses.Value) + 0.0f) / (float)FishingRod.maxTackleUses; spriteBatch.Draw(Game1.staminaRect, new Rectangle((int)(location.X + 8f), (int)((location.Y + itemSlotSize) - 16f), (int)((itemSlotSize - 0x10) * power), 8), Utility.getRedToGreenLerpColor(power)); } } if (__instance.IsRecipe) { scaleSize *= 0.5f; spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(-12f * scaleSize, -20f * scaleSize), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 0x1c3, 0x10, 0x10)), Color.White, 0f, Vector2.Zero, (float)(4f * scaleSize), SpriteEffects.None, layerDepth + 0.0001f); } return(false); } if (__instance.IsRecipe) { transparency = 0.5f; scaleSize *= 0.75f; } flag = (drawStackNumber == StackDrawType.Draw && __instance.maximumStackSize() > 1 && __instance.Stack > 1 || drawStackNumber == StackDrawType.Draw_OneInclusive) && (double)scaleSize > 0.3 && __instance.Stack != int.MaxValue; if (__instance.IsRecipe) { flag = false; } if (__instance.bigCraftable.Value) { Microsoft.Xna.Framework.Rectangle rectForBigCraftable = SObject.getSourceRectForBigCraftable(__instance.ParentSheetIndex); spriteBatch.Draw(Game1.bigCraftableSpriteSheet, location + new Vector2(32f, 32f), new Microsoft.Xna.Framework.Rectangle?(rectForBigCraftable), color * transparency, 0.0f, new Vector2(8f, 16f), (float)(4.0 * ((double)scaleSize < 0.2 ? (double)scaleSize : (double)scaleSize / 2.0)), SpriteEffects.None, layerDepth); if (flag) { Utility.drawTinyDigits(__instance.Stack, spriteBatch, location + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(__instance.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)(64.0 - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, color); } } else { if (__instance.ParentSheetIndex != 590 & drawShadow) { spriteBatch.Draw(Game1.shadowTexture, location + new Vector2(32f, 48f), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), color * 0.5f, 0.0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 3f, SpriteEffects.None, layerDepth - 0.0001f); } // modified spriteBatch.Draw(spriteSheet, location + new Vector2((float)(int)(32.0 * (double)scaleSize), (float)(int)(32.0 * (double)scaleSize)), new Microsoft.Xna.Framework.Rectangle?(position), color * transparency, 0.0f, new Vector2(8f, 8f) * scaleSize, 4f * scaleSize, SpriteEffects.None, layerDepth); if (flag) { Utility.drawTinyDigits(__instance.Stack, spriteBatch, location + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(__instance.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)(64.0 - 18.0 * (double)scaleSize + 1.0)), 3f * scaleSize, 1f, color); } // New if (transparency >= 1 && iconPosition != Rectangle.Empty) { spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(Game1.tileSize / 6 * scaleSize, Game1.tileSize / 6 * scaleSize), new Microsoft.Xna.Framework.Rectangle?(iconPosition), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (3f / 2f) * scaleSize, SpriteEffects.None, layerDepth); } if (drawStackNumber != StackDrawType.Hide && __instance.Quality > 0) { float num = __instance.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, 52f + num), new Microsoft.Xna.Framework.Rectangle?(__instance.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (__instance.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), color * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); } if (__instance.Category == -22 && __instance.uses.Value > 0) { float power = ((float)(FishingRod.maxTackleUses - __instance.uses.Value) + 0.0f) / (float)FishingRod.maxTackleUses; spriteBatch.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle((int)location.X, (int)((double)location.Y + 56.0 * (double)scaleSize), (int)(64.0 * (double)scaleSize * (double)power), (int)(8.0 * (double)scaleSize)), Utility.getRedToGreenLerpColor(power)); } } if (__instance.IsRecipe) { spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(16f, 16f), new Microsoft.Xna.Framework.Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 451, 16, 16)), color, 0.0f, Vector2.Zero, 3f, SpriteEffects.None, layerDepth + 0.0001f); } return(false); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { float originalScale = scaleSize; scaleSize *= 0.75f; spriteBatch.Draw(FarmerRenderer.hatsTexture, location + new Vector2(32f, 32f), new Rectangle((int)which * 20 % FarmerRenderer.hatsTexture.Width, (int)which * 20 / FarmerRenderer.hatsTexture.Width * 20 * 4, 20, 20), isPrismatic ? (Utility.GetPrismaticColor() * transparency) : (color * transparency), 0f, new Vector2(10f, 10f), 4f * scaleSize, SpriteEffects.None, layerDepth); if (((drawStackNumber == StackDrawType.Draw && maximumStackSize() > 1 && Stack > 1) || drawStackNumber == StackDrawType.Draw_OneInclusive) && (double)scaleSize > 0.3 && Stack != int.MaxValue) { Utility.drawTinyDigits(Stack, spriteBatch, location + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(Stack, 3f * originalScale)) + 3f * originalScale, 64f - 18f * originalScale + 2f), 3f * originalScale, 1f, color); } }
private static bool ObjectDrawInMenuPrefix(SObject __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (__instance is not { ParentSheetIndex : Globals.MEAD_INDEX_I, preservedParentSheetIndex.Value : > 0 } mead) { return(true); // run original logic } var parameters = new object?[] { __instance, null, null, null }; var got = (bool)_GetDrawInfo.Invoke(null, parameters) !; if (!got) { return(true); // run original logic } var spritesheet = (Texture2D)parameters[1] !; var sourceRectangle = (Rectangle)parameters[2] !; if (drawShadow) { var shadowTexture = Game1.shadowTexture; spriteBatch.Draw( texture: shadowTexture, position: location + new Vector2(32f, 48f), sourceRectangle: shadowTexture.Bounds, color: color * 0.5f, rotation: 0f, origin: new(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), scale: 3f, effects: SpriteEffects.None, layerDepth: layerDepth - 0.0001f ); } spriteBatch.Draw( texture: spritesheet, position: location + new Vector2( (int)(32f * scaleSize), (int)(32f * scaleSize) ), sourceRectangle: sourceRectangle, color: color * transparency, rotation: 0f, origin: new Vector2(8f, 8f) * scaleSize, scale: 4f * scaleSize, effects: SpriteEffects.None, layerDepth: layerDepth ); var shouldDrawStackNumber = (drawStackNumber == StackDrawType.Draw && __instance.maximumStackSize() > 1 && __instance.Stack > 1 || drawStackNumber == StackDrawType.Draw_OneInclusive) && scaleSize > 0.3 && __instance.Stack != int.MaxValue; if (shouldDrawStackNumber) { Utility.drawTinyDigits( toDraw: __instance.Stack, spriteBatch, position: location + new Vector2( 64 - Utility.getWidthOfTinyDigitString(__instance.Stack, 3f * scaleSize) + 3f * scaleSize, 64f - 18f * scaleSize + 1f ), scale: 3f * scaleSize, layerDepth: 1f, color ); } if (drawStackNumber != StackDrawType.Hide && __instance.Quality > 0) { var num = __instance.Quality < 4 ? 0f : ((float)Math.Cos(Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1f) * 0.05f; spriteBatch.Draw( texture: Game1.mouseCursors, position: location + new Vector2(12f, 52f + num), sourceRectangle: __instance.Quality < 4 ? new(338 + (__instance.Quality - 1) * 8, 400, 8, 8) : new(346, 392, 8, 8), color: color * transparency, rotation: 0f, origin: new(4f, 4f), scale: 3f * scaleSize * (1f + num), effects: SpriteEffects.None, layerDepth: layerDepth ); } return(false); // don't run original logic }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (combinedRings.Count >= 2) { float oldScaleSize = scaleSize; scaleSize = 1f; location.Y -= (oldScaleSize - 1f) * 32f; Rectangle src = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, combinedRings[0].indexInTileSheet, 16, 16); src.X += 5; src.Y += 7; src.Width = 4; src.Height = 6; spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(51f, 51f) * scaleSize + new Vector2(-12f, 8f) * scaleSize, src, color * transparency, 0f, new Vector2(1.5f, 2f) * 4f * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); src.X++; src.Y += 4; src.Width = 3; src.Height = 1; spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(51f, 51f) * scaleSize + new Vector2(-8f, 4f) * scaleSize, src, color * transparency, 0f, new Vector2(1.5f, 2f) * 4f * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); src = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, combinedRings[1].indexInTileSheet, 16, 16); src.X += 9; src.Y += 7; src.Width = 4; src.Height = 6; spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(51f, 51f) * scaleSize + new Vector2(4f, 8f) * scaleSize, src, color * transparency, 0f, new Vector2(1.5f, 2f) * 4f * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); src.Y += 4; src.Width = 3; src.Height = 1; spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(51f, 51f) * scaleSize + new Vector2(4f, 4f) * scaleSize, src, color * transparency, 0f, new Vector2(1.5f, 2f) * 4f * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); Color?color3 = TailoringMenu.GetDyeColor(combinedRings[0]); Color?color2 = TailoringMenu.GetDyeColor(combinedRings[1]); Color color1noNull = Color.Red; Color color2noNull = Color.Blue; if (color3.HasValue) { color1noNull = color3.Value; } if (color2.HasValue) { color2noNull = color2.Value; } base.drawInMenu(spriteBatch, location + new Vector2(-5f, -1f), scaleSize, transparency, layerDepth, drawStackNumber, Utility.Get2PhaseColor(color1noNull, color2noNull), drawShadow); spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(13f, 35f) * scaleSize, new Rectangle(263, 579, 4, 2), Utility.Get2PhaseColor(color1noNull, color2noNull, 0, 1f, 1125f) * transparency, -(float)Math.PI / 2f, new Vector2(2f, 1.5f) * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(49f, 35f) * scaleSize, new Rectangle(263, 579, 4, 2), Utility.Get2PhaseColor(color1noNull, color2noNull, 0, 1f, 375f) * transparency, (float)Math.PI / 2f, new Vector2(2f, 1.5f) * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(31f, 53f) * scaleSize, new Rectangle(263, 579, 4, 2), Utility.Get2PhaseColor(color1noNull, color2noNull, 0, 1f, 750f) * transparency, (float)Math.PI, new Vector2(2f, 1.5f) * scaleSize, scaleSize * 4f, SpriteEffects.None, layerDepth); } else { base.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); } }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { setTags(); base.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { this.info.animationManager.draw(spriteBatch, location, color * transparency, 4f * scaleSize, SpriteEffects.None, layerDepth); //base.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, color, drawShadow); }
public void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { if (_id != 590 && drawShadow) { spriteBatch.Draw(Game1.shadowTexture, location + new Vector2(32f, 48f), Game1.shadowTexture.Bounds, color * 0.5f, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 3f, SpriteEffects.None, layerDepth - 0.0001f); } spriteBatch.Draw(Game1.concessionsSpriteSheet, location + new Vector2((int)(32f * scaleSize), (int)(32f * scaleSize)), Game1.getSourceRectForStandardTileSheet(Game1.concessionsSpriteSheet, _id, 16, 16), color * transparency, 0f, new Vector2(8f, 8f) * scaleSize, 4f * scaleSize, SpriteEffects.None, layerDepth); }
public static void Postfix(SObject __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { try { DrawCombinedStack(__instance, spriteBatch, location, scaleSize, transparency, color); } catch (Exception ex) { ModEntry.Logger.Log(string.Format("Unhandled Error in {0}.{1}:\n{2}", nameof(DrawInMenuPatch), nameof(Postfix), ex), LogLevel.Error); } }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { this.updateInfo(); foreach (KeyValuePair <Vector2, StardewValley.Object> pair in this.objects) { //ModCore.log(location + (pair.Key * 16) + new Vector2(32, 32)); pair.Value.drawInMenu(spriteBatch, location + (pair.Key * 16) + new Vector2(32, 32), 1.0f, transparency, layerDepth, drawStackNumber, color, drawShadow); } //base.drawInMenu(spriteBatch, location, scaleSize, transparency, layerDepth, drawStackNumber, c, drawShadow); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { checkLoad(); var texture = UsePlaceholder ? AssetManager.Instance.Placeholder : Texture; var offset = new Vector2(16f, 8f); spriteBatch.Draw(Game1.shadowTexture, location + new Vector2(32f, 48f), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), color * 0.5f, 0.0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 3f, SpriteEffects.None, layerDepth - 0.0001f); spriteBatch.Draw(texture, location + offset, null, color, 0.0f, Vector2.Zero, 3f, SpriteEffects.None, layerDepth + 0.0001f); if (Base?.Stack > 1) { Utility.drawTinyDigits(Base.Stack, spriteBatch, location + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(Base.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)(64.0 - 18.0 * (double)scaleSize + 1.0)), 3f * scaleSize, 1f, color); } }
public static void Postfix(Item __instance, SpriteBatch spriteBatch, Vector2 location, float scaleSize, StackDrawType drawStackNumber) { if (!StackEverythingMod.PatchedTypes.Any(item => item.IsInstanceOfType(__instance))) { return; } if (((drawStackNumber == StackDrawType.Draw && __instance.maximumStackSize() > 1 && __instance.Stack > 1) || drawStackNumber == StackDrawType.Draw_OneInclusive) && (double)scaleSize > 0.3 && __instance.Stack != int.MaxValue) { Utility.drawTinyDigits(__instance.Stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(__instance.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White); } }
public void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow) { bool shouldDrawStackNumber = drawStackNumber.ShouldDrawFor(this); if (shouldDrawStackNumber && this.maximumStackSize() > 1 && ((double)scaleSize > 0.3 && this.Stack != int.MaxValue)) { Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(this.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White); } if (shouldDrawStackNumber && this.Quality > 0) { float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); } spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); }
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color colorOverride, bool drawShadow) { if ((bool)isRecipe) { transparency = 0.5f; scaleSize *= 0.75f; } if ((bool)bigCraftable) { spriteBatch.Draw(Game1.bigCraftableSpriteSheet, location + new Vector2(32f, 32f) * scaleSize, Object.getSourceRectForBigCraftable(parentSheetIndex), Color.White * transparency, 0f, new Vector2(32f, 64f) * scaleSize, (scaleSize < 0.2f) ? scaleSize : (scaleSize / 2f), SpriteEffects.None, layerDepth); spriteBatch.Draw(Game1.bigCraftableSpriteSheet, location + new Vector2(32f, 32f) * scaleSize, Object.getSourceRectForBigCraftable((int)parentSheetIndex + 1), color.Value * transparency, 0f, new Vector2(32f, 64f) * scaleSize, (scaleSize < 0.2f) ? scaleSize : (scaleSize / 2f), SpriteEffects.None, Math.Min(1f, layerDepth + 2E-05f)); } else { spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(32f, 32f) * scaleSize, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, parentSheetIndex, 16, 16), Color.White * transparency, 0f, new Vector2(8f, 8f) * scaleSize, 4f * scaleSize, SpriteEffects.None, layerDepth); spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(32f, 32f) * scaleSize, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, (int)parentSheetIndex + ((!colorSameIndexAsParentSheetIndex) ? 1 : 0), 16, 16), color.Value * transparency, 0f, new Vector2(8f, 8f) * scaleSize, 4f * scaleSize, SpriteEffects.None, Math.Min(1f, layerDepth + 2E-05f)); if (((drawStackNumber == StackDrawType.Draw && maximumStackSize() > 1 && Stack > 1) || drawStackNumber == StackDrawType.Draw_OneInclusive) && (double)scaleSize > 0.3 && Stack != int.MaxValue) { Utility.drawTinyDigits(stack, spriteBatch, location + new Vector2((float)(64 - Utility.getWidthOfTinyDigitString(stack, 3f * scaleSize)) + 3f * scaleSize, 64f - 18f * scaleSize + 2f), 3f * scaleSize, 1f, Color.White); } if (drawStackNumber != 0 && (int)quality > 0) { Rectangle quality_rect = ((int)quality < 4) ? new Rectangle(338 + ((int)quality - 1) * 8, 400, 8, 8) : new Rectangle(346, 392, 8, 8); Texture2D quality_sheet = Game1.mouseCursors; float yOffset = ((int)quality < 4) ? 0f : (((float)Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1f) * 0.05f); spriteBatch.Draw(quality_sheet, location + new Vector2(12f, 52f + yOffset), quality_rect, Color.White * transparency, 0f, new Vector2(4f, 4f), 3f * scaleSize * (1f + yOffset), SpriteEffects.None, layerDepth); } } if ((bool)isRecipe) { spriteBatch.Draw(Game1.objectSpriteSheet, location + new Vector2(16f, 16f), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 451, 16, 16), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, Math.Min(1f, layerDepth + 0.0001f)); } }