Bladeren bron

Merge branch 'master' of http://10.108.64.190:3000/gfg/client

zhangyuqian 1 jaar geleden
bovenliggende
commit
714ed40eba

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Assets/SpriteHelper.cs

@@ -10,9 +10,10 @@ namespace GFGGame
         /// </summary>
         /// <param name="spr"></param>
         /// <param name="resPath"></param>
-        public static void AddSpriteTo(SpriteRenderer spr, string resPath)
+        public static async void AddSpriteTo(SpriteRenderer spr, string resPath)
         {
             RemoveSpriteFrom(spr);
+            await LoadManager.Instance.CheckResExsitedOrDownload(resPath);
             var handle = YooAssets.LoadAssetSync<Sprite>(resPath);
             Sprite sp = handle.AssetObject as Sprite;
             GameObject gameObject = spr.gameObject;

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Data/TaskDataManager.cs

@@ -222,7 +222,8 @@ namespace GFGGame
                 case ConstTaskType.UpgradeCardSkill:
                     return string.Format(activeRewardCfg.desc, taskCfg.paramsArr[0], taskCfg.GetTargetCount());
                 case ConstTaskType.CollectParts:
-                    return string.Format(activeRewardCfg.desc, taskCfg.paramsArr[0], taskCfg.GetTargetCount());
+                    string itemType = ItemTypeCfgArray.Instance.GetCfg(taskCfg.paramsArr[0]).name;
+                    return string.Format(activeRewardCfg.desc, itemType, taskCfg.GetTargetCount());
                 default: return string.Format(activeRewardCfg.desc, taskCfg.GetTargetCount());
             }
         }

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

@@ -109,7 +109,6 @@ namespace GFGGame
                 StoryDialogDataManager.Instance.waitPicFade = true;
 
                 var resPath = ResPathUtil.GetNpcPicSPath(value);
-                await LoadManager.Instance.CheckResExsitedOrDownload(resPath);
                 SpriteHelper.AddSpriteTo(spr, resPath);
                 SetSpriteRendererAlpha(spr, 0f);
                 FairyGUI.Timers.inst.StartCoroutine(UpdateDialogPicAlpha());

+ 1 - 1
GameClient/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs

@@ -296,7 +296,7 @@ namespace YooAsset.Editor
 			{
 				EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
 			}
-			AssetBundleHelper.OnPostExecuteBuild();
+			AssetBundleHelper.OnPostExecuteBuild(buildResult);
 		}
 
 		// 构建版本相关

+ 50 - 1
GameClient/Assets/YooAsset/Editor/GFGAsset/Collect/AssetBundleHelper.cs

@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.IO;
 using UnityEditor;
+using UnityEngine;
+using YooAsset.Editor;
 
 namespace GFGEditor
 {
@@ -104,7 +106,7 @@ namespace GFGEditor
             EditorUtility.ClearProgressBar();
         }
 
-        public static void OnPostExecuteBuild()
+        public static void OnPostExecuteBuild(BuildResult buildResult)
         {
             if(fileBundleDic != null)
             {
@@ -118,6 +120,13 @@ namespace GFGEditor
             }
             assetBundleCollector = null;
             _ruler = null;
+
+            int index = buildResult.OutputPackageDirectory.LastIndexOf("/");
+            string targetPath = buildResult.OutputPackageDirectory.Substring(0, index);
+            Debug.Log($"sourcePath {buildResult.OutputPackageDirectory}");
+            Debug.Log($"targetPath {targetPath}");
+            CopyFilesTo(buildResult.OutputPackageDirectory, targetPath);
+            Directory.Delete(buildResult.OutputPackageDirectory, true);
         }
 
         public static void CollectDynamicFile(string dirPath, string itemKey, string assetPath, bool autoMerge)
@@ -277,5 +286,45 @@ namespace GFGEditor
         {
             return excludeFileExtensions.Contains(extension);
         }
+
+        public static List<string> CopyFilesTo(string sourcePath, string targetPath, string[] includeExtensionNames = null)
+        {
+            if(!sourcePath.EndsWith("/"))
+            {
+                sourcePath += "/";
+            }
+            if (!targetPath.EndsWith("/"))
+            {
+                targetPath += "/";
+            }
+            List<string> result = new List<string>();
+            if (Directory.Exists(sourcePath))
+            {
+                var files = Directory.GetFiles(sourcePath);
+                var dirs = Directory.GetDirectories(sourcePath);
+                foreach (var dir in dirs)
+                {
+                    List<string> tempResult = CopyFilesTo(dir, targetPath, includeExtensionNames);
+                    result.AddRange(tempResult);
+                }
+
+                foreach (var file in files)
+                {
+                    var fileName = Path.GetFileName(file);
+                    string extensionName = Path.GetExtension(file);
+                    if (includeExtensionNames == null || Array.IndexOf(includeExtensionNames, extensionName) >= 0)
+                    {
+                        string targetFilePath = targetPath + fileName;
+                        if (!File.Exists(targetFilePath) || !Equals(file, targetFilePath))
+                        {
+                            File.Copy(file, targetFilePath, true);
+                            result.Add(file);
+                        }
+                    }
+                }
+            }
+            return result;
+        }
+
     }
 }