45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
#nullable enable
|
|
|
|
using ShrinkCommand.Integration.App;
|
|
using ShrinkCommand.Integration;
|
|
using ShrinkContext.AppAdapter;
|
|
using ShrinkDataSaver.Integration.App;
|
|
using ShrinkDataSaver.Integration;
|
|
using ShrinkNetwork.Integration.App;
|
|
using ShrinkNetwork.Integration;
|
|
using UnityEngine;
|
|
|
|
namespace ShrinkApp.Starter.Basic
|
|
{
|
|
/// <summary>
|
|
/// Basic Starter 的组合根:ContextLoader 模式下默认使用原生 Cordis 组件,
|
|
/// 不再把三个功能模块交给 IShrinkAppModuleInstaller 包装器执行。
|
|
/// </summary>
|
|
public static class ShrinkAppBasicContextComposition
|
|
{
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
private static void RegisterDefaultComposition()
|
|
{
|
|
ShrinkAppLoaderBootstrapper.DefaultComposition = Configure;
|
|
}
|
|
|
|
public static void Configure(ShrinkAppLoaderHost host)
|
|
{
|
|
if (host == null)
|
|
throw new System.ArgumentNullException(nameof(host));
|
|
|
|
host.OverrideModuleComponent("shrink.network", static () => new ShrinkNetworkAppComponent());
|
|
host.OverrideModuleComponent("shrink.command", static () => new ShrinkCommandAppComponent());
|
|
host.OverrideModuleComponent("shrink.datasaver", static () => new ShrinkDataSaverAppComponent());
|
|
host.AddModuleComponent("shrink.integration.command-network",
|
|
static () => new ShrinkCommandNetworkIntegrationComponent());
|
|
host.AddModuleComponent("shrink.integration.command-eventbus",
|
|
static () => new ShrinkCommandEventBusComponent());
|
|
host.AddModuleComponent("shrink.integration.datasaver-eventbus",
|
|
static () => new ShrinkDataSaverEventBusComponent());
|
|
host.AddModuleComponent("shrink.integration.network-eventbus",
|
|
static () => new ShrinkNetworkEventBusComponent());
|
|
}
|
|
}
|
|
}
|