diff options
Diffstat (limited to 'StardewModdingAPI/Events/Game.cs')
-rw-r--r-- | StardewModdingAPI/Events/Game.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/StardewModdingAPI/Events/Game.cs b/StardewModdingAPI/Events/Game.cs new file mode 100644 index 00000000..d155ba2e --- /dev/null +++ b/StardewModdingAPI/Events/Game.cs @@ -0,0 +1,57 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StardewModdingAPI.Events
+{
+ public static class GameEvents
+ {
+ public static event EventHandler GameLoaded = delegate { };
+ public static event EventHandler Initialize = delegate { };
+ public static event EventHandler LoadContent = delegate { };
+ public static event EventHandler UpdateTick = delegate { };
+
+ public static void InvokeGameLoaded()
+ {
+ GameLoaded.Invoke(null, EventArgs.Empty);
+ }
+
+ public static void InvokeInitialize()
+ {
+ try
+ {
+ Initialize.Invoke(null, EventArgs.Empty);
+ }
+ catch (Exception ex)
+ {
+ Program.LogError("An exception occured in XNA Initialize: " + ex.ToString());
+ }
+ }
+
+ public static void InvokeLoadContent()
+ {
+ try
+ {
+ LoadContent.Invoke(null, EventArgs.Empty);
+ }
+ catch (Exception ex)
+ {
+ Program.LogError("An exception occured in XNA LoadContent: " + ex.ToString());
+ }
+ }
+
+ public static void InvokeUpdateTick()
+ {
+ try
+ {
+ UpdateTick.Invoke(null, EventArgs.Empty);
+ }
+ catch (Exception ex)
+ {
+ Program.LogError("An exception occured in XNA UpdateTick: " + ex.ToString());
+ }
+ }
+ }
+}
|