feat(sdk): migrate to EventBus 2.0
Replace the legacy EventBase runtime with generated multi-bus bindings and explicit scheduling. Migrate app, data, network, demo, and mod consumers; add generated network-event registration and owner-scoped mod content overrides.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
namespace ShrinkEventBus
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class ShrinkEventSubscriberAttribute : Attribute
|
||||
{
|
||||
public string OwnerId { get; set; } = string.Empty;
|
||||
public string DefaultBus { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class ShrinkSubscribeAttribute : Attribute
|
||||
{
|
||||
public string Bus { get; set; } = string.Empty;
|
||||
public ShrinkEventPriority Priority { get; set; } = ShrinkEventPriority.Normal;
|
||||
public int NumericPriority { get; set; }
|
||||
public bool ReceiveCanceled { get; set; }
|
||||
|
||||
public ShrinkSubscribeAttribute() { }
|
||||
|
||||
public ShrinkSubscribeAttribute(ShrinkEventPriority priority, bool receiveCanceled = false)
|
||||
{
|
||||
Priority = priority;
|
||||
ReceiveCanceled = receiveCanceled;
|
||||
}
|
||||
|
||||
public ShrinkSubscribeAttribute(int priority)
|
||||
{
|
||||
NumericPriority = priority;
|
||||
Priority = priority switch
|
||||
{
|
||||
>= 100 => ShrinkEventPriority.Highest,
|
||||
>= 50 => ShrinkEventPriority.High,
|
||||
>= 0 => ShrinkEventPriority.Normal,
|
||||
>= -50 => ShrinkEventPriority.Low,
|
||||
_ => ShrinkEventPriority.Lowest
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
|
||||
public sealed class ShrinkEventAttribute : Attribute
|
||||
{
|
||||
public ShrinkDispatchMode Dispatch { get; set; } = ShrinkDispatchMode.Ordered;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user