Browse Source

摘星特效报错修改

huangxiaoyue 2 years ago
parent
commit
2882ab8ca4

+ 22 - 24
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxBonusShowView.cs

@@ -11,7 +11,9 @@ namespace GFGGame
         private UI_LuckBoxBonusShowUI _ui;
         private List<ItemData> _rewardList = new List<ItemData>();
         // private List<GameObject> _gameobjects = new List<GameObject>();
-        private Dictionary<int, Dictionary<int, EffectUI>> _effList = new Dictionary<int, Dictionary<int, EffectUI>>();
+        //private Dictionary<int, Dictionary<int, EffectUI>> _effList = new Dictionary<int, Dictionary<int, EffectUI>>();
+        private Dictionary<int, EffectUI> _effList = new Dictionary<int, EffectUI>();
+        private int countEff = 0;
 
         private EffectUI _effectUI1;
         private EffectUI _effectUI2;
@@ -27,23 +29,6 @@ namespace GFGGame
             //     SceneController.DestroyObjectFromView(_gameobjects[i], _wrappers[i]);
 
             // }
-            foreach (int key in _effList.Keys)
-            {
-                foreach (int key1 in _effList[key].Keys)
-                {
-                    EffectUIPool.Recycle(_effList[key][key1]);
-                    _effList[key][key1] = null;
-                }
-            }
-            _effList.Clear();
-            EffectUIPool.Recycle(_effectUI1);
-            _effectUI1 = null;
-            EffectUIPool.Recycle(_effectUI2);
-            _effectUI2 = null;
-            EffectUIPool.Recycle(_effectUI3);
-            _effectUI3 = null;
-            EffectUIPool.Recycle(_effectUI4);
-            _effectUI4 = null;
 
             if (_ui != null)
             {
@@ -93,6 +78,22 @@ namespace GFGGame
 
         protected override void OnHide()
         {
+            for (int key = 0; key < _effList.Count; key++)
+            {
+                EffectUIPool.Recycle(_effList[key]);
+                _effList[key] = null;
+            }
+            countEff = 0;
+            _effList.Clear();
+            EffectUIPool.Recycle(_effectUI1);
+            _effectUI1 = null;
+            EffectUIPool.Recycle(_effectUI2);
+            _effectUI2 = null;
+            EffectUIPool.Recycle(_effectUI3);
+            _effectUI3 = null;
+            EffectUIPool.Recycle(_effectUI4);
+            _effectUI4 = null;
+
             base.OnHide();
             _rewardList.Clear();
             GetSuitItemController.TryShow(0);
@@ -111,15 +112,12 @@ namespace GFGGame
 
             string resPath = itemCfg.rarity == ConstDressRarity.Rarity_TIANYI ? "CK_all_01" : "CK_all_02";
 
-            if (countType == 10 && itemCfg.rarity > 2 && (!_effList.ContainsKey(itemCfg.rarity) || !_effList[itemCfg.rarity].ContainsKey(index)))
+            if (countType == 10 && itemCfg.rarity > 2 )//&& (!_effList.ContainsKey(itemCfg.rarity) || !_effList[itemCfg.rarity].ContainsKey(index)))
             {
-                if (!_effList.ContainsKey(itemCfg.rarity))
-                {
-                    _effList[itemCfg.rarity] = new Dictionary<int, EffectUI>();
-                }
                 GGraph holder = itemCfg.rarity == 3 ? item.m_comIcon.m_holder : item.m_comIcon.m_holder1;
                 EffectUI _effectUI = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", resPath);
-                _effList[itemCfg.rarity][index] = _effectUI;
+                _effList.Add(countEff , _effectUI);
+                countEff += 1;
             }
             if (countType == 1 && itemCfg.rarity > 2 && _effectUI4 == null)
             {