internal override GOEAsset SetAsset(string name, UnityEngine.Object obj, string bundleName = null) { GOEAsset asset = new GOEAsset(obj, name, bundleName); cacheMgr.Cache.AddAsset(name, asset); return(asset); }
public void AddAsset(string name, GOEAsset asset) { if (!loadedAssets.ContainsKey(name)) { loadedAssets[name] = asset; assetList.Add(asset); } }
public void AddAsset(string name, GOEAsset asset) { GOEAsset old; if (addedAssets.TryGetValue(name, out old)) { old.ReleaseAsset(true); } addedAssets[name] = asset; }
internal virtual GOEAsset SetAsset(string name, UnityEngine.Object obj, string bundleName = null) { GOEAsset asset = new GOEAsset(obj, name, bundleName); GOEAsset oldAsset; if (mDicAsset.TryGetValue(name, out oldAsset)) { oldAsset.ReleaseAsset(true); } mDicAsset[name] = asset; return(asset); }
protected virtual void OnLoadAudio(string name, UnityEngine.Object obj) { AudioClip audioclip = obj as AudioClip; GOEAsset old; if (mDicAsset.TryGetValue(name, out old)) { Logger.GetFile(LogFile.Res).LogError(name + " already in mDicAudio"); } Resource res = GetDownloadResource(name); GOEAsset asset = SetAsset(name, audioclip); }
internal void GetAsset(string name, Action <string, UnityEngine.Object> callback, LoadPriority priority = LoadPriority.Default) { if (name == null || name == string.Empty) { return; } if (HasLoaded(name)) { if (callback != null) { GetAssetInCache(name, callback); } return; } #if UNITY_EDITOR UnityEngine.Object obj = LoadFromPrefab(name, typeof(UnityEngine.Object)); if (obj != null) { SetAsset(name, obj).Reference = 1; if (callback != null) { callback(name, GOEAsset.InstanceAsset(obj, name)); } return; } #endif string bundleName = ResourceMgr.GetBundleName(name); if (bundleName == string.Empty) { Logger.GetFile(LogFile.Res).LogError("can not find asset: " + name); return; } if (!cacheMgr.HasLoadingInfo(bundleName)) { Resource res = this.GetDownloadResource(bundleName); if (res == null) { res = this.CreateResource(bundleName, priority); res.LoadRes(); } //逻辑加载时,提高优先级// if (res.Loader.Priority < priority) { this.ResourceMgr.GOELoaderMgr.SetLoaderPriority(res.Loader, priority); } } cacheMgr.AddCallbackToDic(name, callback); }
void InvokeAssetLoaded(GOEAsset asset) { LinkedList <Action <string, UnityEngine.Object> > list = null; if (assetLoadedCallbacks.TryGetValue(asset.Name, out list)) { LinkedListNode <Action <string, UnityEngine.Object> > cur = list.First; while (cur != null) { try { asset.GetAsset(cur.Value); } catch (Exception ex) { Debug.LogError(ex.ToString()); } cur = cur.Next; } assetLoadedCallbacks.Remove(asset.Name); } }
private GOEAsset OnGotAsset(string name, UnityEngine.Object obj, string bundleName) { GOEAsset asset = new GOEAsset(obj, name, bundleName); return(asset); }