public static AssetCallback Gen(OnAssetGot cb, string path) { AssetCallback acb = new AssetCallback(cb, path); items.Add(acb.Id, acb); return(acb); }
//通过asset路径获取asset,cb是在获取后的回调,返回值是一个索引,用于取消获取 public ulong GetAsset(string assetPath, OnAssetGot cb, bool isManifest = false) { BundleHolder holder = this.GetHolder(assetPath, isManifest); if (null != holder) { return(holder.RefBy(cb)); } cb(null, 0); return(0); }
public ulong RefBy(OnAssetGot cb) { if (this.IsLoaded()) { Ref(); DoCallback(cb); return(0); } else { AssetCallback acb = AssetCallback.Gen(cb, info.path); cbs.Add(acb); Ref(); return(acb.Id); } }
public ulong GetManifest(string assetPath, OnAssetGot cb) { return(GetAsset(assetPath, cb)); }
private AssetCallback(OnAssetGot cb, string path) { Id = ++idLast; this.cb = cb; Path = path; }
protected override void DoCallback(OnAssetGot cb) { cb(assets, 0); }
protected virtual void DoCallback(OnAssetGot cb) { cb(MyAsset, 0); }
protected override void DoCallback(OnAssetGot cb) { cb(bundle, 0); }