Ejemplo n.º 1
0
        private List <UnityEngine.Object> releaseSubCacheReferences(ICacheableContent cacheableContent)
        {
            List <UnityEngine.Object> list  = new List <UnityEngine.Object>();
            List <UnityEngine.Object> list2 = cacheableContent.InternalReferences();

            if (list2 != null)
            {
                foreach (UnityEngine.Object item in list2)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    int instanceID = item.GetInstanceID();
                    if (subCache.TryGetValue(instanceID, out var value))
                    {
                        value.RefCount--;
                        if (value.RefCount <= 0)
                        {
                            subCache.Remove(instanceID);
                            list.Add(value.Value);
                        }
                    }
                    else
                    {
                        Log.LogErrorFormatted(item, "Instance Id '{0}' not found in the sub cache!", instanceID);
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        private void addSubCacheReferences(ICacheableContent cacheableContent)
        {
            List <UnityEngine.Object> list = cacheableContent.InternalReferences();

            if (list == null)
            {
                return;
            }
            foreach (UnityEngine.Object item in list)
            {
                if (!(item == null))
                {
                    int instanceID = item.GetInstanceID();
                    if (!subCache.ContainsKey(instanceID))
                    {
                        SubItem subItem = new SubItem();
                        subItem.Value = item;
                        subCache.Add(instanceID, subItem);
                    }
                    subCache[instanceID].RefCount++;
                }
            }
        }