Stardew_Valley_Mods/GeneralMods/BuyBackCollectables/BuyBackCollectables.cs

44 lines
1.4 KiB
C#
Raw Normal View History

using Omegasis.BuyBackCollectables.Framework;
2017-07-28 08:28:39 +08:00
using StardewModdingAPI;
using StardewModdingAPI.Events;
2017-07-28 08:28:39 +08:00
using StardewValley;
2017-07-28 08:28:39 +08:00
namespace Omegasis.BuyBackCollectables
{
/// <summary>The mod entry point.</summary>
public class BuyBackCollectables : Mod
{
/*********
2019-01-06 15:23:07 +08:00
** Fields
*********/
/// <summary>The mod configuration.</summary>
private ModConfig Config;
/*********
** 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>
public override void Entry(IModHelper helper)
{
this.Config = helper.ReadConfig<ModConfig>();
2019-01-06 15:21:06 +08:00
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
}
/*********
** 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>
/// <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)
{
2019-01-06 15:21:06 +08:00
if (Context.IsPlayerFree && e.Button == this.Config.KeyBinding)
Game1.activeClickableMenu = new BuyBackMenu(this.Config.CostMultiplier);
}
}
}