Added in crafting menu for machines. For some reason though custom obbjects are broken in crafting menus.
This commit is contained in:
parent
1a63bcc34d
commit
a2b66afb65
|
@ -6,6 +6,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Revitalize.Framework.Menus;
|
||||
using Revitalize.Framework.Objects.Machines;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
using StardustCore.Animations;
|
||||
|
@ -164,6 +165,60 @@ namespace Revitalize.Framework.Crafting
|
|||
if (Game1.activeClickableMenu == null) Game1.activeClickableMenu = menu;
|
||||
}
|
||||
|
||||
public CraftingMenuV1 getCraftingMenuForMachine(int x, int y, int width, int height,ref IList<Item> Items,ref IList<Item> Output,Machine Machine)
|
||||
{
|
||||
CraftingMenuV1 menu = new Framework.Menus.CraftingMenuV1(x, y, width, height, Color.White, ref Items,ref Output,Machine);
|
||||
//menu.addInCraftingPageTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f));
|
||||
|
||||
foreach (KeyValuePair<string, AnimatedButton> pair in this.craftingMenuTabs)
|
||||
{
|
||||
menu.addInCraftingPageTab(pair.Key, pair.Value);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, UnlockableCraftingRecipe> pair in this.craftingRecipes)
|
||||
{
|
||||
if (pair.Value.hasUnlocked)
|
||||
{
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(pair.Value.recipe, null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), pair.Value.whichTab);
|
||||
ModCore.log("Add in a crafting recipe to the menu!");
|
||||
}
|
||||
else
|
||||
{
|
||||
ModCore.log("Recipe is locked!");
|
||||
}
|
||||
}
|
||||
menu.currentTab = this.defaultTab;
|
||||
menu.sortRecipes();
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void openCraftingMenu(int x, int y, int width, int height, ref IList<Item> items)
|
||||
{
|
||||
CraftingMenuV1 menu = new Framework.Menus.CraftingMenuV1(x, y, width, height, Color.White, items);
|
||||
//menu.addInCraftingPageTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f));
|
||||
|
||||
foreach (KeyValuePair<string, AnimatedButton> pair in this.craftingMenuTabs)
|
||||
{
|
||||
menu.addInCraftingPageTab(pair.Key, pair.Value);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, UnlockableCraftingRecipe> pair in this.craftingRecipes)
|
||||
{
|
||||
if (pair.Value.hasUnlocked)
|
||||
{
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(pair.Value.recipe, null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), pair.Value.whichTab);
|
||||
ModCore.log("Add in a crafting recipe to the menu!");
|
||||
}
|
||||
else
|
||||
{
|
||||
ModCore.log("Recipe is locked!");
|
||||
}
|
||||
}
|
||||
menu.currentTab = this.defaultTab;
|
||||
menu.sortRecipes();
|
||||
if (Game1.activeClickableMenu == null) Game1.activeClickableMenu = menu;
|
||||
}
|
||||
|
||||
#region
|
||||
//~~~~~~~~~~~~~~~~~~~~//
|
||||
// Static Functions //
|
||||
|
|
|
@ -44,12 +44,17 @@ namespace Revitalize.Framework.Crafting
|
|||
/// </summary>
|
||||
public StatCost statCost;
|
||||
|
||||
/// <summary>
|
||||
/// The number of in-game minutes it takes to craft this item.
|
||||
/// </summary>
|
||||
public int timeToCraft;
|
||||
|
||||
public Recipe() { }
|
||||
|
||||
/// <summary>Constructor for single item output.</summary>
|
||||
/// <param name="inputs">All the ingredients required to make the output.</param>
|
||||
/// <param name="output">The item given as output with how many</param>
|
||||
public Recipe(List<CraftingRecipeComponent> inputs, CraftingRecipeComponent output, StatCost StatCost = null)
|
||||
public Recipe(List<CraftingRecipeComponent> inputs, CraftingRecipeComponent output, StatCost StatCost = null,int TimeToCraft=0)
|
||||
{
|
||||
this.ingredients = inputs;
|
||||
this.DisplayItem = output.item;
|
||||
|
@ -60,9 +65,10 @@ namespace Revitalize.Framework.Crafting
|
|||
output
|
||||
};
|
||||
this.statCost = StatCost ?? new StatCost();
|
||||
this.timeToCraft = TimeToCraft;
|
||||
}
|
||||
|
||||
public Recipe(List<CraftingRecipeComponent> inputs, List<CraftingRecipeComponent> outputs, string OutputName, string OutputDescription, Item DisplayItem = null, StatCost StatCost = null)
|
||||
public Recipe(List<CraftingRecipeComponent> inputs, List<CraftingRecipeComponent> outputs, string OutputName, string OutputDescription, Item DisplayItem = null, StatCost StatCost = null,int TimeToCraft=0)
|
||||
{
|
||||
this.ingredients = inputs;
|
||||
this.outputs = outputs;
|
||||
|
@ -70,6 +76,7 @@ namespace Revitalize.Framework.Crafting
|
|||
this.outputDescription = OutputDescription;
|
||||
this.DisplayItem = DisplayItem;
|
||||
this.statCost = StatCost ?? new StatCost();
|
||||
this.timeToCraft = TimeToCraft;
|
||||
}
|
||||
|
||||
/// <summary>Checks if a player contains all recipe ingredients.</summary>
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Revitalize.Framework.Crafting
|
||||
{
|
||||
public class RecipeBook
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics;
|
|||
using Revitalize.Framework.Crafting;
|
||||
using Revitalize.Framework.Menus.MenuComponents;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Objects.Machines;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
|
@ -28,6 +29,7 @@ namespace Revitalize.Framework.Menus
|
|||
public Vector2 itemDisplayLocation;
|
||||
|
||||
public IList<Item> inventory;
|
||||
public IList<Item> outputInventory;
|
||||
|
||||
private Dictionary<ItemDisplayButton,int> requiredItems;
|
||||
|
||||
|
@ -35,6 +37,10 @@ namespace Revitalize.Framework.Menus
|
|||
|
||||
public bool isPlayerInventory;
|
||||
|
||||
private Machine machine;
|
||||
|
||||
string hoverText;
|
||||
|
||||
public Item actualItem
|
||||
{
|
||||
get
|
||||
|
@ -63,6 +69,31 @@ namespace Revitalize.Framework.Menus
|
|||
this.requiredItems.Add(b, this.infoButton.recipe.ingredients.ElementAt(i).requiredAmount);
|
||||
}
|
||||
this.craftingButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("CraftingButton", new Vector2(this.xPositionOnScreen + this.width / 2-96, this.getCraftingButtonHeight()),new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "CraftingMenu", "CraftButton"),new StardustCore.Animations.Animation(0,0,48,16)), Color.White),new Rectangle(0,0,48,16),4f);
|
||||
this.outputInventory = this.inventory;
|
||||
}
|
||||
|
||||
public CraftingInformationPage(int x, int y, int width, int height, Color BackgroundColor, CraftingRecipeButton ItemToDisplay, ref IList<Item> Inventory,ref IList<Item> OutputInventory ,bool IsPlayerInventory, Machine Machine) : base(x, y, width, height, false)
|
||||
{
|
||||
this.backgroundColor = BackgroundColor;
|
||||
this.infoButton = ItemToDisplay;
|
||||
this.itemDisplayLocation = new Vector2(this.xPositionOnScreen + (this.width / 2) - 32, this.yPositionOnScreen + (128));
|
||||
this.inventory = Inventory;
|
||||
this.isPlayerInventory = IsPlayerInventory;
|
||||
|
||||
this.requiredItems = new Dictionary<ItemDisplayButton, int>();
|
||||
for (int i = 0; i < this.infoButton.recipe.ingredients.Count; i++)
|
||||
{
|
||||
ItemDisplayButton b = new ItemDisplayButton(this.infoButton.recipe.ingredients.ElementAt(i).item, null, new Vector2(this.xPositionOnScreen + 64, this.getIngredientHeightOffset().Y), new Rectangle(0, 0, 64, 64), 2f, true, Color.White);
|
||||
this.requiredItems.Add(b, this.infoButton.recipe.ingredients.ElementAt(i).requiredAmount);
|
||||
}
|
||||
this.craftingButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("CraftingButton", new Vector2(this.xPositionOnScreen + this.width / 2 - 96, this.getCraftingButtonHeight()), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "CraftingMenu", "CraftButton"), new StardustCore.Animations.Animation(0, 0, 48, 16)), Color.White), new Rectangle(0, 0, 48, 16), 4f);
|
||||
|
||||
if (OutputInventory == null)
|
||||
{
|
||||
this.outputInventory = this.inventory;
|
||||
}
|
||||
this.outputInventory = OutputInventory;
|
||||
this.machine = Machine;
|
||||
}
|
||||
|
||||
public override void receiveLeftClick(int x, int y, bool playSound = true)
|
||||
|
@ -72,7 +103,19 @@ namespace Revitalize.Framework.Menus
|
|||
if (this.canCraftRecipe())
|
||||
{
|
||||
Game1.soundBank.PlayCue("coin");
|
||||
this.infoButton.craftItem();
|
||||
|
||||
this.infoButton.craftItem(this.inventory, this.outputInventory);
|
||||
if (this.machine != null)
|
||||
{
|
||||
if (this.infoButton.recipe.timeToCraft == 0)
|
||||
{
|
||||
this.machine.InventoryManager.dumpBufferToItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.machine.MinutesUntilReady = this.infoButton.recipe.timeToCraft;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isPlayerInventory)
|
||||
{
|
||||
|
@ -82,6 +125,41 @@ namespace Revitalize.Framework.Menus
|
|||
}
|
||||
}
|
||||
|
||||
public override void performHoverAction(int x, int y)
|
||||
{
|
||||
bool hovered = false;
|
||||
if (this.craftingButton.containsPoint(x, y))
|
||||
{
|
||||
if (this.infoButton.recipe.CanCraft(this.inventory) == false)
|
||||
{
|
||||
this.hoverText = "Not enough items.";
|
||||
hovered = true;
|
||||
}
|
||||
if (this.machine != null)
|
||||
{
|
||||
if (this.machine.MinutesUntilReady > 0)
|
||||
{
|
||||
this.hoverText = "Crafting in progress...";
|
||||
hovered = true;
|
||||
}
|
||||
if (this.machine.MinutesUntilReady == 0 && this.machine.InventoryManager.hasItemsInBuffer)
|
||||
{
|
||||
this.hoverText = "Items in buffer. Please make room in the inventory for: " + System.Environment.NewLine + this.machine.InventoryManager + " items.";
|
||||
hovered = true;
|
||||
}
|
||||
if (this.machine.InventoryManager.IsFull)
|
||||
{
|
||||
this.hoverText = "Inventory is full!";
|
||||
hovered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hovered == false)
|
||||
{
|
||||
this.hoverText = "";
|
||||
}
|
||||
}
|
||||
|
||||
public override void draw(SpriteBatch b)
|
||||
{
|
||||
this.drawDialogueBoxBackground(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, this.backgroundColor);
|
||||
|
@ -110,7 +188,16 @@ namespace Revitalize.Framework.Menus
|
|||
|
||||
public bool canCraftRecipe()
|
||||
{
|
||||
return this.infoButton.recipe.CanCraft(this.inventory);
|
||||
bool canCraft = true;
|
||||
if (this.infoButton.recipe.CanCraft(this.inventory) == false) canCraft = false;
|
||||
|
||||
if (this.machine != null)
|
||||
{
|
||||
if (this.machine.InventoryManager.hasItemsInBuffer) canCraft = false;
|
||||
if (this.machine.InventoryManager.IsFull) canCraft = false;
|
||||
}
|
||||
|
||||
return canCraft;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -7,6 +7,7 @@ using Microsoft.Xna.Framework;
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Revitalize.Framework.Menus.MenuComponents;
|
||||
using Revitalize.Framework.Objects.Machines;
|
||||
using StardewValley;
|
||||
using StardewValley.Menus;
|
||||
using StardustCore.UIUtilities;
|
||||
|
@ -90,6 +91,8 @@ namespace Revitalize.Framework.Menus
|
|||
/// </summary>
|
||||
public StardewValley.Menus.TextBox searchBox;
|
||||
|
||||
private Machine machine;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum amount of pages to display.
|
||||
/// </summary>
|
||||
|
@ -167,7 +170,7 @@ namespace Revitalize.Framework.Menus
|
|||
/// <param name="BackgroundColor"></param>
|
||||
/// <param name="FromInventory"></param>
|
||||
/// <param name="ToInventory"></param>
|
||||
public CraftingMenuV1(int X, int Y, int Width, int Height, Color BackgroundColor, ref IList<Item> FromInventory, ref IList<Item> ToInventory) : base(X, Y, Width, Height, false)
|
||||
public CraftingMenuV1(int X, int Y, int Width, int Height, Color BackgroundColor, ref IList<Item> FromInventory, ref IList<Item> ToInventory,Machine Machine) : base(X, Y, Width, Height, false)
|
||||
{
|
||||
this.backgroundColor = BackgroundColor;
|
||||
this.CraftingTabs = new Dictionary<string, AnimatedButton>();
|
||||
|
@ -176,6 +179,8 @@ namespace Revitalize.Framework.Menus
|
|||
this.fromInventory = FromInventory;
|
||||
this.toInventory = ToInventory;
|
||||
this.initializeButtons();
|
||||
this.machine = Machine;
|
||||
this.playerInventory = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -386,17 +391,19 @@ namespace Revitalize.Framework.Menus
|
|||
this.fromInventory = Game1.player.Items;
|
||||
}
|
||||
|
||||
this.craftingInfo = new CraftingInformationPage(this.xPositionOnScreen + this.width + this.xOffset, this.yPositionOnScreen, 400, this.height, this.backgroundColor, button, ref this.fromInventory, this.playerInventory);
|
||||
this.craftingInfo = new CraftingInformationPage(this.xPositionOnScreen + this.width + this.xOffset, this.yPositionOnScreen, 400, this.height, this.backgroundColor, button, ref this.fromInventory,ref this.toInventory,this.playerInventory,this.machine);
|
||||
Game1.soundBank.PlayCue("coin");
|
||||
if (this.playerInventory)
|
||||
{
|
||||
Game1.player.Items = this.toInventory;
|
||||
return;
|
||||
}
|
||||
|
||||
//ModCore.log("Button has been clicked!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//ModCore.log("Menu has been clicked");
|
||||
|
||||
if (this.craftingInfo != null)
|
||||
{
|
||||
|
@ -420,7 +427,7 @@ namespace Revitalize.Framework.Menus
|
|||
this.leftButton.draw(b);
|
||||
//Draw page numbers here.
|
||||
//b.DrawString(Game1.smallFont,"Page: "+this.currentPageIndex.ToString()/)
|
||||
b.DrawString(Game1.dialogueFont, ("Page: " + (this.currentPageIndex + 1) + " / " + (this.maxPages + 1)).ToString(), new Vector2(this.xPositionOnScreen + 128, this.yPositionOnScreen), Color.White);
|
||||
b.DrawString(Game1.dialogueFont, ("Page: " + (this.currentPageIndex + 1) + " / " + (this.maxPages + 1)).ToString(), new Vector2(this.xPositionOnScreen + 128, this.yPositionOnScreen+32), Color.White);
|
||||
this.rightButton.draw(b);
|
||||
|
||||
this.searchBox.Draw(b, true);
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
public string currentTab;
|
||||
public string hoverText;
|
||||
|
||||
|
||||
public IClickableMenuExtended CurrentMenu
|
||||
{
|
||||
get
|
||||
|
|
|
@ -14,6 +14,12 @@ using StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons;
|
|||
|
||||
namespace Revitalize.Framework.Menus.Machines
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO:
|
||||
/// Add in minutes remaining display
|
||||
/// Add in remaining inventory space display.
|
||||
/// Make crafting menu require the object passed in to count down before crafting the recipe.
|
||||
/// </summary>
|
||||
public class MachineSummaryMenu : IClickableMenuExtended
|
||||
{
|
||||
|
||||
|
@ -45,12 +51,24 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Should this menu draw the battery for the energy guage?
|
||||
/// </summary>
|
||||
private bool shouldDrawBattery
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.energy.maxEnergy != 0 || ModCore.Configs.machinesConfig.doMachinesConsumeEnergy==false;
|
||||
}
|
||||
}
|
||||
|
||||
public MachineSummaryMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MachineSummaryMenu(int x, int y, int width, int height, Color BackgroundColor, CustomObject SourceObject):base(x,y,width,height,false)
|
||||
public MachineSummaryMenu(int x, int y, int width, int height, Color BackgroundColor, CustomObject SourceObject) : base(x, y, width, height, false)
|
||||
{
|
||||
|
||||
this.objectSource = SourceObject;
|
||||
|
@ -58,8 +76,8 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
this.energyTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
|
||||
this.colorSwap();
|
||||
|
||||
this.energyPosition = new Vector2(this.xPositionOnScreen + this.width - 128, this.yPositionOnScreen + this.height - 72*4);
|
||||
this.batteryBackground =new AnimatedButton(new StardustCore.Animations.AnimatedSprite("BatteryFrame", this.energyPosition, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", "BatteryFrame"), new StardustCore.Animations.Animation(0, 0, 32, 64)),Color.White),new Rectangle(0,0,32,64),4f);
|
||||
this.energyPosition = new Vector2(this.xPositionOnScreen + this.width - 128, this.yPositionOnScreen + this.height - 72 * 4);
|
||||
this.batteryBackground = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("BatteryFrame", this.energyPosition, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", "BatteryFrame"), new StardustCore.Animations.Animation(0, 0, 32, 64)), Color.White), new Rectangle(0, 0, 32, 64), 4f);
|
||||
this.battergyEnergyGuage = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("BatteryEnergyGuage", this.energyPosition, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", "BatteryEnergyGuage"), new StardustCore.Animations.Animation(0, 0, 32, 64)), Color.White), new Rectangle(0, 0, 32, 64), 4f);
|
||||
|
||||
this.itemDisplayOffset = ObjectUtilities.GetDimensionOffsetFromItem(this.objectSource);
|
||||
|
@ -68,9 +86,9 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
public override void performHoverAction(int x, int y)
|
||||
{
|
||||
bool hovered = false;
|
||||
if (this.batteryBackground.containsPoint(x, y))
|
||||
if (this.batteryBackground.containsPoint(x, y) && this.shouldDrawBattery)
|
||||
{
|
||||
this.hoverText ="Energy: "+this.energy.energyDisplayString;
|
||||
this.hoverText = "Energy: " + this.energy.energyDisplayString;
|
||||
hovered = true;
|
||||
}
|
||||
|
||||
|
@ -90,16 +108,21 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
{
|
||||
this.drawDialogueBoxBackground(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, this.backgroundColor);
|
||||
|
||||
this.batteryBackground.draw(b, 1f, 1f);
|
||||
this.colorSwap();
|
||||
b.Draw(this.energyTexture, new Rectangle((int)this.energyPosition.X+(int)(11*this.batteryBackground.scale), (int)this.energyPosition.Y+(int)(18*this.batteryBackground.scale), (int)(9*this.batteryBackground.scale), (int)(46*this.batteryBackground.scale)), new Rectangle(0, 0, 1, 1), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.2f);
|
||||
this.battergyEnergyGuage.draw(b, 1f, 1f);
|
||||
//Draw the energy on the screen.
|
||||
|
||||
if (this.shouldDrawBattery)
|
||||
{
|
||||
this.batteryBackground.draw(b, 1f, 1f);
|
||||
this.colorSwap();
|
||||
b.Draw(this.energyTexture, new Rectangle((int)this.energyPosition.X + (int)(11 * this.batteryBackground.scale), (int)this.energyPosition.Y + (int)(18 * this.batteryBackground.scale), (int)(9 * this.batteryBackground.scale), (int)(46 * this.batteryBackground.scale)), new Rectangle(0, 0, 1, 1), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.2f);
|
||||
this.battergyEnergyGuage.draw(b, 1f, 1f);
|
||||
}
|
||||
|
||||
|
||||
this.objectSource.drawFullyInMenu(b,new Vector2((int)(this.xPositionOnScreen+ (this.width / 2) - (this.itemDisplayOffset.X / 2)),(int)(this.yPositionOnScreen+128f)),.24f);
|
||||
this.objectSource.drawFullyInMenu(b, new Vector2((int)(this.xPositionOnScreen + (this.width / 2) - (this.itemDisplayOffset.X / 2)), (int)(this.yPositionOnScreen + 128f)), .24f);
|
||||
Vector2 nameOffset = Game1.dialogueFont.MeasureString(this.objectSource.DisplayName);
|
||||
|
||||
b.DrawString(Game1.dialogueFont, this.objectSource.DisplayName, new Vector2(this.xPositionOnScreen + (this.width / 2)-nameOffset.X/2, (this.yPositionOnScreen + 150f)) + new Vector2(0,ObjectUtilities.GetHeightOffsetFromItem(this.objectSource)), Color.Black);
|
||||
b.DrawString(Game1.dialogueFont, this.objectSource.DisplayName, new Vector2(this.xPositionOnScreen + (this.width / 2) - nameOffset.X / 2, (this.yPositionOnScreen + 150f)) + new Vector2(0, ObjectUtilities.GetHeightOffsetFromItem(this.objectSource)), Color.Black);
|
||||
|
||||
if (string.IsNullOrEmpty(this.hoverText) == false)
|
||||
{
|
||||
|
@ -127,7 +150,7 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
{
|
||||
col = Color.GreenYellow;
|
||||
}
|
||||
else if(this.energy.energyPercentRemaining>.25d && this.energy.energyPercentRemaining <= .5d)
|
||||
else if (this.energy.energyPercentRemaining > .25d && this.energy.energyPercentRemaining <= .5d)
|
||||
{
|
||||
col = Color.Yellow;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,15 @@ using Microsoft.Xna.Framework;
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Newtonsoft.Json;
|
||||
using PyTK.CustomElementHandler;
|
||||
using Revitalize.Framework.Crafting;
|
||||
using Revitalize.Framework.Menus;
|
||||
using Revitalize.Framework.Menus.Machines;
|
||||
using Revitalize.Framework.Objects.InformationFiles;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
using StardustCore.Animations;
|
||||
using StardustCore.UIUtilities;
|
||||
using StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons;
|
||||
|
||||
namespace Revitalize.Framework.Objects.Machines
|
||||
{
|
||||
|
@ -31,7 +37,7 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
string timeToProduce = this.timeToProduce.ToString();
|
||||
string updatesContainer = this.updatesContainerObjectForProduction.ToString();
|
||||
|
||||
return info + "<" + guidStr + "<" + pyTkData + "<" + offsetKey + "<" + container+"<"+resources+"<"+energyRequired+"<"+timeToProduce+"<"+updatesContainer;
|
||||
return info + "<" + guidStr + "<" + pyTkData + "<" + offsetKey + "<" + container+"<"+resources+"<"+energyRequired+"<"+timeToProduce+"<"+updatesContainer+"<"+this.craftingRecipeBook;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -46,6 +52,7 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
string energyRequired = data[6];
|
||||
string time = data[7];
|
||||
string updates = data[8];
|
||||
this.craftingRecipeBook = data[9];
|
||||
this.info = (BasicItemInformation)Revitalize.ModCore.Serializer.DeserializeFromJSONString(infoString, typeof(BasicItemInformation));
|
||||
this.data = Revitalize.ModCore.Serializer.DeserializeFromJSONString<CustomObjectData>(pyTKData);
|
||||
this.energyRequiredPer10Minutes = Convert.ToInt32(energyRequired);
|
||||
|
@ -114,6 +121,8 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
public int timeToProduce;
|
||||
public bool updatesContainerObjectForProduction;
|
||||
|
||||
public string craftingRecipeBook;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool ProducesItems
|
||||
{
|
||||
|
@ -137,15 +146,16 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
|
||||
public Machine() { }
|
||||
|
||||
public Machine(CustomObjectData PyTKData, BasicItemInformation info,List<ResourceInformation> ProducedResources=null, int EnergyRequiredPer10Minutes = 0,int TimeToProduce=0,bool UpdatesContainer=false) : base(PyTKData, info) {
|
||||
public Machine(CustomObjectData PyTKData, BasicItemInformation info,List<ResourceInformation> ProducedResources=null, int EnergyRequiredPer10Minutes = 0,int TimeToProduce=0,bool UpdatesContainer=false, string CraftingBook = "") : base(PyTKData, info) {
|
||||
this.producedResources = ProducedResources?? new List<ResourceInformation>();
|
||||
this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes;
|
||||
this.timeToProduce = TimeToProduce;
|
||||
this.updatesContainerObjectForProduction = UpdatesContainer;
|
||||
this.MinutesUntilReady = TimeToProduce;
|
||||
this.craftingRecipeBook = CraftingBook;
|
||||
}
|
||||
|
||||
public Machine(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, List<ResourceInformation> ProducedResources=null,int EnergyRequiredPer10Minutes=0,int TimeToProduce=0,bool UpdatesContainer=false,MultiTiledObject obj=null) : base(PyTKData, info, TileLocation)
|
||||
public Machine(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, List<ResourceInformation> ProducedResources=null,int EnergyRequiredPer10Minutes=0,int TimeToProduce=0,bool UpdatesContainer=false, string CraftingBook = "", MultiTiledObject obj=null) : base(PyTKData, info, TileLocation)
|
||||
{
|
||||
this.containerObject = obj;
|
||||
this.producedResources = ProducedResources ?? new List<ResourceInformation>();
|
||||
|
@ -153,9 +163,10 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
this.timeToProduce = TimeToProduce;
|
||||
this.updatesContainerObjectForProduction = UpdatesContainer;
|
||||
this.MinutesUntilReady = TimeToProduce;
|
||||
this.craftingRecipeBook = CraftingBook;
|
||||
}
|
||||
|
||||
public Machine(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Vector2 offsetKey,List<ResourceInformation> ProducedResources=null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce=0,bool UpdatesContainer=false,MultiTiledObject obj = null) : base(PyTKData, info, TileLocation)
|
||||
public Machine(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Vector2 offsetKey,List<ResourceInformation> ProducedResources=null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce=0,bool UpdatesContainer=false, string CraftingBook = "", MultiTiledObject obj = null) : base(PyTKData, info, TileLocation)
|
||||
{
|
||||
this.offsetKey = offsetKey;
|
||||
this.containerObject = obj;
|
||||
|
@ -163,6 +174,7 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
this.timeToProduce = TimeToProduce;
|
||||
this.updatesContainerObjectForProduction = UpdatesContainer;
|
||||
this.MinutesUntilReady = TimeToProduce;
|
||||
this.craftingRecipeBook = CraftingBook;
|
||||
}
|
||||
|
||||
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
||||
|
@ -185,7 +197,6 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
energySources = this.EnergyGraphSearchSources(); //Only grab the network once.
|
||||
}
|
||||
|
||||
|
||||
if (this.ProducesItems)
|
||||
{
|
||||
//ModCore.log("This produces items!");
|
||||
|
@ -219,6 +230,17 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
this.produceEnergy();
|
||||
}
|
||||
}
|
||||
if (this.MinutesUntilReady>0)
|
||||
{
|
||||
this.MinutesUntilReady = Math.Max(0, this.MinutesUntilReady - minutes);
|
||||
|
||||
if(this.InventoryManager.hasItemsInBuffer && this.MinutesUntilReady == 0)
|
||||
{
|
||||
this.InventoryManager.dumpBufferToItems();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -235,18 +257,40 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
if (this.location == null)
|
||||
this.location = Game1.player.currentLocation;
|
||||
if (Game1.menuUp || Game1.currentMinigame != null) return false;
|
||||
if (this.containerObject.info.inventory != null && Game1.activeClickableMenu == null)
|
||||
{
|
||||
Game1.activeClickableMenu = new Revitalize.Framework.Menus.InventoryTransferMenu(100, 100, 500, 500, this.containerObject.info.inventory.items, this.containerObject.info.inventory.capacity);
|
||||
}
|
||||
//ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero);
|
||||
|
||||
//ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero);
|
||||
this.createMachineMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the necessary components to display the machine menu properly.
|
||||
/// </summary>
|
||||
protected virtual void createMachineMenu()
|
||||
{
|
||||
MachineMenu machineMenu = new MachineMenu((Game1.viewport.Width / 2) - 400, 0, 800, 600);
|
||||
|
||||
MachineSummaryMenu m = new Framework.Menus.Machines.MachineSummaryMenu((Game1.viewport.Width / 2) - 400, 48, 800, 600, Color.White, this.containerObject);
|
||||
machineMenu.addInMenuTab("Summary", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("SummaryTab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), m, true);
|
||||
|
||||
if (this.InventoryManager.capacity > 0)
|
||||
{
|
||||
InventoryTransferMenu transferMenu = new InventoryTransferMenu(100, 150, 500, 600, this.InventoryManager.items, 36);
|
||||
machineMenu.addInMenuTab("Inventory", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Inventory Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), transferMenu, false);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.craftingRecipeBook)==false)
|
||||
{
|
||||
CraftingMenuV1 craftingMenu = CraftingRecipeBook.CraftingRecipesByGroup[this.craftingRecipeBook].getCraftingMenuForMachine(100, 100, 400, 700, ref this.InventoryManager.items,ref this.InventoryManager.bufferItems,this);
|
||||
machineMenu.addInMenuTab("Crafting", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Crafting Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), craftingMenu, false);
|
||||
}
|
||||
|
||||
if (Game1.activeClickableMenu == null) Game1.activeClickableMenu = machineMenu;
|
||||
}
|
||||
|
||||
public override Item getOne()
|
||||
{
|
||||
Machine component = new Machine(this.data, this.info.Copy(), this.TileLocation, this.offsetKey, this.producedResources,this.energyRequiredPer10Minutes,this.timeToProduce,this.updatesContainerObjectForProduction,this.containerObject);
|
||||
Machine component = new Machine(this.data, this.info.Copy(), this.TileLocation, this.offsetKey, this.producedResources,this.energyRequiredPer10Minutes,this.timeToProduce,this.updatesContainerObjectForProduction,this.craftingRecipeBook,this.containerObject);
|
||||
return component;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,24 +154,24 @@ namespace Revitalize.Framework.Objects
|
|||
MultiTiledObject sandBox = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(), Color.White, true, new InventoryManager(36), null, null));
|
||||
Machine sandBox_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"),new Animation(0,0,16,16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
|
||||
{
|
||||
new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
//new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), true);
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), true,"Workbench");
|
||||
Machine sandBox_1_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"), new Animation(16, 0, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
|
||||
{
|
||||
new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
//new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), false);
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), false, "Workbench");
|
||||
Machine sandBox_0_1 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"), new Animation(0, 16, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
|
||||
{
|
||||
new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
//new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0,1,0), false);
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0,1,0), false, "Workbench");
|
||||
Machine sandBox_1_1 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
|
||||
{
|
||||
new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
//new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), false);
|
||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), false, "Workbench");
|
||||
|
||||
sandBox.addComponent(new Vector2(0,0),sandBox_0_0);
|
||||
sandBox.addComponent(new Vector2(1, 0), sandBox_1_0);
|
||||
|
|
|
@ -20,12 +20,26 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <summary>The actual contents of the inventory.</summary>
|
||||
public IList<Item> items;
|
||||
|
||||
/// <summary>
|
||||
/// Items that are to be buffered into the inventory manager if possible.
|
||||
/// </summary>
|
||||
public IList<Item> bufferItems;
|
||||
|
||||
/// <summary>Checks if the inventory is full or not.</summary>
|
||||
public bool IsFull => this.ItemCount >= this.capacity && this.items.Where(i=>i==null).Count()==0;
|
||||
|
||||
/// <summary>Checks to see if this core object actually has a valid inventory.</summary>
|
||||
public bool HasInventory => this.capacity > 0;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool hasItemsInBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bufferItems.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public bool requiresUpdate;
|
||||
public InventoryManager()
|
||||
|
@ -33,6 +47,7 @@ namespace Revitalize.Framework.Utilities
|
|||
this.capacity = 0;
|
||||
this.setMaxLimit(0);
|
||||
this.items = new List<Item>();
|
||||
this.bufferItems = new List<Item>();
|
||||
}
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
|
@ -41,6 +56,7 @@ namespace Revitalize.Framework.Utilities
|
|||
this.capacity = int.MaxValue;
|
||||
this.setMaxLimit(int.MaxValue);
|
||||
this.items = items;
|
||||
this.bufferItems = new List<Item>();
|
||||
}
|
||||
|
||||
public InventoryManager(IList<Item> items)
|
||||
|
@ -48,6 +64,7 @@ namespace Revitalize.Framework.Utilities
|
|||
this.capacity = int.MaxValue;
|
||||
this.setMaxLimit(int.MaxValue);
|
||||
this.items = items;
|
||||
this.bufferItems = new List<Item>();
|
||||
}
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
|
@ -56,6 +73,7 @@ namespace Revitalize.Framework.Utilities
|
|||
this.capacity = capacity;
|
||||
this.MaxCapacity = int.MaxValue;
|
||||
this.items = new List<Item>();
|
||||
this.bufferItems = new List<Item>();
|
||||
}
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
|
@ -64,6 +82,7 @@ namespace Revitalize.Framework.Utilities
|
|||
this.capacity = capacity;
|
||||
this.setMaxLimit(MaxCapacity);
|
||||
this.items = new List<Item>();
|
||||
this.bufferItems = new List<Item>();
|
||||
}
|
||||
|
||||
/// <summary>Add the item to the inventory.</summary>
|
||||
|
@ -75,15 +94,23 @@ namespace Revitalize.Framework.Utilities
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach (Item self in this.items)
|
||||
for(int i = 0; i < this.items.Count; i++)
|
||||
{
|
||||
Item self = this.items[i];
|
||||
if (self != null && self.canStackWith(item))
|
||||
{
|
||||
self.addToStack(item.Stack);
|
||||
this.requiresUpdate = true;
|
||||
return true;
|
||||
}
|
||||
if (self == null)
|
||||
{
|
||||
self = item;
|
||||
this.requiresUpdate=true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
this.requiresUpdate = true;
|
||||
this.items.Add(item);
|
||||
return true;
|
||||
|
@ -156,5 +183,14 @@ namespace Revitalize.Framework.Utilities
|
|||
{
|
||||
return new InventoryManager(this.capacity, this.MaxCapacity);
|
||||
}
|
||||
|
||||
public void dumpBufferToItems()
|
||||
{
|
||||
foreach(Item I in this.bufferItems)
|
||||
{
|
||||
this.addItem(I);
|
||||
}
|
||||
this.bufferItems.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,7 +254,6 @@ namespace Revitalize
|
|||
//Loads in objects to be use by the mod.
|
||||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||
ObjectManager = new ObjectManager(Manifest);
|
||||
ObjectManager.loadInItems();
|
||||
ObjectsToDraw = new Dictionary<GameLocation, MultiTiledObject>();
|
||||
|
||||
//Adds in event handling for the mod.
|
||||
|
@ -278,9 +277,7 @@ namespace Revitalize
|
|||
ModHelper.Events.Multiplayer.ModMessageReceived += MultiplayerUtilities.GetModMessage;
|
||||
ModHelper.Events.Input.ButtonPressed += ObjectInteractionHacks.ResetNormalToolsColorOnLeftClick;
|
||||
|
||||
//Adds in recipes to the mod.
|
||||
VanillaRecipeBook = new VanillaRecipeBook();
|
||||
CraftingRecipeBook.CraftingRecipesByGroup = new Dictionary<string, CraftingRecipeBook>();
|
||||
|
||||
|
||||
ModHelper.Events.Display.MenuChanged += MenuHacks.RecreateFarmhandInventory;
|
||||
|
||||
|
@ -339,9 +336,12 @@ namespace Revitalize
|
|||
MachineSummaryMenu m= new Framework.Menus.Machines.MachineSummaryMenu((Game1.viewport.Width/2)-400, 48, 800, 600,Color.White,test);
|
||||
InventoryTransferMenu transferMenu = new InventoryTransferMenu(100, 150, 500, 600, test.info.inventory.items, 36);
|
||||
MachineMenu machineMenu = new MachineMenu((Game1.viewport.Width / 2) - 400, 0, 800, 600);
|
||||
CraftingMenuV1 craftingMenu= new Framework.Menus.CraftingMenuV1(100, 100, 400, 700, Color.White, Game1.player.Items);
|
||||
|
||||
machineMenu.addInMenuTab("Summary",new AnimatedButton(new StardustCore.Animations.AnimatedSprite("SummaryTab",new Vector2(),new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest,"Menus","MenuTab"),new Animation(0,0,24,24)),Color.White),new Rectangle(0,0,24,24),2f),m,true);
|
||||
machineMenu.addInMenuTab("Inventory", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Inventory Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), transferMenu, true);
|
||||
machineMenu.addInMenuTab("Crafting", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Crafting Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), craftingMenu, true);
|
||||
|
||||
|
||||
if (Game1.activeClickableMenu == null) Game1.activeClickableMenu = machineMenu;
|
||||
}
|
||||
|
@ -537,6 +537,11 @@ namespace Revitalize
|
|||
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
|
||||
{
|
||||
this.loadContent();
|
||||
ObjectManager.loadInItems();
|
||||
//Adds in recipes to the mod.
|
||||
VanillaRecipeBook = new VanillaRecipeBook();
|
||||
CraftingRecipeBook.CraftingRecipesByGroup = new Dictionary<string, CraftingRecipeBook>();
|
||||
|
||||
Serializer.afterLoad();
|
||||
ShopHacks.AddInCustomItemsToShops();
|
||||
ObjectInteractionHacks.AfterLoad_RestoreTrackedMachines();
|
||||
|
@ -555,7 +560,8 @@ namespace Revitalize
|
|||
new StardewValley.Object((int)Enums.SDVObject.Wood,100),
|
||||
ModCore.ObjectManager.GetItem("SteelIngot", 20),
|
||||
ModCore.ObjectManager.GetItem("TrashCan",1),
|
||||
ModCore.ObjectManager.GetItem("SandBox",1)
|
||||
ModCore.ObjectManager.GetItem("SandBox",1),
|
||||
ModCore.ObjectManager.GetItem("Anvil",1)
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
<Compile Include="Framework\Crafting\CraftingRecipeComponent.cs" />
|
||||
<Compile Include="Framework\Crafting\MachineCraftingRecipe.cs" />
|
||||
<Compile Include="Framework\Crafting\Recipe.cs" />
|
||||
<Compile Include="Framework\Crafting\RecipeBook.cs" />
|
||||
<Compile Include="Framework\Crafting\StatCost.cs" />
|
||||
<Compile Include="Framework\Crafting\UnlockableCraftingRecipe.cs" />
|
||||
<Compile Include="Framework\Crafting\VanillaRecipeBook.cs" />
|
||||
|
|
|
@ -122,6 +122,10 @@ namespace StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons
|
|||
public void draw(SpriteBatch b,float Depth, float Alpha,bool DrawShadow)
|
||||
{
|
||||
if(this.background!=null)this.background.draw(b, this.scale, Depth,Alpha);
|
||||
if (this.item == null)
|
||||
{
|
||||
ModCore.log("ITEM IS NULL!!!!");
|
||||
}
|
||||
if(this.item!=null)this.item.drawInMenu(b, this.position, 1f,Alpha,Depth,this.drawStackNumber,this.drawColor,DrawShadow);
|
||||
}
|
||||
|
||||
|
@ -137,12 +141,20 @@ namespace StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons
|
|||
{
|
||||
if (this.background != null) this.background.draw(b,Position,this.scale, Depth, Alpha);
|
||||
if (this.item != null) this.item.drawInMenu(b, Position, 1f, Alpha, Depth, this.drawStackNumber, this.drawColor, DrawShadow);
|
||||
if (this.item == null)
|
||||
{
|
||||
ModCore.log("ITEM IS NULL!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(SpriteBatch b,float ItemScale ,float Depth, float Alpha, bool DrawShadow)
|
||||
{
|
||||
this.background.draw(b, this.scale, Depth, Alpha);
|
||||
if (this.item != null) this.item.drawInMenu(b, this.position, ItemScale, Alpha, Depth, this.drawStackNumber, this.drawColor, DrawShadow);
|
||||
if (this.item == null)
|
||||
{
|
||||
ModCore.log("ITEM IS NULL!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -155,6 +167,10 @@ namespace StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons
|
|||
/// <param name="DrawShadow">Should the shadow be drawn for the item?</param>
|
||||
public void drawJustItem(SpriteBatch b,float Scale,float Depth, float Alpha, bool DrawShadow)
|
||||
{
|
||||
if (this.item == null)
|
||||
{
|
||||
ModCore.log("ITEM IS NULL!!!!");
|
||||
}
|
||||
if (this.item != null) this.item.drawInMenu(b, this.position, Scale, Alpha, Depth, this.drawStackNumber, this.drawColor, DrawShadow);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue