guodong 2 жил өмнө
parent
commit
18bf66392c

+ 0 - 32
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -110,37 +110,5 @@ namespace GFGGame
             spr.sprite = sp;
         }
 
-        public static void AddObjectToView(GameObject _gameObject, GoWrapper _wrapper, GGraph holder, string resPath, out GameObject gameObject, out GoWrapper wrapper, float scale = 100)
-        {
-            if (_gameObject != null)
-            {
-                GameObject.DestroyImmediate(_gameObject);
-            }
-            _gameObject = DressUpUtil.CreateAnimationObj(resPath);
-            _gameObject.transform.localScale = new Vector3(scale, scale, scale);
-
-            if (_wrapper != null)
-            {
-                GameObject.Destroy(_wrapper.wrapTarget);
-                _wrapper.Dispose();
-            }
-
-            _wrapper = new GoWrapper(_gameObject);
-            holder.SetNativeObject(_wrapper);
-
-            wrapper = _wrapper;
-            gameObject = _gameObject;
-        }
-        public static void DestroyObjectFromView(GameObject _gameObject, GoWrapper goWrapper)
-        {
-            if (_gameObject != null)
-            {
-                GameObject.DestroyImmediate(_gameObject);
-            }
-            if (goWrapper != null)
-            {
-                goWrapper.Dispose();
-            }
-        }
     }
 }

+ 11 - 2
GameClient/Assets/Game/HotUpdate/Effect/EffectUI.cs

@@ -10,11 +10,20 @@ namespace GFGGame
         public bool isDisposed;
 
 
-        public void Reset(GGraph holder, string uiName, string resName, float scale = 100)
+        public void Reset(GGraph holder, string uiName, string resName, float scale = 100, EffectUIType effectUIType = EffectUIType.UI )
         {
             if (!isDisposed) Dispose();
             isDisposed = false;
-            string resPath = ResPathUtil.GetViewEffectPath(uiName, resName);
+            string resPath;
+            switch(effectUIType)
+            {
+                case EffectUIType.Card:
+                    resPath = ResPathUtil.GetCardAnimationPath(resName);
+                    break;
+                default:
+                    resPath = ResPathUtil.GetViewEffectPath(uiName, resName);
+                    break;
+            }
             _gameObject = DressUpUtil.CreateAnimationObj(resPath);
             _gameObject.transform.localScale = new Vector3(scale, scale, scale);
             _wrapper = new GoWrapper(_gameObject);

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Enum/Enum.cs

@@ -8,4 +8,6 @@ namespace GFGGame
     public enum MessageType { ERR, WARNING, NORMAL, SUCCESS }
 
     public enum FirstGetCardViewType {JUMP,CANNOT_JUMP,CANNOT_JUMP_CANNOT_SUIT }//弹窗类型:0可跳过,1:首次获得物品不可跳过,2首次获得物品不可跳过,不弹获得套装界面
+
+    public enum EffectUIType { UI, Card}
 }

+ 1 - 5
GameClient/Assets/Game/HotUpdate/Utils/ResPathUtil.cs

@@ -150,13 +150,9 @@ namespace GFGGame
         {
             return $"{EFFECT_DIR_PATH}/UI/{uiName}/{resName}.{extName}";
         }
-        public static string GetCardAnimationDirPath(string res)
-        {
-            return $"{ANIMATION_DIR_PATH}/Card/{res}";
-        }
         public static string GetCardAnimationPath(string res, string extName = "prefab")
         {
-            return $"{GetCardAnimationDirPath(res)}/{res}.{extName}";
+            return $"{ANIMATION_DIR_PATH}/Card/{res}/{res}.{extName}";
         }
         public static string GetActivityPath(string res, string extName = "jpg")
         {

+ 10 - 9
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -23,8 +23,7 @@ namespace GFGGame
         private List<CardStarCfg> _cardStarRewards = new List<CardStarCfg>();
         private int _selectTab = 0;
         private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
-        private GameObject _cardObj;
-        private GoWrapper _wrapper;
+        private EffectUI _effectUI;
 
         private GObject _consumeSelectItem;//选中的材料item
         private int _consumeSelectIndex = 0;//0为减,1为加
@@ -59,7 +58,8 @@ namespace GFGGame
                 _valueBarController.Dispose();
                 _valueBarController = null;
             }
-            SceneController.DestroyObjectFromView(_cardObj, _wrapper);
+            EffectUIPool.Recycle(_effectUI);
+            _effectUI = null;
 
             if (_ui != null)
             {
@@ -228,19 +228,20 @@ namespace GFGGame
         }
         private void UpdateCardRes()
         {
-
-            if (_cardObj != null)
+            if (_effectUI != null)
             {
-                GameObject.Destroy(_cardObj);
-                _cardObj = null;
+                EffectUIPool.Recycle(_effectUI);
+                _effectUI = null;
             }
+            string resName = _cardData.resources[_cardData.resIndex];
             string resPath = ResPathUtil.GetCardAnimationPath(_cardData.resources[_cardData.resIndex]);
             if (_cardData.itemCfg.animationCardStar > 0 && _cardData.star >= _cardData.itemCfg.animationCardStar && Versions.Contains(resPath))
             {
-                SceneController.AddObjectToView(_cardObj, _wrapper, _ui.m_comCard.m_comCardHolder.m_holder, resPath, out _cardObj, out _wrapper);
+                _effectUI = new EffectUI();
+                _effectUI.Reset(_ui.m_comCard.m_comCardHolder.m_holder, resName, resName, 100, EffectUIType.Card);
             }
 
-            if (_cardObj != null)
+            if (_effectUI != null)
             {
                 _ui.m_c1.selectedIndex = 1;
                 _ui.m_comCard.target.scrollPane.SetPercX(0.5f, false);

+ 0 - 9
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -44,10 +44,6 @@ namespace GFGGame
         private EffectUI _effectUI2;
         private EffectUI _effectUI3;
 
-        private List<GameObject> _effects = new List<GameObject>();
-        private List<GoWrapper> _wrappers = new List<GoWrapper>();
-        private List<GameObject> _effects1 = new List<GameObject>();
-        private List<GoWrapper> _wrappers1 = new List<GoWrapper>();
         private UI_ButtonModle1[] _btns;
 
         public override void Dispose()
@@ -58,11 +54,6 @@ namespace GFGGame
                 _valueBarController = null;
             }
 
-            for (int i = 0; i < _effects.Count; i++)
-            {
-                SceneController.DestroyObjectFromView(_effects[i], _wrappers[i]);
-                SceneController.DestroyObjectFromView(_effects1[i], _wrappers1[i]);
-            }
             EffectUIPool.Recycle(_effectUI1);
             _effectUI1 = null;
             EffectUIPool.Recycle(_effectUI2);