2025-01-24 16:21:00 +08:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2025-01-26 20:55:39 +08:00
|
|
|
using System.Linq;
|
2025-03-04 18:40:14 +08:00
|
|
|
using AlicizaX.Editor.Setting;
|
2025-01-26 20:55:39 +08:00
|
|
|
using AlicizaX.Runtime;
|
2025-03-04 18:40:14 +08:00
|
|
|
using AlicizaX.UI.Runtime;
|
|
|
|
|
using Newtonsoft.Json;
|
2025-01-24 16:21:00 +08:00
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace AlicizaX.UI.Editor
|
|
|
|
|
{
|
2025-03-04 18:40:14 +08:00
|
|
|
[AlicizaX.Editor.Setting.FilePath("ProjectSettings/UIGenerateConfiguration.asset")]
|
|
|
|
|
internal class UIGenerateConfiguration : ScriptableSingleton<UIGenerateConfiguration>
|
2025-01-24 16:21:00 +08:00
|
|
|
{
|
2025-03-04 18:40:14 +08:00
|
|
|
public UIGenerateCommonData UIGenerateCommonData = new UIGenerateCommonData();
|
2025-01-26 20:55:39 +08:00
|
|
|
public List<UIScriptGenerateData> UIScriptGenerateConfigs = new List<UIScriptGenerateData>();
|
|
|
|
|
public List<UIEelementRegexData> UIElementRegexConfigs = new List<UIEelementRegexData>();
|
2025-01-24 16:21:00 +08:00
|
|
|
}
|
|
|
|
|
|
2025-03-04 18:40:14 +08:00
|
|
|
[System.Serializable]
|
|
|
|
|
public class UIGenerateCommonData
|
2025-01-24 16:21:00 +08:00
|
|
|
{
|
2025-03-04 18:40:14 +08:00
|
|
|
[LabelText("组件检查分隔符")] public string ComCheckSplitName = "#";
|
|
|
|
|
[LabelText("组件结尾分隔符")] public string ComCheckEndName = "@";
|
|
|
|
|
[LabelText("数组组件检查分隔符")] public string ArrayComSplitName = "*";
|
|
|
|
|
[LabelText("生成脚本前缀")] public string GeneratePrefix = "ui";
|
2025-01-24 16:21:00 +08:00
|
|
|
}
|
|
|
|
|
|
2025-01-26 20:55:39 +08:00
|
|
|
[System.Serializable]
|
2025-03-07 18:00:59 +08:00
|
|
|
public class UIEelementRegexData
|
2025-01-26 20:55:39 +08:00
|
|
|
{
|
|
|
|
|
public string uiElementRegex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ShowInInspector] [ValueDropdown("GetFilteredTypeList", ExpandAllMenuItems = false)]
|
|
|
|
|
public string componentType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<string> cacheFilterType;
|
|
|
|
|
|
|
|
|
|
public IEnumerable<string> GetFilteredTypeList()
|
|
|
|
|
{
|
|
|
|
|
if (cacheFilterType == null)
|
|
|
|
|
{
|
|
|
|
|
cacheFilterType = AlicizaX.Runtime.Utility.Assembly.GetTypes()
|
|
|
|
|
.Where(m => !m.FullName.Contains("Editor"))
|
|
|
|
|
.Where(x => !x.IsAbstract || x.IsInterface)
|
|
|
|
|
.Where(x => !x.IsGenericTypeDefinition)
|
|
|
|
|
.Where(x => !x.IsSubclassOf(typeof(GameFrameworkComponent)))
|
|
|
|
|
.Where(x => x.IsSubclassOf(typeof(Component)))
|
|
|
|
|
.Where(x => !x.FullName.Contains("YooAsset"))
|
|
|
|
|
.Where(x => !x.FullName.Contains(("Unity.VisualScripting")))
|
|
|
|
|
.Where(x => !x.FullName.Contains(("Cysharp.Threading")))
|
|
|
|
|
.Where(x => !x.FullName.Contains(("UnityEngine.Rendering.UI.Debug")))
|
|
|
|
|
.Where(x => !x.FullName.Contains(("Unity.PerformanceTesting")))
|
|
|
|
|
.Where(x => !x.FullName.Contains(("UnityEngine.TestTools")))
|
|
|
|
|
.Select(x => x.FullName).ToList();
|
|
|
|
|
|
|
|
|
|
cacheFilterType.Add(typeof(GameObject).FullName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cacheFilterType;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
2025-03-07 18:00:59 +08:00
|
|
|
public class UIScriptGenerateData
|
2025-01-26 20:55:39 +08:00
|
|
|
{
|
|
|
|
|
public string ConfigName;
|
|
|
|
|
|
2025-03-04 18:40:14 +08:00
|
|
|
public string NameSpace;
|
|
|
|
|
|
2025-01-26 20:55:39 +08:00
|
|
|
[Sirenix.OdinInspector.FolderPath(RequireExistingPath = true, AbsolutePath = false)]
|
2025-03-04 18:40:14 +08:00
|
|
|
public string GenerateHolderCodePath;
|
|
|
|
|
|
|
|
|
|
public string GenerateUICodePath;
|
2025-01-26 20:55:39 +08:00
|
|
|
|
|
|
|
|
[Sirenix.OdinInspector.FolderPath(RequireExistingPath = true, AbsolutePath = false)]
|
|
|
|
|
public string UIPrefabPath;
|
2025-03-04 18:40:14 +08:00
|
|
|
|
|
|
|
|
public EUIResLoadType LoadType;
|
2025-01-26 20:55:39 +08:00
|
|
|
}
|
|
|
|
|
}
|