Files
Workspace/Godot/Packages/ShrinkSDK.Context.AppAdapter/Runtime/ShrinkContextAppHost.cs
T
cneicy 88ba3cdc48
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s
feat: add Godot C# compatibility and shared codegen weaving
2026-09-05 02:37:43 +08:00

32 lines
1.1 KiB
C#

#nullable enable
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using ShrinkApp;
namespace ShrinkContext.AppAdapter;
public sealed class ShrinkContextAppHost
{
private readonly ShrinkContextRuntime _runtime = new();
private readonly ShrinkComponentCatalog _catalog = new();
private readonly ShrinkContextLoader _loader;
public ShrinkContextAppHost(ShrinkAppServices? services = null)
{
Services = services ?? new ShrinkAppServices();
_loader = new ShrinkContextLoader(_runtime, _catalog);
}
public ShrinkAppServices Services { get; }
public ShrinkContextRuntime Runtime => _runtime;
public ShrinkLoaderTransactionDiagnostic? LastTransaction => _loader.LastTransaction;
public void Register(string name, Func<IShrinkComponent> factory) => _catalog.Register(name, factory);
public void Register<TComponent>(string name) where TComponent : IShrinkComponent, new() =>
_catalog.Register<TComponent>(name);
public UniTask ApplyAsync(IReadOnlyList<ShrinkLoaderEntry> entries) => _loader.ApplyAsync(entries);
public UniTask ShutdownAsync() => _runtime.ShutdownAsync();
}