From 9f6fc2a55bbbf825870fc1db79940e80a3537219 Mon Sep 17 00:00:00 2001 From: Starfire-Corporation-Win Date: Sat, 13 Jan 2024 14:44:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20Feature=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E8=B5=84=E6=BA=90=E6=9F=A5=E8=AF=A2=E5=8F=AF?= =?UTF-8?q?=E5=AF=BB=E5=9D=80=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Windows/ASConfigEditor.cs | 4 +- Editor/Windows/AssetCollectWindow.Data.cs | 6 +- Editor/Windows/Data/AssetCollectItem.cs | 55 +++++++++++++++++-- Editor/Windows/Data/AssetCollectRoot.cs | 52 +++++++++++++++++- Editor/Windows/Interface/AssetInfoData.cs | 4 +- .../Mode/AssetCollectWindow.OnDrawConfig.cs | 4 +- .../Mode/AssetCollectWindow.OnDrawLookMode.cs | 47 ++++++++-------- .../AssetCollectWindow.OnDrawBuildMode.FTP.cs | 6 +- .../AssetCollectWindow.OnDrawBuildMode.cs | 2 +- .../Editor/1.5.7/Command/YooAssetBuild.cs | 10 ++-- .../1.5.7/Windows/BuildExportGraphWindows.cs | 18 +++--- .../Editor/1.5.7/Windows/YooAssetUnityArgs.cs | 14 ++--- 12 files changed, 158 insertions(+), 64 deletions(-) diff --git a/Editor/Windows/ASConfigEditor.cs b/Editor/Windows/ASConfigEditor.cs index 729886c..9fca6cb 100644 --- a/Editor/Windows/ASConfigEditor.cs +++ b/Editor/Windows/ASConfigEditor.cs @@ -35,13 +35,13 @@ protected override void OnGUI() if (GELayout.Button("Clean Sandbox")) { var sandbox = Path.Combine(EHelper.Path.Project, "Sandbox"); - if (Directory.Exists(sandbox)) AHelper.IO.DeleteFolder(sandbox, SearchOption.AllDirectories, true); + if (Directory.Exists(sandbox)) AHelper.IO.DeleteDir(sandbox, SearchOption.AllDirectories, true); } if (GELayout.Button("Clean Bundles")) { var sandbox = Path.Combine(EHelper.Path.Project, "Bundles"); - if (Directory.Exists(sandbox)) AHelper.IO.DeleteFolder(sandbox, SearchOption.AllDirectories, true); + if (Directory.Exists(sandbox)) AHelper.IO.DeleteDir(sandbox, SearchOption.AllDirectories, true); } } diff --git a/Editor/Windows/AssetCollectWindow.Data.cs b/Editor/Windows/AssetCollectWindow.Data.cs index 0fb855a..8b0b8a0 100644 --- a/Editor/Windows/AssetCollectWindow.Data.cs +++ b/Editor/Windows/AssetCollectWindow.Data.cs @@ -391,7 +391,9 @@ private class DependenciesInfo #region Common private Hashtable TempTable = new Hashtable(); - + private GUILayoutOption GP_MAX_Width_100; + private GUILayoutOption GP_MIN_Width_50; + private GUILayoutOption GP_Width_100; private GUILayoutOption GP_Width_120; private GUILayoutOption GP_Width_150; @@ -533,6 +535,8 @@ private class DependenciesInfo private void GPInit() { + GP_MAX_Width_100 = GUILayout.MaxWidth(100); + GP_MIN_Width_50 = GUILayout.MinWidth(50); GP_Width_EXPAND = GUILayout.ExpandWidth(true); GP_Width_120 = GUILayout.Width(120); GP_Width_150 = GUILayout.Width(150); diff --git a/Editor/Windows/Data/AssetCollectItem.cs b/Editor/Windows/Data/AssetCollectItem.cs index 174febc..5eeaa23 100644 --- a/Editor/Windows/Data/AssetCollectItem.cs +++ b/Editor/Windows/Data/AssetCollectItem.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; using AIO.UEngine; using UnityEditor; @@ -186,7 +185,7 @@ public bool IsCollectAsset(AssetRuleData data) // 判断收集规则是否符合条件 如果不符合则跳过 if (RuleCollects.Count != 0 && - !RuleCollects.Any(filter => filter.IsCollectAsset(data)) + !RuleCollects.Exists(filter => filter.IsCollectAsset(data)) ) return false; // 判断自定义收集规则等 @@ -196,7 +195,7 @@ public bool IsCollectAsset(AssetRuleData data) // 判断过滤规则是否符合条件 如果符合则跳过 if (RuleFilters.Count != 0 && - RuleFilters.Any(filter => filter.IsCollectAsset(data)) + RuleFilters.Exists(filter => filter.IsCollectAsset(data)) ) return false; // 判断自定义过滤规则等 @@ -207,6 +206,54 @@ public bool IsCollectAsset(AssetRuleData data) return true; } + public string GetAddress(string assetPath) + { + UpdateCollect(); + UpdateFilter(); + var data = new AssetRuleData + { + Tags = Tags, + UserData = UserData, + PackageName = PackageName, + GroupName = GroupName, + CollectPath = CollectPath, + }; + var index = assetPath.LastIndexOf('.'); + if (index >= 0) + { + data.Extension = assetPath.Substring(index).Replace(".", "").ToLower(); + } + + data.AssetPath = assetPath.Substring(0, assetPath.Length - data.Extension.Length - 1); + return IsCollectAsset(data) ? GetAssetAddress(data, ASConfig.GetOrCreate().LoadPathToLower) : string.Empty; + } + + /// + /// 是否存在指定资源 + /// + /// 资源相对路径 + /// Ture:存在 False:不存在 + public bool Exist(string assetPath) + { + UpdateFilter(); + var data = new AssetRuleData + { + Tags = Tags, + UserData = UserData, + PackageName = PackageName, + GroupName = GroupName, + CollectPath = CollectPath, + }; + var index = assetPath.LastIndexOf('.'); + if (index >= 0) + { + data.Extension = assetPath.Substring(index).Replace(".", "").ToLower(); + } + + data.AssetPath = assetPath.Substring(0, assetPath.Length - data.Extension.Length - 1); + return IsCollectAsset(data); + } + public string GetAssetAddress(AssetRuleData data, bool pathToLower = false) { var rule = AssetCollectSetting.MapAddress.GetValue(Address); @@ -337,7 +384,7 @@ private void CollectAsset(string[] tags, bool pathToLower) } } - public async void CollectAssetTask(string package, string group, + public async Task CollectAssetTask(string package, string group, Action> cb = null) { AssetDataInfos.Clear(); diff --git a/Editor/Windows/Data/AssetCollectRoot.cs b/Editor/Windows/Data/AssetCollectRoot.cs index ca4c6a2..2d3bdf0 100644 --- a/Editor/Windows/Data/AssetCollectRoot.cs +++ b/Editor/Windows/Data/AssetCollectRoot.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using UnityEditor; using UnityEngine; @@ -20,7 +19,7 @@ namespace AIO.UEditor [HelpURL( "https://github.com/AIO-GAME/Unity.Asset.CLI/blob/main/.github/API_USAGE/ToolWindow.md#asset-system-%E5%B7%A5%E5%85%B7%E8%AF%B4%E6%98%8E")] #if UNITY_2021_1_OR_NEWER - [Icon( "Packages/com.aio.package/Resources/Editor/Setting/icon_interests.png")] + [Icon("Packages/com.aio.package/Resources/Editor/Setting/icon_interests.png")] #else [ScriptIcon(IconRelative = "Packages/com.aio.package/Resources/Editor/Setting/icon_interests.png")] #endif @@ -374,5 +373,54 @@ public void FoldoutOff() } } } + + [MenuItem("Assets/Asset System Find Address", true, 1000)] + private static bool IsSelectAsset() + { + return Selection.activeObject != null && + AssetDatabase.Contains(Selection.activeObject) && + !AssetDatabase.IsValidFolder(AssetDatabase.GetAssetPath(Selection.activeObject)); // 不能是文件夹 + } + + /// + /// 根据GUID查找资源可寻址路径 + /// + [MenuItem("Assets/Asset System Find Address", false, 1000)] + public static void FindAssetLocal() + { + var obj = Selection.activeObject; + var path = AssetDatabase.GetAssetPath(obj); + var guid = AssetDatabase.AssetPathToGUID(path); + if (string.IsNullOrEmpty(guid)) return; + var root = GetOrCreate(); + var list = new List(); + foreach (var package in root.Packages) + { + if (package is null) continue; + foreach (var group in package.Groups) + { + if (group is null) continue; + foreach (var item in group.Collectors) + { + if (item is null) continue; + if (item.Type != EAssetCollectItemType.MainAssetCollector) continue; + if (!path.StartsWith(item.CollectPath)) continue; + // 是否是否被过滤 + var address = item.GetAddress(path); + if (string.IsNullOrEmpty(address)) continue; + list.Add(address); + } + } + } + + if (list.Count == 0) + { + Debug.Log($"未找到资源{path}的可寻址路径"); + } + else + { + Debug.Log($"资源:{path}\n可寻址路径为:\n{string.Join("\n", list)}"); + } + } } } \ No newline at end of file diff --git a/Editor/Windows/Interface/AssetInfoData.cs b/Editor/Windows/Interface/AssetInfoData.cs index c76bb33..9a0ffb7 100644 --- a/Editor/Windows/Interface/AssetInfoData.cs +++ b/Editor/Windows/Interface/AssetInfoData.cs @@ -55,7 +55,7 @@ public long Size } else if (Directory.Exists(AssetPath)) { - _size = AHelper.IO.GetFolderLength(AssetPath); + _size = AHelper.IO.GetDirLength(AssetPath); } else _size = -1; } @@ -101,7 +101,7 @@ public DateTime LastWriteTime if (File.Exists(AssetPath)) _lastWriteTime = AHelper.IO.GetFileLastWriteTimeUtc(AssetPath); else if (Directory.Exists(AssetPath)) - _lastWriteTime = AHelper.IO.GetFolderLastWriteTimeUtc(AssetPath); + _lastWriteTime = AHelper.IO.GetDirLastWriteTimeUtc(AssetPath); else _lastWriteTime = DateTime.MinValue; } diff --git a/Editor/Windows/Mode/AssetCollectWindow.OnDrawConfig.cs b/Editor/Windows/Mode/AssetCollectWindow.OnDrawConfig.cs index cb78fd3..502f898 100644 --- a/Editor/Windows/Mode/AssetCollectWindow.OnDrawConfig.cs +++ b/Editor/Windows/Mode/AssetCollectWindow.OnDrawConfig.cs @@ -127,14 +127,14 @@ partial void OnDrawASConfig() { var sandbox = Path.Combine(EHelper.Path.Project, "Sandbox"); if (Directory.Exists(sandbox)) - AHelper.IO.DeleteFolder(sandbox, SearchOption.AllDirectories, true); + AHelper.IO.DeleteDir(sandbox, SearchOption.AllDirectories, true); } if (GELayout.Button("Clean Bundles", GEStyle.toolbarbuttonRight, GP_Width_100)) { var sandbox = Path.Combine(EHelper.Path.Project, "Bundles"); if (Directory.Exists(sandbox)) - AHelper.IO.DeleteFolder(sandbox, SearchOption.AllDirectories, true); + AHelper.IO.DeleteDir(sandbox, SearchOption.AllDirectories, true); } } diff --git a/Editor/Windows/Mode/AssetCollectWindow.OnDrawLookMode.cs b/Editor/Windows/Mode/AssetCollectWindow.OnDrawLookMode.cs index 0773fca..cffce29 100644 --- a/Editor/Windows/Mode/AssetCollectWindow.OnDrawLookMode.cs +++ b/Editor/Windows/Mode/AssetCollectWindow.OnDrawLookMode.cs @@ -31,8 +31,7 @@ LookModeDisplayPackages is null || } Data.CurrentPackageIndex = EditorGUILayout.Popup(Data.CurrentPackageIndex, LookModeDisplayPackages, - GEStyle.PreDropDown, - GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); if (!Data.IsGroupValid()) { @@ -60,7 +59,7 @@ LookModeDisplayPackages is null || Data.CurrentGroupIndex = EditorGUILayout.Popup( Data.CurrentGroupIndex, LookModeDisplayGroups[packageName], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); if (!Data.IsCollectValid()) { @@ -93,19 +92,19 @@ LookModeDisplayPackages is null || LookModeDisplayCollectorsIndex = 0; EditorGUILayout.Popup(0, LookModeDisplayCollectors[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } else if (LookModeDisplayCollectors[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)].Length >= 31) { LookModeDisplayCollectorsIndex = EditorGUILayout.Popup(LookModeDisplayCollectorsIndex, LookModeDisplayCollectors[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } else { LookModeDisplayCollectorsIndex = EditorGUILayout.MaskField(LookModeDisplayCollectorsIndex, LookModeDisplayCollectors[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } } else LookModeDisplayCollectorsIndex = 0; @@ -117,13 +116,13 @@ LookModeDisplayPackages is null || LookModeDisplayTypeIndex = 0; EditorGUILayout.Popup(0, LookModeDisplayTypes[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } else { LookModeDisplayTypeIndex = EditorGUILayout.MaskField(LookModeDisplayTypeIndex, LookModeDisplayTypes[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } } else LookModeDisplayTypeIndex = 0; @@ -135,13 +134,13 @@ LookModeDisplayPackages is null || LookModeDisplayTagsIndex = 0; EditorGUILayout.Popup(0, LookModeDisplayTags[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } else { LookModeDisplayTagsIndex = EditorGUILayout.MaskField(LookModeDisplayTagsIndex, LookModeDisplayTags[(Data.CurrentPackageIndex, Data.CurrentGroupIndex)], - GEStyle.PreDropDown, GP_Width_100); + GEStyle.PreDropDown, GP_MAX_Width_100, GP_MIN_Width_50); } } else LookModeDisplayTagsIndex = 0; @@ -182,6 +181,14 @@ LookModeDisplayPackages is null || } OnDrawHeaderLookPageSetting(); + + if (GUILayout.Button(GC_REFRESH, GEStyle.TEtoolbarbutton, GP_Width_25)) + { + LookModeCurrentSelectAsset = null; + SearchText = string.Empty; + LookModeDisplayTagsIndex = LookModeDisplayTypeIndex = LookModeDisplayCollectorsIndex = 0; + UpdateDataLookMode(); + } } /// @@ -228,14 +235,6 @@ private void OnDrawHeaderLookPageSetting() { LookDataPageSizeMenu.ShowAsContext(); } - - if (GUILayout.Button(GC_REFRESH, GEStyle.TEtoolbarbutton, GP_Width_25)) - { - LookModeCurrentSelectAsset = null; - SearchText = string.Empty; - LookModeDisplayTagsIndex = LookModeDisplayTypeIndex = LookModeDisplayCollectorsIndex = 0; - UpdateDataLookMode(); - } } /// @@ -397,29 +396,24 @@ private void OnDrawLookModeAssetDetail() EditorGUILayout.LabelField(GC_LookMode_Detail_Asset, GP_Width_100); EditorGUILayout.ObjectField(LookModeCurrentSelectAsset, LookModeCurrentSelectAsset.GetType(), false); - if (GELayout.Button(GC_OPEN_FOLDER, GEStyle.IconButton, 16)) - EditorUtility.RevealInFinder(LookModeCurrentSelectAssetDataInfo.AssetPath); } using (new EditorGUILayout.HorizontalScope(GEStyle.toolbarbuttonLeft)) { EditorGUILayout.LabelField(GC_LookMode_Detail_GUID, GP_Width_100); EditorGUILayout.LabelField(LookModeCurrentSelectAssetDataInfo.GUID); - GELayout.ButtonCopy(GC_COPY, LookModeCurrentSelectAssetDataInfo.GUID, 16, GEStyle.IconButton); } using (new EditorGUILayout.HorizontalScope(GEStyle.toolbarbuttonLeft)) { EditorGUILayout.LabelField(GC_LookMode_Detail_Type, GP_Width_100); EditorGUILayout.LabelField(LookModeCurrentSelectAssetDataInfo.Type); - GELayout.ButtonCopy(GC_COPY, LookModeCurrentSelectAssetDataInfo.Type, 16, GEStyle.IconButton); } using (new EditorGUILayout.HorizontalScope(GEStyle.toolbarbuttonLeft)) { EditorGUILayout.LabelField(GC_LookMode_Detail_Path, GP_Width_100); EditorGUILayout.LabelField(LookModeCurrentSelectAssetDataInfo.AssetPath); - GELayout.ButtonCopy(GC_COPY, LookModeCurrentSelectAssetDataInfo.AssetPath, 16, GEStyle.IconButton); } using (new EditorGUILayout.HorizontalScope(GEStyle.toolbarbuttonLeft)) @@ -428,7 +422,6 @@ private void OnDrawLookModeAssetDetail() var timer = LookModeCurrentSelectAssetDataInfo.LastWriteTime.ToString("yyyy-MM-dd hh:mm:ss"); EditorGUILayout.LabelField(timer); - GELayout.ButtonCopy(GC_COPY, timer, 16, GEStyle.IconButton); } if (!string.IsNullOrEmpty(LookModeCurrentSelectAssetDataInfo.Tags)) @@ -626,6 +619,10 @@ private void OnDrawLookDataItem(Rect rect, AssetDataInfo data, int index) { GUI.FocusControl(null); onDrawLookDataItemMenu = new GenericMenu(); + onDrawLookDataItemMenu.AddItem(new GUIContent("Open Default Asset"), false, + () => { EditorUtility.OpenWithDefaultApp(data.AssetPath); }); + onDrawLookDataItemMenu.AddItem(new GUIContent("Open Local Folder"), false, + () => { EditorUtility.RevealInFinder(data.AssetPath); }); onDrawLookDataItemMenu.AddItem(new GUIContent("Select Asset"), false, () => { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(data.AssetPath); }); onDrawLookDataItemMenu.AddItem(new GUIContent("Copy Address"), false, @@ -712,7 +709,7 @@ private void UpdateDataLookModeCollector(int packageIndex, int groupIndex) var listTypes = new List(); for (var k = 0; k < Data.Packages[i].Groups[j].Collectors.Length; k++) { - Data.Packages[i].Groups[j].Collectors[k].CollectAssetTask( + _ = Data.Packages[i].Groups[j].Collectors[k].CollectAssetTask( Data.Packages[i].Name, Data.Packages[i].Groups[j].Name, dic => diff --git a/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.FTP.cs b/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.FTP.cs index 2f13425..a7d4fa6 100644 --- a/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.FTP.cs +++ b/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.FTP.cs @@ -92,8 +92,8 @@ private void OnDrawBuildFTP() if (EditorUtility.DisplayDialog("提示", $"{source}\n复制\n{target}", "确定", "取消")) { - if (AHelper.IO.ExistsFolder(target)) - AHelper.IO.DeleteFolder(target, SearchOption.AllDirectories, true); + if (AHelper.IO.ExistsDir(target)) + AHelper.IO.DeleteDir(target, SearchOption.AllDirectories, true); PrPlatform.Folder.Copy(target, source).Async(); return; } @@ -110,7 +110,7 @@ private void OnDrawBuildFTP() "取消")) { IExecutor executor = null; - if (AHelper.IO.ExistsFolder(target)) + if (AHelper.IO.ExistsDir(target)) executor = PrPlatform.Folder.Del(target); var symbolic = executor is null ? PrPlatform.Folder.Symbolic(target, source) diff --git a/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.cs b/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.cs index 269eb2e..6cc18a7 100644 --- a/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.cs +++ b/Editor/Windows/Mode/BuildMode/AssetCollectWindow.OnDrawBuildMode.cs @@ -140,7 +140,7 @@ private void OnDrawBuildBuild() { var sandbox = Path.Combine(EHelper.Path.Project, "Bundles"); if (Directory.Exists(sandbox)) - AHelper.IO.DeleteFolder(sandbox, SearchOption.AllDirectories, true); + AHelper.IO.DeleteDir(sandbox, SearchOption.AllDirectories, true); } if (GUILayout.Button("生成配置", GEStyle.toolbarbutton, GP_Width_75)) diff --git a/Extensions/YooAsset.CLI/Editor/1.5.7/Command/YooAssetBuild.cs b/Extensions/YooAsset.CLI/Editor/1.5.7/Command/YooAssetBuild.cs index ba7bf67..75f2860 100644 --- a/Extensions/YooAsset.CLI/Editor/1.5.7/Command/YooAssetBuild.cs +++ b/Extensions/YooAsset.CLI/Editor/1.5.7/Command/YooAssetBuild.cs @@ -1,7 +1,6 @@ #if SUPPORT_YOOASSET using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; @@ -275,13 +274,13 @@ public static Tuple< { if (!current.ContainsKey(item.Key)) // 删除 { - delete.Add(item.Key.ToString(), item.Value.ToString()); + delete.Add(item.Key, item.Value); continue; } - if (current[item.Key].ToString() != item.Value.ToString()) // 修改 + if (current[item.Key] != item.Value) // 修改 { - change.Add(item.Key.ToString(), item.Value.ToString()); + change.Add(item.Key, item.Value); } } @@ -351,7 +350,6 @@ private static void MergeToLatestExe(string currentPath, string latestPath, stri if (File.Exists(source)) { var target = Path.Combine(latestPath, pair.Key); - Console.WriteLine($"修改文件 : {target}"); File.Copy(source, target, true); } else @@ -379,7 +377,7 @@ private static void MergeToLatest(string rootPath, string version) if (!Directory.Exists(latestPath)) // 如果不存在 则将当前版本资源全部复制至 Latest { Directory.CreateDirectory(latestPath); - AHelper.IO.CopyFolderAll(currentPath, latestPath); + AHelper.IO.CopyDirAll(currentPath, latestPath); return; } diff --git a/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/BuildExportGraphWindows.cs b/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/BuildExportGraphWindows.cs index 11956d7..6402f57 100644 --- a/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/BuildExportGraphWindows.cs +++ b/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/BuildExportGraphWindows.cs @@ -231,7 +231,7 @@ public void UpdateTarget() EngineeringPathPath.Add(BuildTarget, new YooAssetUnityArgs(BuildTarget)); BuildInFilePlatform = Path.Combine(Commond.OutputRoot, BuildTarget.ToString()) .Replace('/', Path.DirectorySeparatorChar); - YooAssetPackageNames = AHelper.IO.GetFoldersName(BuildInFilePlatform).ToList(); + YooAssetPackageNames = AHelper.IO.GetDirsName(BuildInFilePlatform).ToList(); Commond.PackageVersion = DateTime.Now.ToString("yyyy-MM-dd-HHmmss"); EHelper.Prefs.SaveJson(typeof(YooAssetGraphicRect).FullName, EngineeringPathPath); @@ -246,7 +246,7 @@ protected override void OnDrawRight(Rect rect) public void OnDrawRight(float widthHalf, float widthQuarter) { GELayout.Vertical(Command0, GEStyle.INThumbnailShadow); - if (AHelper.IO.ExistsFolder(Commond.OutputRoot)) + if (AHelper.IO.ExistsDir(Commond.OutputRoot)) { GELayout.Vertical(Command1, GEStyle.INThumbnailShadow); GELayout.Vertical(Command2, GEStyle.INThumbnailShadow); @@ -268,9 +268,9 @@ private void Command0() Commond.PackageVersion = DateTime.Now.ToString("yyyy-MM-dd-HHmmss"); } - if (AHelper.IO.ExistsFolder(BuildInFilePlatform)) + if (AHelper.IO.ExistsDir(BuildInFilePlatform)) { - if (AHelper.IO.ExistsFolder(EngineeringPathPath[BuildTarget].OutputRoot) && + if (AHelper.IO.ExistsDir(EngineeringPathPath[BuildTarget].OutputRoot) && YooAssetPackageTarget.Count == 0) { if (GELayout.Button("组合资源包\n目标工程", 100, 25)) @@ -347,8 +347,8 @@ private void Command2() { var source = Commond.OutputRoot.Trim('/', '\\'); var target = LocalStoragePath.Trim('/', '\\'); - if (AHelper.IO.ExistsFolder(target)) - AHelper.IO.DeleteFolder(target, SearchOption.AllDirectories, true); + if (AHelper.IO.ExistsDir(target)) + AHelper.IO.DeleteDir(target, SearchOption.AllDirectories, true); PrPlatform.Folder.Copy(target, source).Async(); } @@ -357,7 +357,7 @@ private void Command2() var source = Commond.OutputRoot.Trim('/', '\\'); var target = LocalStoragePath.Trim('/', '\\'); IExecutor executor = null; - if (AHelper.IO.ExistsFolder(target)) + if (AHelper.IO.ExistsDir(target)) executor = PrPlatform.Folder.Del(target); var symbolic = executor is null ? PrPlatform.Folder.Symbolic(target, source) @@ -387,7 +387,7 @@ private void Command2() private void Command3() { - if (!AHelper.IO.ExistsFolder(BuildInFilePlatform)) return; + if (!AHelper.IO.ExistsDir(BuildInFilePlatform)) return; using (GELayout.VHorizontal()) { GELayout.Label("组合资源 StreamingAssets", GEStyle.DDHeaderStyle, GTOption.Height(25)); @@ -415,7 +415,7 @@ private void Command3() { var package = Path.Combine(BuildInFilePlatform, YooAssetPackageNames[YooAssetPackageIndex]); - var list = AHelper.IO.GetFoldersName(package) + var list = AHelper.IO.GetDirsName(package) .Where(file => !file.StartsWith("OutputCache")).ToList(); YooAssetPackageVersionTarget.Add(YooAssetPackageNames[YooAssetPackageIndex], list); } diff --git a/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/YooAssetUnityArgs.cs b/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/YooAssetUnityArgs.cs index 6689095..3a0c8aa 100644 --- a/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/YooAssetUnityArgs.cs +++ b/Extensions/YooAsset.CLI/Editor/1.5.7/Windows/YooAssetUnityArgs.cs @@ -37,7 +37,7 @@ public YooAssetUnityArgs(BuildTarget target) #elif UNITY_2020 VersionIndex = 3; #elif UNITY_2021 - VersionIndex = 4; + VersionIndex = 4; #elif UNITY_2022 VersionIndex = 5; #elif UNITY_2023 @@ -63,7 +63,7 @@ IDictionary packages return; } - if (AHelper.IO.ExistsFolder(Path.Combine(packageRoot, buildTarget.ToString()))) + if (AHelper.IO.ExistsDir(Path.Combine(packageRoot, buildTarget.ToString()))) { Debug.LogError("请设置YooAsset资源包根目录 -> " + buildTarget); return; @@ -76,8 +76,8 @@ IDictionary packages } var output = Application.streamingAssetsPath.PathCombine(ASConfig.GetOrCreate().RuntimeRootDirectory); - if (AHelper.IO.ExistsFolder(output)) await PrPlatform.Folder.Del(output).Async(); - AHelper.IO.CreateFolder(output); + if (AHelper.IO.ExistsDir(output)) await PrPlatform.Folder.Del(output).Async(); + AHelper.IO.CreateDir(output); foreach (var package in packages) { var packagePath = Path.Combine(output, package.Key); @@ -98,7 +98,7 @@ public async void BuiltUp(BuildTarget buildTarget, string packageRoot, IDictiona return; } - if (AHelper.IO.ExistsFolder(Path.Combine(packageRoot, buildTarget.ToString()))) + if (AHelper.IO.ExistsDir(Path.Combine(packageRoot, buildTarget.ToString()))) { Debug.LogError("请设置YooAsset资源包根目录 -> " + buildTarget); return; @@ -141,8 +141,8 @@ public async void BuiltUp(BuildTarget buildTarget, string packageRoot, IDictiona } if (string.IsNullOrEmpty(output)) return; - if (AHelper.IO.ExistsFolder(output)) await PrPlatform.Folder.Del(output).Async(); - AHelper.IO.CreateFolder(output); + if (AHelper.IO.ExistsDir(output)) await PrPlatform.Folder.Del(output).Async(); + AHelper.IO.CreateDir(output); foreach (var package in packages) { var packagePath = Path.Combine(output, package.Key); From 093d2c71b66415074faa945c9182ba01eb549070 Mon Sep 17 00:00:00 2001 From: Starfire-Corporation-Win Date: Sat, 13 Jan 2024 14:50:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20Feature=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E8=B5=84=E6=BA=90=E6=9F=A5=E8=AF=A2=E5=8F=AF?= =?UTF-8?q?=E5=AF=BB=E5=9D=80=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Windows/Data/AssetCollectRoot.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Editor/Windows/Data/AssetCollectRoot.cs b/Editor/Windows/Data/AssetCollectRoot.cs index 2d3bdf0..6edcc96 100644 --- a/Editor/Windows/Data/AssetCollectRoot.cs +++ b/Editor/Windows/Data/AssetCollectRoot.cs @@ -393,7 +393,7 @@ public static void FindAssetLocal() var guid = AssetDatabase.AssetPathToGUID(path); if (string.IsNullOrEmpty(guid)) return; var root = GetOrCreate(); - var list = new List(); + var list = new List<(string, string, string)>(); foreach (var package in root.Packages) { if (package is null) continue; @@ -408,18 +408,20 @@ public static void FindAssetLocal() // 是否是否被过滤 var address = item.GetAddress(path); if (string.IsNullOrEmpty(address)) continue; - list.Add(address); + list.Add((package.Name, group.Name, address)); } } } - if (list.Count == 0) - { - Debug.Log($"未找到资源{path}的可寻址路径"); - } + if (list.Count == 0) Debug.Log($"未找到资源{path}的可寻址路径"); else { - Debug.Log($"资源:{path}\n可寻址路径为:\n{string.Join("\n", list)}"); + var str = string.Join("\n", list.Select(tuple => @$" +Package : {tuple.Item1} +Group : {tuple.Item2} +Address : {tuple.Item3} +")); + Debug.Log($"资源{path}的可寻址路径:\n{str}"); } } } From d9a7a734597e5f1c132de6d9c4984ce3ac770389 Mon Sep 17 00:00:00 2001 From: Starfire-Corporation-Win Date: Sat, 13 Jan 2024 14:52:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9C=A8=20Feature=20up=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4432549..176318c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.aio.cli.asset", "displayName": "AIO Unity CLI Asset", "description": "AIO Unity CLI Asset", - "version": "1.0.19-preview", + "version": "1.0.20-preview", "unity": "2019.4", "unityRelease": "0f1", "license": "MIT", @@ -14,10 +14,10 @@ "url": "https://github.com/AIO-GAME/Unity.Asset.CLI.git" }, "dependencies": { - "com.aio.package": "1.0.28-preview" + "com.aio.package": "1.0.29-preview" }, "relatedPackages": { - "com.aio.package": "1.0.28-preview" + "com.aio.package": "1.0.29-preview" }, "keywords": ["Asset", "YooAsset", "Unity Asset", "Resource"], "author": {