Exemple #1
0
        public void PreloadGroup(string groupName, bool isCommon)
        {
            for (int i = 0; i < this._preloadedEffectGroupNames.Count; i++)
            {
                if (this._preloadedEffectGroupNames[i].groupName == groupName)
                {
                    PreloadGroupEntry local1 = this._preloadedEffectGroupNames[i];
                    local1.refCount++;
                    return;
                }
            }
            this._preloadedEffectGroupNames.Add(new PreloadGroupEntry(groupName, isCommon));
            if (EffectData.HasEffectPattern(groupName))
            {
                foreach (EffectPattern pattern in EffectData.GetEffectGroupPatterns(groupName))
                {
                    for (int j = 0; j < pattern.subEffects.Length; j++)
                    {
                        SubEffect  effect    = pattern.subEffects[j];
                        GameObject prototype = Miscs.LoadResource <GameObject>(EffectData.GetPrefabResPath(effect.prefabPath), BundleType.RESOURCE_FILE);
                        if (prototype != null)
                        {
                            Singleton <EffectManager> .Instance.AddEffectPrototype(effect.prefabPath, prototype);

                            this.PreloadSingleEffect(prototype, isCommon);
                        }
                    }
                }
            }
        }
Exemple #2
0
        public void CleanAll(bool includeCommon)
        {
            List <string> list = new List <string>(this.dictInstanceCache.Keys);

            foreach (string str in list)
            {
                ProtoPoolItem item = this.dictInstanceCache[str];
                if (includeCommon || !item.isCommon)
                {
                    int num   = 0;
                    int count = item.availableList.Count;
                    while (num < count)
                    {
                        UnityEngine.Object.Destroy(item.availableList[num]);
                        num++;
                    }
                    item.availableList.Clear();
                    int num3 = 0;
                    int num4 = item.occupiedList.Count;
                    while (num3 < num4)
                    {
                        UnityEngine.Object.Destroy(item.occupiedList[num3]);
                        num3++;
                    }
                    item.occupiedList.Clear();
                    this.dictInstanceCache.Remove(str);
                }
            }
            if (includeCommon)
            {
                this.dictInstanceCache.Clear();
                if (this._instanceRoot != null)
                {
                    UnityEngine.Object.Destroy(this._instanceRoot.gameObject);
                    this._instanceRoot = null;
                }
                this._preloadedEffectGroupNames.Clear();
            }
            else
            {
                for (int i = 0; i < this._preloadedEffectGroupNames.Count; i++)
                {
                    PreloadGroupEntry entry = this._preloadedEffectGroupNames[i];
                    if (!entry.isCommon)
                    {
                        this._preloadedEffectGroupNames[i] = null;
                    }
                }
                this._preloadedEffectGroupNames.RemoveAllNulls <PreloadGroupEntry>();
            }
        }