Browse Source

预加载

guodong 1 year ago
parent
commit
c1edc34c9e
1 changed files with 8 additions and 2 deletions
  1. 8 2
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs

+ 8 - 2
GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs

@@ -28,6 +28,7 @@ namespace GFGGame
         private EAction actionType;
 
         private List<GameObject> preloadList = new List<GameObject>();
+        private string[] locationsLoading;
 
         public DressUpLayerOperation(GameObject parentObj, bool needSetMask, bool showAni, string resPath, string effectResPath)
         {
@@ -125,6 +126,7 @@ namespace GFGGame
             downloaderOperation = null;
             this.itemCfg = null;
             this.parentObj = null;
+            locationsLoading = null;
         }
 
         internal override void Start()
@@ -148,6 +150,10 @@ namespace GFGGame
                 {
                     if (downloaderOperation.Status == EOperationStatus.Succeed)
                     {
+                        foreach (var t in locationsLoading)
+                        {
+                            LoadManager.Instance.SetResDownloaded(t);
+                        }
                         CheckPreDraw();
                     }
                     else
@@ -188,8 +194,8 @@ namespace GFGGame
                 Status = EOperationStatus.Succeed;
                 return;
             }
-
-            downloaderOperation = YooAssets.CreateBundleDownloader(locations.ToArray(), 3, 3);
+            locationsLoading = locations.ToArray();
+            downloaderOperation = YooAssets.CreateBundleDownloader(locationsLoading, 3, 3);
             if(downloaderOperation.TotalDownloadCount == 0)
             {
                 //文件已在本地,不需要下载