private void render(object sender, EventArgs args) { if (shop == null) { return; } Vector2 pos = new Vector2(shop.xPositionOnScreen + 25, shop.yPositionOnScreen + 550); IClickableMenu.drawTextureBox(Game1.spriteBatch, (int)pos.X, (int)pos.Y, 200, 72, Color.White); pos.X += 16; pos.Y += 16; string str = "Category: \n" + categoryNames[((currCategory == -1 || currCategory == categories.Count) ? currCategory : categories[currCategory])]; Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos + new Vector2(-1, 1), new Color(224, 150, 80), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos, new Color(86, 22, 12), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); pos = new Vector2(shop.xPositionOnScreen + 25, shop.yPositionOnScreen + 630); IClickableMenu.drawTextureBox(Game1.spriteBatch, (int)pos.X, (int)pos.Y, 200, 48, Color.White); pos.X += 16; pos.Y += 16; str = "Sorting: " + (sorting == 0 ? "None" : (sorting == 1 ? "Price" : "Name")); Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos + new Vector2(-1, 1), new Color(224, 150, 80), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos, new Color(86, 22, 12), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); shop.drawMouse(Game1.spriteBatch); }
internal static void Postfix(ShopMenu __instance, SpriteBatch b) { if (__instance.portraitPerson == null || !(Game1.viewport.Width > 800 && Game1.options.showMerchantPortraits)) { return; } Texture2D texture = TextureLoader.getPortrait(__instance.portraitPerson.name); if (texture == null) { texture = __instance.portraitPerson.Portrait; } Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)(__instance.xPositionOnScreen - 80 * Game1.pixelZoom), (float)__instance.yPositionOnScreen), new Rectangle(603, 414, 74, 74), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, false, 0.91f, -1, -1, 0.35f); Rectangle rectangle = TextureLoader.getSoureRectangle(texture); b.Draw(texture, new Rectangle(__instance.xPositionOnScreen - 80 * Game1.pixelZoom + Game1.pixelZoom * 5, __instance.yPositionOnScreen + Game1.pixelZoom * 5, 64 * Game1.pixelZoom, 64 * Game1.pixelZoom), new Rectangle?(rectangle), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.92f); IClickableMenu.drawHoverText(b, __instance.potraitPersonDialogue, Game1.dialogueFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, __instance.xPositionOnScreen - (int)Game1.dialogueFont.MeasureString(__instance.potraitPersonDialogue).X - Game1.tileSize, __instance.yPositionOnScreen + (__instance.portraitPerson != null ? 78 * Game1.pixelZoom : 0), 1f, (CraftingRecipe)null); __instance.drawMouse(b); }
/// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised after that menu is drawn to the sprite batch but before it's rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void onRenderedActiveMenu(object sender, RenderedActiveMenuEventArgs e) { if (shop == null) { return; } Vector2 pos = new Vector2(shop.xPositionOnScreen + 25, shop.yPositionOnScreen + 525); IClickableMenu.drawTextureBox(Game1.spriteBatch, (int)pos.X, (int)pos.Y, 200, 72, Color.White); pos.X += 16; pos.Y += 16; string str = "Category: \n" + categoryNames[((currCategory == -1 || currCategory == categories.Count) ? currCategory : categories[currCategory])]; Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos + new Vector2(-1, 1), new Color(224, 150, 80), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos, new Color(86, 22, 12), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); pos = new Vector2(shop.xPositionOnScreen + 25, shop.yPositionOnScreen + 600); IClickableMenu.drawTextureBox(Game1.spriteBatch, (int)pos.X, (int)pos.Y, 200, 48, Color.White); pos.X += 16; pos.Y += 16; str = "Sorting: " + (sorting == 0 ? "None" : (sorting == 1 ? "Price" : "Name")); Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos + new Vector2(-1, 1), new Color(224, 150, 80), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); Game1.spriteBatch.DrawString(Game1.dialogueFont, str, pos, new Color(86, 22, 12), 0, Vector2.Zero, 0.5f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); if (Config.GridLayout) { drawGridLayout(); } pos.X = shop.xPositionOnScreen + 25; pos.Y = shop.yPositionOnScreen + 650; //Game1.spriteBatch.DrawString( Game1.dialogueFont, "Search: ", pos, Game1.textColor, 0, Vector2.Zero, 0.5f, SpriteEffects.None, 0 ); search.X = ( int )(pos.X); // + Game1.dialogueFont.MeasureString( "Search: " ).X); search.Y = ( int )pos.Y; search.Draw(Game1.spriteBatch); shop.drawMouse(Game1.spriteBatch); }