public override bool LoadAudioClipAsync(string fileName, ResourceCacheType cache, Action <float, bool, AudioClip> onProcess) { return(LoadObjectAsync <AudioClip> (fileName, cache, onProcess)); }
public abstract Material LoadMaterial(string fileName, ResourceCacheType cacheType);
public abstract Texture LoadTexture(string fileName, ResourceCacheType cacheType);
public static T Get <T>(this ICache cache, ResourceCacheType type) where T : class { return(cache.Get <T>(type.ToString())); }
public abstract GameObject LoadPrefab(string fileName, ResourceCacheType cacheType);
public override ScriptableObject LoadScriptableObject(string fileName, ResourceCacheType cacheType) { return(LoadObject <ScriptableObject> (fileName, cacheType)); }
public override ShaderVariantCollection LoadShaderVarCollection(string fileName, ResourceCacheType cacheType) { return(LoadObject <ShaderVariantCollection> (fileName, cacheType)); }
public override GameObject LoadPrefab(string fileName, ResourceCacheType cacheType) { return(LoadObject <GameObject> (fileName, cacheType)); }
public override bool LoadPrefabAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, GameObject> onProcess, int priority = 0) { return(LoadObjectAsync <GameObject> (fileName, cacheType, priority, onProcess)); }
public bool LoadObjectAsync <T>(string fileName, ResourceCacheType cacheType, int priority, Action <float, bool, T> onProcess) where T : UnityEngine.Object { if (string.IsNullOrEmpty(fileName)) { return(false); } string orgFileName = fileName; #if USE_HAS_EXT T obj = FindCache <T>(orgFileName); if (obj != null) { if (AddRefCache(orgFileName, obj, cacheType, typeof(T)) != null) { if (onProcess != null) { onProcess(1.0f, true, obj); } return(true); } } #endif if (!IsResLoaderFileName(ref fileName)) { return(false); } // 同时反复调用可能产生多个Timer ResourceRequest request = Resources.LoadAsync(fileName, typeof(T)); if (request == null) { return(false); } if (request.isDone) { T orgObj = request.asset as T; if (orgObj == null) { string err = string.Format("LoadObjectAsync: ({0}) error!", fileName); LogMgr.Instance.LogError(err); return(false); } AssetCache cache = AddRefCache(orgFileName, orgObj, cacheType, typeof(T)); #if USE_HAS_EXT AddCacheMap(cache); #endif if (onProcess != null) { onProcess(request.progress, request.isDone, orgObj); } return(true); } request.priority = priority; var ret = AsyncOperationMgr.Instance.AddAsyncOperation <ResourceRequest, System.Object> (request, delegate(ResourceRequest req, bool isDone) { if (isDone) { T orgObj = req.asset as T; if (orgObj == null) { string err = string.Format("LoadObjectAsync: ({0}) error!", fileName); LogMgr.Instance.LogError(err); return; } AssetCache cache = AddRefCache(orgFileName, orgObj, cacheType, typeof(T)); #if USE_HAS_EXT AddCacheMap(cache); #endif if (onProcess != null) { onProcess(req.progress, isDone, orgObj); } } else { if (onProcess != null) { onProcess(req.progress, isDone, null); } } } ); return(ret != null); }
public override Shader LoadShader(string fileName, ResourceCacheType cacheType) { return(LoadObject <Shader>(fileName, cacheType)); }
public static void AddOrUpdate(this ICache cache, ResourceCacheType type, object value, long ttl) { cache.AddOrUpdate(type.ToString(), value, ttl); }
public override bool LoadFontAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, Font> onProcess) { return(LoadObjectAsync <Font> (fileName, cacheType, onProcess)); }
// not used addToCache public override bool LoadMaterialAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, Material> onProcess) { return(LoadObjectAsync <Material> (fileName, cacheType, onProcess)); }
public override AnimationClip LoadAnimationClip(string fileName, ResourceCacheType cacheType) { return(LoadObject <AnimationClip> (fileName, cacheType)); }
public override AudioClip LoadAudioClip(string fileName, ResourceCacheType cache) { return(LoadObject <AudioClip> (fileName, cache)); }
public override bool LoadAnimationClipAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, AnimationClip> onProcess, int priority = 0) { return(LoadObjectAsync <AnimationClip> (fileName, cacheType, priority, onProcess)); }
// not used addToCache public override Material LoadMaterial(string fileName, ResourceCacheType cacheType) { return(LoadObject <Material> (fileName, cacheType)); }
public override bool LoadScriptableObjectAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, UnityEngine.ScriptableObject> onProcess, int priority = 0) { return(LoadObjectAsync <ScriptableObject> (fileName, cacheType, priority, onProcess)); }
// not used addToCache public override Texture LoadTexture(string fileName, ResourceCacheType cacheType) { return(LoadObject <Texture> (fileName, cacheType)); }
public override bool LoadShaderVarCollectionAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, ShaderVariantCollection> onProcess, int priority = 0) { return(LoadObjectAsync <ShaderVariantCollection> (fileName, cacheType, priority, onProcess)); }
// not used addToCache public override bool LoadTextureAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, Texture> onProcess, int priority = 0) { return(LoadObjectAsync <Texture> (fileName, cacheType, priority, onProcess)); }
public static void Set(this ICache cache, ResourceCacheType type, object value, TimeSpan ts) { cache.Set(type.ToString(), value, ts); }
public override Font LoadFont(string fileName, ResourceCacheType cacheType) { return(LoadObject <Font> (fileName, cacheType)); }
public abstract bool LoadPrefabAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, GameObject> onProcess);
public override RuntimeAnimatorController LoadAniController(string fileName, ResourceCacheType cacheType) { return(LoadObject <RuntimeAnimatorController> (fileName, cacheType)); }
public abstract bool LoadMaterialAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, Material> onProcess);
public override bool LoadAniControllerAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, RuntimeAnimatorController> onProcess, int priority = 0) { return(LoadObjectAsync <RuntimeAnimatorController> (fileName, cacheType, priority, onProcess)); }
public abstract bool LoadTextureAsync(string fileName, ResourceCacheType cacheType, Action <float, bool, Texture> onProcess);
public bool LoadShaderAsync(string fileName, Action <float, bool, Shader> onProcess, ResourceCacheType cacheType) { bool ret = mAssetLoader.LoadShaderAsync(fileName, cacheType, onProcess); if (ret) { return(ret); } return(mResLoader.LoadShaderAsync(fileName, cacheType, onProcess)); }