Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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
        }
Пример #4
0
 public virtual void Clear(ResourceCacheMask mask)
 {
     ReleaseActives();
     ClearInternal(mask);
 }
Пример #5
0
 public void ChangePoolMaskFromTo <T>(ResourceCacheMask from, ResourceCacheMask to, Dictionary <int, ResourceConfig <T> > configs) where T : GameDataMap <int, T>, new()
 {
     Clear(from);
     Initialize(to, configs);
 }
Пример #6
0
 public void ChangePoolMaskFromTo <T>(ResourceCacheMask from, ResourceCacheMask to, Dictionary <int, ResourceConfig <T> > configs)
 {
     Clear(from);
     Initialize(to, configs);
 }