diff --git a/.github/README.md b/.github/README.md
index 7c8de60..b123dc8 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -1,10 +1,10 @@
```
- █████╗ ██╗ ██████╗ ██╗ ██╗███╗ ██╗██╗████████╗██╗ ██╗ ██████╗██╗ ██╗ █████╗ ███████╗███████╗███████╗████████╗
- ██╔══██╗██║██╔═══██╗ ██║ ██║████╗ ██║██║╚══██╔══╝╚██╗ ██╔╝ ██╔════╝██║ ██║ ██╔══██╗██╔════╝██╔════╝██╔════╝╚══██╔══╝
- ███████║██║██║ ██║ ██║ ██║██╔██╗ ██║██║ ██║ ╚████╔╝ ██║ ██║ ██║ ███████║███████╗███████╗█████╗ ██║
- ██╔══██║██║██║ ██║ ██║ ██║██║╚██╗██║██║ ██║ ╚██╔╝ ██║ ██║ ██║ ██╔══██║╚════██║╚════██║██╔══╝ ██║
- ██║ ██║██║╚██████╔╝ ╚██████╔╝██║ ╚████║██║ ██║ ██║ ╚██████╗███████╗██║ ██║ ██║███████║███████║███████╗ ██║
- ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ╚═╝
+ ██╗ ██╗███╗ ██╗██╗████████╗██╗ ██╗ ██████╗██╗ ██╗ █████╗ ███████╗███████╗███████╗████████╗
+ ██║ ██║████╗ ██║██║╚══██╔══╝╚██╗ ██╔╝ ██╔════╝██║ ██║ ██╔══██╗██╔════╝██╔════╝██╔════╝╚══██╔══╝
+ ██║ ██║██╔██╗ ██║██║ ██║ ╚████╔╝ ██║ ██║ ██║ ███████║███████╗███████╗█████╗ ██║
+ ██║ ██║██║╚██╗██║██║ ██║ ╚██╔╝ ██║ ██║ ██║ ██╔══██║╚════██║╚════██║██╔══╝ ██║
+ ╚██████╔╝██║ ╚████║██║ ██║ ██║ ╚██████╗███████╗██║ ██║ ██║███████║███████║███████╗ ██║
+ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ╚═╝
```
English | 简体中文
diff --git a/.github/qodana.yaml b/.github/qodana.yaml
new file mode 100644
index 0000000..d3a7637
--- /dev/null
+++ b/.github/qodana.yaml
@@ -0,0 +1,35 @@
+#-------------------------------------------------------------------------------#
+# Qodana analysis is configured by qodana.yaml file #
+# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
+#-------------------------------------------------------------------------------#
+version: "1.0"
+linter: jetbrains/qodana-dotnet:2023.3
+include:
+ - name: CheckDependencyLicenses
+
+#Specify IDE code to run analysis without container (Applied in CI/CD pipeline)
+ide: QDNET
+
+#Specify inspection profile for code analysis
+profile:
+ name: qodana.starter
+
+#Enable inspections
+#include:
+# - name:
+
+#Disable inspections
+exclude:
+ - name: All
+ paths:
+ - "Resources/Editor"
+ - "*.meta"
+ - "*.asmdef"
+ - "*.tt"
+
+#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
+#bootstrap: sh ./prepare-qodana.sh
+
+#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
+#plugins:
+# - id: #(plugin id can be found at https://plugins.jetbrains.com)
\ No newline at end of file
diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml
new file mode 100644
index 0000000..ff99505
--- /dev/null
+++ b/.github/workflows/code_quality.yml
@@ -0,0 +1,30 @@
+name: 🧬 Code Optimize Qodana
+on:
+ workflow_dispatch:
+ pull_request:
+ branches:
+ - main
+ push:
+ tags: # 当生成指定标签时触发
+ - '*.*.*'
+ branches: # Specify your branches here
+ - main
+ - '1.*'
+jobs:
+ qodana:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ pull-requests: write
+ checks: write
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: ${{ github.event.pull_request.head.sha }} # 检查实际的pull请求提交,而不是合并提交
+ fetch-depth: 0 # 拉请求分析需要完整的历史记录
+ - name: 🧬 Qodana Scan
+ uses: JetBrains/qodana-action@v2023.3
+ with:
+ pr-mode: false
+ env:
+ QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/github-close-stale-issues.yml b/.github/workflows/github-close-stale-issues.yml
index 3b28c39..e0d3e38 100644
--- a/.github/workflows/github-close-stale-issues.yml
+++ b/.github/workflows/github-close-stale-issues.yml
@@ -12,9 +12,9 @@
# Abandoned Issues and Pull Request".
# https://igorwiese.com/images/papers/Paper_BotSE_19.pdf
-name: GitHub - Close stale issues
+name: 🧪 GitHub - Close stale issues
on:
- schedule: [cron: "50 0 * * 1"] # run weekly Monday 00:50 UTC
+ schedule: [ cron: "50 0 * * 1" ] # run weekly Monday 00:50 UTC
workflow_dispatch:
jobs:
job-close-stale-issues:
@@ -32,8 +32,28 @@ jobs:
exempt-issue-labels: 'blocker,bug,enhancement,help wanted,regression'
days-before-stale: 90
days-before-close: 30
- stale-issue-message: 'This issue is stale because it has been open for 90 days with no activity. Please remove the stale label or add a comment or this issue will be closed in 30 days.'
- stale-pr-message: 'This PR is stale because it has been open for 90 days with no activity. Please remove the stale label or add a comment or this PR will be closed in 30 days.'
- close-issue-message: 'This issue was closed because it has been stalled for 30 days with no activity. Please feel free to reopen.'
- close-pr-message: 'This PR was closed because it has been stalled for 30 days with no activity. Please feel free to reopen.'
+ stale-issue-message: |
+ ### English
+ This issue is stale because it has been open for 90 days with no activity.
+ Please remove the stale label or add a comment or this issue will be closed in 30 days.
+ ### 中文
+ 此问题已经打开了90天没有活动,因此已经过时。
+ 请删除过时标签或添加评论,否则此问题将在30天内关闭。
+ stale-pr-message: |
+ ### English
+ This PR is stale because it has been open for 90 days with no activity.
+ Please remove the stale label or add a comment or this PR will be closed in 30 days.
+ ### 中文
+ 此拉取请求已经打开了90天没有活动,因此已经过时。
+ 请删除过时标签或添加评论,否则此拉取请求将在30天内关闭。
+ close-issue-message: |
+ ### English
+ This issue was closed because it has been stale for 30 days with no activity. Please feel free to reopen.
+ ### 中文
+ 此问题已经过时30天没有活动,因此已经关闭。请随时重新打开。
+ close-pr-message: |
+ ### English
+ This PR was closed because it has been stale for 30 days with no activity. Please feel free to reopen.
+ ### 中文
+ 此拉取请求已经过时30天没有活动,因此已经关闭。请随时重新打开.
repo-token: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml
index 279ca14..49bbb5c 100644
--- a/.github/workflows/greetings.yml
+++ b/.github/workflows/greetings.yml
@@ -1,6 +1,6 @@
name: 🧪 CI Greetings
-on: [pull_request_target, issues]
+on: [ pull_request_target, issues ]
jobs:
greeting:
@@ -9,16 +9,27 @@ jobs:
issues: write
pull-requests: write
steps:
- - uses: actions/first-interaction@v1
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- issue-message: "Hello @${{ github.actor }} , thank you for submitting an issue!"
- pr-message: "Hello @${{ github.actor }} , thank you submitting a pull request!"
- issuesOpened: |
- 👋 @{{ author }} Thank you for raising an issue.
- We will will investigate into the matter and get back to you as soon as possible.
- Please make sure you have given us as much context as possible.
- pullRequestOpened: |
- 👋 @{{ author }}
- Thank you for raising your pull request.
- Please make sure you have followed our contributing guidelines. We will review it as soon as possible
+ - uses: actions/first-interaction@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ issue-message: "Hello @${{ github.actor }} , thank you for submitting an issue!"
+ pr-message: "Hello @${{ github.actor }} , thank you submitting a pull request!"
+ issuesOpened: |
+ ### English
+ 👋 @{{ author }} Thank you for raising an issue.
+ We will will investigate into the matter and get back to you as soon as possible.
+ Please make sure you have given us as much context as possible.
+ ### 中文
+ 👋 @{{ author }} 感谢您提出问题。
+ 我们将调查此问题并尽快回复您。
+ 请确保您尽可能提供尽可能多的上下文。
+
+ pullRequestOpened: |
+ ### English
+ 👋 @{{ author }}
+ Thank you for raising your pull request.
+ Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
+ ### 中文
+ 👋 @{{ author }}
+ 感谢您提出拉取请求。
+ 请确保您已遵循我们的贡献准则。我们将尽快审查它。
\ No newline at end of file
diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml
index 3675e29..35d9104 100644
--- a/.github/workflows/label.yml
+++ b/.github/workflows/label.yml
@@ -1,16 +1,15 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
-# To use this workflow, you will need to set up a .github/labeler.yml
+# To use this workflow, you will need to set up a .github/workflows/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler
-name: 🧬 CI Labeler
-on: [pull_request_target]
+name: 🧪 CI Labeler
+on: [ pull_request_target ]
jobs:
label:
-
runs-on: ubuntu-latest
permissions:
contents: read
diff --git a/.github/workflows/reademe-contributors.yml b/.github/workflows/reademe-contributors.yml
index 2e8c388..386e752 100644
--- a/.github/workflows/reademe-contributors.yml
+++ b/.github/workflows/reademe-contributors.yml
@@ -1,10 +1,8 @@
+name: 🧪 CI Generate a list of contributors
on:
push:
branches:
- main
-
-name: 🧪 CI Generate a list of contributors
-
jobs:
contrib-readme-en-job:
runs-on: ubuntu-latest
@@ -15,9 +13,9 @@ jobs:
with:
image_size: 64
readme_path: .github/README.md
- use_username: true
+ use_username: true
commit_message: "🤖 [contrib-readme-action] : updated readme"
committer_username: "Action Contrib Readme"
committer_email: "xinansky99@gmail.com"
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..79aa90c
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,27 @@
+# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
+#
+# You can adjust the behavior by modifying this file.
+# For more information, see:
+# https://github.com/actions/stale
+name: Mark stale issues and pull requests
+
+on:
+ schedule:
+ - cron: '30 08 * * *'
+
+jobs:
+ stale:
+
+ runs-on: ubuntu-latest
+ permissions:
+ issues: write
+ pull-requests: write
+
+ steps:
+ - uses: actions/stale@v9
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ stale-issue-message: 'Stale issue message'
+ stale-pr-message: 'Stale pull request message'
+ stale-issue-label: 'no-issue-activity'
+ stale-pr-label: 'no-pr-activity'
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index eb3c77e..96b970e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,22 +5,24 @@
*.git
*.vscode
+# 编译器
+.git/
+.vs/
+.gradle/
+.idea/
+.vscode/
+.consulo/
+
!*.dll.meta
!*.asset.meta
!*.asmdef.meta
!*.cs.meta
-.git/
-.vs/
-.idea/
-.gradle/
-.consulo/
[Bb]uild/
[Bb]uilds/
[Tt]emp/
[Oo]bj/
[Ll]ogs/
[Bb]in/
-[Oo]bj/
[Pp]ackages/
[Vv]env/
\ No newline at end of file
diff --git a/Editor/Data/AssetBuildConfig.cs b/Editor/Data/AssetBuildConfig.cs
index c9a092b..6329698 100644
--- a/Editor/Data/AssetBuildConfig.cs
+++ b/Editor/Data/AssetBuildConfig.cs
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using System.IO;
+using System.Linq;
using AIO.UEngine;
using UnityEditor;
using UnityEngine;
@@ -64,28 +65,25 @@ public partial class AssetBuildConfig : ScriptableObject
///
public static AssetBuildConfig GetOrCreate()
{
- if (_instance is null)
- {
- var objects = EHelper.IO.GetScriptableObjects();
- if (objects != null && objects.Length > 0)
- foreach (var asset in objects)
- {
- if (asset is null) continue;
- if (string.IsNullOrEmpty(asset.BuildOutputPath))
- asset.BuildOutputPath = Path.Combine(EHelper.Path.Project, "Bundles");
-
- _instance = asset;
- break;
- }
-
- if (_instance is null)
+ if (_instance != null) return _instance;
+
+ var objects = EHelper.IO.GetScriptableObjects();
+ if (objects != null && objects.Length > 0)
+ foreach (var asset in objects.Where(asset => asset))
{
- _instance = CreateInstance();
- _instance.BuildOutputPath = Path.Combine(EHelper.Path.Project, "Bundles");
- AssetDatabase.CreateAsset(_instance, "Assets/Editor/ASBuildConfig.asset");
- AssetDatabase.SaveAssets();
+ if (string.IsNullOrEmpty(asset.BuildOutputPath))
+ asset.BuildOutputPath = Path.Combine(EHelper.Path.Project, "Bundles");
+
+ _instance = asset;
+ break;
}
- }
+
+ if (_instance) return _instance;
+
+ _instance = CreateInstance();
+ _instance.BuildOutputPath = Path.Combine(EHelper.Path.Project, "Bundles");
+ AssetDatabase.CreateAsset(_instance, "Assets/Editor/ASBuildConfig.asset");
+ AssetDatabase.SaveAssets();
return _instance;
}
diff --git a/Editor/Data/Collect/Root/AssetCollectRoot.Helper.cs b/Editor/Data/Collect/Root/AssetCollectRoot.Helper.cs
index d7a1b20..31ca2ea 100644
--- a/Editor/Data/Collect/Root/AssetCollectRoot.Helper.cs
+++ b/Editor/Data/Collect/Root/AssetCollectRoot.Helper.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Linq;
using UnityEditor;
using Object = UnityEngine.Object;
@@ -114,11 +115,11 @@ public static AssetCollectRoot GetOrCreate()
var objects = EHelper.IO.GetScriptableObjects();
if (objects != null && objects.Length > 0)
{
- foreach (var asset in objects)
+ foreach (var asset in objects.Where(asset => asset))
{
- if (asset is null) continue;
if (asset.Packages is null)
asset.Packages = Array.Empty();
+
_Instance = asset;
return _Instance;
}
@@ -138,11 +139,12 @@ public static AssetCollectRoot GetOrCreate()
/// 是否小写
/// 是否包含后缀
/// 限制包名 只查找指定包资源 空则忽略
- ///
- /// Item1 包名
- /// Item2 组名
- /// Item3 可寻址路径
- ///
+ ///
+ /// var result = AssetCollectRoot.AssetToAddress();
+ /// result.Item1 包名
+ /// result.Item2 组名
+ /// result.Item3 可寻址路径
+ ///
public static Tuple AssetToAddress(string assetPath, bool isLower, bool hasExtension, string limitPackage = "")
{
if (IsNoAssetPath(assetPath)) return Empty;
diff --git a/Editor/Interface/IAssetRuleFilter/IAssetRuleFilter.cs b/Editor/Interface/IAssetRuleFilter/IAssetRuleFilter.cs
index 5acb6ab..34cb2b6 100644
--- a/Editor/Interface/IAssetRuleFilter/IAssetRuleFilter.cs
+++ b/Editor/Interface/IAssetRuleFilter/IAssetRuleFilter.cs
@@ -11,7 +11,7 @@ public interface IAssetRuleFilter
/// 显示顺序
///
int DisplayIndex { get; }
-
+
///
/// 验证资源是否符合规则
///
diff --git a/Editor/Properties/AssemblyInfo.cs b/Editor/Properties/AssemblyInfo.cs
index 36ce6db..5dfec53 100644
--- a/Editor/Properties/AssemblyInfo.cs
+++ b/Editor/Properties/AssemblyInfo.cs
@@ -1,13 +1,22 @@
-using System.Runtime.CompilerServices;
+#region namespace
+
+using System.Runtime.CompilerServices;
using Newtonsoft.Json.Linq;
-using UnityEditor.PackageManager;
+using UnityEditor;
+using UnityEngine;
+using PackageInfo = UnityEditor.PackageManager.PackageInfo;
[assembly: InternalsVisibleTo("AIO.CLI.YooAsset.Editor")]
+#endregion
+
namespace AIO.UEditor
{
- internal static class Setting
+ public static class AssetsEditorSetting
{
+ public const string MENU_ROOT = "AIO/Asset/";
+ public const string MENU_ROOT_SETTING = MENU_ROOT + "Setting/";
+
///
/// 名称
///
@@ -18,12 +27,109 @@ internal static class Setting
///
public static string Version { get; private set; }
+ #region AutoConversionConfig
+
+ ///
+ /// 是否自动转换配置
+ ///
+ public static bool AutoConversionConfig;
+
+ private const string MENU_PATH_AUTO_CONVERSION_CONFIG = MENU_ROOT_SETTING + "自动转换配置";
+
+ [MenuItem(MENU_PATH_AUTO_CONVERSION_CONFIG, true)]
+ public static bool MenuAutoConversionConfigValidate()
+ {
+ Menu.SetChecked(MENU_PATH_AUTO_CONVERSION_CONFIG, AutoConversionConfig);
+ return true;
+ }
+
+ [MenuItem(MENU_PATH_AUTO_CONVERSION_CONFIG)]
+ public static void MenuAutoConversionConfig()
+ {
+ AutoConversionConfig = !AutoConversionConfig;
+ EditorPrefs.SetBool(MENU_PATH_AUTO_CONVERSION_CONFIG, AutoConversionConfig);
+ if (AutoConversionConfig) Editor.finishedDefaultHeaderGUI += ResInspectorUI.OnPostHeaderGUI;
+ else Editor.finishedDefaultHeaderGUI -= ResInspectorUI.OnPostHeaderGUI;
+ }
+
+ #endregion
+
+ #region ShowInspectorAddress
+
+ ///
+ /// 显示检视器地址
+ ///
+ public static bool ShowInspectorAddress;
+
+ [MenuItem(MENU_PATH_SHOW_INSPECTOR_ADDRESS, true)]
+ public static bool MenuShowInspectorAddressValidate()
+ {
+ Menu.SetChecked(MENU_PATH_SHOW_INSPECTOR_ADDRESS, ShowInspectorAddress);
+ return true;
+ }
+
+ private const string MENU_PATH_SHOW_INSPECTOR_ADDRESS = MENU_ROOT_SETTING + "显示检视器地址";
+
+ [MenuItem(MENU_PATH_SHOW_INSPECTOR_ADDRESS)]
+ public static void MenuShowInspectorAddress()
+ {
+ ShowInspectorAddress = !ShowInspectorAddress;
+ EditorPrefs.SetBool(MENU_PATH_SHOW_INSPECTOR_ADDRESS, ShowInspectorAddress);
+ if (ShowInspectorAddress) Editor.finishedDefaultHeaderGUI += ResInspectorUI.OnPostHeaderGUI;
+ else Editor.finishedDefaultHeaderGUI -= ResInspectorUI.OnPostHeaderGUI;
+ }
+
+ #endregion
+
[AInit(EInitAttrMode.Both, int.MaxValue)]
- public static void Initialize()
+ private static void Initialize()
{
- var package = PackageInfo.FindForAssembly(typeof(Setting).Assembly);
+ ShowInspectorAddress = EditorPrefs.GetBool(MENU_PATH_SHOW_INSPECTOR_ADDRESS, true);
+ AutoConversionConfig = EditorPrefs.GetBool(MENU_PATH_AUTO_CONVERSION_CONFIG, true);
+
+ var package = PackageInfo.FindForAssembly(typeof(AssetsEditorSetting).Assembly);
var packageJson = AHelper.IO.ReadJsonUTF8(string.Concat(package.resolvedPath, "/package.json"));
Version = packageJson.Value("version");
}
+
+ private static SettingsProvider provider;
+
+ ///
+ /// 创建设置提供者
+ ///
+ [SettingsProvider]
+ private static SettingsProvider CreateSettingsProvider()
+ {
+ if (provider != null) return provider;
+
+ provider = new GraphicSettingsProvider("AIO/Asset System", SettingsScope.User);
+ provider.label = "Asset System";
+ provider.guiHandler = delegate
+ {
+ GUILayout.BeginVertical();
+ GUILayout.Space(10);
+ GUILayout.Label("Settings", EditorStyles.boldLabel);
+ GUILayout.Space(5);
+
+ using (new EditorGUILayout.HorizontalScope())
+ {
+ EditorGUILayout.LabelField("显示检视器地址");
+ if (GUILayout.Button(ShowInspectorAddress ? "开启" : "关闭", EditorStyles.miniButton, GUILayout.Width(50)))
+ MenuShowInspectorAddress();
+ }
+
+ using (new EditorGUILayout.HorizontalScope())
+ {
+ EditorGUILayout.LabelField("自动转换配置");
+ if (GUILayout.Button(AutoConversionConfig ? "开启" : "关闭", EditorStyles.miniButton, GUILayout.Width(50)))
+ MenuAutoConversionConfig();
+ }
+
+ GUILayout.EndVertical();
+ GUILayout.FlexibleSpace();
+ EditorGUILayout.LabelField($"Version {Version}", EditorStyles.centeredGreyMiniLabel);
+ };
+ return provider;
+ }
}
}
\ No newline at end of file
diff --git a/Editor/Properties/Language.cs b/Editor/Properties/Language.cs
index f9e5591..17906ca 100644
--- a/Editor/Properties/Language.cs
+++ b/Editor/Properties/Language.cs
@@ -16,10 +16,7 @@ public static event Func FindValue
remove => FindValueList.Remove(value);
}
- static Lang()
- {
- Tr = new Lang((SystemLanguage)PlayerPrefs.GetInt("AIO.UEditor.Language", (int)Application.systemLanguage));
- }
+ static Lang() { Tr = new Lang((SystemLanguage)PlayerPrefs.GetInt("AIO.UEditor.Language", (int)Application.systemLanguage)); }
public static Lang Tr { get; private set; }
@@ -35,15 +32,9 @@ private static string GetValue(SystemLanguage language, string key)
private static List> FindValueList = new List>();
- private Lang()
- {
- Current = Application.systemLanguage;
- }
+ private Lang() { Current = Application.systemLanguage; }
- private Lang(SystemLanguage language)
- {
- Current = language;
- }
+ private Lang(SystemLanguage language) { Current = language; }
private Dictionary> Tables = new Dictionary>();
diff --git a/Editor/Proxy/AssetProxyEditor.cs b/Editor/Proxy/AssetProxyEditor.cs
index f030f2f..f295375 100644
--- a/Editor/Proxy/AssetProxyEditor.cs
+++ b/Editor/Proxy/AssetProxyEditor.cs
@@ -21,13 +21,10 @@ public static class AssetProxyEditor
[AInit(EInitAttrMode.Both, int.MaxValue)]
public static void Initialize()
{
- foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
+ foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Where(assembly => assembly.GetName().Name.EndsWith("Editor")))
{
- if (!assembly.GetName().Name.Contains("Editor")) continue;
- foreach (var type in assembly.GetTypes())
+ foreach (var type in assembly.GetTypes().Where(type => !type.IsAbstract).Where(type => typeof(IAssetProxyEditor).IsAssignableFrom(type)))
{
- if (type.IsAbstract) continue;
- if (!typeof(IAssetProxyEditor).IsAssignableFrom(type)) continue;
Editor = (IAssetProxyEditor)Activator.CreateInstance(type);
break;
}
@@ -54,9 +51,7 @@ public static void CreateConfig(string BundlesDir, bool MergeToLatest = false, b
///
/// 上传到GCloud
///
- public static async Task UploadGCloud(
- [ReadOnlyArray] ICollection parameters,
- bool isTips = false)
+ public static async Task UploadGCloud([ReadOnlyArray] ICollection parameters, bool isTips = false)
{
if (Editor is null)
{
diff --git a/Editor/Windows/AssetWindow.Helper.cs b/Editor/Windows/AssetWindow.Helper.cs
index df9fdce..a644bbb 100644
--- a/Editor/Windows/AssetWindow.Helper.cs
+++ b/Editor/Windows/AssetWindow.Helper.cs
@@ -6,16 +6,15 @@
namespace AIO.UEditor
{
- public partial class AssetWindow
+ partial class AssetWindow
{
[LnkTools(Tooltip = "AIO 资源管理工具", IconResource = "Editor/Icon/Asset", ShowMode = ELnkShowMode.Toolbar)]
public static void OpenWindow() => EditorApplication.ExecuteMenuItem(MENU_WINDOW);
- public const string MENU_ROOT = "AIO/Asset/";
- public const string MENU_WINDOW = MENU_ROOT + "Window";
- public const string MENU_CONFIG = MENU_ROOT + "Config";
+ public const string MENU_WINDOW = AssetsEditorSetting.MENU_ROOT + "Window";
+ public const string MENU_CONFIG = AssetsEditorSetting.MENU_ROOT + "Config";
- [MenuItem(MENU_ROOT + "清空运行时缓存")]
+ [MenuItem(AssetsEditorSetting.MENU_ROOT + "清空运行时缓存")]
public static void ClearRuntimeCache()
{
var sandbox = Path.Combine(EHelper.Path.Project, ASConfig.GetOrCreate().RuntimeRootDirectory);
@@ -23,7 +22,7 @@ public static void ClearRuntimeCache()
AHelper.IO.DeleteDir(sandbox, SearchOption.AllDirectories, true);
}
- [MenuItem(MENU_ROOT + "清空构建时缓存")]
+ [MenuItem(AssetsEditorSetting.MENU_ROOT + "清空构建时缓存")]
public static void ClearBuildCache()
{
var sandbox = Path.Combine(EHelper.Path.Project, "Bundles");
@@ -101,25 +100,38 @@ public static async void UpdateUploadFirstPack(AssetBuildConfig.GCloudConfig con
[InitializeOnLoadMethod]
private static void Initialize()
{
+ if (!AssetsEditorSetting.AutoConversionConfig) return;
+ EditorQuit();
EditorApplication.playModeStateChanged -= EditorQuit;
EditorApplication.playModeStateChanged += EditorQuit;
}
// Unity 第一次进入 Editor 模式时,将 AssetCollectRoot 转换为 AssetProxy
- [InitializeOnLoadMethod]
private static void EditorQuit()
{
+ if (!AssetsEditorSetting.AutoConversionConfig)
+ {
+ EditorApplication.playModeStateChanged -= EditorQuit;
+ return;
+ }
+
var config = ASConfig.GetOrCreate();
if (config.ASMode != EASMode.Editor) return;
var root = AssetCollectRoot.GetOrCreate();
- if (root is null) throw new Exception($"Not found {nameof(AssetCollectRoot)}.asset ! Please create it !");
+ if (!root) throw new Exception($"Not found {nameof(AssetCollectRoot)}.asset ! Please create it !");
AssetProxyEditor.ConvertConfig(root, false);
EditorApplication.playModeStateChanged -= EditorQuit;
}
private static void EditorQuit(PlayModeStateChange value)
{
+ if (!AssetsEditorSetting.AutoConversionConfig)
+ {
+ EditorApplication.playModeStateChanged -= EditorQuit;
+ return;
+ }
+
if (value != PlayModeStateChange.EnteredPlayMode) return;
if (!Application.isPlaying) return;
@@ -127,7 +139,7 @@ private static void EditorQuit(PlayModeStateChange value)
if (config.ASMode != EASMode.Editor) return;
var root = AssetCollectRoot.GetOrCreate();
- if (root is null) throw new Exception($"Not found {nameof(AssetCollectRoot)}.asset ! Please create it !");
+ if (!root) throw new Exception($"Not found {nameof(AssetCollectRoot)}.asset ! Please create it !");
AssetProxyEditor.ConvertConfig(root, false);
EditorApplication.playModeStateChanged -= EditorQuit;
}
diff --git a/Editor/Windows/AssetWindow.cs b/Editor/Windows/AssetWindow.cs
index 4c439ff..d4fe045 100644
--- a/Editor/Windows/AssetWindow.cs
+++ b/Editor/Windows/AssetWindow.cs
@@ -39,16 +39,15 @@ protected override void OnActivation()
if (Pages is null)
{
Pages = new List();
- foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
+ foreach (var type in from assembly in AppDomain.CurrentDomain.GetAssemblies()
+ where assembly.FullName.Contains("Editor")
+ from type in assembly.GetTypes()
+ where !type.IsAbstract && !type.IsInterface
+ where typeof(IAssetPage).IsAssignableFrom(type)
+ select type)
{
- if (!assembly.FullName.Contains("Editor")) continue;
- foreach (var type in assembly.GetTypes())
- {
- if (type.IsAbstract || type.IsInterface) continue;
- if (!typeof(IAssetPage).IsAssignableFrom(type)) continue;
- if (!(Activator.CreateInstance(type) is IAssetPage page)) continue;
- Pages.Add(page);
- }
+ if (!(Activator.CreateInstance(type) is IAssetPage page)) continue;
+ Pages.Add(page);
}
}
@@ -91,7 +90,7 @@ protected override void OnDraw()
CurrentPage?.OnDrawContent(DrawRect);
}
- DrawVersion(Setting.Version);
+ DrawVersion(AssetsEditorSetting.Version);
OnOpenEvent();
}
@@ -145,7 +144,8 @@ public int PageIndex
}
}
- public static T OpenPage() where T : IAssetPage
+ public static T OpenPage()
+ where T : IAssetPage
{
if (!Instance)
{
@@ -157,7 +157,8 @@ public static T OpenPage() where T : IAssetPage
return (T)Instance.Pages[Instance.PageIndex];
}
- public static bool IsOpenPage() where T : IAssetPage
+ public static bool IsOpenPage()
+ where T : IAssetPage
{
if (!Instance) return false;
return Instance.Pages[Instance.PageIndex] is T;
diff --git a/Editor/Windows/Helper.cs b/Editor/Windows/Helper.cs
index 45d875c..fbdfd5c 100644
--- a/Editor/Windows/Helper.cs
+++ b/Editor/Windows/Helper.cs
@@ -1,6 +1,7 @@
#region
using System;
+using System.Collections.Generic;
using AIO.UEngine;
using UnityEditor;
using UnityEngine;
@@ -17,6 +18,7 @@ internal class ResInspectorUI
{
static ResInspectorUI()
{
+ if (!AssetsEditorSetting.ShowInspectorAddress) return;
Editor.finishedDefaultHeaderGUI -= OnPostHeaderGUI;
Editor.finishedDefaultHeaderGUI += OnPostHeaderGUI;
}
@@ -32,99 +34,103 @@ private static ASConfig Config
private static ASConfig _Config;
- private static void OnPostHeaderGUI(Editor editor)
+ private static readonly List WhiteList = new List
{
- if (editor.targets.Length != 1) return;
- switch (editor.target)
- {
- case AssetCollectRoot _:
- case ASConfig _:
- case AssetBuildConfig _:
- case ConsoleWindowConfig _:
+ typeof(AssetCollectRoot).FullName,
+ typeof(ASConfig).FullName,
+ typeof(AssetBuildConfig).FullName,
+ typeof(ConsoleWindowConfig).FullName,
#if SUPPORT_YOOASSET
- case AssetBundleCollectorSetting _:
- case ShaderVariantCollectorSetting _:
+ typeof(AssetBundleCollectorSetting).FullName,
+ typeof(ShaderVariantCollectorSetting).FullName,
#endif
- return;
- default:
+ };
+
+ internal static void OnPostHeaderGUI(Editor editor)
+ {
+ if (!AssetsEditorSetting.ShowInspectorAddress)
+ {
+ Editor.finishedDefaultHeaderGUI -= OnPostHeaderGUI;
+ return;
+ }
- try
+ if (editor.targets == null) return;
+ if (editor.targets.Length != 1) return;
+ if (WhiteList.Contains(editor.target.GetType().FullName)) return; // 判断资源类型
+ try
+ {
+ if (AssetCollectRoot.ObjToCollector(editor.target, out var result))
+ {
+ using (new EditorGUI.DisabledScope(false))
{
- if (AssetCollectRoot.ObjToCollector(editor.target, out var result))
- {
- using (new EditorGUI.DisabledScope(false))
- {
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("包名", GUILayout.MaxWidth(65));
- EditorGUILayout.TextField(result.PackageName, GUILayout.MinWidth(30));
- GUILayout.EndHorizontal();
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("组名", GUILayout.MaxWidth(65));
- EditorGUILayout.TextField(result.GroupName, GUILayout.MinWidth(30));
- GUILayout.EndHorizontal();
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("收集模式", GUILayout.MaxWidth(65));
- result.Type = GELayout.Popup(result.Type, GEStyle.PreDropDown);
- GUILayout.EndHorizontal();
- }
-
- if (result.Type != EAssetCollectItemType.MainAssetCollector) return;
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("寻址规则", GUILayout.MaxWidth(65));
- result.AddressIndex = GELayout.Popup(result.AddressIndex, AssetCollectSetting.MapAddress.Displays,
- GEStyle.PreDropDown);
- GUILayout.EndHorizontal();
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("打包规则", GUILayout.MaxWidth(65));
- result.RulePackIndex = GELayout.Popup(result.RulePackIndex, AssetCollectSetting.MapPacks.Displays,
- GEStyle.PreDropDown);
- GUILayout.EndHorizontal();
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("打包模式", GUILayout.MaxWidth(65));
- result.LoadType = GELayout.Popup(result.LoadType, GEStyle.PreDropDown);
- GUILayout.EndHorizontal();
-
-
- GUILayout.BeginHorizontal();
- EditorGUILayout.LabelField("寻址命名", GUILayout.MaxWidth(65));
- if (Config.LoadPathToLower)
- {
- using (new EditorGUI.DisabledScope(false))
- result.LocationFormat = GELayout.Popup(EAssetLocationFormat.ToLower, GEStyle.PreDropDown);
- }
- else
- {
- result.LocationFormat = GELayout.Popup(result.LocationFormat, GEStyle.PreDropDown);
- }
-
- if (Config.HasExtension)
- {
- using (new EditorGUI.DisabledScope(false))
- result.HasExtension = GELayout.ToggleLeft("后缀", true, GTOptions.Width(42));
- }
- else
- {
- result.HasExtension = GELayout.ToggleLeft("后缀", result.HasExtension, GTOptions.Width(42));
- }
-
- GUILayout.EndHorizontal();
- }
- else
- {
- ShowRulePath(AssetCollectRoot.ObjToAddress(editor.target, Config.LoadPathToLower, Config.HasExtension));
- }
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("包名", GUILayout.MaxWidth(65));
+ EditorGUILayout.TextField(result.PackageName, GUILayout.MinWidth(30));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("组名", GUILayout.MaxWidth(65));
+ EditorGUILayout.TextField(result.GroupName, GUILayout.MinWidth(30));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("收集模式", GUILayout.MaxWidth(65));
+ result.Type = GELayout.Popup(result.Type, GEStyle.PreDropDown);
+ GUILayout.EndHorizontal();
}
- catch
+
+ if (result.Type != EAssetCollectItemType.MainAssetCollector) return;
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("寻址规则", GUILayout.MaxWidth(65));
+ result.AddressIndex = GELayout.Popup(result.AddressIndex, AssetCollectSetting.MapAddress.Displays,
+ GEStyle.PreDropDown);
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("打包规则", GUILayout.MaxWidth(65));
+ result.RulePackIndex = GELayout.Popup(result.RulePackIndex, AssetCollectSetting.MapPacks.Displays,
+ GEStyle.PreDropDown);
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("打包模式", GUILayout.MaxWidth(65));
+ result.LoadType = GELayout.Popup(result.LoadType, GEStyle.PreDropDown);
+ GUILayout.EndHorizontal();
+
+
+ GUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("寻址命名", GUILayout.MaxWidth(65));
+ if (Config.LoadPathToLower)
+ {
+ using (new EditorGUI.DisabledScope(false))
+ result.LocationFormat = GELayout.Popup(EAssetLocationFormat.ToLower, GEStyle.PreDropDown);
+ }
+ else
{
- // ignored
+ result.LocationFormat = GELayout.Popup(result.LocationFormat, GEStyle.PreDropDown);
}
- break;
+ if (Config.HasExtension)
+ {
+ using (new EditorGUI.DisabledScope(false))
+ result.HasExtension = GELayout.ToggleLeft("后缀", true, GTOptions.Width(42));
+ }
+ else
+ {
+ result.HasExtension = GELayout.ToggleLeft("后缀", result.HasExtension, GTOptions.Width(42));
+ }
+
+ GUILayout.EndHorizontal();
+ }
+ else
+ {
+ ShowRulePath(AssetCollectRoot.ObjToAddress(editor.target, Config.LoadPathToLower, Config.HasExtension));
+ }
+ }
+ catch
+ {
+ // ignored
}
}
diff --git a/Editor/Windows/Inspector/AssetConfigCommonEditor.cs b/Editor/Windows/Inspector/AssetConfigCommonEditor.cs
index 3b192c2..03bd2e7 100644
--- a/Editor/Windows/Inspector/AssetConfigCommonEditor.cs
+++ b/Editor/Windows/Inspector/AssetConfigCommonEditor.cs
@@ -156,7 +156,7 @@ private void OnDrawABConfig()
if (GUILayout.Button("打开", GEStyle.toolbarbuttonRight))
{
AssetWindow.OpenPage();
- EditorApplication.ExecuteMenuItem("AIO/Window/Asset");
+ EditorApplication.ExecuteMenuItem(AssetWindow.MENU_WINDOW);
}
if (GUILayout.Button("构建", GEStyle.toolbarbutton)) AssetProxyEditor.BuildArt(ABConfig);
diff --git a/Editor/Windows/Page/4AssetPage.LookCollect.cs b/Editor/Windows/Page/4AssetPage.LookCollect.cs
index 9319701..f7cf9f7 100644
--- a/Editor/Windows/Page/4AssetPage.LookCollect.cs
+++ b/Editor/Windows/Page/4AssetPage.LookCollect.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
@@ -43,11 +44,11 @@ public void Dispose()
#endregion
- private Dictionary DisplayGroupNames;
- private Dictionary<(int, int), string[]> CollectorDisplays;
- private Dictionary<(int, int), string[]> TypeDisplays;
- private Dictionary<(int, int), string[]> TagDisplays;
- private Dictionary<(int, int), List> DataDic;
+ private Dictionary DisplayGroupNames;
+ private Dictionary<(int, int), string[]> CollectorDisplays;
+ private Dictionary<(int, int), string[]> TypeDisplays;
+ private Dictionary<(int, int), string[]> TagDisplays;
+ private Dictionary<(int, int), ConcurrentBag> DataDic;
public void OnDrawHeader(Rect rect)
{
@@ -193,46 +194,61 @@ private void UpdateDataCollector(int packageIndex, int groupIndex)
|| Data.Packages[i].Count <= j
) return;
- var key = (i, j);
- DisplayGroupNames[DisplayPackages[i]] = GetGroupDisPlayNames(Data.Packages[i].Groups);
- TagDisplays[key] = Data.Packages[i].Groups[j].Tags;
- CollectorDisplays[key] = GetCollectorDisPlayNames(Data.Packages[i].Groups[j].Collectors.GetDisPlayNames());
+ var key = (i, j);
+ var package = Data.Packages[i];
+ var group = package.Groups[j];
+
+ DisplayGroupNames[DisplayPackages[i]] = GetGroupDisPlayNames(package.Groups);
+ TagDisplays[key] = group.Tags;
+ CollectorDisplays[key] = GetCollectorDisPlayNames(group.Collectors.GetDisPlayNames());
DisplayCollectorsIndex = 0;
- DataDic[key] = new List();
+ DataDic[key] = new ConcurrentBag();
TypeDisplays[(i, j)] = Array.Empty();
var toLower = Config.LoadPathToLower;
var hasExtension = Config.HasExtension;
- var listTypes = new List();
+ var listTypes = new ConcurrentBag();
- var count = Data.Packages[i].Groups[j].Collectors.Length;
+ var count = group.Collectors.Length;
var index = 0;
-
- foreach (var item in Data.Packages[i].Groups[j].Collectors)
+
+ foreach (var item in group.Collectors)
{
if (item.AllowThread)
- Runner.StartTask(() => Collect(item));
+ Runner.StartTask(Collect, item);
else
- Runner.StartCoroutine(() => Collect(item));
+ Runner.StartCoroutine(Collect, item);
}
+
TreeViewQueryAsset.Reload(PageValues);
return;
void Collect(AssetCollectItem item)
{
- item.CollectAssetAsync(Data.Packages[i], Data.Packages[i].Groups[j], toLower, hasExtension);
- DataDic[(i, j)].AddRange(item.DataInfos.Values);
+ item.CollectAssetAsync(package, group, toLower, hasExtension);
+ foreach (var variable in item.DataInfos.Values)
+ {
+ DataDic[(i, j)].Add(variable);
+ }
+
if (count != ++index) return;
- Runner.StartCoroutine(() =>
+
+ Runner.StartCoroutine(UpdateType, item);
+ Runner.StartTask(End);
+ }
+
+ void UpdateType(AssetCollectItem item)
+ {
+ foreach (var type in item.DataInfos.Values.Select(dataInfo => dataInfo.Type))
{
- listTypes.AddRange(DataDic[(i, j)].Where(dataInfo => !listTypes.Contains(dataInfo.Type)).Select(dataInfo => dataInfo.Type));
- Runner.StartTask(End);
- });
+ listTypes.Add(type);
+ }
+
+ TypeDisplays[(i, j)] = listTypes.Distinct().ToArray();
}
void End()
{
- TypeDisplays[(i, j)] = listTypes.ToArray();
lock (PageValues)
{
PageValues.Add(DataDic[(i, j)].Where(data => !FilterData(data)));
@@ -272,7 +288,7 @@ public void UpdateData()
if (TagDisplays is null) TagDisplays = new Dictionary<(int, int), string[]>();
if (TypeDisplays is null) TypeDisplays = new Dictionary<(int, int), string[]>();
if (DisplayGroupNames is null) DisplayGroupNames = new Dictionary();
- if (DataDic is null) DataDic = new Dictionary<(int, int), List>();
+ if (DataDic is null) DataDic = new Dictionary<(int, int), ConcurrentBag>();
PageValues.Clear();
PageValues.PageIndex = 0;
diff --git a/Editor/Windows/Page/AssetPage.Look.cs b/Editor/Windows/Page/AssetPage.Look.cs
index 104884f..129f7af 100644
--- a/Editor/Windows/Page/AssetPage.Look.cs
+++ b/Editor/Windows/Page/AssetPage.Look.cs
@@ -4,6 +4,7 @@
using System.ComponentModel;
using System.IO;
using System.Linq;
+using System.Threading.Tasks;
using AIO.UEngine;
using UnityEditor;
using UnityEngine;
@@ -15,10 +16,7 @@ public partial class AssetPageLook
{
#region Instance
- static AssetPageLook()
- {
- _Instance = new AssetPageLook();
- }
+ static AssetPageLook() { _Instance = new AssetPageLook(); }
private static AssetPageLook _Instance;
private static AssetPageLook Instance => _Instance ?? (_Instance = new AssetPageLook());
@@ -90,7 +88,7 @@ public string Type
get
{
if (string.IsNullOrEmpty(_Type)) return _Type;
- _Type = Object is null ? "Unknown" : Object.GetType().FullName;
+ _Type = !Object ? "Unknown" : Object.GetType().FullName;
return _Type;
}
}
@@ -104,7 +102,9 @@ public string Type
private readonly Dictionary Dependencies = new Dictionary(); // 依赖资源
- private void OnQueryAsseChanged(int id)
+ private int TempIndex;
+
+ private async void OnQueryAsseChanged(int id)
{
Runner.StopCoroutine(OnSelectionChangedRef);
if (id < 0)
@@ -114,28 +114,31 @@ private void OnQueryAsseChanged(int id)
}
SelectAssetDataInfo = PageValues.CurrentPageValues[id];
+ Dependencies.Clear();
+ TempIndex = id;
+ await Task.Delay(500);
+ if (TempIndex != id) return;
Runner.StartCoroutine(OnSelectionChangedRef);
}
private IEnumerator OnSelectionChangedRef()
{
- Dependencies.Clear();
- yield return Runner.WaitForSeconds(0.5f);
+ yield return Runner.YieldReturn;
var assetPath = SelectAssetDataInfo.AssetPath;
foreach (var dependency in AssetDatabase.GetDependencies(assetPath))
{
if (assetPath == dependency) continue;
if (Dependencies.ContainsKey(dependency)) continue;
- var info = new DependenciesInfo
- {
- AssetPath = dependency, Object = AssetDatabase.LoadAssetAtPath