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:
+1
-1
@@ -5,7 +5,7 @@ using ShrinkNetwork;
|
||||
|
||||
namespace __ROOT_NAMESPACE__
|
||||
{
|
||||
public sealed class __PROJECT_NAME__Event : EventBase
|
||||
public sealed class __PROJECT_NAME__Event : IShrinkEvent
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
+4
-8
@@ -8,10 +8,10 @@ using ShrinkNetwork;
|
||||
namespace __ROOT_NAMESPACE__
|
||||
{
|
||||
[ShrinkMod("__MOD_ID__", "__DISPLAY_NAME__", "1.0.0")]
|
||||
[EventBusSubscriber]
|
||||
[ShrinkEventSubscriber(OwnerId = "__MOD_ID__", DefaultBus = "mod:__MOD_ID__")]
|
||||
[ShrinkCommandSubscriber]
|
||||
[ShrinkNetworkSubscriber]
|
||||
public sealed class __PROJECT_NAME__Mod : ShrinkModBase
|
||||
public sealed partial class __PROJECT_NAME__Mod : ShrinkModBase
|
||||
{
|
||||
private readonly RuntimeState _state = new();
|
||||
|
||||
@@ -22,11 +22,7 @@ namespace __ROOT_NAMESPACE__
|
||||
|
||||
public override void OnRegisterContent(ShrinkModContext context)
|
||||
{
|
||||
var registry = context.GetRegistry<string>("example.items");
|
||||
registry.Register(
|
||||
context.ModInfo.ModId,
|
||||
context.ModInfo.ModId + ":example_item",
|
||||
"__DISPLAY_NAME__ Item");
|
||||
context.RegisterContent("example.items", "example_item", "__DISPLAY_NAME__ Item");
|
||||
}
|
||||
|
||||
public override void OnInitialize(ShrinkModContext context)
|
||||
@@ -38,7 +34,7 @@ namespace __ROOT_NAMESPACE__
|
||||
});
|
||||
}
|
||||
|
||||
[EventSubscribe]
|
||||
[ShrinkSubscribe]
|
||||
private void OnExampleEvent(__PROJECT_NAME__Event evt)
|
||||
{
|
||||
_state.LastEventMessage = evt.Message ?? string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user