2018-12-30 18:00:05 +08:00
|
|
|
using Microsoft.Xna.Framework;
|
2018-05-01 09:21:31 +08:00
|
|
|
using Netcode;
|
2017-02-22 15:29:00 +08:00
|
|
|
using StardewModdingAPI;
|
|
|
|
using StardewValley;
|
2017-07-28 08:28:39 +08:00
|
|
|
using StardewValley.Menus;
|
2017-02-22 15:29:00 +08:00
|
|
|
|
2017-07-31 11:07:07 +08:00
|
|
|
namespace Omegasis.SaveAnywhere.Framework
|
2017-02-22 15:29:00 +08:00
|
|
|
{
|
2017-07-31 06:26:22 +08:00
|
|
|
/// <summary>A subclass of <see cref="ShippingMenu"/> that does everything except save.</summary>
|
|
|
|
internal class NewShippingMenu : ShippingMenu
|
2017-02-22 15:29:00 +08:00
|
|
|
{
|
2017-07-31 06:26:22 +08:00
|
|
|
/*********
|
|
|
|
** Properties
|
|
|
|
*********/
|
|
|
|
/// <summary>The private field on the shipping menu which indicates the game has already been saved, which prevents it from saving.</summary>
|
2018-01-11 05:14:19 +08:00
|
|
|
private readonly IReflectedField<bool> SavedYet;
|
2017-02-22 15:29:00 +08:00
|
|
|
|
|
|
|
|
2017-07-31 06:26:22 +08:00
|
|
|
/*********
|
|
|
|
** Public methods
|
|
|
|
*********/
|
|
|
|
/// <summary>Construct an instance.</summary>
|
|
|
|
/// <param name="items">The shipping bin items.</param>
|
|
|
|
/// <param name="reflection">Simplifies access to game code.</param>
|
2018-05-01 09:21:31 +08:00
|
|
|
public NewShippingMenu(NetCollection<Item> items, IReflectionHelper reflection)
|
2017-07-31 06:26:22 +08:00
|
|
|
: base(items)
|
2017-02-22 15:29:00 +08:00
|
|
|
{
|
2018-01-11 05:14:19 +08:00
|
|
|
this.SavedYet = reflection.GetField<bool>(this, "savedYet");
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Overrides some base functionality of the shipping menu to enable proper closing.</summary>
|
2018-01-11 05:14:19 +08:00
|
|
|
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);
|
2017-02-22 15:29:00 +08:00
|
|
|
}
|
|
|
|
|
2017-07-31 06:26:22 +08:00
|
|
|
/// <summary>Updates the menu during the game's update loop.</summary>
|
|
|
|
/// <param name="time">The game time that has passed.</param>
|
2017-02-22 15:29:00 +08:00
|
|
|
public override void update(GameTime time)
|
|
|
|
{
|
2017-07-31 06:26:22 +08:00
|
|
|
this.SavedYet.SetValue(true); // prevent menu from saving
|
2017-02-22 15:29:00 +08:00
|
|
|
base.update(time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|