diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-10-06 00:51:45 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-10-06 00:51:45 -0400 |
commit | 79705448f57c962e9331fb802097c24d2424476c (patch) | |
tree | 06b15229f7f9089af864fa0f948f209bc5aec51a /src/SMAPI/Framework/SModHooks.cs | |
parent | 14fab29370310a762a000c50b23075326b4e95da (diff) | |
download | SMAPI-79705448f57c962e9331fb802097c24d2424476c.tar.gz SMAPI-79705448f57c962e9331fb802097c24d2424476c.tar.bz2 SMAPI-79705448f57c962e9331fb802097c24d2424476c.zip |
add DayEnding event (#310)
Diffstat (limited to 'src/SMAPI/Framework/SModHooks.cs')
-rw-r--r-- | src/SMAPI/Framework/SModHooks.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/SModHooks.cs b/src/SMAPI/Framework/SModHooks.cs new file mode 100644 index 00000000..9f0201c8 --- /dev/null +++ b/src/SMAPI/Framework/SModHooks.cs @@ -0,0 +1,34 @@ +using System; +using StardewValley; + +namespace StardewModdingAPI.Framework +{ + /// <summary>Invokes callbacks for mod hooks provided by the game.</summary> + internal class SModHooks : ModHooks + { + /********* + ** Properties + *********/ + /// <summary>A callback to invoke before <see cref="Game1.newDayAfterFade"/> runs.</summary> + private readonly Action BeforeNewDayAfterFade; + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="beforeNewDayAfterFade">A callback to invoke before <see cref="Game1.newDayAfterFade"/> runs.</param> + public SModHooks(Action beforeNewDayAfterFade) + { + this.BeforeNewDayAfterFade = beforeNewDayAfterFade; + } + + /// <summary>A hook invoked when <see cref="Game1.newDayAfterFade"/> is called.</summary> + /// <param name="action">The vanilla <see cref="Game1.newDayAfterFade"/> logic.</param> + public override void OnGame1_NewDayAfterFade(Action action) + { + this.BeforeNewDayAfterFade?.Invoke(); + action(); + } + } +} |