From 4bb1fb5ec2eec2b740ac529ae75e07c15b67d3a7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 22 五月 2026 18:32:23 +0800
Subject: [PATCH] localres前置资源包装

---
 Assets/AssetBundleCollectorSetting.asset                |   88 +++++++++++++++++++++++++---
 Assets/Editor/YooAsset/YooAssetBuildTool.cs             |   72 +++++++++++++++++++++++
 Assets/Editor/AssetBundleBrowser/AssetBundleBuildTab.cs |   11 +++
 3 files changed, 157 insertions(+), 14 deletions(-)

diff --git a/Assets/AssetBundleCollectorSetting.asset b/Assets/AssetBundleCollectorSetting.asset
index 694cd9d..70a4fa4 100644
--- a/Assets/AssetBundleCollectorSetting.asset
+++ b/Assets/AssetBundleCollectorSetting.asset
@@ -89,14 +89,6 @@
       AssetTags: 
       ActiveRuleName: EnableGroup
       Collectors:
-      - CollectPath: Assets/ResourcesOut/BuiltIn
-        CollectorGUID: e5f9df9a324df2b46b1a92fa8da26b67
-        CollectorType: 0
-        AddressRuleName: AddressByRelativePath
-        PackRuleName: PackDirectory
-        FilterRuleName: CollectAll
-        AssetTags: 
-        UserData: 
       - CollectPath: Assets/ResourcesOut/Shader
         CollectorGUID: 01ad80e2bb073fb46ad906e3572fbe50
         CollectorType: 0
@@ -135,6 +127,19 @@
         AddressRuleName: AddressByRelativePath
         PackRuleName: PackDirectory
         FilterRuleName: CollectConfigExcludeOPConfig
+        AssetTags: 
+        UserData: 
+    - GroupName: BuiltinAfterUpdate
+      GroupDesc: 
+      AssetTags: 
+      ActiveRuleName: EnableGroup
+      Collectors:
+      - CollectPath: Assets/ResourcesOut/BuiltIn
+        CollectorGUID: e5f9df9a324df2b46b1a92fa8da26b67
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackDirectory
+        FilterRuleName: CollectBuiltinAfterUpdate
         AssetTags: 
         UserData: 
   - PackageName: Dll
@@ -273,12 +278,73 @@
       GroupDesc: 
       AssetTags: 
       ActiveRuleName: EnableGroup
+      Collectors: []
+    - GroupName: ResBeforeUpdate
+      GroupDesc: 
+      AssetTags: 
+      ActiveRuleName: EnableGroup
       Collectors:
-      - CollectPath: Assets/ResourcesOut/BuiltIn
-        CollectorGUID: e5f9df9a324df2b46b1a92fa8da26b67
+      - CollectPath: Assets/ResourcesOut/BuiltIn/Prefabs/LaunchExWin.prefab
+        CollectorGUID: 47197a2719503114b8f5e31e9ebd5681
         CollectorType: 0
         AddressRuleName: AddressByRelativePath
-        PackRuleName: PackDirectory
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/BuiltIn/Sprites/TY_TB_JH1.png
+        CollectorGUID: b97cb389470e86a4497784c6f8ef25c7
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/BuiltIn/Sprites/TY_TB_JH2.png
+        CollectorGUID: deefbcc93bc197e4db4e10a29c3bbac3
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/BuiltIn/Sprites/LoadingBottom.png
+        CollectorGUID: a62ce07e7f8dcef49bfe3678e8ec09c2
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/BuiltIn/Sprites/LoadingSlider.png
+        CollectorGUID: c610422c20ccc42c39cb773afbe86a29
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/Config/InitialFunction.txt
+        CollectorGUID: ab2ea28be4c891a4e81ddf6317e8f7c0
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/Config/PriorLanguage.txt
+        CollectorGUID: 10564c412fe84634e88b92c0b377a152
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
+        FilterRuleName: CollectAll
+        AssetTags: 
+        UserData: 
+      - CollectPath: Assets/ResourcesOut/Config/PriorBundle.txt
+        CollectorGUID: fa5dd5fa8b0c89649893a3791066c4f5
+        CollectorType: 0
+        AddressRuleName: AddressByRelativePath
+        PackRuleName: PackSeparately
         FilterRuleName: CollectAll
         AssetTags: 
         UserData: 
diff --git a/Assets/Editor/AssetBundleBrowser/AssetBundleBuildTab.cs b/Assets/Editor/AssetBundleBrowser/AssetBundleBuildTab.cs
index 3ad6f3a..6349698 100644
--- a/Assets/Editor/AssetBundleBrowser/AssetBundleBuildTab.cs
+++ b/Assets/Editor/AssetBundleBrowser/AssetBundleBuildTab.cs
@@ -596,8 +596,10 @@
 
         private void CopyToStreamingAssets()
         {
-            // YooAsset 鎵撳寘鏃跺凡閫氳繃 ClearAndCopyAll 鑷姩鎷疯礉鍒� StreamingAssets/yoo/
-            Debug.Log("[AssetBundleBuildTab] YooAsset 妯″紡涓嬫墦鍖呭凡鑷姩鎷疯礉鍒� StreamingAssets锛屾棤闇�鎵嬪姩鎿嶄綔銆�");
+            if (YooAssetBuildTool.CopyStartupConfigsToStreamingAssets())
+            {
+                AssetDatabase.Refresh();
+            }
         }
 
         private void ExecuteBuildAll()
@@ -624,9 +626,14 @@
             EditorUtility.ClearProgressBar();
 
             if (ok)
+            {
+                YooAssetBuildTool.CopyStartupConfigsToStreamingAssets();
                 Debug.Log($"[AssetBundleBuildTab] Package '{yooPackageName}' 鎵撳寘鎴愬姛锛�");
+            }
             else
+            {
                 Debug.LogError($"[AssetBundleBuildTab] Package '{yooPackageName}' 鎵撳寘澶辫触锛�");
+            }
 
             AssetDatabase.Refresh();
         }
diff --git a/Assets/Editor/YooAsset/YooAssetBuildTool.cs b/Assets/Editor/YooAsset/YooAssetBuildTool.cs
index bb8022a..42b2fce 100644
--- a/Assets/Editor/YooAsset/YooAssetBuildTool.cs
+++ b/Assets/Editor/YooAsset/YooAssetBuildTool.cs
@@ -461,8 +461,78 @@
         string summary = $"鎵撳寘瀹屾垚锛佹垚鍔�: {successCount}, 澶辫触: {failCount}, 鑰楁椂: {sw.Elapsed.TotalSeconds:F1}绉�";
         Debug.Log($"[YooAssetBuildTool] ========== {summary} ==========");
 
+        bool success = failCount == 0;
+        if (success)
+        {
+            success = CopyStartupConfigsToStreamingAssets();
+        }
+
         AssetDatabase.Refresh();
-        return failCount == 0;
+        return success;
+    }
+
+    public static bool CopyStartupConfigsToStreamingAssets()
+    {
+        string sourceConfigDir = System.IO.Path.Combine(Application.dataPath, "ResourcesOut", "Config");
+        string streamingAssetsDir = System.IO.Path.Combine(Application.dataPath, "StreamingAssets", "yoo");
+        string streamingConfigDir = System.IO.Path.Combine(streamingAssetsDir, "config");
+
+        if (!System.IO.Directory.Exists(sourceConfigDir))
+        {
+            Debug.LogError($"[YooAssetBuildTool] 鍚姩閰嶇疆婧愮洰褰曚笉瀛樺湪: {sourceConfigDir}");
+            return false;
+        }
+
+        System.IO.Directory.CreateDirectory(streamingAssetsDir);
+        System.IO.Directory.CreateDirectory(streamingConfigDir);
+
+        bool success = true;
+        string initialFunctionSrc = System.IO.Path.Combine(sourceConfigDir, "InitialFunction.txt");
+        string initialFunctionDst = System.IO.Path.Combine(streamingAssetsDir, "InitialFunction.txt");
+        if (System.IO.File.Exists(initialFunctionSrc))
+        {
+            System.IO.File.Copy(initialFunctionSrc, initialFunctionDst, true);
+        }
+        else
+        {
+            Debug.LogError($"[YooAssetBuildTool] InitialFunction.txt 涓嶅瓨鍦�: {initialFunctionSrc}");
+            success = false;
+        }
+
+        foreach (var oldFile in System.IO.Directory.GetFiles(streamingConfigDir, "*", System.IO.SearchOption.TopDirectoryOnly))
+        {
+            if (IsOPConfigFileName(oldFile))
+            {
+                System.IO.File.Delete(oldFile);
+            }
+        }
+
+        int opConfigCount = 0;
+        foreach (var sourceFile in System.IO.Directory.GetFiles(sourceConfigDir, "*", System.IO.SearchOption.TopDirectoryOnly))
+        {
+            if (!IsOPConfigFileName(sourceFile))
+            {
+                continue;
+            }
+
+            string destFile = System.IO.Path.Combine(streamingConfigDir, System.IO.Path.GetFileName(sourceFile));
+            System.IO.File.Copy(sourceFile, destFile, true);
+            opConfigCount++;
+        }
+
+        if (opConfigCount == 0)
+        {
+            Debug.LogWarning($"[YooAssetBuildTool] 鏈壘鍒� OPConfig 閰嶇疆: {sourceConfigDir}");
+        }
+
+        Debug.Log($"[YooAssetBuildTool] 宸叉嫹璐濆惎鍔ㄩ厤缃埌 StreamingAssets: InitialFunction={(System.IO.File.Exists(initialFunctionDst) ? "ok" : "missing")}, OPConfig={opConfigCount}, 鐩綍={streamingAssetsDir}");
+        return success;
+    }
+
+    private static bool IsOPConfigFileName(string path)
+    {
+        string fileName = System.IO.Path.GetFileName(path);
+        return fileName.EndsWith("OPConfig.txt", StringComparison.OrdinalIgnoreCase);
     }
 
     /// <summary>

--
Gitblit v1.8.0