public virtual void Initialize <T>(ResourceCacheMask mask, Dictionary <int, ResourceConfig <T> > configs, bool cacheOn = true) where T : GameDataMap <int, T>, new() { ResourceCachePool pool = null; foreach (ResourceConfig <T> config in configs.Values) { if (CheckLevelShow(config.Level)) { if (((int)mask & config.Mask) != 0) { if (!mPools.ContainsKey(config.ID)) { pool = new ResourceCachePool(); pool.Initialize(config, ResourceCacheBindParent.CacheUnused, GetLevel(), this, cacheOn); mPools.Add(config.ID, pool); } } } } if (IsPrintOn) { PrintTimerId = -1; PrintTimer(true); } }
protected virtual void ClearInternal(ResourceCacheMask mask) { CACHE.Clear(); List <int> poolKeys = mPools.Keys.ToList(); foreach (int key in poolKeys) { ResourceCachePool pool = mPools[key]; if ((pool.GetMask() & (int)mask) != 0) { pool.Clear(); CACHE.Add(key); } } foreach (int key in CACHE) { mPools.Remove(key); } }
public virtual void Initialize <T>(ResourceCacheMask mask, Dictionary <int, ResourceConfig <T> > configs, bool cacheOn = true) { ResourceCachePool pool = null; foreach (ResourceConfig <T> config in configs.Values) { if (CheckLevelShow(config.Level)) { if (((int)mask & config.Mask) != 0) { if (!mPools.ContainsKey(config.Id)) { pool = new ResourceCachePool(); pool.Initialize(config, ResourceCacheBindParent.CacheUnused, GetLevel(), this, cacheOn); mPools.Add(config.Id, pool); } } } } #if UNITY_EDITOR PrintTimerId = -1; PrintTimer(true); #endif }
public virtual void Clear(ResourceCacheMask mask) { ReleaseActives(); ClearInternal(mask); }
public void ChangePoolMaskFromTo <T>(ResourceCacheMask from, ResourceCacheMask to, Dictionary <int, ResourceConfig <T> > configs) where T : GameDataMap <int, T>, new() { Clear(from); Initialize(to, configs); }
public void ChangePoolMaskFromTo <T>(ResourceCacheMask from, ResourceCacheMask to, Dictionary <int, ResourceConfig <T> > configs) { Clear(from); Initialize(to, configs); }