Updated machine inventory menu to update when an item is crafted.
This commit is contained in:
parent
048dfc9dc0
commit
5e5c15f692
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Revitalize.Framework.Crafting;
|
||||
using Revitalize.Framework.Menus.Machines;
|
||||
using Revitalize.Framework.Menus.MenuComponents;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Objects.Machines;
|
||||
|
@ -121,6 +122,8 @@ namespace Revitalize.Framework.Menus
|
|||
{
|
||||
this.inventory = Game1.player.Items;
|
||||
}
|
||||
|
||||
if (Game1.activeClickableMenu is MachineMenu) (Game1.activeClickableMenu as MachineMenu).updateInventoryMenuIfPossible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -457,5 +457,12 @@ namespace Revitalize.Framework.Menus
|
|||
{
|
||||
if (this.displayTrashedItem && this.trashedItem.item!=null) IClickableMenu.drawToolTip(b, this.trashedItem.item.getDescription(), this.trashedItem.item.DisplayName, this.trashedItem.item, false, -1, 0, -1, -1, (CraftingRecipe)null, -1);
|
||||
}
|
||||
|
||||
|
||||
public void updateInventory()
|
||||
{
|
||||
this.playerInventory.populateClickableItems();
|
||||
this.otherInventory.populateClickableItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ using StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons;
|
|||
|
||||
namespace Revitalize.Framework.Menus.Machines
|
||||
{
|
||||
/// <summary>
|
||||
/// Need to
|
||||
/// </summary>
|
||||
public class MachineMenu : IClickableMenuExtended
|
||||
{
|
||||
|
||||
|
@ -148,5 +151,13 @@ namespace Revitalize.Framework.Menus.Machines
|
|||
|
||||
this.drawMouse(b);
|
||||
}
|
||||
|
||||
public void updateInventoryMenuIfPossible()
|
||||
{
|
||||
if (this.menuPages.ContainsKey("Inventory"))
|
||||
{
|
||||
(this.menuPages["Inventory"].Value as InventoryTransferMenu).updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
|
||||
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);
|
||||
CraftingMenuV1 craftingMenu = CraftingRecipeBook.CraftingRecipesByGroup[this.craftingRecipeBook].getCraftingMenuForMachine(100, 100, 400, 700, ref this.InventoryManager.items,ref this.InventoryManager.items,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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue