public AssetNotLoadedException(Type type, string path, IAssetLoaderParameters param = null) : base(string.Format("Asset not loaded: '{0}' ({1})", path, type)) { this.Type = type; this.Path = path; this.Params = param; }
/// <summary> /// Returns the asset associated with the specified path. /// Throws an AssetNotLoadedException if no asset is found. /// </summary> public T Get <T>(string path, IAssetLoaderParameters param = null) { Type type = typeof(T); if (type == null) { throw new AssetNotLoadedException(typeof(T), path); } using (Key.Lock(assets)) { IReferencedObject ro = assets.Get(new AssetDescriptor(type, path, param), null); if (ro == null) { throw new AssetNotLoadedException(typeof(T), path); } object result = ro.Asset; if (result == null) { throw new AssetNotLoadedException(typeof(T), path); } return((T)result); } }
// // Methods used to schedule the loading of an asset, or immediate unloading thereof. // #region Load / Unload Methods /// <summary> /// Schedules the specified asset for loading. The request will not be processed /// until Update() is called. /// </summary> public void Load <T>(string path, IAssetLoaderParameters param = null) { if (path == null) { throw new ArgumentNullException("path"); } Load(new AssetDescriptor(typeof(T), path, param)); }
public static AssetDescriptor Create <T>(string path, IAssetLoaderParameters param = null) { if (path != null) { path = path.Replace("\\", "/"); } return(new AssetDescriptor(typeof(T), path, param)); }
public AssetDescriptor(Type type, string path, IAssetLoaderParameters param = null) { if (path != null) { path = path.Replace("\\", "/"); } Type = type; Path = path; Params = param; }
public bool IsLoaded(Type type, string path, IAssetLoaderParameters param = null) { if (type == null || path == null) { return(false); } using (Key.Lock(assets)) { return(assets.ContainsKey(new AssetDescriptor(type, path))); } }
/// <summary> /// Schedules the specified asset for loading. The request will not be processed /// until Update() is called. /// </summary> public void Load(Type type, string path, IAssetLoaderParameters param = null) { if (type == null) { throw new ArgumentNullException("type"); } if (path == null) { throw new ArgumentNullException("path"); } Load(new AssetDescriptor(type, path, param)); }
public int GetRefCount <T>(string path, IAssetLoaderParameters param = null) { if (path == null) { throw new ArgumentNullException("path"); } using (Key.Lock(assets)) { AssetDescriptor desc = AssetDescriptor.Create <T>(path, param); if (assets.ContainsKey(desc)) { return(assets[desc].RefCount); } return(0); } }
/// <summary> /// Unloads the asset associated with the specified path. /// If there are no references left to the asset, it is removed and destroyed, if needed. /// </summary> public void Unload <T>(string path, IAssetLoaderParameters param = null) { Unload(new AssetDescriptor(typeof(T), path, param)); }
/// <summary> /// Unloads the asset associated with the specified path. /// If there are no references left to the asset, it is removed and destroyed, if needed. /// </summary> public void Unload(Type type, string path, IAssetLoaderParameters param = null) { Unload(new AssetDescriptor(type, path, param)); }
public abstract object LoadSync( AssetManager manager, string path, FileInfo fileHandle, IAssetLoaderParameters param );
public abstract object LoadSync(AssetManager manager, string path, FileInfo fileHandle, IAssetLoaderParameters param);
/// <param name="fileName">Name of the asset to load</param> /// <param name="fileHandle">The resolved file to load</param> /// <param name="param">parameters for loading the asset</param> public abstract List <AssetDescriptor> GetDependencies(AssetManager manager, string fileName, FileInfo fileHandle, IAssetLoaderParameters param);