lyra-wasm-scripting-test/guests/csharp/dotnet-guest-test/LyraApi/Asset/Handle.cs

34 lines
734 B
C#
Raw Permalink Normal View History

namespace LyraApi.Asset;
public class Handle<T>(UntypedHandle handle) where T : IAssetHandle
{
internal UntypedHandle inner = handle;
public bool Watched { get => inner.Watched; }
public ulong Version { get => inner.Version; }
public Guid Uuid { get => inner.Uuid; }
public string? Path { get => inner.Path; }
public bool IsLoaded { get => inner.IsLoaded; }
public void WaitForLoad()
{
inner.WaitForLoad();
}
public void WaitForLoadRecursive()
{
inner.WaitForLoadRecursive();
}
public T? GetData()
{
if (IsLoaded)
{
return (T?)T.FromRawHandle(inner);
}
else
{
return default;
}
}
}