From b33acd4af06e76bdf5477b800959dd5cf70724ac Mon Sep 17 00:00:00 2001 From: yyl <yyl> Date: 星期四, 12 六月 2025 17:36:55 +0800 Subject: [PATCH] 18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建 配置生成新增排除列表 UIBase界面新增Inspector --- Assets/Editor/ConfigGen/ConfigGenerater.cs | 15 +++++++++++++++ Assets/Editor/UI/UIBaseInspector.cs | 30 +++++++++++++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Assets/Editor/ConfigGen/ConfigGenerater.cs b/Assets/Editor/ConfigGen/ConfigGenerater.cs index cabf9a1..d884ccc 100644 --- a/Assets/Editor/ConfigGen/ConfigGenerater.cs +++ b/Assets/Editor/ConfigGen/ConfigGenerater.cs @@ -5,6 +5,7 @@ using System.Text; using UnityEditor; using UnityEngine; +using System.Linq; /// <summary> /// 閰嶇疆鐢熸垚鍣� - 鐢ㄤ簬鑷姩鐢熸垚閰嶇疆绠$悊鍣ㄤ唬鐮� @@ -15,6 +16,18 @@ private const string ConfigsPath = "Assets/Scripts/Main/Config/Configs"; private const string ConfigManagerPath = "Assets/Scripts/Main/Manager/ConfigManager.cs"; + private static List<string> ExcludeClassList = new List<string>() + { + "InitialFunctionConfig", + "PriorLanguageConfig", + }; + + [MenuItem("Tools/鎵嬪姩鍒锋柊")] + public static void Refresh() + { + AssetDatabase.Refresh(); + } + /// <summary> /// 鐢熸垚閰嶇疆绠$悊鍣ㄨ彍鍗曢」 /// </summary> @@ -26,6 +39,8 @@ // 鑾峰彇鎵�鏈夐厤缃被 List<string> configClasses = GetAllConfigClasses(); + configClasses = new List<string>(configClasses.Where(config => !ExcludeClassList.Contains(config))); + // 鐢熸垚閰嶇疆绠$悊鍣ㄤ唬鐮� GenerateConfigManager(configClasses); diff --git a/Assets/Editor/UI/UIBaseInspector.cs b/Assets/Editor/UI/UIBaseInspector.cs index 08f2b90..0874163 100644 --- a/Assets/Editor/UI/UIBaseInspector.cs +++ b/Assets/Editor/UI/UIBaseInspector.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEditor; -[CustomEditor(typeof(UIBase))] +[CustomEditor(typeof(UIBase), true)] public class UIBaseInspector : Editor { SerializedProperty uiLayer; @@ -10,26 +10,32 @@ SerializedProperty supportParentChildRelation; SerializedProperty isPersistent; SerializedProperty maxIdleRounds; + + // 鍔ㄧ敾鐩稿叧 SerializedProperty openAnimationType; SerializedProperty closeAnimationType; - SerializedProperty animationDuration; + SerializedProperty animeRoot; + SerializedProperty animeDuration; SerializedProperty animationEase; + SerializedProperty openMask; SerializedProperty clickEmptySpaceClose; void OnEnable() { - // 鑾峰彇鎵�鏈塖erializedProperty uiLayer = serializedObject.FindProperty("uiLayer"); uiName = serializedObject.FindProperty("uiName"); isMainUI = serializedObject.FindProperty("isMainUI"); supportParentChildRelation = serializedObject.FindProperty("supportParentChildRelation"); isPersistent = serializedObject.FindProperty("isPersistent"); maxIdleRounds = serializedObject.FindProperty("maxIdleRounds"); + openAnimationType = serializedObject.FindProperty("openAnimationType"); closeAnimationType = serializedObject.FindProperty("closeAnimationType"); - animationDuration = serializedObject.FindProperty("animationDuration"); + animeRoot = serializedObject.FindProperty("_rectTransform"); + animeDuration = serializedObject.FindProperty("animeDuration"); animationEase = serializedObject.FindProperty("animationEase"); + openMask = serializedObject.FindProperty("openMask"); clickEmptySpaceClose = serializedObject.FindProperty("clickEmptySpaceClose"); } @@ -57,32 +63,31 @@ EditorGUILayout.LabelField("鍔ㄧ敾璁剧疆", EditorStyles.boldLabel); EditorGUILayout.PropertyField(openAnimationType); EditorGUILayout.PropertyField(closeAnimationType); + EditorGUILayout.PropertyField(animeRoot, new GUIContent("animeRoot (鍔ㄧ敾鏍硅妭鐐�)")); if (openAnimationType.enumValueIndex != 0 || closeAnimationType.enumValueIndex != 0) { EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(animationDuration); + EditorGUILayout.PropertyField(animeDuration); EditorGUILayout.PropertyField(animationEase); EditorGUI.indentLevel--; + } + // 鍔ㄧ敾鐢熸晥鎻愮ず + if ((openAnimationType.enumValueIndex != 0 || closeAnimationType.enumValueIndex != 0) && animeRoot.objectReferenceValue == null) + { + EditorGUILayout.HelpBox("濡傞渶鍔ㄧ敾鐢熸晥锛屽繀椤绘寚瀹� animeRoot锛堝姩鐢绘牴鑺傜偣锛夛紒", MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.LabelField("閬僵璁剧疆", EditorStyles.boldLabel); - // 浣跨敤BeginHorizontal鏉ュ垱寤轰竴涓按骞冲竷灞�缁� EditorGUILayout.BeginHorizontal(); - - // 鍒涘缓涓�涓紑鍏虫寜閽粍 EditorGUI.BeginChangeCheck(); bool tempOpenMask = GUILayout.Toggle(openMask.boolValue, "寮�鍚伄缃�", EditorStyles.miniButtonLeft); bool tempClickEmptyClose = GUILayout.Toggle(clickEmptySpaceClose.boolValue, "鐐瑰嚮绌虹櫧鍏抽棴", EditorStyles.miniButtonRight); - - // 濡傛灉鏈夋敼鍙� if (EditorGUI.EndChangeCheck()) { - // 纭繚鍙湁涓�涓彲浠ヤ负true if (tempOpenMask && tempClickEmptyClose) { - // 濡傛灉涓や釜閮戒负true锛屼繚鎸佹渶鍚庢敼鍙樼殑閭d釜涓簍rue if (openMask.boolValue != tempOpenMask) { clickEmptySpaceClose.boolValue = false; @@ -100,7 +105,6 @@ clickEmptySpaceClose.boolValue = tempClickEmptyClose; } } - EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); -- Gitblit v1.8.0