public void Init(string resRootDir) { ResRootDir = resRootDir; if (!ResRootDir.EndsWith("/")) { ResRootDir += "/"; } #if UNITY_EDITOR StreamingAssetsPath = Application.dataPath + "/../AssetBundles/" + RunPlatform + "/"; //editor下的streaming就是打包的目录,稍微改了下(并不是工程目录下Streaming下的目录 ResourceLoadPath = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/"; FILE_SYMBOL = @"file://"; OUTER_FILE_SYMBOL = @"file:///"; #elif (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) StreamingAssetsPath = Application.dataPath + "/StreamingAssets/AssetBundles/" + RunPlatform + "/"; ResourceLoadPath = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/"; FILE_SYMBOL = @"file://"; OUTER_FILE_SYMBOL = @"file:///"; #elif UNITY_IOS StreamingAssetsPath = Application.dataPath + "/Raw/AssetBundles/" + RunPlatform + "/"; ResourceLoadPath = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/"; FILE_SYMBOL = "file://"; OUTER_FILE_SYMBOL = "file://"; #elif UNITY_ANDROID StreamingAssetsPath = Application.dataPath + "!/assets/AssetBundles/" + RunPlatform + "/"; ResourceLoadPath = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/"; FILE_SYMBOL = "jar:file://"; OUTER_FILE_SYMBOL = "file://"; #endif _resourceMgr = gameObject.AddComponentOnce <ResourceMgr>(); _assetBundleMgr = gameObject.AddComponentOnce <AssetBundleMgr>(); }
public MultiResourceLoader(ResourceMgr resourceMgr) { _resourceMgr = resourceMgr; _loadList = new List <string>(); _mapRes = new Dictionary <string, Resource>(); _mapTryGetRes = new Dictionary <string, List <Action <Resource> > >(); _finishCount = 0; }
protected void Init() { _resMgr = this.gameObject.AddComponentOnce <ResourceMgr>(); _inResourcesLoader = this.gameObject.AddComponentOnce <InResourcesLoader>(); _wwwLoader = this.gameObject.AddComponentOnce <WWWResLoader>(); _outResourcesLoader = this.gameObject.AddComponentOnce <OutResourcesLoader>(); _inResourcesLoader.OnResourceDone += OnResourceDone; _wwwLoader.OnResourceDone += OnResourceDone; _outResourcesLoader.OnResourceDone += OnResourceDone; _waitingList = new LinkedList <Resource>(); _loadingList = new LinkedList <Resource>(); }
public void Clear() { if (_finishCount < _loadList.Count) { for (int i = 0; i < _loadList.Count; i++) { _resourceMgr.RemoveListener(_loadList[i], OnFinish, OnFinish); } } _mapTryGetRes.Clear(); _finishCount = 0; _loadList.Clear(); foreach (var item in _mapRes) { item.Value.Release(); } _mapRes.Clear(); this._OnComplete = null; this._OnProgress = null; _resourceMgr = null; }