コード例 #1
0
        public void AddCacheType(string cacheName)
        {
            GameObjectCaching.GameComponentCache cache = GameObjectCaching.GetCacheByName(cacheName);
            if (cache == null)
            {
                return;
            }

            if (cacheTypeNames == null)
            {
                cacheTypeNames = new List <string>();
                cacheTypes     = new List <GameObjectCaching.GameComponentCache>();
            }
            else if (cacheTypeNames.Contains(cacheName))
            {
                return;
            }

            cacheTypeNames.Add(cacheName);
            cacheTypes.Add(cache);

            // Sadly, when we call this in the type constructor of a derived type we've already called AddChild for that type
            // in the GameComponent constructor so we can't put AddToCache there.
            cache.addFunction(this);
        }
コード例 #2
0
 public void RefreshCacheTypes()
 {
     if (cacheTypeNames == null)
     {
         return;
     }
     cacheTypes = new List <GameObjectCaching.GameComponentCache>(cacheTypeNames.Count);
     for (int i = 0; i < cacheTypeNames.Count; i++)
     {
         GameObjectCaching.GameComponentCache cache = GameObjectCaching.GetCacheByName(cacheTypeNames[i]);
         if (cache == null)
         {
             continue;
         }
         cacheTypes.Add(cache);
         cache.addFunction(this);
     }
 }