void DownLoadOriginResource(string name, string path, _DelegateObject onLoadOk, EResourceType type) { string[] deps = _manifest.GetAllDependencies(path); Queue <string> queue = new Queue <string>(deps.Length); for (int i = 0, imax = deps.Length; i < imax; ++i) { queue.Enqueue(deps[i]); } DownLoadResInfo info = new DownLoadResInfo(); info.Assets = new AssetsResource(); info.Assets.SetNameAndPath(name, path, type); info.MainAbPath = path; info.DependenceAbPath = queue; AddAssetsResource(info.Assets); info.onLoadComplete = delegate(AssetsResource ar) { if (ar != null) { ar.LoadObject(); ar.AddRef(); onLoadOk(ar.OriginObj); } else { onLoadOk(null); } }; DownLoadMgr.Instance.AddToDownLoadQueue(info); }
public void AddToWaitList(_DelegateObject onloadok) { if (_getOriginObjList == null) { _getOriginObjList = new List <_DelegateObject>(); } _getOriginObjList.Add(onloadok); }
public void GetOriginObjAsync(string name, string path, EResourceType type, _DelegateObject onLoadOk) { //string path = ResourcePath.GetPath (type) + name + _bundleEx; AssetsResource ar; if (_originObjDic.TryGetValue(path, out ar)) { if (!ar.LoadOk) { ar.AddToWaitList(onLoadOk); return; } ar.AddRef(); onLoadOk(ar.OriginObj); } else { DownLoadOriginResource(name, path, onLoadOk, type); } }