46 throw new Exception(
"Main thread transition requested without an asset");
99 throw new Exception(
"Must be on main thread");
144 throw new Exception(
"Some assets loaded asynchronously, despite AssetRequestMode.ImmediateLoad on main thread");
249 throw new Exception(
"Asset load started without holding _requestLock");
252 asset.SetToLoadingState();
259 if (
source.Rejections.IsRejected(asset.Name))
303 throw new Exception(
"Asset transfer started without holding _requestLock");
333 while (asset.Continuation ==
null)
341 asset.Continuation();
346 asset.Continuation();
350 throw new Exception(
"Load task not completed after running continuations on main thread?");
358 throw new Exception(
"How did you get here?");
409 if (asset.State != 0)
440 asset.Value.Dispose();
static AssetLoadException FromMissingReader(string extension)
static AssetLoadException FromMissingAsset(string assetName, Exception innerException=null)
static string CleanPath(string path)
bool TryGetReader(string extension, out IAssetReader reader)
string[] GetSupportedExtensions()
async Task LoadAssetWithPotentialAsync< T >(Asset< T > asset, AssetRequestMode mode)
readonly AssetReaderCollection _readers
async Task LoadUntracked< T >(Stream stream, IAssetReader reader, Asset< T > asset, AssetRequestMode mode)
Asset< T > Request< T >(string assetName)
static void SetMainThread()
bool IsAsyncLoadingEnabled
void ReloadAssetsIfSourceChanged(AssetRequestMode mode)
virtual void SetSources(IEnumerable< IContentSource > sources, AssetRequestMode mode=AssetRequestMode.ImmediateLoad)
readonly ConcurrentQueue< Action > _assetTransferQueue
readonly Dictionary< Type, Action< IAsset, AssetRequestMode > > _typeSpecificReloadActions
IAsset[] GetLoadedAssets()
static Thread _mainThread
void TransferCompletedAssets()
AssetRepository(AssetReaderCollection readers, IEnumerable< IContentSource > sources=null)
void EnsureReloadActionExistsForType< T >()
readonly object _requestLock
void ForceReloadAsset< T >(IAsset asset, AssetRequestMode mode)
void SafelyWaitForLoad< T >(Asset< T > asset, Task loadTask, bool tracked)
readonly Dictionary< string, IAsset > _assets
IContentSource FindSourceForAsset(string assetName)
virtual void Dispose(bool disposing)
void Invoke(Action action)
static void ThrowIfNotMainThread()
void LoadAsset< T >(Asset< T > asset, AssetRequestMode mode)
Asset< T > CreateUntracked< T >(Stream stream, string name, AssetRequestMode mode=AssetRequestMode.ImmediateLoad)
FailedToLoadAssetCustomAction AssetLoadFailHandler
void ForceReloadAsset(IAsset asset, AssetRequestMode mode)
IContentSource[] _sources
Async loading has been fully integrated into AssetRepository Assets which are asynchronously loaded w...
bool TryDequeue([MaybeNullWhen(false)] out T result)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static ? string GetExtension(string? path)
static int Decrement(ref int location)
static int Increment(ref int location)
static bool IsEntered(object obj)
static YieldAwaitable Yield()
static Thread CurrentThread
delegate void FailedToLoadAssetCustomAction(string assetName, Exception e)
readonly AssetRepository repository
ContinuationScheduler(IAsset asset, AssetRepository repository)
void OnCompleted(Action continuation)