using LyraApi.Ecs; using ExampleWorld.wit.imports.lyra.api; 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_REP: Console.WriteLine($"Got the resource rep: {result.AsWasmResourceRep}"); var handle = new IAsset.AssetManager.THandle((int)result.AsWasmResourceRep); var inner = new IAsset.AssetManager(handle); return new AssetManager(inner); 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(); } }