浏览代码

预渲染,取消回收

guodong 1 年之前
父节点
当前提交
2ff964ed83

+ 12 - 1
GameClient/Assets/Game/HotUpdate/Assets/PrefabManager.cs

@@ -16,7 +16,7 @@ namespace GFGGame
 
         private void Awake()
         {
-            preDrawRoot = new GameObject("PredrawToot");
+            preDrawRoot = new GameObject("PredrawRoot");
             preDrawRoot.transform.position = new Vector3(0, 0, 0);
             preDrawRoot.transform.localScale = Vector3.zero;
         }
@@ -140,5 +140,16 @@ namespace GFGGame
             return null;
         }
 
+        public void CancelPreDraw(string resPath)
+        {
+            preDrawDic.TryGetValue(resPath, out var list);
+            if(list != null && list.Count > 0)
+            {
+                int index = list.Count - 1;
+                var t = list[index];
+                list.RemoveAt(index);
+                Restore(t);
+            }
+        }
     }
 }

+ 5 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs

@@ -102,6 +102,11 @@ namespace GFGGame
                 {
                     downloaderOperation.CancelDownload();
                 }
+                if(_steps == EDressUpSteps.PreDrawing)
+                {
+                    //取消预渲染
+                    PrefabManager.Instance.CancelPreDraw(resPath);
+                }
                 _steps = EDressUpSteps.Done;
             }
             Status = EOperationStatus.Failed;