using LyraApi.Ecs; using ExampleWorld.wit.imports.lyra.api; using System.Numerics; namespace LyraApi.Asset; public class AssetManager(IAsset.AssetManager assetManager) : IResource { internal IAsset.AssetManager inner = assetManager; public static ulong TypeId => 567234789345; public static object? FromWasmResult(IEcs.WorldResourceResult result) { switch (result.Tag) { case IEcs.WorldResourceResult.NONE: return null; case IEcs.WorldResourceResult.WASM_RESOURCE: var handle = IAsset.AssetManager.FromEcsResource(result.AsWasmResource) ?? throw new MismatchedResourceResultException(); return new AssetManager(handle); case IEcs.WorldResourceResult.BYTES: return null; default: return null; } } public UntypedHandle Request(string path) { return new UntypedHandle(inner.Request(path)); } public Handle Request(string path) where T : IAssetHandle { return Request(path).AsHandle(); } }