using System.Collections.Generic;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Menus;
namespace Omegasis.SaveAnywhere.Framework
{
/// A subclass of that does everything except save.
internal class NewShippingMenu : ShippingMenu
{
/*********
** Properties
*********/
/// The private field on the shipping menu which indicates the game has already been saved, which prevents it from saving.
private readonly IReflectedField SavedYet;
/*********
** Public methods
*********/
/// Construct an instance.
/// The shipping bin items.
/// Simplifies access to game code.
public NewShippingMenu(List- items, IReflectionHelper reflection)
: base(items)
{
this.SavedYet = reflection.GetField(this, "savedYet");
}
///
/// Overrides some base functionality of the shipping menu to enable proper closing.
///
///
///
///
public override void receiveLeftClick(int x, int y, bool playSound = true)
{
if (this.okButton.containsPoint(x, y)) this.exitThisMenu(true);
base.receiveLeftClick(x, y, playSound);
}
/// Updates the menu during the game's update loop.
/// The game time that has passed.
public override void update(GameTime time)
{
this.SavedYet.SetValue(true); // prevent menu from saving
base.update(time);
}
}
}