diff options
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r-- | src/SMAPI/Events/EventPriority.cs | 29 | ||||
-rw-r--r-- | src/SMAPI/Events/EventPriorityAttribute.cs | 29 |
2 files changed, 58 insertions, 0 deletions
diff --git a/src/SMAPI/Events/EventPriority.cs b/src/SMAPI/Events/EventPriority.cs new file mode 100644 index 00000000..17f5fbb7 --- /dev/null +++ b/src/SMAPI/Events/EventPriority.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Events +{ + /// <summary> + /// Event priority for method handlers. + /// </summary> + public enum EventPriority + { + /// <summary> + /// Low priority. + /// </summary> + Low = 3, + + /// <summary> + /// Normal priority. This is the default. + /// </summary> + Normal = 2, + + /// <summary> + /// High priority. + /// </summary> + High = 1, + } +} diff --git a/src/SMAPI/Events/EventPriorityAttribute.cs b/src/SMAPI/Events/EventPriorityAttribute.cs new file mode 100644 index 00000000..c5683931 --- /dev/null +++ b/src/SMAPI/Events/EventPriorityAttribute.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewModdingAPI.Events +{ + /// <summary> + /// An attribute for controlling event priority of an event handler. + /// </summary> + [AttributeUsage(AttributeTargets.Method)] + public class EventPriorityAttribute : System.Attribute + { + /// <summary> + /// The priority for the method marked by this attribute. + /// </summary> + public EventPriority Priority { get; } + + /// <summary> + /// Constructor. + /// </summary> + /// <param name="priority">The priority for method marked by this attribute.</param> + public EventPriorityAttribute( EventPriority priority ) + { + this.Priority = priority; + } + } +} |