SMAPI/StardewModdingAPI/Events.cs

63 lines
1.6 KiB
C#
Raw Normal View History

2016-02-28 19:55:35 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2016-02-29 09:26:36 +08:00
using Microsoft.Xna.Framework.Input;
2016-02-28 19:55:35 +08:00
namespace StardewModdingAPI
{
public static class Events
{
public delegate void BlankEventHandler();
2016-02-29 05:01:24 +08:00
public static event BlankEventHandler GameLoaded = delegate { };
2016-02-29 09:26:36 +08:00
public static event BlankEventHandler Initialize = delegate { };
public static event BlankEventHandler LoadContent = delegate { };
2016-02-29 05:01:24 +08:00
public static event BlankEventHandler UpdateTick = delegate { };
2016-02-29 09:26:36 +08:00
public static event BlankEventHandler DrawTick = delegate { };
public delegate void StateChanged(KeyboardState newState);
public static event StateChanged KeyboardChanged = delegate { };
public delegate void KeyStateChanged(Keys key);
public static event KeyStateChanged KeyPressed = delegate { };
2016-02-28 19:55:35 +08:00
public static void InvokeGameLoaded()
{
GameLoaded.Invoke();
}
2016-02-29 05:01:24 +08:00
2016-02-29 09:26:36 +08:00
public static void InvokeInitialize()
{
Initialize.Invoke();
}
public static void InvokeLoadContent()
2016-02-29 05:01:24 +08:00
{
2016-02-29 09:26:36 +08:00
LoadContent.Invoke();
2016-02-29 05:01:24 +08:00
}
public static void InvokeUpdateTick()
{
UpdateTick.Invoke();
}
2016-02-29 09:26:36 +08:00
public static void InvokeDrawTick()
{
DrawTick.Invoke();
}
public static void InvokeKeyboardChanged(KeyboardState newState)
{
KeyboardChanged.Invoke(newState);
}
public static void InvokeKeyPressed(Keys key)
{
KeyPressed.Invoke(key);
}
2016-02-28 19:55:35 +08:00
}
}