Pārlūkot izejas kodu

GameObject回收缓存处理

guodong 1 gadu atpakaļ
vecāks
revīzija
fcaad18a28
25 mainītis faili ar 229 papildinājumiem un 77 dzēšanām
  1. 1 0
      GameClient/Assets/Game/HotUpdate/Assets/AssetReleaser.cs
  2. 30 16
      GameClient/Assets/Game/HotUpdate/Assets/PrefabManager.cs
  3. 48 14
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs
  4. 51 11
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpObj.cs
  5. 12 1
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjUI.cs
  6. 4 0
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpOperationBase.cs
  7. 21 0
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpRemoveOperation.cs
  8. 29 3
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs
  9. 2 2
      GameClient/Assets/Game/HotUpdate/Views/Arena/ArenaDressInfoView.cs
  10. 2 2
      GameClient/Assets/Game/HotUpdate/Views/Arena/ArenaView.cs
  11. 2 4
      GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs
  12. 2 2
      GameClient/Assets/Game/HotUpdate/Views/DressUp/ArenaDressUpFightView.cs
  13. 2 2
      GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs
  14. 3 2
      GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpView.cs
  15. 2 2
      GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs
  16. 2 2
      GameClient/Assets/Game/HotUpdate/Views/Friend/FriendView.cs
  17. 1 1
      GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs
  18. 1 1
      GameClient/Assets/Game/HotUpdate/Views/MainStory/ArenaFightResultView.cs
  19. 2 2
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs
  20. 1 1
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightSingleScoreView.cs
  21. 2 2
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightSingleView.cs
  22. 1 1
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetScoreView.cs
  23. 3 3
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetView.cs
  24. 1 1
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StroyFightResultView.cs
  25. 4 2
      GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Assets/AssetReleaser.cs

@@ -51,6 +51,7 @@ namespace GFGGame
         {
             this.assetOperationHandle?.Release();
             this.assetOperationHandle = null;
+            this.spawnHandle?.Discard();
             this.spawnHandle = null;
             this.resPath = null;
         }

+ 30 - 16
GameClient/Assets/Game/HotUpdate/Assets/PrefabManager.cs

@@ -1,7 +1,6 @@
 using UniFramework.Pooling;
 using UnityEngine;
 using YooAsset;
-using System.Threading.Tasks;
 
 namespace GFGGame
 {
@@ -24,7 +23,7 @@ namespace GFGGame
             if (!_entitySpawner.IsGameObjectPoolExisted(resPath))
             {
                 // 创建游戏对象池,销毁时间单位为秒
-                _entitySpawner.CreateGameObjectPoolSync(resPath, false, 0, 1, 60);
+                _entitySpawner.CreateGameObjectPoolSync(resPath, false, 0, 10, 60);
             }
 
             var handle = _entitySpawner.SpawnSync(resPath);
@@ -32,19 +31,19 @@ namespace GFGGame
             return handle.GameObj;
         }
 
-        public async Task<GameObject> SpawnASync(string resPath)
-        {
-            if (!_entitySpawner.IsGameObjectPoolExisted(resPath))
-            {
-                // 创建游戏对象池,销毁时间单位为秒
-                _entitySpawner.CreateGameObjectPoolSync(resPath, false, 0, 1, 60);
-            }
+        //public async Task<GameObject> SpawnASync(string resPath)
+        //{
+        //    if (!_entitySpawner.IsGameObjectPoolExisted(resPath))
+        //    {
+        //        // 创建游戏对象池,销毁时间单位为秒
+        //        _entitySpawner.CreateGameObjectPoolSync(resPath, false, 0, 1, 60);
+        //    }
 
-            SpawnHandle handle = _entitySpawner.SpawnAsync(resPath);
-            await handle.Task;
-            AssetReleaserHelper.AddReleaserToSpawnObj(handle.GameObj, resPath, handle);
-            return handle.GameObj;
-        }
+        //    SpawnHandle handle = _entitySpawner.SpawnAsync(resPath);
+        //    await handle.Task;
+        //    AssetReleaserHelper.AddReleaserToSpawnObj(handle.GameObj, resPath, handle);
+        //    return handle.GameObj;
+        //}
 
         public GameObject InstantiateSync(string resPath)
         {
@@ -60,14 +59,29 @@ namespace GFGGame
             {
                 return;
             }
-            AssetReleaser assetRestorer = gameObject.GetComponent<AssetReleaser>();
+            AssetReleaser assetRestorer = gameObject.GetComponent<AssetReleaser>(); 
             if (assetRestorer != null && assetRestorer.IsSpawn)
             {
                 assetRestorer.Restore();
             }
             else
             {
-                GameObject.DestroyImmediate(gameObject);
+                var assetReleasers = gameObject.GetComponentsInChildren<AssetReleaser>();
+                if (assetReleasers != null && assetReleasers.Length > 0)
+                {
+                    foreach(var t in assetReleasers)
+                    {
+                        if(t.IsSpawn)
+                        {
+                            t.Restore();
+                        }
+                    }
+                    GameObject.Destroy(gameObject);
+                }
+                else
+                {
+                    GameObject.DestroyImmediate(gameObject);
+                }
             }
         }
     }

+ 48 - 14
GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs

@@ -41,6 +41,7 @@ namespace GFGGame
 
         public void InitLayer(ItemCfg itemCfg, int layerId)
         {
+            Debug.Log($"InitLayer {itemCfg.id}");
             this.itemCfg = itemCfg;
             this.layerId = layerId;
             actionType = EAction.Layer;
@@ -48,6 +49,7 @@ namespace GFGGame
 
         public void InitBody()
         {
+            Debug.Log("InitBody");
             actionType = EAction.Body;
         }
 
@@ -55,11 +57,29 @@ namespace GFGGame
         {
             actionType = EAction.Head;
         }
+        internal override bool CheckRepeated(DressUpOperationBase t)
+        {
+            var operation = t as DressUpLayerOperation;
+            if (operation != null && operation.actionType == this.actionType)
+            {
+                if(actionType == EAction.Layer)
+                {
+                    return (operation.parentObj == this.parentObj
+                        && operation.itemCfg == this.itemCfg
+                        && operation.layerId == this.layerId);
 
+                }
+                else
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
         /// <summary>
         /// 取消下载
         /// </summary>
-        public void Cancel()
+        internal override void Cancel()
         {
             if (_steps != EDressUpSteps.Done)
             {
@@ -68,20 +88,20 @@ namespace GFGGame
                     downloaderOperation.CancelDownload();
                 }
                 _steps = EDressUpSteps.Done;
-                Status = EOperationStatus.Failed;
-                Error = "User cancel.";
             }
+            Status = EOperationStatus.Failed;
+            Error = "User cancel.";
         }
 
         internal override void UpdateView()
         {
-            ViewManager.Hide<ModalStatusView>();
-            foreach (var t in preloadList)
+            if (parentObj == null)
             {
-                Live2dAnimationManager.Instance.FinishPreDrawed(t);
+                this.Release();
+                return;
             }
-            preloadList.Clear();
-            preloadList = null;
+            ViewManager.Hide<ModalStatusView>();
+            TryFinishPreDraw();
 
             switch (actionType)
             {
@@ -101,11 +121,10 @@ namespace GFGGame
 
         internal override void Release()
         {
+            TryFinishPreDraw();
             downloaderOperation = null;
             this.itemCfg = null;
             this.parentObj = null;
-            preloadList?.Clear();
-            preloadList = null;
         }
 
         internal override void Start()
@@ -140,7 +159,7 @@ namespace GFGGame
             }
             if(_steps == EDressUpSteps.PreDrawing)
             {
-                Debug.Log($"preRendering {preRendering}    {resPath} {TimeHelper.ClientNow()}");
+                //Debug.Log($"preRendering {preRendering}    {resPath} {TimeHelper.ClientNow()}");
                 if(preRendering <= 0)
                 {
                     _steps = EDressUpSteps.Done;
@@ -195,7 +214,7 @@ namespace GFGGame
                     //预渲染
                     var t = Live2dAnimationManager.Instance.PreDraw(resPath);
                     preloadList.Add(t);
-                    Debug.Log($"PreDraw    {resPath} {TimeHelper.ClientNow()}");
+                    //Debug.Log($"PreDraw    {resPath} {TimeHelper.ClientNow()}");
                     return;
                 }
             }
@@ -203,11 +222,26 @@ namespace GFGGame
             Status = EOperationStatus.Succeed;
         }
 
+        private void TryFinishPreDraw()
+        {
+            if(preloadList == null)
+            {
+                return;
+            }
+            foreach (var t in preloadList)
+            {
+                Live2dAnimationManager.Instance.FinishPreDrawed(t);
+            }
+            preloadList.Clear();
+            preloadList = null;
+        }
+
         private void UpdateLayer()
         {
+            Debug.Log($"UpdateLayer add {itemCfg.id}");
             //清理旧的
             var spritObjName = string.Format(DressUpUtil.FORMAT_SPRITE_NAME, itemCfg.subType, layerId);
-            DressUpUtil.TryRemoveObj(parentObj, spritObjName);
+            DressUpUtil.TryRemoveSprite(parentObj, spritObjName);
             var aniObjName = string.Format(DressUpUtil.FORMAT_ANIMATION_NAME, itemCfg.subType, layerId);
             DressUpUtil.TryRemoveObj(parentObj, aniObjName);
             string effectObjName = string.Format(DressUpUtil.FORMAT_EFFECT_OBJ_NAME, itemCfg.subType, layerId);
@@ -237,7 +271,7 @@ namespace GFGGame
             int sortingOrder = 0;
             var removeBodyAni = DressUpUtil.TryRemoveObj(parentObj, aniObjName);
             DressUpUtil.TryRemoveObj(parentObj, effectObjName);
-            DressUpUtil.TryRemoveObj(parentObj, spritObjName);
+            DressUpUtil.TryRemoveSprite(parentObj, spritObjName);
             if (this.showAni)
             {
                 DressUpUtil.AddAnimationObj(this.resPath, aniObjName, parentObj, sortingOrder);

+ 51 - 11
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObj.cs

@@ -71,7 +71,7 @@ namespace GFGGame
         {
             if (_sceneObj != null && _sceneObj != sceneObj)
             {
-                GameObject.Destroy(_sceneObj);
+                PrefabManager.Instance.Restore(_sceneObj);
             }
             _sceneObj = sceneObj;
             _needSetMask = needSetMask;
@@ -85,7 +85,7 @@ namespace GFGGame
             else
             {
                 var tempData = DressUpDataClone();
-                TakeOffAll();
+                TakeOffAll(false);
                 PutOnDressUpData(tempData);
             }
             Timers.inst.AddUpdate(OnUpdate);
@@ -100,6 +100,21 @@ namespace GFGGame
         {
             _sceneObj = null;
             _dressUpData = null;
+            Timers.inst.Remove(OnUpdate);
+            foreach (var t in handlers)
+            {
+                t.Release();
+            }
+        }
+
+        private void ClearView()
+        {
+            Timers.inst.Remove(OnUpdate);
+            foreach (var t in handlers)
+            {
+                t.Cancel();
+                t.Release();
+            }
         }
 
         //传入一个服装部件Id,判断是否有与此部件同类型服装已穿着
@@ -202,6 +217,10 @@ namespace GFGGame
         //脱掉所有换装,换成默认装(不处理背景)
         public void TakeOffAll(bool checkDefault = true)
         {
+            if(_sceneObj == null)
+            {
+                return;
+            }
             _dressUpData.suitId = 0;
             _dressUpData.actionId = 0;
             foreach (int itemID in itemList)
@@ -659,6 +678,11 @@ namespace GFGGame
 
         private void OnUpdate(object param = null)
         {
+            if(_sceneObj == null)
+            {
+                ClearView();
+                return;
+            }
             if(handlers != null && handlers.Count > 0)
             {
                 bool draw = true;
@@ -675,7 +699,10 @@ namespace GFGGame
                     handlers.Clear();
                     foreach (var handler in t)
                     {
-                        handler.UpdateView();
+                        if(handler.Status == YooAsset.EOperationStatus.Succeed)
+                        {
+                            handler.UpdateView();
+                        }
                         handler.Release();
                     }
                     //Debug.Log($"draw    {TimeHelper.ClientNow()}");
@@ -683,21 +710,34 @@ namespace GFGGame
             }
         }
 
-        private void TryAddHandlers(List<DressUpLayerOperation> handlers)
+        private void TryAddHandlers(List<DressUpLayerOperation> t)
         {
-            if (handlers != null)
+            if (t != null)
             {
-                this.handlers.AddRange(handlers);
-                //OnUpdate();
+                foreach(var h in t)
+                {
+                    TryAddHandler(h);
+                }
+                //this.handlers.AddRange(t);
             }
         }
 
-        private void TryAddHandler(DressUpOperationBase handler)
+        private void TryAddHandler(DressUpOperationBase t)
         {
-            if (handler != null)
+            if (t != null)
             {
-                this.handlers.Add(handler);
-                //OnUpdate();
+                var len = handlers.Count;
+                for (var i = len - 1; i >= 0; i--)
+                {
+                    var h = handlers[i];
+                    if (h.CheckRepeated(t))
+                    {
+                        h.Cancel();
+                        h.Release();
+                        handlers.RemoveAt(i);
+                    }
+                }
+                this.handlers.Add(t);
             }
         }
 

+ 12 - 1
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjUI.cs

@@ -24,6 +24,7 @@ namespace GFGGame
             sceneObject = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath(this.prefabName));
             sceneObject.transform.localScale = new Vector3(scale, scale, scale);
             dressUpObj.setSceneObj(sceneObject, needSetMask, showSceneType, roleObj, showBg);
+            Timers.inst.AddUpdate(OnUpdate);
         }
 
         public void UpdateWrapper(GGraph holder)
@@ -36,7 +37,7 @@ namespace GFGGame
         {
             if (sceneObject != null)
             {
-                GameObject.Destroy(sceneObject);
+                PrefabManager.Instance.Restore(sceneObject);
                 sceneObject = null;
             }
 
@@ -52,5 +53,15 @@ namespace GFGGame
                 wrapper = null;
             }
         }
+
+        private void OnUpdate(object o)
+        {
+            if(sceneObject == null)
+            {
+                Timers.inst.Remove(OnUpdate);
+                return;
+            }
+            wrapper.wrapTarget = sceneObject;
+        }
     }
 }

+ 4 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpOperationBase.cs

@@ -25,5 +25,9 @@ namespace GFGGame
         internal abstract void UpdateView();
 
         internal abstract void Release();
+        internal abstract bool CheckRepeated(DressUpOperationBase t);
+
+        internal abstract void Cancel();
+
     }
 }

+ 21 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpRemoveOperation.cs

@@ -14,6 +14,7 @@ namespace GFGGame
             this.itemID = itemID;
             this.sceneObj = sceneObj;
             this.parentObj = parentObj;
+            Debug.Log($"remove {itemID}");
         }
 
         internal override void Release()
@@ -32,8 +33,28 @@ namespace GFGGame
             
         }
 
+        internal override void Cancel()
+        {
+            Status = EOperationStatus.Failed;
+            Error = "User cancel.";
+        }
+
+        internal override bool CheckRepeated(DressUpOperationBase t)
+        {
+            var operation = t as DressUpRemoveOperation;
+            return (operation != null 
+                && operation.itemID == this.itemID 
+                && operation.sceneObj == this.sceneObj);
+        }
+
         internal override void UpdateView()
         {
+            if(sceneObj == null)
+            {
+                this.Release();
+                return;
+            }
+            Debug.Log($"UpdateView remove {itemID}");
             DressUpUtil.RemoveItem(this.itemID, this.sceneObj, this.parentObj);
         }
     }

+ 29 - 3
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -177,7 +177,7 @@ namespace GFGGame
                 if (!string.IsNullOrEmpty(itemCfg.resLayer1))
                 {
                     spritObjName = string.Format(FORMAT_SPRITE_NAME, itemCfg.subType, 1);
-                    TryRemoveObj(parentObj, spritObjName);
+                    TryRemoveSprite(parentObj, spritObjName);
                     aniObjName = string.Format(FORMAT_ANIMATION_NAME, itemCfg.subType, 1);
                     TryRemoveObj(parentObj, aniObjName);
                     aniObjName = string.Format(FORMAT_EFFECT_OBJ_NAME, itemCfg.subType, 1);
@@ -187,7 +187,7 @@ namespace GFGGame
                 if (!string.IsNullOrEmpty(itemCfg.resLayer2))
                 {
                     spritObjName = string.Format(FORMAT_SPRITE_NAME, itemCfg.subType, 2);
-                    TryRemoveObj(parentObj, spritObjName);
+                    TryRemoveSprite(parentObj, spritObjName);
                     aniObjName = string.Format(FORMAT_ANIMATION_NAME, itemCfg.subType, 2);
                     TryRemoveObj(parentObj, aniObjName);
                     aniObjName = string.Format(FORMAT_EFFECT_OBJ_NAME, itemCfg.subType, 2);
@@ -197,7 +197,7 @@ namespace GFGGame
                 if (!string.IsNullOrEmpty(itemCfg.resLayer3))
                 {
                     spritObjName = string.Format(FORMAT_SPRITE_NAME, itemCfg.subType, 3);
-                    TryRemoveObj(parentObj, spritObjName);
+                    TryRemoveSprite(parentObj, spritObjName);
                     aniObjName = string.Format(FORMAT_ANIMATION_NAME, itemCfg.subType, 3);
                     TryRemoveObj(parentObj, aniObjName);
                     aniObjName = string.Format(FORMAT_EFFECT_OBJ_NAME, itemCfg.subType, 3);
@@ -494,6 +494,7 @@ namespace GFGGame
             LoadSpritePos(resPath, out tx, out ty);
             gameObj.transform.localPosition = new Vector3(tx, ty, gameObj.transform.localPosition.z);
             SpriteHelper.AddSpriteTo(spr, resPath);
+            gameObj.SetActive(true);
             spr.sortingOrder = sortingOrder;
 
             if (needSetMask)
@@ -594,6 +595,31 @@ namespace GFGGame
             return false;
         }
 
+        public static bool TryRemoveSprite(GameObject parentObj, string objName)
+        {
+            if (parentObj == null)
+            {
+                return false;
+            }
+            Transform transform = parentObj.transform.Find(objName);
+            if (transform != null)
+            {
+                GameObject gameObj = transform.gameObject;
+                if (gameObj != null)
+                {
+                    var spr = gameObj.GetComponent<SpriteRenderer>();
+                    if(spr != null)
+                    {
+                        //Debug.Log($"TryRemoveSprite {objName}");
+                        SpriteHelper.RemoveSpriteFrom(spr);
+                        gameObj.SetActive(false);
+                    }
+                    return true;
+                }
+            }
+            return false;
+        }
+
         public static GameObject GetGameObjExisted(GameObject parentObj, string objName, string resPath)
         {
             if (parentObj == null)

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/Arena/ArenaDressInfoView.cs

@@ -24,7 +24,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 
@@ -93,7 +93,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/Arena/ArenaView.cs

@@ -25,7 +25,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             if (_valueBarController != null)
@@ -124,7 +124,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 4
GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

@@ -1,7 +1,5 @@
-using System.Collections;
-using UnityEngine;
+using UnityEngine;
 using UI.ClothingSynthetic;
-using UI.CommonGame;
 using FairyGUI;
 using System.Collections.Generic;
 using System;
@@ -198,7 +196,7 @@ namespace GFGGame
         {
             if (_clearDressUpList)
             {
-                _dressUpObjUI.dressUpObj.ClearDressUpList();
+                _dressUpObjUI.dressUpObj.TakeOffAll();
                 _clearDressUpList = false;
             }
             _dressUpObjUI.ResetSceneObj(45, true, true, null, false);

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/DressUp/ArenaDressUpFightView.cs

@@ -35,7 +35,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             for (int i = 0; i < _listLongPress.Count; i++)
@@ -162,7 +162,7 @@ namespace GFGGame
 
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -45,7 +45,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             for (int i = 0; i < _listLongPress.Count; i++)
@@ -260,7 +260,7 @@ namespace GFGGame
 
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 3 - 2
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpView.cs

@@ -39,7 +39,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             for (int i = 0; i < _listLongPress.Count; i++)
@@ -177,8 +177,9 @@ namespace GFGGame
 
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
+                //MyDressUpHelper.dressUpObj.ClearView();
             }
             _ui.m_c2.selectedIndex = 0;
             Reset();

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -55,7 +55,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 
@@ -584,7 +584,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/Friend/FriendView.cs

@@ -18,7 +18,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             _dressUpObj = null;
@@ -111,7 +111,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             _ui.m_list.numItems = 0;

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -109,7 +109,7 @@ namespace GFGGame
 
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             base.OnHide();

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/ArenaFightResultView.cs

@@ -112,7 +112,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -48,7 +48,7 @@ namespace GFGGame
             base.Dispose();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 
@@ -170,7 +170,7 @@ namespace GFGGame
             StopAutoPlay();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             MusicManager.Instance.PlayCroutine(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightSingleScoreView.cs

@@ -545,7 +545,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightSingleView.cs

@@ -12,7 +12,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 
@@ -65,7 +65,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
         }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetScoreView.cs

@@ -645,7 +645,7 @@ namespace GFGGame
             Reset();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetView.cs

@@ -18,7 +18,7 @@ namespace GFGGame
         {
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             if (_sceneTargetObject != null)
@@ -131,12 +131,12 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             if (_sceneTargetObject != null)
             {
-                GameObject.Destroy(_sceneTargetObject);
+                PrefabManager.Instance.Restore(_sceneTargetObject);
                 _sceneTargetObject = null;
             }
         }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StroyFightResultView.cs

@@ -145,7 +145,7 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             InstanceZonesDataManager.isResultFighting = false;

+ 4 - 2
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -63,7 +63,7 @@ namespace GFGGame
 
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
 
@@ -250,7 +250,9 @@ namespace GFGGame
             base.OnHide();
             if (_sceneObject != null)
             {
-                GameObject.Destroy(_sceneObject);
+                //MyDressUpHelper.dressUpObj.TakeOffAll();
+                //GameObject.Destroy(_sceneObject);
+                PrefabManager.Instance.Restore(_sceneObject);
                 _sceneObject = null;
             }
             _valueBarController.OnHide();