public static ResLoad get(string path, ResideType reside = ResideType.None, int v = 0) { #if CHECK_PATH checkPathCase(path); #endif CachItem it = CachItem.getFromCach(path, reside); it.mVer = v; return(new ResLoad(it)); }
//-------------- #region cach管理 internal static CachItem getFromCach(string key, ResideType reside) { CachItem item = null; if (mCach.TryGetValue(key, out item)) { if (item.mReside != ResideType.Ref && item.mReside < reside) { item.mReside = reside; } item.mTime = Time.realtimeSinceStartup; } else { if (mPool.Count > 0) { item = mPool[0]; mPool.RemoveAt(0); } else { item = new CachItem(); } item.mKey = key; item.mReside = reside; item.mRef = 0; item.mVer = 0; item.mIsPrefab = false; item.mIsAB = false; item.mCallData = null; item.mTag = null; if (item.mReside != ResideType.None) { item.mTime = Time.realtimeSinceStartup; mCach [item.mKey] = item; } } item.mUniqueID = ++uniqueID; #if UNITY_EDITOR traceLoad(item); #endif return(item); }
internal static void clearByReside(ResideType riside) { ArrayList ls = new ArrayList(); IDictionaryEnumerator e = mCach.GetEnumerator(); while (e.MoveNext()) { CachItem it = e.Value as CachItem; if (it.mReside == riside) { ls.Add(it); } } for (int i = 0, max = ls.Count; i < max; ++i) { CachItem it = ls[i] as CachItem; it.release(true); } }
public static void clearReside(ResideType riside) { CachItem.clearByReside(riside); }