/// <inheritdoc /> public override ISubject GetSubject(IClickableMenu menu, int cursorX, int cursorY) { IClickableMenu targetMenu = (menu as GameMenu)?.GetCurrentPage() ?? menu; switch (targetMenu) { /**** ** GameMenu ****/ // skills tab case SkillsPage _: return(this.BuildSubject(Game1.player)); // social tab case SocialPage socialPage: { // get villagers on current page int scrollOffset = this.Reflection.GetField <int>(socialPage, "slotPosition").GetValue(); ClickableTextureComponent[] entries = this.Reflection .GetField <List <ClickableTextureComponent> >(socialPage, "sprites") .GetValue() .Skip(scrollOffset) .ToArray(); // find hovered villager ClickableTextureComponent entry = entries.FirstOrDefault(p => p.containsPoint(cursorX, cursorY)); if (entry != null) { int index = Array.IndexOf(entries, entry) + scrollOffset; object socialID = this.Reflection.GetField <List <object> >(socialPage, "names").GetValue()[index]; if (socialID is long playerID) { Farmer player = Game1.getFarmer(playerID); return(this.BuildSubject(player)); } else if (socialID is string villagerName) { NPC npc = this.GameHelper.GetAllCharacters().FirstOrDefault(p => p.isVillager() && p.Name == villagerName); if (npc != null) { return(this.BuildSubject(npc)); } } } } break; /**** ** Other menus ****/ // calendar case Billboard billboard: { // get target day int selectedDay = -1; for (int i = 0; i < billboard.calendarDays.Count; i++) { if (billboard.calendarDays[i].containsPoint(cursorX, cursorY)) { selectedDay = i + 1; break; } } if (selectedDay == -1) { return(null); } // get villager with a birthday on that date NPC target = this.GameHelper.GetAllCharacters().FirstOrDefault(p => p.Birthday_Season == Game1.currentSeason && p.Birthday_Day == selectedDay); if (target != null) { return(this.BuildSubject(target)); } } break; // load menu case TitleMenu _ when TitleMenu.subMenu is LoadGameMenu loadMenu: { ClickableComponent button = loadMenu.slotButtons.FirstOrDefault(p => p.containsPoint(cursorX, cursorY)); if (button != null) { int index = this.Reflection.GetField <int>(loadMenu, "currentItemIndex").GetValue() + int.Parse(button.name); var slots = this.Reflection.GetProperty <List <LoadGameMenu.MenuSlot> >(loadMenu, "MenuSlots").GetValue(); LoadGameMenu.SaveFileSlot slot = slots[index] as LoadGameMenu.SaveFileSlot; if (slot?.Farmer != null) { return(new FarmerSubject(this.GameHelper, slot.Farmer, isLoadMenu: true)); } } } break; } return(null); }
public override void draw(SpriteBatch b) { Rectangle rectButton(Rectangle rect, bool hover) { int off = hover ? hover_button_inc / 2 : 0; return(new Rectangle(rect.X - off, rect.Y - off, rect.Width + off + off, rect.Height + off + off)); } if (!applyMode) { base.draw(b); //IClickableMenu.drawTextureBox(b, xPositionOnScreen - 96, yPositionOnScreen - 16, compostInventoryMenu.width + 64, compostInventoryMenu.height*2 + space + nutrition_area_height + space + 64*2, Color.White); IClickableMenu.drawTextureBox(b, xPositionOnScreen, yPositionOnScreen, width, height, Color.White); compostInventoryMenu.draw(b); playerInventoryMenu.draw(b); if (state == State.fill) { nutritionsComponent.draw(b); } b.Draw(Game1.mouseCursors, rectButton(applyButton.bounds, hoverApplyButton), CursorsOkButtonRect, Color.White); if (state == State.fill && nutritionsComponent.GoodDistribution()) { b.Draw(Game1.mouseCursors, rectButton(activateButton.bounds, hoverActivateButton), CursorsPlayButtonRect, Color.White); } //int needed = nutritionsComponent.ItemsNeeded(); //needed = needed <= 0 ? 0 : needed; switch (state) { case State.fill: SpriteText.drawStringWithScrollCenteredAt(b, ModEntry.GetHelper().Translation.Get("composter.fillheadline", new { parts = nutritionsComponent.Parts(), min_needed = Composting.config.composter_min_parts }), Game1.viewport.Width / 2, 64); break; case State.ready: SpriteText.drawStringWithScrollCenteredAt(b, ModEntry.GetHelper().Translation.Get("composter.readyheadline", new { amount = Composting.ComposterCompostLeft[BinPos] }), Game1.viewport.Width / 2, 64); break; case State.active: SpriteText.drawStringWithScrollCenteredAt(b, ModEntry.GetHelper().Translation.Get("composter.activeheadline", new { amount = Composting.ComposterDaysLeft[BinPos] }), Game1.viewport.Width / 2, 64); break; } } else //applyMode { int color = 0; //1: red, 0: green foreach (Vector2 v in greenTiles) { b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, (new Vector2(v.X, v.Y)) * 64f), CursorsColoredTileRect(color), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.999f); } foreach (Vector2 vec in Composting.CompostAppliedDays.Keys) { b.DrawString(Game1.smallFont, Composting.CompostAppliedDays[vec].ToString(), Game1.GlobalToLocal(Game1.viewport, new Vector2(vec.X * Game1.tileSize + Game1.tileSize / 2, vec.Y * Game1.tileSize + Game1.tileSize / 2)), Color.White); } b.Draw(Game1.mouseCursors, rectButton(cancelButton.bounds, hoverCancelButton), CursorsCancelButtonRect, Color.White); if (Composting.ComposterCompostLeft.ContainsKey(BinPos) && Composting.ComposterCompostLeft[BinPos] > 0) { SpriteText.drawStringWithScrollCenteredAt(b, ModEntry.GetHelper().Translation.Get("composter.applyheadline", new { amount = Composting.ComposterCompostLeft[BinPos] }), Game1.viewport.Width / 2, 64); } } drawMouse(b); if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 32, Game1.getOldMouseY() - 32), 1); } if (hoverText.Length > 0) { drawHoverText(b, hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); } }
public override void draw(SpriteBatch b) { int x = xPositionOnScreen + 64 - 12; int y3 = yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder; b.Draw((Game1.timeOfDay >= 1900) ? Game1.nightbg : Game1.daybg, new Vector2(x, y3), Color.White); FarmerRenderer.isDrawingForUI = true; Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(Game1.player.bathingClothes ? 108 : playerPanelFrames[playerPanelIndex], 0, secondaryArm: false, flip: false), Game1.player.bathingClothes ? 108 : playerPanelFrames[playerPanelIndex], new Rectangle(playerPanelFrames[playerPanelIndex] * 16, Game1.player.bathingClothes ? 576 : 0, 16, 32), new Vector2(x + 32, y3 + 32), Vector2.Zero, 0.8f, 2, Color.White, 0f, 1f, Game1.player); if (Game1.timeOfDay >= 1900) { Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(playerPanelFrames[playerPanelIndex], 0, secondaryArm: false, flip: false), playerPanelFrames[playerPanelIndex], new Rectangle(playerPanelFrames[playerPanelIndex] * 16, 0, 16, 32), new Vector2(x + 32, y3 + 32), Vector2.Zero, 0.8f, 2, Color.DarkBlue * 0.3f, 0f, 1f, Game1.player); } FarmerRenderer.isDrawingForUI = false; b.DrawString(Game1.smallFont, Game1.player.Name, new Vector2((float)(x + 64) - Game1.smallFont.MeasureString(Game1.player.Name).X / 2f, y3 + 192 + 4), Game1.textColor); b.DrawString(Game1.smallFont, Game1.player.getTitle(), new Vector2((float)(x + 64) - Game1.smallFont.MeasureString(Game1.player.getTitle()).X / 2f, y3 + 256 - 32), Game1.textColor); x = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.it) ? (xPositionOnScreen + width - 448 - 48) : (xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8)); y3 = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - 8; int addedX = 0; for (int j = 0; j < 10; j++) { for (int i = 0; i < 5; i++) { bool drawRed = false; bool addedSkill = false; string skill = ""; int skillLevel = 0; Rectangle iconSource = Rectangle.Empty; switch (i) { case 0: drawRed = (Game1.player.FarmingLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11604"); } skillLevel = Game1.player.FarmingLevel; addedSkill = ((int)Game1.player.addedFarmingLevel > 0); iconSource = new Rectangle(10, 428, 10, 10); break; case 1: drawRed = (Game1.player.MiningLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11605"); } skillLevel = Game1.player.MiningLevel; addedSkill = ((int)Game1.player.addedMiningLevel > 0); iconSource = new Rectangle(30, 428, 10, 10); break; case 2: drawRed = (Game1.player.ForagingLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11606"); } skillLevel = Game1.player.ForagingLevel; addedSkill = ((int)Game1.player.addedForagingLevel > 0); iconSource = new Rectangle(60, 428, 10, 10); break; case 3: drawRed = (Game1.player.FishingLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11607"); } skillLevel = Game1.player.FishingLevel; addedSkill = ((int)Game1.player.addedFishingLevel > 0 || (Game1.player.CurrentTool != null && Game1.player.CurrentTool.hasEnchantmentOfType <MasterEnchantment>())); iconSource = new Rectangle(20, 428, 10, 10); break; case 4: drawRed = (Game1.player.CombatLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11608"); } skillLevel = Game1.player.CombatLevel; addedSkill = ((int)Game1.player.addedCombatLevel > 0); iconSource = new Rectangle(120, 428, 10, 10); break; case 5: drawRed = (Game1.player.LuckLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11609"); } skillLevel = Game1.player.LuckLevel; addedSkill = ((int)Game1.player.addedLuckLevel > 0); iconSource = new Rectangle(50, 428, 10, 10); break; } if (!skill.Equals("")) { b.DrawString(Game1.smallFont, skill, new Vector2((float)x - Game1.smallFont.MeasureString(skill).X + 4f - 64f, y3 + 4 + i * 56), Game1.textColor); b.Draw(Game1.mouseCursors, new Vector2(x - 56, y3 + i * 56), iconSource, Color.Black * 0.3f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2(x - 52, y3 - 4 + i * 56), iconSource, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (!drawRed && (j + 1) % 5 == 0) { b.Draw(Game1.mouseCursors, new Vector2(addedX + x - 4 + j * 36, y3 + i * 56), new Rectangle(145, 338, 14, 9), Color.Black * 0.35f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); b.Draw(Game1.mouseCursors, new Vector2(addedX + x + j * 36, y3 - 4 + i * 56), new Rectangle(145 + (drawRed ? 14 : 0), 338, 14, 9), Color.White * (drawRed ? 1f : 0.65f), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } else if ((j + 1) % 5 != 0) { b.Draw(Game1.mouseCursors, new Vector2(addedX + x - 4 + j * 36, y3 + i * 56), new Rectangle(129, 338, 8, 9), Color.Black * 0.35f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2(addedX + x + j * 36, y3 - 4 + i * 56), new Rectangle(129 + (drawRed ? 8 : 0), 338, 8, 9), Color.White * (drawRed ? 1f : 0.65f), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (j == 9) { NumberSprite.draw(skillLevel, b, new Vector2(addedX + x + (j + 2) * 36 + 12 + ((skillLevel >= 10) ? 12 : 0), y3 + 16 + i * 56), Color.Black * 0.35f, 1f, 0.85f, 1f, 0); NumberSprite.draw(skillLevel, b, new Vector2(addedX + x + (j + 2) * 36 + 16 + ((skillLevel >= 10) ? 12 : 0), y3 + 12 + i * 56), (addedSkill ? Color.LightGreen : Color.SandyBrown) * ((skillLevel == 0) ? 0.75f : 1f), 1f, 0.87f, 1f, 0); } } if ((j + 1) % 5 == 0) { addedX += 24; } } foreach (ClickableTextureComponent skillBar in skillBars) { skillBar.draw(b); } foreach (ClickableTextureComponent c in skillBars) { if (c.scale == 0f) { IClickableMenu.drawTextureBox(b, c.bounds.X - 16 - 8, c.bounds.Y - 16 - 16, 96, 96, Color.White); b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X - 8, c.bounds.Y - 32 + 16), new Rectangle(professionImage % 6 * 16, 624 + professionImage / 6 * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } } x = xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32 + 16; y3 = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 320 - 8; if ((int)Game1.netWorldState.Value.GoldenWalnuts > 0) { b.Draw(Game1.objectSpriteSheet, new Vector2(x, y3), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 73, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); x += 48; b.DrawString(Game1.smallFont, string.Concat((object)Game1.netWorldState.Value.GoldenWalnuts), new Vector2(x, y3), Game1.textColor); x += 64; } if (Game1.player.QiGems > 0) { b.Draw(Game1.objectSpriteSheet, new Vector2(x, y3), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 858, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); x += 48; b.DrawString(Game1.smallFont, string.Concat(Game1.player.QiGems), new Vector2(x, y3), Game1.textColor); x += 64; } Game1.drawDialogueBox(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((float)height / 2f) - 32, width - 64 - IClickableMenu.spaceToClearSideBorder * 2, height / 4 + 64, speaker: false, drawOnlyBox: true); drawBorderLabel(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11610"), Game1.smallFont, xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 96, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((float)height / 2f) - 32); foreach (ClickableTextureComponent specialItem in specialItems) { specialItem?.draw(b); } if (hoverText.Length > 0) { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont, 0, 0, -1, (hoverTitle.Length > 0) ? hoverTitle : null); } }
/********* ** Accessors *********/ /// <summary>Construct an instance.</summary> /// <param name="priorMenu">The menu that was closed.</param> public EventArgsClickableMenuClosed(IClickableMenu priorMenu) { this.PriorMenu = priorMenu; }
public override void draw(SpriteBatch b) { if (!this.invisible) { if (!Game1.options.showMenuBackground) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); } Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.pages[this.currentTab].width, this.pages[this.currentTab].height, false, true, null, false); this.pages[this.currentTab].draw(b); b.End(); b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null); if (!GameMenu.forcePreventClose) { foreach (ClickableComponent current in this.tabs) { int num = 0; string name = current.name; uint num2 = < PrivateImplementationDetails >.ComputeStringHash(name); if (num2 <= 3048072735u) { if (num2 <= 2237694710u) { if (num2 != 1700191391u) { if (num2 == 2237694710u) { if (name == "catalogue") { num = 7; } } } else if (name == "skills") { num = 1; } } else if (num2 != 3001865938u) { if (num2 == 3048072735u) { if (name == "crafting") { num = 4; } } } else if (name == "social") { num = 2; } } else if (num2 <= 3751997361u) { if (num2 != 3454868101u) { if (num2 == 3751997361u) { if (name == "map") { num = 3; } } } else if (name == "exit") { num = 7; } } else if (num2 != 3760730054u) { if (num2 != 4012403877u) { if (num2 == 4244489279u) { if (name == "inventory") { num = 0; } } } else if (name == "options") { num = 6; } } else if (name == "collections") { num = 5; } b.Draw(Game1.mouseCursors, new Vector2((float)current.bounds.X, (float)(current.bounds.Y + ((this.currentTab == this.getTabNumberFromName(current.name)) ? 8 : 0))), new Rectangle?(new Rectangle(num * 16, 368, 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.0001f); if (current.name.Equals("skills")) { Game1.player.FarmerRenderer.drawMiniPortrat(b, new Vector2((float)(current.bounds.X + 8), (float)(current.bounds.Y + 12 + ((this.currentTab == this.getTabNumberFromName(current.name)) ? 8 : 0))), 0.00011f, 3f, 2, Game1.player); } } b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); if (this.junimoNoteIcon != null) { this.junimoNoteIcon.draw(b); } if (!this.hoverText.Equals("")) { IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); } } } else { this.pages[this.currentTab].draw(b); } if (!GameMenu.forcePreventClose) { base.draw(b); } if (!Game1.options.hardwareCursor) { b.Draw(Game1.mouseCursors, new Vector2((float)Game1.getOldMouseX(), (float)Game1.getOldMouseY()), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, Game1.options.gamepadControls ? 44 : 0, 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 1f); } }
public RemoteFridgeCraftingPage(IClickableMenu page, FridgeHandler fridgeHandler) : base(page.xPositionOnScreen, page.yPositionOnScreen, page.width, page.height, true) { _fridgeHandler = fridgeHandler; }
/// <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) { // draw shop harvest prices if (Game1.activeClickableMenu is ShopMenu menu) { if (typeof(ShopMenu).GetField("hoveredItem", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) is Item hoverItem) { String text = string.Empty; bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0; if (hoverItem is StardewValley.Object && (hoverItem as StardewValley.Object).Type == "Seeds" && itemHasPriceInfo && hoverItem.Name != "Mixed Seeds" && hoverItem.Name != "Winter Seeds") { StardewValley.Object temp = new StardewValley.Object( new Debris( new Crop( hoverItem.ParentSheetIndex, 0, 0) .indexOfHarvest.Value, Game1.player.position, Game1.player.position).chunkType.Value, 1); text = " " + temp.Price; } Item heldItem = typeof(ShopMenu).GetField("heldItem", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) as Item; if (heldItem == null) { int value = 0; switch (hoverItem.ParentSheetIndex) { case 628: value = 50; break; case 629: value = 80; break; case 630: case 633: value = 100; break; case 631: case 632: value = 140; break; } if (value > 0) { text = " " + value; } if (text != "" && (hoverItem as StardewValley.Object).Type == "Seeds") { String textToRender = _helper.SafeGetString( LanguageKeys.HarvestPrice); int xPosition = menu.xPositionOnScreen - 30; int yPosition = menu.yPositionOnScreen + 580; IClickableMenu.drawTextureBox( Game1.spriteBatch, xPosition + 20, yPosition - 52, 264, 108, Color.White); Game1.spriteBatch.DrawString( Game1.dialogueFont, textToRender, new Vector2(xPosition + 30, yPosition - 38), Color.Black * 0.2f); Game1.spriteBatch.DrawString( Game1.dialogueFont, textToRender, new Vector2(xPosition + 32, yPosition - 40), Color.Black * 0.8f); xPosition += 80; Game1.spriteBatch.Draw( Game1.mouseCursors, new Vector2(xPosition, yPosition), new Rectangle(60, 428, 10, 10), Color.White, 0, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.85f); Game1.spriteBatch.Draw( Game1.debrisSpriteSheet, new Vector2(xPosition + 32, yPosition + 10), Game1.getSourceRectForStandardTileSheet(Game1.debrisSpriteSheet, 8, 16, 16), Color.White, 0, new Vector2(8, 8), 4, SpriteEffects.None, 0.95f); Game1.spriteBatch.DrawString( Game1.dialogueFont, text, new Vector2(xPosition - 2, yPosition + 6), Color.Black * 0.2f); Game1.spriteBatch.DrawString( Game1.dialogueFont, text, new Vector2(xPosition, yPosition + 4), Color.Black * 0.8f); String hoverText = _helper.Reflection.GetField <String>(menu, "hoverText").GetValue(); String hoverTitle = _helper.Reflection.GetField <String>(menu, "boldTitleText").GetValue(); Item hoverItem2 = _helper.Reflection.GetField <Item>(menu, "hoveredItem").GetValue(); int currency = _helper.Reflection.GetField <int>(menu, "currency").GetValue(); int hoverPrice = _helper.Reflection.GetField <int>(menu, "hoverPrice").GetValue(); IReflectedMethod getHoveredItemExtraItemIndex = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemIndex"); IReflectedMethod getHoveredItemExtraItemAmount = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemAmount"); IClickableMenu.drawToolTip( Game1.spriteBatch, hoverText, hoverTitle, hoverItem2, heldItem != null, -1, currency, getHoveredItemExtraItemIndex.Invoke <int>(new object[0]), getHoveredItemExtraItemAmount.Invoke <int>(new object[0]), null, hoverPrice); } } } } }
public override void draw(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.6f); Game1.DrawBox(MapRectangle.X, MapRectangle.Y, MapRectangle.Width, MapRectangle.Height); b.Draw(image, this.TopLeft, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); foreach (var npcMarker in NPCLocationData.NPCMarkers) { npcMarker.draw(b); } if (farmerMarker != null) { Game1.player.FarmerRenderer.drawMiniPortrat(b, farmerMarker.MapPosition, 0.5f, 2f, 2, Game1.player); } bool drawPeopleOnAreaHover = true; //check if people have to be drawn var mousePos = Game1.getMousePosition(true); //16 offset because markersCoordinates are top-left int x = mousePos.X - 16; int y = mousePos.Y - 16; StringBuilder Names = new StringBuilder(); List <string> NPCsToShow = new List <string>(); foreach (var marker in NPCLocationData.NPCMarkers) { if (Math.Abs(marker.MapPosition.X - x) < Radius && Math.Abs(marker.MapPosition.Y - y) < Radius) { Names.Append(marker.DisplayName); Names.Append(", "); NPCsToShow.Add(marker.Name); } } if (Names.Length > 2) { drawPeopleOnAreaHover = false; Names.Remove(Names.Length - 2, 2); IClickableMenu.drawHoverText(b, Names.ToString(), Game1.smallFont, yOffset: -70); int CharPosX = (int)mousePos.X + 40; int CharPosY = (int)mousePos.Y + 2 - 70; var sourceRect = new Rectangle(0, 0, 16, 20); foreach (var characterName in NPCsToShow) { if (this.NameTexturePairs.TryGetValue(characterName, out Texture2D texture) && texture != null) { b.Draw(texture, new Vector2(CharPosX, CharPosY - 30), sourceRect, Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, 0.5f); CharPosX += 50; } } } mousePos = Game1.getMousePosition(true); x = mousePos.X - (int)this.TopLeft.X; y = mousePos.Y - (int)this.TopLeft.Y; foreach (var entry in this.MapData.Locations.Values) { if (entry.AreaRect.Contains(x, y)) { IClickableMenu.drawHoverText(b, entry.Text, Game1.smallFont); int CharPosX = (int)mousePos.X + 40; int CharPosY = (int)mousePos.Y + 2; var sourceRect = new Rectangle(0, 0, 16, 20); var animalSourceRect = new Rectangle(0, 0, 16, 16); if (entry.InhabitantsList == null || !drawPeopleOnAreaHover) { break; } foreach (var characterName in entry.InhabitantsList) { if (this.NameTexturePairs.TryGetValue(characterName, out Texture2D texture) && texture != null) { if (characterName.StartsWith("A:")) { b.Draw(texture, new Vector2(CharPosX, CharPosY), animalSourceRect, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.5f); CharPosX += 36; } else { b.Draw(texture, new Vector2(CharPosX, CharPosY - 30), sourceRect, Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, 0.5f); CharPosX += 50; } } } break; } } /* * foreach (var key in NPCLocationData.Areas.Keys) * { * Rectangle targetRectanlge = NPCLocationData.Areas[key].AreaRect; * targetRectanlge.X += (int)TopLeft.X; * targetRectanlge.Y += (int)TopLeft.Y; * b.Draw(Game1.staminaRect, targetRectanlge, Color.Orange * 0.4f); * }*/ base.draw(b); base.drawMouse(b); }
/// <summary>Draw a tooltip box which shows the unit and stack prices for an item.</summary> /// <param name="spriteBatch">The sprite batch to update.</param> /// <param name="font">The font with which to draw text.</param> /// <param name="item">The item whose price to display.</param> private void DrawPriceTooltip(SpriteBatch spriteBatch, SpriteFont font, Item item) { // get info int stack = item.Stack; int?price = this.GetSellPrice(item); if (price == null) { return; } // basic measurements const int borderSize = ModEntry.TooltipBorderSize; const int padding = ModEntry.Padding; int coinSize = this.CoinSourceRect.Width * Game1.pixelZoom; int lineHeight = (int)font.MeasureString("X").Y; Vector2 offsetFromCursor = this.TooltipOffset; bool showStack = stack > 1; // prepare text string unitLabel = I18n.Labels_SinglePrice() + ":"; string unitPrice = price.ToString(); string stackLabel = I18n.Labels_StackPrice() + ":"; string stackPrice = (price * stack).ToString(); // get dimensions Vector2 unitPriceSize = font.MeasureString(unitPrice); Vector2 stackPriceSize = font.MeasureString(stackPrice); Vector2 labelSize = font.MeasureString(unitLabel); if (showStack) { labelSize = new Vector2(Math.Max(labelSize.X, font.MeasureString(stackLabel).X), labelSize.Y * 2); } Vector2 innerSize = new Vector2(labelSize.X + padding + Math.Max(unitPriceSize.X, showStack ? stackPriceSize.X : 0) + padding + coinSize, labelSize.Y); Vector2 outerSize = innerSize + new Vector2((borderSize + padding) * 2); // get position float x = Game1.getMouseX() - offsetFromCursor.X - outerSize.X; float y = Game1.getMouseY() + offsetFromCursor.Y + borderSize; // adjust position to fit on screen Rectangle area = new Rectangle((int)x, (int)y, (int)outerSize.X, (int)outerSize.Y); if (area.Right > Game1.uiViewport.Width) { x = Game1.uiViewport.Width - area.Width; } if (area.Bottom > Game1.uiViewport.Height) { y = Game1.uiViewport.Height - area.Height; } // draw tooltip box IClickableMenu.drawTextureBox(spriteBatch, Game1.menuTexture, this.TooltipSourceRect, (int)x, (int)y, (int)outerSize.X, (int)outerSize.Y, Color.White); // draw coins spriteBatch.Draw(Game1.debrisSpriteSheet, new Vector2(x + outerSize.X - borderSize - padding - coinSize, y + borderSize + padding), this.CoinSourceRect, Color.White, 0.0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 1f); if (showStack) { spriteBatch.Draw(Game1.debrisSpriteSheet, new Vector2(x + outerSize.X - borderSize - padding - coinSize, y + borderSize + padding + lineHeight), this.CoinSourceRect, Color.White, 0.0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 1f); } // draw text Utility.drawTextWithShadow(spriteBatch, unitLabel, font, new Vector2(x + borderSize + padding, y + borderSize + padding), Game1.textColor); Utility.drawTextWithShadow(spriteBatch, unitPrice, font, new Vector2(x + outerSize.X - borderSize - padding - coinSize - padding - unitPriceSize.X, y + borderSize + padding), Game1.textColor); if (showStack) { Utility.drawTextWithShadow(spriteBatch, stackLabel, font, new Vector2(x + borderSize + padding, y + borderSize + padding + lineHeight), Game1.textColor); Utility.drawTextWithShadow(spriteBatch, stackPrice, font, new Vector2(x + outerSize.X - borderSize - padding - coinSize - padding - stackPriceSize.X, y + borderSize + padding + lineHeight), Game1.textColor); } }
private void drawMenuBackground(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), xPositionOnScreen, yPositionOnScreen, width, base.height + 32, Color.White, 4f, true); }
/// <inheritdoc /> public virtual ISubject GetSubject(IClickableMenu menu, int cursorX, int cursorY) { return(null); }
public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu) { NewMenu = newMenu; PriorMenu = priorMenu; }
/// <inheritdoc /> public override ISubject?GetSubject(IClickableMenu menu, int cursorX, int cursorY) { IClickableMenu targetMenu = (menu as GameMenu)?.GetCurrentPage() ?? menu; switch (targetMenu) { /**** ** GameMenu ****/ // skills tab case SkillsPage: return(this.BuildSubject(Game1.player)); // profile tab case ProfileMenu profileMenu: if (profileMenu.hoveredItem == null) { if (profileMenu.GetCharacter() is NPC npc) { return(this.Codex.GetByEntity(npc, npc.currentLocation)); } } break; // social tab case SocialPage socialPage: foreach (ClickableTextureComponent slot in socialPage.characterSlots) { if (slot.containsPoint(cursorX, cursorY)) { object socialID = this.Reflection.GetField <List <object> >(socialPage, "names").GetValue()[slot.myID]; // player slot if (socialID is long playerID) { Farmer player = Game1.getFarmerMaybeOffline(playerID); return(this.BuildSubject(player)); } // NPC slot if (socialID is string villagerName) { NPC?npc = this.GameHelper.GetAllCharacters().FirstOrDefault(p => p.isVillager() && p.Name == villagerName); if (npc != null) { return(this.BuildSubject(npc)); } } } } break; /**** ** Calendar ****/ case Billboard { calendarDays: not null } billboard:// Billboard used for both calendar and 'help wanted' { // get target day int selectedDay = -1; for (int i = 0; i < billboard.calendarDays.Count; i++) { if (billboard.calendarDays[i].containsPoint(cursorX, cursorY)) { selectedDay = i + 1; break; } } if (selectedDay == -1) { return(null); } // get villager with a birthday on that date NPC?target = this.GameHelper .GetAllCharacters() .Where(p => p.Birthday_Season == Game1.currentSeason && p.Birthday_Day == selectedDay) .OrderByDescending(p => p.CanSocialize) // SVE duplicates the Marlon NPC, but only one of them is marked social .FirstOrDefault(); if (target != null) { return(this.BuildSubject(target)); } } break; /**** ** Load menu ****/ case TitleMenu when TitleMenu.subMenu is LoadGameMenu loadMenu: { ClickableComponent?button = loadMenu.slotButtons.FirstOrDefault(p => p.containsPoint(cursorX, cursorY)); if (button != null) { int index = this.Reflection.GetField <int>(loadMenu, "currentItemIndex").GetValue() + int.Parse(button.name); var slots = this.Reflection.GetProperty <List <LoadGameMenu.MenuSlot> >(loadMenu, "MenuSlots").GetValue(); LoadGameMenu.SaveFileSlot?slot = slots[index] as LoadGameMenu.SaveFileSlot; if (slot?.Farmer != null) { return(new FarmerSubject(this.GameHelper, slot.Farmer, isLoadMenu: true)); } } } break; /**** ** mod: Animal Social Menu ****/ case not null when targetMenu.GetType().FullName == "AnimalSocialMenu.Framework.AnimalSocialPage": { int slotOffset = this.Reflection.GetField <int>(targetMenu, "SlotPosition").GetValue(); List <ClickableTextureComponent> slots = this.Reflection.GetField <List <ClickableTextureComponent> >(targetMenu, "Sprites").GetValue(); List <object> animalIds = this.Reflection.GetField <List <object> >(targetMenu, "Names").GetValue(); for (int i = slotOffset; i < slots.Count; i++) { if (slots[i].containsPoint(cursorX, cursorY)) { if (animalIds.TryGetIndex(i, out object?rawId) && rawId is long id) { FarmAnimal?animal = Game1 .getFarm() .getAllFarmAnimals() .FirstOrDefault(p => p.myID.Value == id); if (animal != null) { return(this.BuildSubject(animal)); } } break; } } } break; } return(null); }
public override void draw(SpriteBatch b) { if (_standaloneMenu) { Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen, width, height, speaker: false, drawOnlyBox: true); } drawHorizontalPartition(b, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256); inventory.draw(b); if (trashCan != null) { trashCan.draw(b); b.Draw(Game1.mouseCursors, new Vector2(trashCan.bounds.X + 60, trashCan.bounds.Y + 40), new Rectangle(564 + Game1.player.trashCanLevel * 18, 129, 18, 10), Color.White, trashCanLidRotation, new Vector2(16f, 10f), 4f, SpriteEffects.None, 0.86f); } b.End(); b.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); foreach (ClickableTextureComponent c in pagesOfCraftingRecipes[currentCraftingPage].Keys) { if (c.hoverText.Equals("ghosted")) { c.draw(b, Color.Black * 0.35f, 0.89f); } else if (!pagesOfCraftingRecipes[currentCraftingPage][c].doesFarmerHaveIngredientsInInventory(getContainerContents())) { c.draw(b, Color.DimGray * 0.4f, 0.89f); if (pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft > 1) { NumberSprite.draw(pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft, b, new Vector2(c.bounds.X + 64 - 2, c.bounds.Y + 64 - 2), Color.LightGray * 0.75f, 0.5f * (c.scale / 4f), 0.97f, 1f, 0); } } else { c.draw(b); if (pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft > 1) { NumberSprite.draw(pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft, b, new Vector2(c.bounds.X + 64 - 2, c.bounds.Y + 64 - 2), Color.White, 0.5f * (c.scale / 4f), 0.97f, 1f, 0); } } } b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); if (hoverItem != null) { IClickableMenu.drawToolTip(b, hoverText, hoverTitle, hoverItem, heldItem != null); } else if (!string.IsNullOrEmpty(hoverText)) { if (hoverAmount > 0) { IClickableMenu.drawToolTip(b, hoverText, hoverTitle, null, heldItem: true, -1, 0, -1, -1, null, hoverAmount); } else { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont, (heldItem != null) ? 64 : 0, (heldItem != null) ? 64 : 0); } } if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 16, Game1.getOldMouseY() + 16), 1f); } base.draw(b); if (downButton != null && currentCraftingPage < pagesOfCraftingRecipes.Count - 1) { downButton.draw(b); } if (upButton != null && currentCraftingPage > 0) { upButton.draw(b); } if (_standaloneMenu) { Game1.mouseCursorTransparency = 1f; drawMouse(b); } if (hoverRecipe != null) { IClickableMenu.drawHoverText(b, " ", Game1.smallFont, (heldItem != null) ? 48 : 0, (heldItem != null) ? 48 : 0, -1, hoverRecipe.DisplayName + ((hoverRecipe.numberProducedPerCraft > 1) ? (" x" + hoverRecipe.numberProducedPerCraft) : ""), -1, (cooking && lastCookingHover != null && Game1.objectInformation[(lastCookingHover as Object).parentSheetIndex].Split('/').Length > 7) ? Game1.objectInformation[(lastCookingHover as Object).parentSheetIndex].Split('/')[7].Split(' ') : null, lastCookingHover, 0, -1, -1, -1, -1, 1f, hoverRecipe, getContainerContents()); } }
/// <summary>Draw the component to the screen.</summary> /// <param name="spriteBatch">The sprite batch being drawn.</param> /// <param name="slotX">The X position at which to draw, relative to the bounds.</param> /// <param name="slotY">The Y position at which to draw, relative to the bounds.</param> /// <param name="context">The menu drawing the component.</param> public override void draw(SpriteBatch spriteBatch, int slotX, int slotY, IClickableMenu context = null) { spriteBatch.Draw(Game1.mouseCursors, new Vector2(slotX + bounds.X, slotY + bounds.Y), IsChecked ? OptionsCheckbox.sourceRectChecked : OptionsCheckbox.sourceRectUnchecked, Color.White * (greyedOut ? 0.33f : 1f), 0.0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.4f); base.draw(spriteBatch, slotX + GetOffsetX(), slotY, context); }
private static void Events_MenuChanged(IClickableMenu newMenu) { Log.AsyncY("NEW MENU: " + newMenu.GetType()); if (newMenu is GameMenu) { Game1.activeClickableMenu = SGameMenu.ConstructFromBaseClass(Game1.activeClickableMenu as GameMenu); } }
public EventArgsClickableMenuClosed(IClickableMenu priorMenu) { PriorMenu = priorMenu; }
public override void draw(SpriteBatch b) { if (this.drawBG) { b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * 0.5f); } base.draw(b, false, false); if (this.showReceivingMenu) { b.Draw(Game1.mouseCursors, new Vector2((float)(this.xPositionOnScreen - 16 * Game1.pixelZoom), (float)(this.yPositionOnScreen + this.height / 2 + Game1.tileSize + Game1.pixelZoom * 4)), new Rectangle?(new Rectangle(16, 368, 12, 16)), Color.White, 4.712389f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.xPositionOnScreen - 16 * Game1.pixelZoom), (float)(this.yPositionOnScreen + this.height / 2 + Game1.tileSize - Game1.pixelZoom * 4)), new Rectangle?(new Rectangle(21, 368, 11, 16)), Color.White, 4.712389f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.xPositionOnScreen - 10 * Game1.pixelZoom), (float)(this.yPositionOnScreen + this.height / 2 + Game1.tileSize - Game1.pixelZoom * 11)), new Rectangle?(new Rectangle(4, 372, 8, 11)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); if (this.source != 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(this.xPositionOnScreen - 18 * Game1.pixelZoom), (float)(this.yPositionOnScreen + Game1.tileSize + Game1.pixelZoom * 4)), new Rectangle?(new Rectangle(16, 368, 12, 16)), Color.White, 4.712389f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.xPositionOnScreen - 18 * Game1.pixelZoom), (float)(this.yPositionOnScreen + Game1.tileSize - Game1.pixelZoom * 4)), new Rectangle?(new Rectangle(21, 368, 11, 16)), Color.White, 4.712389f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); Rectangle value = new Rectangle(127, 412, 10, 11); int num = this.source; if (num != 2) { if (num == 3) { value.X += 10; } } else { value.X += 20; } b.Draw(Game1.mouseCursors, new Vector2((float)(this.xPositionOnScreen - 13 * Game1.pixelZoom), (float)(this.yPositionOnScreen + Game1.tileSize - Game1.pixelZoom * 11)), new Rectangle?(value), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); } 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, null, false); this.ItemsToGrabMenu.draw(b); } else if (this.message != null) { Game1.drawDialogueBox(Game1.viewport.Width / 2, this.ItemsToGrabMenu.yPositionOnScreen + this.ItemsToGrabMenu.height / 2, false, false, this.message); } if (this.poof != null) { this.poof.draw(b, true, 0, 0); } if (this.shippingBin && Game1.getFarm().lastItemShipped != null) { this.lastShippedHolder.draw(b); Game1.getFarm().lastItemShipped.drawInMenu(b, new Vector2((float)(this.lastShippedHolder.bounds.X + Game1.pixelZoom * 4), (float)(this.lastShippedHolder.bounds.Y + Game1.pixelZoom * 4)), 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.lastShippedHolder.bounds.X + Game1.pixelZoom * -2), (float)(this.lastShippedHolder.bounds.Bottom - Game1.pixelZoom * 25)), new Rectangle?(new Rectangle(325, 448, 5, 14)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.lastShippedHolder.bounds.X + Game1.pixelZoom * 21), (float)(this.lastShippedHolder.bounds.Bottom - Game1.pixelZoom * 25)), new Rectangle?(new Rectangle(325, 448, 5, 14)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.lastShippedHolder.bounds.X + Game1.pixelZoom * -2), (float)(this.lastShippedHolder.bounds.Bottom - Game1.pixelZoom * 11)), new Rectangle?(new Rectangle(325, 452, 5, 13)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(this.lastShippedHolder.bounds.X + Game1.pixelZoom * 21), (float)(this.lastShippedHolder.bounds.Bottom - Game1.pixelZoom * 11)), new Rectangle?(new Rectangle(325, 452, 5, 13)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); } if (this.colorPickerToggleButton != null) { this.colorPickerToggleButton.draw(b); } else if (this.specialButton != null) { this.specialButton.draw(b); } if (this.chestColorPicker != null) { this.chestColorPicker.draw(b); } if (this.organizeButton != null) { this.organizeButton.draw(b); } if (this.hoverText != null && (this.hoveredItem == null || this.hoveredItem == null || this.ItemsToGrabMenu == null)) { IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); } if (this.hoveredItem != null) { IClickableMenu.drawToolTip(b, this.hoveredItem.getDescription(), this.hoveredItem.DisplayName, this.hoveredItem, this.heldItem != null, -1, 0, -1, -1, null, -1); } else if (this.hoveredItem != null && this.ItemsToGrabMenu != null) { IClickableMenu.drawToolTip(b, this.ItemsToGrabMenu.descriptionText, this.ItemsToGrabMenu.descriptionTitle, this.hoveredItem, this.heldItem != null, -1, 0, -1, -1, null, -1); } if (this.heldItem != null) { this.heldItem.drawInMenu(b, new Vector2((float)(Game1.getOldMouseX() + 8), (float)(Game1.getOldMouseY() + 8)), 1f); } Game1.mouseCursorTransparency = 1f; base.drawMouse(b); }
public override void draw(SpriteBatch b) { if (!movingAnimal && !Game1.globalFade) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f); Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen + 128, width, height - 128, speaker: false, drawOnlyBox: true); if ((byte)animal.harvestType != 2) { textBox.Draw(b); } int age = (animal.GetDaysOwned() + 1) / 28 + 1; string ageText = (age <= 1) ? Game1.content.LoadString("Strings\\UI:AnimalQuery_Age1") : Game1.content.LoadString("Strings\\UI:AnimalQuery_AgeN", age); if ((int)animal.age < (byte)animal.ageWhenMature) { ageText += Game1.content.LoadString("Strings\\UI:AnimalQuery_AgeBaby"); } Utility.drawTextWithShadow(b, ageText, Game1.smallFont, new Vector2(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 16 + 128), Game1.textColor); int yOffset = 0; if (parentName != null) { yOffset = 21; Utility.drawTextWithShadow(b, Game1.content.LoadString("Strings\\UI:AnimalQuery_Parent", parentName), Game1.smallFont, new Vector2(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32, 32 + yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 16 + 128), Game1.textColor); } int halfHeart = (int)((loveLevel * 1000.0 % 200.0 >= 100.0) ? (loveLevel * 1000.0 / 200.0) : (-100.0)); for (int i = 0; i < 5; i++) { b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 96 + 32 * i, yOffset + yPositionOnScreen - 32 + 320), new Microsoft.Xna.Framework.Rectangle(211 + ((loveLevel * 1000.0 <= (double)((i + 1) * 195)) ? 7 : 0), 428, 7, 6), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.89f); if (halfHeart == i) { b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 96 + 32 * i, yOffset + yPositionOnScreen - 32 + 320), new Microsoft.Xna.Framework.Rectangle(211, 428, 4, 6), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.891f); } } Utility.drawTextWithShadow(b, Game1.parseText(animal.getMoodMessage(), Game1.smallFont, width - IClickableMenu.spaceToClearSideBorder * 2 - 64), Game1.smallFont, new Vector2(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32, yOffset + yPositionOnScreen + 384 - 64 + 4), Game1.textColor); okButton.draw(b); sellButton.draw(b); moveHomeButton.draw(b); if (allowReproductionButton != null) { allowReproductionButton.draw(b); } if (confirmingSell) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f); Game1.drawDialogueBox(Game1.uiViewport.Width / 2 - 160, Game1.uiViewport.Height / 2 - 192, 320, 256, speaker: false, drawOnlyBox: true); string confirmText = Game1.content.LoadString("Strings\\UI:AnimalQuery_ConfirmSell"); b.DrawString(Game1.dialogueFont, confirmText, new Vector2((float)(Game1.uiViewport.Width / 2) - Game1.dialogueFont.MeasureString(confirmText).X / 2f, Game1.uiViewport.Height / 2 - 96 + 8), Game1.textColor); yesButton.draw(b); noButton.draw(b); } else if (hoverText != null && hoverText.Length > 0) { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont); } } else if (!Game1.globalFade) { string s = Game1.content.LoadString("Strings\\UI:AnimalQuery_ChooseBuilding", animal.displayHouse, animal.displayType); Game1.drawDialogueBox(32, -64, (int)Game1.dialogueFont.MeasureString(s).X + IClickableMenu.borderWidth * 2 + 16, 128 + IClickableMenu.borderWidth * 2, speaker: false, drawOnlyBox: true); b.DrawString(Game1.dialogueFont, s, new Vector2(32 + IClickableMenu.spaceToClearSideBorder * 2 + 8, 44f), Game1.textColor); okButton.draw(b); } drawMouse(b); }
public override bool answerDialogueAction(string questionAndAnswer, string[] questionParams) { if (questionAndAnswer == null) { return(false); } switch (questionAndAnswer) { case "Safari_Hint": { int bone = getRandomUnfoundBoneIndex(); if (bone == 823) { bone = 824; } Game1.drawDialogue(safariGuy, Game1.content.LoadString("Data\\ExtraDialogue:ProfessorSnail_Hint_" + bone)); break; } case "Safari_Collect": { Game1.activeClickableMenu = new ItemGrabMenu(new List <Item>(uncollectedRewards), reverseGrab: false, showReceivingMenu: true, null, null, "Rewards", OnCollectReward, snapToBottom: false, canBeExitedWithKey: true, playRightClickSound: false, allowRightClick: false, showOrganizeButton: false, 0, null, -1, this); IClickableMenu activeClickableMenu2 = Game1.activeClickableMenu; activeClickableMenu2.exitFunction = (IClickableMenu.onExit)Delegate.Combine(activeClickableMenu2.exitFunction, (IClickableMenu.onExit) delegate { safariGuyMutex.ReleaseLock(); }); break; } case "Safari_Donate": { Game1.activeClickableMenu = new FieldOfficeMenu(this); IClickableMenu activeClickableMenu = Game1.activeClickableMenu; activeClickableMenu.exitFunction = (IClickableMenu.onExit)Delegate.Combine(activeClickableMenu.exitFunction, (IClickableMenu.onExit) delegate { safariGuyMutex.ReleaseLock(); }); break; } case "Safari_Leave": safariGuyMutex.ReleaseLock(); break; case "Survey_Yes": if (!plantsRestoredLeft) { List <Response> responses2 = new List <Response>(); for (int j = 18; j < 25; j++) { responses2.Add(new Response((j == 22) ? "Correct" : "Wrong", string.Concat(j))); } responses2.Add(new Response("No", Game1.content.LoadString("Strings\\Locations:MineCart_Destination_Cancel")).SetHotKey(Keys.Escape)); createQuestionDialogue(Game1.content.LoadString("Strings\\Locations:IslandFieldOffice_Survey_PurpleFlower_Question"), responses2.ToArray(), "PurpleFlowerSurvey"); } else if (!plantsRestoredRight) { List <Response> responses = new List <Response>(); for (int i = 11; i < 19; i++) { responses.Add(new Response((i == 18) ? "Correct" : "Wrong", string.Concat(i))); } responses.Add(new Response("No", Game1.content.LoadString("Strings\\Locations:MineCart_Destination_Cancel")).SetHotKey(Keys.Escape)); createQuestionDialogue(Game1.content.LoadString("Strings\\Locations:IslandFieldOffice_Survey_PurpleStarfish_Question"), responses.ToArray(), "PurpleStarfishSurvey"); } break; case "PurpleFlowerSurvey_Correct": Game1.drawDialogue(safariGuy, Game1.content.LoadString("Strings\\Locations:IslandFieldOffice_Survey_PurpleFlower_Correct")); plantsRestoredLeft.Value = true; Game1.multiplayer.globalChatInfoMessage("FinishedSurvey", Game1.player.name); break; case "PurpleFlowerSurvey_Wrong": Game1.drawDialogue(safariGuy, Game1.content.LoadString("Strings\\Locations:IslandFieldOffice_Survey_PurpleFlower_Wrong")); hasFailedSurveyToday.Value = true; break; case "PurpleStarfishSurvey_Correct": Game1.drawDialogue(safariGuy, Game1.content.LoadString("Strings\\Locations:IslandFieldOffice_Survey_PurpleFlower_Correct")); plantsRestoredRight.Value = true; Game1.multiplayer.globalChatInfoMessage("FinishedSurvey", Game1.player.name); break; case "PurpleStarfishSurvey_Wrong": Game1.drawDialogue(safariGuy, Game1.content.LoadString("Strings\\Locations:IslandFieldOffice_Survey_PurpleFlower_Wrong")); hasFailedSurveyToday.Value = true; break; } if (!Game1.player.hasOrWillReceiveMail("fieldOfficeFinale") && isRangeAllTrue(0, 11) && plantsRestoredRight.Value && plantsRestoredLeft.Value) { triggerFinaleCutscene(); } return(base.answerDialogueAction(questionAndAnswer, questionParams)); }
/// <summary>Get whether a skills page is supported for extension.</summary> /// <param name="skillsPage">The skills page to check.</param> private static bool IsSupportedSkillsPage(IClickableMenu skillsPage) { return (skillsPage is SkillsPage || // vanilla menu skillsPage?.GetType().FullName == "SpaceCore.Interface.NewSkillsPage"); // SpaceCore (e.g. Luck Skill) }
public override void draw(SpriteBatch b) { if (Game1.wasRainingYesterday) { b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)this.introTimer / 3500.0)); b.Draw(Game1.mouseCursors, new Rectangle(2556, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)this.introTimer / 3500.0)); for (int index = -244; index < Game1.viewport.Width + 244; index += 244) { b.Draw(Game1.mouseCursors, new Vector2((float)index + (float)((double)this.weatherX / 2.0 % 244.0), 32f), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.DarkSlateGray * 1f * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2(160f, (float)(Game1.viewport.Height - 128 + 16 + 8)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); for (int index = -244; index < Game1.viewport.Width + 244; index += 244) { b.Draw(Game1.mouseCursors, new Vector2((float)index + this.weatherX % 244f, -32f), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.SlateGray * 0.85f * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); } foreach (TemporaryAnimatedSprite animation in this.animations) { animation.draw(b, true, 0, 0, 1f); } for (int index = -244; index < Game1.viewport.Width + 244; index += 244) { b.Draw(Game1.mouseCursors, new Vector2((float)index + (float)((double)this.weatherX * 1.5 % 244.0), (float)sbyte.MinValue), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.LightSlateGray * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); } } else { b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0)); b.Draw(Game1.mouseCursors, new Rectangle(2556, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0)); b.Draw(Game1.mouseCursors, new Vector2(0.0f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2(2556f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); if (Game1.dayOfMonth == 28) { b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.viewport.Width - 176), 4f) + (this.moonShake > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Rectangle?(new Rectangle(642, 835, 43, 43)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); if (this.timesPokedMoon > 10) { SpriteBatch spriteBatch = b; Texture2D mouseCursors = Game1.mouseCursors; Vector2 position = new Vector2((float)(Game1.viewport.Width - 136), 48f) + (this.moonShake > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero); int num; if (Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 4000.0 >= 200.0) { TimeSpan totalGameTime = Game1.currentGameTime.TotalGameTime; if (totalGameTime.TotalMilliseconds % 8000.0 > 7600.0) { totalGameTime = Game1.currentGameTime.TotalGameTime; if (totalGameTime.TotalMilliseconds % 8000.0 < 7800.0) { goto label_21; } } num = 0; goto label_22; } label_21: num = 21; label_22: Rectangle? sourceRectangle = new Rectangle?(new Rectangle(685, 844 + num, 19, 21)); Color color = Color.White * (float)(1.0 - (double)this.introTimer / 3500.0); Vector2 zero = Vector2.Zero; spriteBatch.Draw(mouseCursors, position, sourceRectangle, color, 0.0f, zero, 4f, SpriteEffects.None, 1f); } } b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2(160f, (float)(Game1.viewport.Height - 128 + 16 + 8)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } if (!this.outro && !Game1.wasRainingYesterday) { foreach (TemporaryAnimatedSprite animation in this.animations) { animation.draw(b, true, 0, 0, 1f); } } if (this.currentPage == -1) { int y = this.categories[0].bounds.Y - 128; if (y >= 0) { SpriteText.drawStringWithScrollCenteredAt(b, Utility.getDateString(), Game1.viewport.Width / 2, y, "", 1f, -1, 0, 0.88f, false); } int num = -20; int index1 = 0; foreach (ClickableTextureComponent category in this.categories) { if (this.introTimer < 2500 - index1 * 500) { Vector2 vector2 = category.getVector2() + new Vector2(12f, -8f); if (category.visible) { category.draw(b); b.Draw(Game1.mouseCursors, vector2 + new Vector2(-104f, (float)(num + 4)), new Rectangle?(new Rectangle(293, 360, 24, 24)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); this.categoryItems[index1][0].drawInMenu(b, vector2 + new Vector2(-88f, (float)(num + 16)), 1f, 1f, 0.9f, StackDrawType.Hide); } IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), (int)((double)vector2.X + (double)-this.itemSlotWidth - (double)this.categoryLabelsWidth - 12.0), (int)((double)vector2.Y + (double)num), this.categoryLabelsWidth, 104, Color.White, 4f, false); SpriteText.drawString(b, category.hoverText, (int)vector2.X - this.itemSlotWidth - this.categoryLabelsWidth + 8, (int)vector2.Y + 4, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1, SpriteText.ScrollTextAlignment.Left); for (int index2 = 0; index2 < 6; ++index2) { b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-this.itemSlotWidth - 192 - 24 + index2 * 6 * 4), 12f), new Rectangle?(new Rectangle(355, 476, 7, 11)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); } this.categoryDials[index1].draw(b, vector2 + new Vector2((float)(-this.itemSlotWidth - 192 - 48 + 4), 20f), this.categoryTotals[index1]); b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-this.itemSlotWidth - 64 - 4), 12f), new Rectangle?(new Rectangle(408, 476, 9, 11)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); } ++index1; } if (this.introTimer <= 0) { this.okButton.draw(b); } } else { IClickableMenu.drawTextureBox(b, 0, 0, Game1.viewport.Width, Game1.viewport.Height, Color.White); Vector2 location = new Vector2((float)(this.xPositionOnScreen + 32), (float)(this.yPositionOnScreen + 32)); for (int index1 = this.currentTab * this.itemsPerCategoryPage; index1 < this.currentTab * this.itemsPerCategoryPage + this.itemsPerCategoryPage; ++index1) { if (this.categoryItems[this.currentPage].Count > index1) { Item index2 = this.categoryItems[this.currentPage][index1]; index2.drawInMenu(b, location, 1f, 1f, 1f, StackDrawType.Draw); if (LocalizedContentManager.CurrentLanguageLatin) { SpriteText.drawString(b, index2.DisplayName + (index2.Stack > 1 ? " x" + (object)index2.Stack : ""), (int)location.X + 64 + 12, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1, SpriteText.ScrollTextAlignment.Left); string s = "."; for (int index3 = 0; index3 < this.width - 96 - SpriteText.getWidthOfString(index2.DisplayName + (index2.Stack > 1 ? " x" + (object)index2.Stack : "") + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)this.itemValues[index2]), 999999); index3 += SpriteText.getWidthOfString(" .", 999999)) { s += " ."; } SpriteText.drawString(b, s, (int)location.X + 80 + SpriteText.getWidthOfString(index2.DisplayName + (index2.Stack > 1 ? " x" + (object)index2.Stack : ""), 999999), (int)location.Y + 8, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1, SpriteText.ScrollTextAlignment.Left); SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)this.itemValues[index2]), (int)location.X + this.width - 64 - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)this.itemValues[index2]), 999999), (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1, SpriteText.ScrollTextAlignment.Left); } else { string s1 = index2.DisplayName + (index2.Stack > 1 ? " x" + (object)index2.Stack : "."); string s2 = Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)this.itemValues[index2]); int x = (int)location.X + this.width - 64 - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)this.itemValues[index2]), 999999); SpriteText.getWidthOfString(s1 + s2, 999999); while (SpriteText.getWidthOfString(s1 + s2, 999999) < 1123) { s1 += " ."; } if (SpriteText.getWidthOfString(s1 + s2, 999999) >= 1155) { s1 = s1.Remove(s1.Length - 1); } SpriteText.drawString(b, s1, (int)location.X + 64 + 12, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1, SpriteText.ScrollTextAlignment.Left); SpriteText.drawString(b, s2, x, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1, SpriteText.ScrollTextAlignment.Left); } location.Y += 68f; } } this.backButton.draw(b); if (this.showForwardButton()) { this.forwardButton.draw(b); } } if (this.outro) { b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.Black * (float)(1.0 - (double)this.outroFadeTimer / 800.0)); SpriteText.drawStringWithScrollCenteredAt(b, this.newDayPlaque ? Utility.getDateString(0) : Utility.getDateString(), Game1.viewport.Width / 2, this.dayPlaqueY, "", 1f, -1, 0, 0.88f, false); foreach (TemporaryAnimatedSprite animation in this.animations) { animation.draw(b, true, 0, 0, 1f); } if (this.finalOutroTimer > 0 || this._hasFinished) { b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * (float)(1.0 - (double)this.finalOutroTimer / 2000.0)); } } if (Game1.options.SnappyMenus && (this.introTimer > 0 || this.outro)) { return; } this.drawMouse(b); }
public void DrawTooltip(SpriteBatch b) { IClickableMenu.drawHoverText(b, _name, Game1.smallFont); }
/**** ** IActiveClickableMenu ****/ /// <summary>Get a string representation of the menu chain to the given menu (including the specified menu), in parent to child order.</summary> /// <param name="menu">The menu whose chain to get.</param> public static string GetMenuChainLabel(this IClickableMenu menu) {
void EventUpdateTick(object sender, EventArgs e) { if (Game1.currentLocation == null) { return; } HoverChestValue = null; if (LastMenu == null || Game1.activeClickableMenu == null || LastMenu != Game1.activeClickableMenu) { if (ChestValueBox != null && Game1.keyboardDispatcher.Subscriber == ChestValueBox) { Game1.keyboardDispatcher.Subscriber = null; } LabelButton = null; leftClickWasDown = false; ChestValueBox = null; if (oldMenuButton != null) { Game1.options.menuButton = oldMenuButton; oldMenuButton = null; } } GameLocation currentLocation = Game1.currentLocation; Chest openChest = null; foreach (KeyValuePair <Vector2, Object> keyPair in currentLocation.objects) { if (keyPair.Value is Chest) { openChest = (Chest)keyPair.Value; if (openChest.currentLidFrame == 135 && Game1.activeClickableMenu is ItemGrabMenu) { LastMenu = Game1.activeClickableMenu; ChestVector = keyPair.Key; break; } if (openChest.getBoundingBox(keyPair.Key).Contains(Game1.getMouseX() + Game1.viewport.X, Game1.getMouseY() + Game1.viewport.Y)) { // HoverChestValue = openChest.name; if (openChest != null) { HoverChestValue = GetChestValue(openChest); } } openChest = null; } } if (openChest == null) { return; } if (LabelButton == null) { ChestValueBox = new TextBox(Game1.content.Load <Texture2D>("LooseSprites\\textBox"), null, Game1.smallFont, Game1.textColor); ChestValueBox.Text = openChest.name; ChestValueBox.X = LastMenu.xPositionOnScreen; ChestValueBox.Y = LastMenu.yPositionOnScreen + LastMenu.height - Game1.tileSize * 2; ChestValueBox.Width = Game1.tileSize * 5; LabelButton = new ClickableTextureComponent("label-chest", new Rectangle(ChestValueBox.X + ChestValueBox.Width + Game1.tileSize / 2, ChestValueBox.Y, Game1.tileSize, Game1.tileSize), "", "Label Chest", Game1.mouseCursors, new Rectangle(128, 256, 64, 64), (float)Game1.pixelZoom / 6f); } int mouseX = Game1.getOldMouseX(); int mouseY = Game1.getOldMouseY(); bool mouseJustReleased = false; if (leftClickWasDown == true && Mouse.GetState().LeftButton == ButtonState.Released) { mouseJustReleased = true; } LabelButton.tryHover(mouseX, mouseY); Rectangle ChestValueBoxBoundingBox = new Rectangle(ChestValueBox.X, ChestValueBox.Y, ChestValueBox.Width, ChestValueBox.Height); if (ChestValueBoxBoundingBox.Contains(mouseX, mouseY)) { leftClickWasDown = Mouse.GetState().LeftButton == ButtonState.Pressed; ChestValueBox.Highlighted = true; if (mouseJustReleased) { ChestValueBox.SelectMe(); if (oldMenuButton == null) { oldMenuButton = Game1.options.menuButton; Game1.options.menuButton = new InputButton[] { }; } //Game1.freezeControls = true; } } else if (ChestValueBox.Selected == false) { ChestValueBox.Highlighted = false; } if (LabelButton.containsPoint(mouseX, mouseY)) { if (Mouse.GetState().LeftButton == ButtonState.Pressed) { leftClickWasDown = true; } else { leftClickWasDown = false; } hovered = true; if (mouseJustReleased && ChestValueBox.Selected) { ChestValueBox.Selected = false; ChestValueBox.Highlighted = false; Game1.keyboardDispatcher.Subscriber = null; currentLocation.objects[ChestVector].name = ChestValueBox.Text; Game1.playSound("smallSelect"); Game1.options.menuButton = oldMenuButton; oldMenuButton = null; } } else { hovered = false; } }
/// <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 (!(Game1.activeClickableMenu is ShopMenu menu)) { return; } if (!(menu.hoveredItem is Item hoverItem)) { return; } // draw shop harvest prices bool isSeeds = hoverItem is StardewValley.Object hoverObject && hoverObject.Type == "Seeds"; bool isSapling = hoverItem.Name.EndsWith("Sapling"); int value = 0; if (isSeeds && hoverItem.Name != "Mixed Seeds" && hoverItem.Name != "Winter Seeds") { bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0; if (itemHasPriceInfo) { StardewValley.Object temp = new StardewValley.Object( new Debris( new Crop( hoverItem.ParentSheetIndex, 0, 0) .indexOfHarvest.Value, Game1.player.position, Game1.player.position).chunkType.Value, 1); value = temp.Price; } else { switch (hoverItem.ParentSheetIndex) { case 802: value = 75; break; // Cactus } } } else if (isSapling) { switch (hoverItem.ParentSheetIndex) { case 628: value = 80; break; // Cherry case 629: value = 50; break; // Apricot case 630: // Orange case 633: value = 100; break; // Apple case 631: // Peach case 632: value = 140; break; // Pomegranate } } if (value > 0) { int xPosition = menu.xPositionOnScreen - 30; int yPosition = menu.yPositionOnScreen + 580; IClickableMenu.drawTextureBox( Game1.spriteBatch, xPosition + 20, yPosition - 52, 264, 108, Color.White); // Title "Harvest Price" string textToRender = _helper.SafeGetString(LanguageKeys.HarvestPrice); Game1.spriteBatch.DrawString( Game1.dialogueFont, textToRender, new Vector2(xPosition + 30, yPosition - 38), Color.Black * 0.2f); Game1.spriteBatch.DrawString( Game1.dialogueFont, textToRender, new Vector2(xPosition + 32, yPosition - 40), Color.Black * 0.8f); // Tree Icon xPosition += 80; Game1.spriteBatch.Draw( Game1.mouseCursors, new Vector2(xPosition, yPosition), new Rectangle(60, 428, 10, 10), Color.White, 0, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.85f); // Coin Game1.spriteBatch.Draw( Game1.debrisSpriteSheet, new Vector2(xPosition + 32, yPosition + 10), Game1.getSourceRectForStandardTileSheet(Game1.debrisSpriteSheet, 8, 16, 16), Color.White, 0, new Vector2(8, 8), 4, SpriteEffects.None, 0.95f); // Price Game1.spriteBatch.DrawString( Game1.dialogueFont, value.ToString(), new Vector2(xPosition + 50, yPosition + 6), Color.Black * 0.2f); Game1.spriteBatch.DrawString( Game1.dialogueFont, value.ToString(), new Vector2(xPosition + 52, yPosition + 4), Color.Black * 0.8f); /* * I have no Idea why this is here... * As far as I can see it only overrides the existing Tooltip with a price that is 500 coins higher? * * string hoverText = _helper.Reflection.GetField<string>(menu, "hoverText").GetValue(); * string hoverTitle = _helper.Reflection.GetField<string>(menu, "boldTitleText").GetValue(); * IReflectedMethod getHoveredItemExtraItemIndex = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemIndex"); * IReflectedMethod getHoveredItemExtraItemAmount = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemAmount"); * IClickableMenu.drawToolTip( * Game1.spriteBatch, * hoverText, * hoverTitle, * hoverItem, * menu.heldItem != null, * -1, * menu.currency, * getHoveredItemExtraItemIndex.Invoke<int>(new object[0]), * getHoveredItemExtraItemAmount.Invoke<int>(new object[0]), * null, * menu.hoverPrice); */ } }
/// <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) { // draw heart fills if (Game1.activeClickableMenu is GameMenu gameMenu) { if (gameMenu.currentTab == 2) { if (_socialPage != null) { int slotPosition = (int)typeof(SocialPage) .GetField( "slotPosition", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(_socialPage); int yOffset = 0; for (int i = slotPosition; i < slotPosition + 5 && i < _friendNames.Length; ++i) { int yPosition = Game1.activeClickableMenu.yPositionOnScreen + 130 + yOffset; yOffset += 112; Friendship friendshipValues; String nextName = _friendNames[i]; if (Game1.player.friendshipData.TryGetValue(nextName, out friendshipValues)) { int friendshipRawValue = friendshipValues.Points; if (friendshipRawValue > 0) { int pointsToNextHeart = friendshipRawValue % 250; int numHearts = friendshipRawValue / 250; if (friendshipRawValue < 3000 && _friendNames[i] == Game1.player.spouse || friendshipRawValue < 2500) { DrawEachIndividualSquare(numHearts, pointsToNextHeart, yPosition); //if (!Game1.options.hardwareCursor) // Game1.spriteBatch.Draw( // Game1.mouseCursors, // new Vector2(Game1.getMouseX(), Game1.getMouseY()), // Game1.getSourceRectForStandardTileSheet( // Game1.mouseCursors, Game1.mouseCursor, // 16, // 16), // Color.White, // 0.0f, // Vector2.Zero, // Game1.pixelZoom + (float)(Game1.dialogueButtonScale / 150.0), // SpriteEffects.None, // 1f); } } } } String hoverText = typeof(GameMenu).GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(gameMenu) as String; IClickableMenu.drawHoverText( Game1.spriteBatch, hoverText, Game1.smallFont); } else { ExtendMenuIfNeeded(); } } } }
// Token: 0x06000FB5 RID: 4021 RVA: 0x00142FFC File Offset: 0x001411FC public override void draw(SpriteBatch b) { if (Game1.wasRainingYesterday) { b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : (Color.SlateGray * (1f - (float)this.introTimer / 3500f))); b.Draw(Game1.mouseCursors, new Rectangle(639 * Game1.pixelZoom, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : (Color.SlateGray * (1f - (float)this.introTimer / 3500f))); for (int x = -61 * Game1.pixelZoom; x < Game1.viewport.Width + 61 * Game1.pixelZoom; x += 61 * Game1.pixelZoom) { b.Draw(Game1.mouseCursors, new Vector2((float)x + this.weatherX / 2f % (float)(61 * Game1.pixelZoom), (float)(Game1.tileSize / 2)), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.DarkSlateGray * 1f * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); } b.Draw(Game1.mouseCursors, new Vector2(0f, (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.25f) : new Color(30, 62, 50)) * (0.5f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.25f) : new Color(30, 62, 50)) * (0.5f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2(0f, (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.5f) : new Color(30, 62, 50)) * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.5f) : new Color(30, 62, 50)) * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.tileSize * 2 + Game1.tileSize / 2), (float)(Game1.viewport.Height - Game1.tileSize * 2 + Game1.tileSize / 4 + Game1.pixelZoom * 2)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); for (int x2 = -61 * Game1.pixelZoom; x2 < Game1.viewport.Width + 61 * Game1.pixelZoom; x2 += 61 * Game1.pixelZoom) { b.Draw(Game1.mouseCursors, new Vector2((float)x2 + this.weatherX % (float)(61 * Game1.pixelZoom), (float)(-(float)Game1.tileSize / 2)), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.SlateGray * 0.85f * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.9f); } using (List <TemporaryAnimatedSprite> .Enumerator enumerator = this.animations.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.draw(b, true, 0, 0); } } for (int x3 = -61 * Game1.pixelZoom; x3 < Game1.viewport.Width + 61 * Game1.pixelZoom; x3 += 61 * Game1.pixelZoom) { b.Draw(Game1.mouseCursors, new Vector2((float)x3 + this.weatherX * 1.5f % (float)(61 * Game1.pixelZoom), (float)(-(float)Game1.tileSize * 2)), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.LightSlateGray * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.9f); } } else { b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (1f - (float)this.introTimer / 3500f)); b.Draw(Game1.mouseCursors, new Rectangle(639 * Game1.pixelZoom, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (1f - (float)this.introTimer / 3500f)); b.Draw(Game1.mouseCursors, new Vector2(0f, 0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), 0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); if (Game1.dayOfMonth == 28) { b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.viewport.Width - 44 * Game1.pixelZoom), (float)Game1.pixelZoom), new Rectangle?(new Rectangle(642, 835, 43, 43)), Color.White * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); } b.Draw(Game1.mouseCursors, new Vector2(0f, (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.25f) : new Color(0, 20, 40)) * (0.65f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.25f) : new Color(0, 20, 40)) * (0.65f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); b.Draw(Game1.mouseCursors, new Vector2(0f, (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.5f) : new Color(0, 32, 20)) * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? (Color.White * 0.5f) : new Color(0, 32, 20)) * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.tileSize * 2 + Game1.tileSize / 2), (float)(Game1.viewport.Height - Game1.tileSize * 2 + Game1.tileSize / 4 + Game1.pixelZoom * 2)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (1f - (float)this.introTimer / 3500f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); } if (!this.outro && !Game1.wasRainingYesterday) { using (List <TemporaryAnimatedSprite> .Enumerator enumerator = this.animations.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.draw(b, true, 0, 0); } } } if (this.currentPage == -1) { SpriteText.drawStringWithScrollCenteredAt(b, Utility.getYesterdaysDate(), Game1.viewport.Width / 2, this.categories[0].bounds.Y - Game1.tileSize * 2, "", 1f, -1, 0, 0.88f, false); int yOffset = -5 * Game1.pixelZoom; int i = 0; foreach (ClickableTextureComponent c in this.categories) { if (this.introTimer < 2500 - i * 500) { Vector2 start = c.getVector2() + new Vector2((float)(Game1.pixelZoom * 3), (float)(-(float)Game1.pixelZoom * 2)); if (c.visible) { c.draw(b); b.Draw(Game1.mouseCursors, start + new Vector2((float)(-26 * Game1.pixelZoom), (float)(yOffset + Game1.pixelZoom)), new Rectangle?(new Rectangle(293, 360, 24, 24)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.88f); this.categoryItems[i][0].drawInMenu(b, start + new Vector2((float)(-22 * Game1.pixelZoom), (float)(yOffset + Game1.pixelZoom * 4)), 1f, 1f, 0.9f, false); } IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), (int)(start.X + (float)(-(float)this.itemSlotWidth) - (float)this.categoryLabelsWidth - (float)(Game1.pixelZoom * 3)), (int)(start.Y + (float)yOffset), this.categoryLabelsWidth, 26 * Game1.pixelZoom, Color.White, (float)Game1.pixelZoom, false); SpriteText.drawString(b, c.hoverText, (int)start.X - this.itemSlotWidth - this.categoryLabelsWidth + Game1.pixelZoom * 2, (int)start.Y + Game1.pixelZoom, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); for (int j = 0; j < 6; j++) { b.Draw(Game1.mouseCursors, start + new Vector2((float)(-(float)this.itemSlotWidth - Game1.tileSize * 3 - Game1.pixelZoom * 6 + j * 6 * Game1.pixelZoom), (float)(3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(355, 476, 7, 11)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.88f); } this.categoryDials[i].draw(b, start + new Vector2((float)(-(float)this.itemSlotWidth - Game1.tileSize * 3 - Game1.pixelZoom * 12 + Game1.pixelZoom), (float)(5 * Game1.pixelZoom)), this.categoryTotals[i]); b.Draw(Game1.mouseCursors, start + new Vector2((float)(-(float)this.itemSlotWidth - Game1.tileSize - Game1.pixelZoom), (float)(3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(408, 476, 9, 11)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.88f); } i++; } if (this.introTimer <= 0) { this.okButton.draw(b); } } else { IClickableMenu.drawTextureBox(b, Game1.viewport.Width / 2 - 640, Game1.viewport.Height / 2 - 360, 1280, 720, Color.White); Vector2 position = new Vector2((float)(this.xPositionOnScreen + Game1.tileSize / 2), (float)(this.yPositionOnScreen + Game1.tileSize / 2)); for (int k = this.currentTab * 9; k < this.currentTab * 9 + 9; k++) { if (this.categoryItems[this.currentPage].Count > k) { this.categoryItems[this.currentPage][k].drawInMenu(b, position, 1f, 1f, 1f, true); SpriteText.drawString(b, this.categoryItems[this.currentPage][k].Name + ((this.categoryItems[this.currentPage][k].Stack > 1) ? (" x" + this.categoryItems[this.currentPage][k].Stack) : ""), (int)position.X + Game1.tileSize + Game1.pixelZoom * 3, (int)position.Y + Game1.pixelZoom * 3, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); string dots = "."; for (int l = 0; l < this.width - Game1.tileSize * 3 / 2 - SpriteText.getWidthOfString(string.Concat(new object[] { this.categoryItems[this.currentPage][k].Name, (this.categoryItems[this.currentPage][k].Stack > 1) ? (" x" + this.categoryItems[this.currentPage][k].Stack) : "", (this.categoryItems[this.currentPage][k] as Object).sellToStorePrice() * (this.categoryItems[this.currentPage][k] as Object).Stack, "g" })); l += SpriteText.getWidthOfString(" .")) { dots += " ."; } SpriteText.drawString(b, dots, (int)position.X + Game1.tileSize * 5 / 4 + SpriteText.getWidthOfString(this.categoryItems[this.currentPage][k].Name + ((this.categoryItems[this.currentPage][k].Stack > 1) ? (" x" + this.categoryItems[this.currentPage][k].Stack) : "")), (int)position.Y + Game1.tileSize / 8, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); SpriteText.drawString(b, (this.categoryItems[this.currentPage][k] as Object).sellToStorePrice() * (this.categoryItems[this.currentPage][k] as Object).Stack + "g", (int)position.X + this.width - Game1.tileSize - SpriteText.getWidthOfString((this.categoryItems[this.currentPage][k] as Object).sellToStorePrice() * (this.categoryItems[this.currentPage][k] as Object).Stack + "g"), (int)position.Y + Game1.pixelZoom * 3, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); position.Y += (float)(Game1.tileSize + Game1.pixelZoom); } } this.backButton.draw(b); if (this.showForwardButton()) { this.forwardButton.draw(b); } } if (this.outro) { b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.Black * (1f - (float)this.outroFadeTimer / 800f)); SpriteText.drawStringWithScrollCenteredAt(b, this.newDayPlaque ? string.Concat(new object[] { Game1.dayOfMonth, Utility.getNumberEnding(Game1.dayOfMonth), " of ", Utility.getSeasonNameFromNumber(Utility.getSeasonNumber(Game1.currentSeason)), ", Year ", Game1.year }) : Utility.getYesterdaysDate(), Game1.viewport.Width / 2, this.dayPlaqueY, "", 1f, -1, 0, 0.88f, false); using (List <TemporaryAnimatedSprite> .Enumerator enumerator = this.animations.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.draw(b, true, 0, 0); } } if (this.finalOutroTimer > 0) { b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * (1f - (float)this.finalOutroTimer / 2000f)); } } if (this.saveGameMenu != null) { this.saveGameMenu.draw(b); } base.drawMouse(b); }
// Draw location and name tooltips public override void draw(SpriteBatch b) { DrawMap(b); DrawMarkers(b); int x = Game1.getMouseX() + Game1.tileSize / 2; int y = Game1.getMouseY() + Game1.tileSize / 2; int width; int height; int offsetY = 0; this.performHoverAction(x - Game1.tileSize / 2, y - Game1.tileSize / 2); if (!hoveredLocationText.Equals("")) { IClickableMenu.drawHoverText(b, hoveredLocationText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); int textLength = (int)Game1.smallFont.MeasureString(hoveredLocationText).X + Game1.tileSize / 2; width = Math.Max((int)Game1.smallFont.MeasureString(hoveredLocationText).X + Game1.tileSize / 2, textLength); height = (int)Math.Max(60, Game1.smallFont.MeasureString(hoveredLocationText).Y + Game1.tileSize / 2); if (x + width > Game1.viewport.Width) { x = Game1.viewport.Width - width; y += Game1.tileSize / 4; } if (ModMain.Config.NameTooltipMode == 1) { if (y + height > Game1.viewport.Height) { x += Game1.tileSize / 4; y = Game1.viewport.Height - height; } offsetY = 2 - Game1.tileSize; } else if (ModMain.Config.NameTooltipMode == 2) { if (y + height > Game1.viewport.Height) { x += Game1.tileSize / 4; y = Game1.viewport.Height - height; } offsetY = height - 4; } else { if (y + height > Game1.viewport.Height) { x += Game1.tileSize / 4; y = Game1.viewport.Height - height; } } // Draw name tooltip positioned around location tooltip DrawNames(b, hoveredNames, x, y, offsetY, height, ModMain.Config.NameTooltipMode); // Draw location tooltip IClickableMenu.drawTextureBox(b, Game1.menuTexture, new Rectangle(0, 256, 60, 60), x, y, width, height, Color.White, 1f, false); b.DrawString(Game1.smallFont, hoveredLocationText, new Vector2((float)(x + Game1.tileSize / 4), (float)(y + Game1.tileSize / 4 + 4)) + new Vector2(2f, 2f), Game1.textShadowColor); b.DrawString(Game1.smallFont, hoveredLocationText, new Vector2((float)(x + Game1.tileSize / 4), (float)(y + Game1.tileSize / 4 + 4)) + new Vector2(0f, 2f), Game1.textShadowColor); b.DrawString(Game1.smallFont, hoveredLocationText, new Vector2((float)(x + Game1.tileSize / 4), (float)(y + Game1.tileSize / 4 + 4)) + new Vector2(2f, 0f), Game1.textShadowColor); b.DrawString(Game1.smallFont, hoveredLocationText, new Vector2((float)(x + Game1.tileSize / 4), (float)(y + Game1.tileSize / 4 + 4)), Game1.textColor * 0.9f); } else { // Draw name tooltip only DrawNames(Game1.spriteBatch, hoveredNames, x, y, offsetY, this.height, ModMain.Config.NameTooltipMode); } // Draw indoor icon if (hasIndoorCharacter && !String.IsNullOrEmpty(hoveredNames)) { b.Draw(Game1.mouseCursors, indoorIconVector, new Rectangle?(new Rectangle(448, 64, 32, 32)), Color.White, 0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0f); } // Cursor if (!Game1.options.hardwareCursor) { b.Draw(Game1.mouseCursors, new Vector2(Game1.getOldMouseX(), Game1.getOldMouseY()), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, (Game1.options.gamepadControls ? 44 : 0), 16, 16)), Color.White, 0f, Vector2.Zero, Game1.pixelZoom + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 1f); } }
public void Draw(SpriteBatch b, ITask task, bool popOut = false) { string name = task.Name; bool complete = task.Complete; bool pulse = !task.HasBeenViewed(); int nameWidth = bounds.Width - 76; Rectangle scaledBounds = bounds; Color textColor; if (popOut) { scaledBounds.Inflate(2, 2); } IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), scaledBounds.X, scaledBounds.Y - 4, scaledBounds.Width, scaledBounds.Height + 4, _hovering ? Color.Wheat : Color.White, 4f, drawShadow: popOut); if (task.Active) { textColor = Game1.textColor; checkbox.sourceRect.X = (complete && !pulse) ? 25 : 16; checkbox.draw(b); if (complete && pulse) { Utility.drawWithShadow(b, DeluxeJournalMod.UiTexture, new Vector2(checkbox.bounds.X + 20, checkbox.bounds.Y + 20), new Rectangle(26, 25, 7, 7), Color.White, 0, new Vector2(4f), checkbox.baseScale + Game1.dialogueButtonScale * 0.1f); } if (task.ShouldShowProgress()) { int count = task.Count; int maxCount = task.MaxCount; nameWidth -= 260; if (complete && count < maxCount) { progressBar.Draw(b, _font, Color.DarkBlue, Color.Gray * 0.6f, count, maxCount); } else { progressBar.Draw(b, _font, Color.DarkBlue, count, maxCount); } } } else { int daysRemaining = task.DaysRemaining(); string daysRemainingKey = (daysRemaining == 1) ? "ui.tasks.renew.day" : "ui.tasks.renew.days"; nameWidth -= 260; textColor = Game1.unselectedOptionColor; checkbox.sourceRect.X = checkbox.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) ? 43 : 34; checkbox.draw(b); Utility.drawWithShadow(b, DeluxeJournalMod.UiTexture, new Vector2(progressBar.bounds.X, _centerY - 22), new Rectangle(52, 16, 9, 9), Color.White, 0, Vector2.Zero, 4f); Utility.drawTextWithShadow(b, _translation.Get(daysRemainingKey, new { count = daysRemaining }), _font, new Vector2(progressBar.bounds.X + 48, _centerY - _halfLineSpacing - 6), Color.DarkBlue); } Utility.drawTextWithShadow(b, TruncateString(name, nameWidth), _font, new Vector2(bounds.X + 68, _centerY - _halfLineSpacing - 6), textColor); if (_hovering && (!Game1.options.SnappyMenus || popOut)) { removeButton.draw(b); } }
public void draw(SpriteBatch b, int slotX, int slotY, IClickableMenu clickableMenu = null) { label = dynamicLabel == null ? label : dynamicLabel(); Utility.drawTextWithShadow(b, label, Game1.dialogueFont, new Vector2(slotX + bounds.X + (int)labelOffset.X, slotY + bounds.Y + (int)labelOffset.Y + 12), Game1.textColor); }
/********* ** Protected methods *********/ protected void DrawButton(SpriteBatch b, Texture2D icon, int x, int y, int width, string text) { IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), x, y, width, 44, new Rectangle(x, y, width, 44).Contains(Game1.getMousePosition()) ? Color.Wheat : Color.White, 2, false); b.Draw(icon, new Rectangle(x + 8, y + 8, 24, 24), null, Color.White); Utility.drawTextWithShadow(b, text, Game1.smallFont, new Vector2(x + icon.Width * 2 + 14, y + 6), Game1.textColor); }
internal static void InvokeMenuClosed(IClickableMenu priorMenu) { MenuClosed.Invoke(null, new EventArgsClickableMenuClosed(priorMenu)); }