public UnityEngine.Object GetAsset(string path) { UnityEngine.Object ret = null; if (mObs.TryGetValue(path, out ret)) { return(ret); } if (null != mCurElems) { PatcherElem.Elem elem = null; if (mCurElems.mDic.TryGetValue(path, out elem)) { if (elem.mDepends != null && elem.mDepends.Length > 0) { foreach (var d in elem.mDepends) { GetAsset(d); } } AssetBundle ab = AssetBundle.LoadFromFile(Application.persistentDataPath + "/" + path); if (null != ab) { ret = ab.LoadAsset(path); mObs[path] = ret; mAssets[path] = ab; } } } return(ret); }
bool IsDepenceLoaded(string path) { if (null != mCurElems) { PatcherElem.Elem elem = null; if (mCurElems.mDic.TryGetValue(path, out elem)) { if (elem.mDepends != null && elem.mDepends.Length > 0) { foreach (var d in elem.mDepends) { if (!mObs.ContainsKey(path)) { return(false); } } } else { return(true); } } return(true); } return(true); }
public void LoadAssetAsyn(string path, System.Action <UnityEngine.Object> callback) { if (mObs.ContainsKey(path)) { if (null != callback) { callback(mObs[path]); } } else { if (mReqs.ContainsKey(path)) { if (null != callback) { BundleRequest br = new BundleRequest(); br.mPath = path; br.mCallback = callback; mBuff.Add(br); } } else { if (null != mCurElems) { PatcherElem.Elem elem = null; if (mCurElems.mDic.TryGetValue(path, out elem)) { if (elem.mDepends != null && elem.mDepends.Length > 0) { foreach (var d in elem.mDepends) { LoadAssetAsyn(d, null); } } AssetBundleCreateRequest ar = AssetBundle.LoadFromFileAsync(GetAssetPath(path)); mReqs[path] = ar; } } } } }
public bool IsChange(PatcherElem.Elem elem) { Elem me = null; mDic.TryGetValue(elem.szName, out me); if (me == null) { return(true); } else if (me.mVersion != elem.mVersion) { return(true); } else { string path = Application.persistentDataPath + "/" + elem.szName; if (!File.Exists(path)) { return(true); } } return(false); }