public override void draw(SpriteBatch b) { if (!placingStructure) { foreach (ClickableTextureComponent sideTab in sideTabs) { sideTab.draw(b); } drawHorizontalPartition(b, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256); drawVerticalUpperIntersectingPartition(b, xPositionOnScreen + 576, 328); inventory.draw(b); foreach (ClickableComponent c in blueprintButtons[currentTab].Keys) { Texture2D structureTexture = blueprintButtons[currentTab][c].texture; b.Draw(origin: new Vector2(blueprintButtons[currentTab][c].sourceRectForMenuView.Center.X, blueprintButtons[currentTab][c].sourceRectForMenuView.Center.Y), texture: structureTexture, position: new Vector2(c.bounds.Center.X, c.bounds.Center.Y), sourceRectangle: blueprintButtons[currentTab][c].sourceRectForMenuView, color: blueprintButtons[currentTab][c].canBuildOnCurrentMap ? Color.White : (Color.Gray * 0.8f), rotation: 0f, scale: 1f * c.scale + ((currentTab == 2) ? 0.75f : 0f), effects: SpriteEffects.None, layerDepth: 0.9f); } if (hoveredItem != null) { hoveredItem.drawDescription(b, xPositionOnScreen + 576 + 42, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - 32, 224); } if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 8, Game1.getOldMouseY() + 8), 1f); } if (!hoverText.Equals("")) { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont); } } else { if (demolishing || upgrading) { return; } Vector2 mousePositionTile = new Vector2((Game1.viewport.X + Game1.getOldMouseX()) / 64, (Game1.viewport.Y + Game1.getOldMouseY()) / 64); for (int y = 0; y < structureForPlacement.tilesHeight; y++) { for (int x = 0; x < structureForPlacement.tilesWidth; x++) { int sheetIndex = getTileSheetIndexForStructurePlacementTile(x, y); Vector2 currentGlobalTilePosition = new Vector2(mousePositionTile.X + (float)x, mousePositionTile.Y + (float)y); if (Game1.player.getTileLocation().Equals(currentGlobalTilePosition) || Game1.currentLocation.isTileOccupied(currentGlobalTilePosition) || !Game1.currentLocation.isTilePassable(new Location((int)currentGlobalTilePosition.X, (int)currentGlobalTilePosition.Y), Game1.viewport)) { sheetIndex++; } b.Draw(buildingPlacementTiles, Game1.GlobalToLocal(Game1.viewport, currentGlobalTilePosition * 64f), Game1.getSourceRectForStandardTileSheet(buildingPlacementTiles, sheetIndex), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.999f); } } } }
public virtual void draw(SpriteBatch b, bool drawUpperPortion = true, bool drawDescriptionArea = true, int red = -1, int green = -1, int blue = -1) { 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); } if (drawUpperPortion) { Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen, width, height, speaker: false, drawOnlyBox: true, null, objectDialogueWithPortrait: false, ignoreTitleSafe: false, red, green, blue); drawHorizontalPartition(b, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256, small: false, red, green, blue); if (drawDescriptionArea) { drawVerticalUpperIntersectingPartition(b, xPositionOnScreen + 576, 328, red, green, blue); if (!descriptionText.Equals("")) { int xPosition = xPositionOnScreen + 576 + 42 + ((wiggleWordsTimer > 0) ? Game1.random.Next(-2, 3) : 0); int yPosition = yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - 32 + ((wiggleWordsTimer > 0) ? Game1.random.Next(-2, 3) : 0); int max_height = 320; float scale = 0f; string parsed_text2 = ""; do { scale = ((scale != 0f) ? (scale - 0.1f) : 1f); parsed_text2 = Game1.parseText(descriptionText, Game1.smallFont, (int)(224f / scale)); }while (Game1.smallFont.MeasureString(parsed_text2).Y > (float)max_height / scale && scale > 0.5f); if (red == -1) { Utility.drawTextWithShadow(b, parsed_text2, Game1.smallFont, new Vector2(xPosition, yPosition), Game1.textColor * 0.75f, scale); } else { Utility.drawTextWithColoredShadow(b, parsed_text2, Game1.smallFont, new Vector2(xPosition, yPosition), Game1.textColor * 0.75f, Color.Black * 0.2f, scale); } } } } else { Game1.drawDialogueBox(xPositionOnScreen - IClickableMenu.borderWidth / 2, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 64, width, height - (IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192), speaker: false, drawOnlyBox: true); } if (okButton != null) { okButton.draw(b); } inventory.draw(b, red, green, blue); }
public override void draw(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.uiViewport.Width, Game1.uiViewport.Height), Color.Black * 0.5f); base.draw(b, drawUpperPortion: false, drawDescriptionArea: false); Game1.drawDialogueBox(ItemsToGrabMenu.xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder, ItemsToGrabMenu.yPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder, ItemsToGrabMenu.width + IClickableMenu.borderWidth * 2 + IClickableMenu.spaceToClearSideBorder * 2, ItemsToGrabMenu.height + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth * 2, speaker: false, drawOnlyBox: true); ItemsToGrabMenu.draw(b); if (!hoverText.Equals("")) { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont); } if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 16, Game1.getOldMouseY() + 16), 1f); } drawMouse(b); if (ItemsToGrabMenu.descriptionTitle != null && ItemsToGrabMenu.descriptionTitle.Length > 1) { IClickableMenu.drawHoverText(b, ItemsToGrabMenu.descriptionTitle, Game1.smallFont, 32 + ((heldItem != null) ? 16 : (-21)), 32 + ((heldItem != null) ? 16 : (-21))); } }
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()); } }
public override void draw(SpriteBatch b) { drawHorizontalPartition(b, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192); inventory.draw(b); foreach (ClickableComponent c in equipmentIcons) { switch (c.name) { case "Hat": if (Game1.player.hat.Value != null) { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10), Color.White); Game1.player.hat.Value.drawInMenu(b, new Vector2(c.bounds.X, c.bounds.Y), c.scale, 1f, 0.866f, StackDrawType.Hide); } else { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 42), Color.White); } break; case "Right Ring": if (Game1.player.rightRing.Value != null) { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10), Color.White); Game1.player.rightRing.Value.drawInMenu(b, new Vector2(c.bounds.X, c.bounds.Y), c.scale); } else { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 41), Color.White); } break; case "Left Ring": if (Game1.player.leftRing.Value != null) { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10), Color.White); Game1.player.leftRing.Value.drawInMenu(b, new Vector2(c.bounds.X, c.bounds.Y), c.scale); } else { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 41), Color.White); } break; case "Boots": if (Game1.player.boots.Value != null) { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10), Color.White); Game1.player.boots.Value.drawInMenu(b, new Vector2(c.bounds.X, c.bounds.Y), c.scale); } else { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 40), Color.White); } break; case "Shirt": if (Game1.player.shirtItem.Value != null) { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10), Color.White); Game1.player.shirtItem.Value.drawInMenu(b, new Vector2(c.bounds.X, c.bounds.Y), c.scale); } else { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 69), Color.White); } break; case "Pants": if (Game1.player.pantsItem.Value != null) { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10), Color.White); Game1.player.pantsItem.Value.drawInMenu(b, new Vector2(c.bounds.X, c.bounds.Y), c.scale); } else { b.Draw(Game1.menuTexture, c.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 68), Color.White); } break; } } b.Draw((Game1.timeOfDay >= 1900) ? Game1.nightbg : Game1.daybg, new Vector2(xPositionOnScreen + 192 - 64 - 8, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8), Color.White); FarmerRenderer.isDrawingForUI = true; Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(0, Game1.player.bathingClothes ? 108 : 0, secondaryArm: false, flip: false), Game1.player.bathingClothes ? 108 : 0, new Rectangle(0, Game1.player.bathingClothes ? 576 : 0, 16, 32), new Vector2(xPositionOnScreen + 192 - 8 - 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 320 - 32 - 8), Vector2.Zero, 0.8f, 2, Color.White, 0f, 1f, Game1.player); if (Game1.timeOfDay >= 1900) { Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(0, Game1.player.bathingClothes ? 108 : 0, secondaryArm: false, flip: false), Game1.player.bathingClothes ? 108 : 0, new Rectangle(0, Game1.player.bathingClothes ? 576 : 0, 16, 32), new Vector2(xPositionOnScreen + 192 - 8 - 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 320 - 32 - 8), Vector2.Zero, 0.8f, 2, Color.DarkBlue * 0.3f, 0f, 1f, Game1.player); } FarmerRenderer.isDrawingForUI = false; Utility.drawTextWithShadow(b, Game1.player.Name, Game1.dialogueFont, new Vector2((float)(xPositionOnScreen + 192 - 8) - Game1.dialogueFont.MeasureString(Game1.player.Name).X / 2f, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 448 + 8), Game1.textColor); float offset = 32f; string farmName = Game1.content.LoadString("Strings\\UI:Inventory_FarmName", Game1.player.farmName); Utility.drawTextWithShadow(b, farmName, Game1.dialogueFont, new Vector2((float)xPositionOnScreen + offset + 512f + 32f - Game1.dialogueFont.MeasureString(farmName).X / 2f, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 + 4), Game1.textColor); string currentFunds = Game1.content.LoadString("Strings\\UI:Inventory_CurrentFunds" + (Game1.player.useSeparateWallets ? "_Separate" : ""), Utility.getNumberWithCommas(Game1.player.Money)); Utility.drawTextWithShadow(b, currentFunds, Game1.dialogueFont, new Vector2((float)xPositionOnScreen + offset + 512f + 32f - Game1.dialogueFont.MeasureString(currentFunds).X / 2f, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 320), Game1.textColor); string totalEarnings = Game1.content.LoadString("Strings\\UI:Inventory_TotalEarnings" + (Game1.player.useSeparateWallets ? "_Separate" : ""), Utility.getNumberWithCommas((int)Game1.player.totalMoneyEarned)); Utility.drawTextWithShadow(b, totalEarnings, Game1.dialogueFont, new Vector2((float)xPositionOnScreen + offset + 512f + 32f - Game1.dialogueFont.MeasureString(totalEarnings).X / 2f, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 384 - 4), Game1.textColor); Pet pet_character = Game1.MasterPlayer.getPet(); string pet_name = Game1.MasterPlayer.getPetDisplayName(); if (pet_character != null) { Utility.drawTextWithShadow(b, pet_name, Game1.dialogueFont, new Vector2((float)xPositionOnScreen + offset + 320f + Math.Max(64f, Game1.dialogueFont.MeasureString(Game1.player.Name).X / 2f), yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 448 + 8), Game1.textColor); Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)xPositionOnScreen + offset + 256f + Math.Max(64f, Game1.dialogueFont.MeasureString(Game1.player.Name).X / 2f), yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 448 - 4), new Rectangle(160 + ((!Game1.MasterPlayer.catPerson) ? 48 : 0) + pet_character.whichBreed.Value * 16, 208, 16, 16), Color.White, 0f, Vector2.Zero, 4f); } if (Game1.player.horseName.Value != null && Game1.player.horseName.Value != "") { Utility.drawTextWithShadow(b, Game1.player.horseName.Value, Game1.dialogueFont, new Vector2((float)xPositionOnScreen + offset + 384f + Math.Max(64f, Game1.dialogueFont.MeasureString(Game1.player.Name).X / 2f) + ((pet_name != null) ? Math.Max(64f, Game1.dialogueFont.MeasureString(pet_name).X) : 0f), yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 448 + 8), Game1.textColor); Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)xPositionOnScreen + offset + 320f + 8f + Math.Max(64f, Game1.dialogueFont.MeasureString(Game1.player.Name).X / 2f) + ((pet_name != null) ? Math.Max(64f, Game1.dialogueFont.MeasureString(pet_name).X) : 0f), yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 448 - 4), new Rectangle(193, 192, 16, 16), Color.White, 0f, Vector2.Zero, 4f); } _ = xPositionOnScreen; _ = width / 3; if (organizeButton != null) { organizeButton.draw(b); } 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); if (checkHeldItem()) { Game1.player.CursorSlotItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 16, Game1.getOldMouseY() + 16), 1f); } if (hoverText != null && !hoverText.Equals("")) { if (hoverAmount > 0) { IClickableMenu.drawToolTip(b, hoverText, hoverTitle, null, heldItem: true, -1, 0, -1, -1, null, hoverAmount); } else { IClickableMenu.drawToolTip(b, hoverText, hoverTitle, hoveredItem, checkHeldItem()); } } if (junimoNoteIcon != null) { junimoNoteIcon.draw(b); } }