2018-12-30 18:00:05 +08:00
|
|
|
using Omegasis.BuyBackCollectables.Framework;
|
2017-07-28 08:28:39 +08:00
|
|
|
using StardewModdingAPI;
|
2017-07-30 02:18:46 +08:00
|
|
|
using StardewModdingAPI.Events;
|
2017-07-28 08:28:39 +08:00
|
|
|
using StardewValley;
|
2016-10-13 14:28:13 +08:00
|
|
|
|
2017-07-28 08:28:39 +08:00
|
|
|
namespace Omegasis.BuyBackCollectables
|
2016-10-13 14:28:13 +08:00
|
|
|
{
|
2017-07-30 02:18:46 +08:00
|
|
|
/// <summary>The mod entry point.</summary>
|
|
|
|
public class BuyBackCollectables : Mod
|
2016-10-13 14:28:13 +08:00
|
|
|
{
|
2017-07-30 02:18:46 +08:00
|
|
|
/*********
|
2019-01-06 15:23:07 +08:00
|
|
|
** Fields
|
2017-07-30 02:18:46 +08:00
|
|
|
*********/
|
2017-08-06 03:51:44 +08:00
|
|
|
/// <summary>The mod configuration.</summary>
|
|
|
|
private ModConfig Config;
|
2016-12-09 08:34:28 +08:00
|
|
|
|
2017-07-30 02:18:46 +08:00
|
|
|
|
|
|
|
/*********
|
|
|
|
** Public methods
|
|
|
|
*********/
|
|
|
|
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
|
|
|
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
2016-12-09 08:34:28 +08:00
|
|
|
public override void Entry(IModHelper helper)
|
2016-10-13 14:28:13 +08:00
|
|
|
{
|
2017-08-06 03:51:44 +08:00
|
|
|
this.Config = helper.ReadConfig<ModConfig>();
|
|
|
|
|
2019-01-06 15:21:06 +08:00
|
|
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
2016-12-09 08:34:28 +08:00
|
|
|
}
|
|
|
|
|
2016-10-13 14:28:13 +08:00
|
|
|
|
2017-07-30 02:18:46 +08:00
|
|
|
/*********
|
|
|
|
** Private methods
|
|
|
|
*********/
|
2019-01-06 15:21:06 +08:00
|
|
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
2017-07-30 02:18:46 +08:00
|
|
|
/// <param name="sender">The event sender.</param>
|
2019-01-06 15:21:06 +08:00
|
|
|
/// <param name="e">The event arguments.</param>
|
|
|
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
2016-10-13 14:28:13 +08:00
|
|
|
{
|
2019-01-06 15:21:06 +08:00
|
|
|
if (Context.IsPlayerFree && e.Button == this.Config.KeyBinding)
|
2017-08-06 03:51:44 +08:00
|
|
|
Game1.activeClickableMenu = new BuyBackMenu(this.Config.CostMultiplier);
|
2016-10-13 14:28:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|