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:
2026-08-26 01:15:48 +08:00
parent 67d32795c4
commit ad5a7b68a3
129 changed files with 5071 additions and 5584 deletions
@@ -0,0 +1,18 @@
{
"name": "ShrinkNetwork.Integration.EventBus.Tests",
"rootNamespace": "ShrinkNetwork.Integration.EventBus.Tests",
"references": [
"ShrinkNetwork.Integration.EventBus",
"ShrinkNetwork.Runtime",
"ShrinkEventBus.Runtime",
"UniTask",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": ["Editor"],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"autoReferenced": false,
"defineConstraints": ["UNITY_INCLUDE_TESTS"]
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 132ab80308b64e7abf3a68bb161b7d2f
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,36 @@
#nullable enable
using NUnit.Framework;
using ShrinkEventBus;
namespace ShrinkNetwork.Integration.EventBus.Tests
{
[ShrinkNetworkEvent]
[ShrinkNetworkMessage(49001, "tests/generated_event")]
internal sealed class GeneratedNetworkEvent : IShrinkEvent, IShrinkNetworkMessage
{
}
public sealed class ShrinkNetworkEventCodeGenTests
{
[Test]
public void GeneratedRegistrationAddsNetworkEventToService()
{
var service = new ShrinkNetworkService(
new ShrinkJsonNetworkSerializer(),
new ShrinkNetworkMessageRegistry(),
new ShrinkNetworkRouter());
ShrinkNetworkEventBusBridge.RegisterService(service);
try
{
Assert.IsTrue(service.MessageRegistry.TryGetMeta(typeof(GeneratedNetworkEvent), out var meta));
Assert.AreEqual(49001, meta!.Opcode);
Assert.AreEqual("tests/generated_event", meta.Route);
}
finally
{
ShrinkNetworkEventBusBridge.UnregisterService(service);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d790812eb9845b0820da061de4d7fe5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: