| | |
| | | { |
| | | EditorGUILayout.LabelField("基本信息", EditorStyles.boldLabel); |
| | | |
| | | using (new EditorGUI.DisabledScope(true)) |
| | | EditorGUI.BeginChangeCheck(); |
| | | |
| | | // 允许手动拖拽目标组件和设置类型 |
| | | Component newTarget = (Component)EditorGUILayout.ObjectField("目标组件", adapter.TargetTextComponent, typeof(Component), true); |
| | | TextComponentType newType = (TextComponentType)EditorGUILayout.EnumPopup("组件类型", adapter.TargetTextType); |
| | | |
| | | if (EditorGUI.EndChangeCheck()) |
| | | { |
| | | EditorGUILayout.ObjectField("目标组件", adapter.LanguageConfigs.keys.Count > 0 ? adapter.TargetTextComponent : null, typeof(Component), true); |
| | | EditorGUILayout.EnumPopup("组件类型", adapter.TargetTextType); |
| | | Undo.RecordObject(adapter, "Update Basic Info"); |
| | | |
| | | // 智能辅助:当用户拖拽新组件时,尝试自动匹配一下类型,但也允许手动覆盖 |
| | | if (newTarget != null && newTarget != adapter.TargetTextComponent) |
| | | { |
| | | string typeName = newTarget.GetType().Name; |
| | | if (typeName == "GradientText") newType = TextComponentType.GradientText; |
| | | else if (typeName == "TextEx") newType = TextComponentType.TextEx; |
| | | else if (newTarget is UnityEngine.UI.Text) newType = TextComponentType.Text; |
| | | } |
| | | |
| | | adapter.TargetTextComponent = newTarget; |
| | | adapter.TargetTextType = newType; |
| | | } |
| | | |
| | | if (GUILayout.Button("刷新组件检测", GUILayout.Width(120))) adapter.Editor_ForceRefreshDetection(); |
| | | EditorGUILayout.HelpBox("组件或类型变更后需执行刷新组件检测", MessageType.Info); |
| | | EditorGUILayout.HelpBox("请手动拖拽要适配的文本组件,并确认组件类型是否正确。", MessageType.Info); |
| | | } |
| | | } |
| | | |