添加编辑器界面
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using UnityEditor;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeButton))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class XericUIrAttributeButtonEditor : XericButtonEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
XericUIrAttributeEditorHelper.DrawAttributeTagFields(serializedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 326a7ebf62af0d5419630e20cf2861e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeDropdown))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class XericUIrAttributeDropdownEditor : DropdownEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
XericUIrAttributeEditorHelper.DrawAttributeTagFields(serializedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f8d011250fa17848a724fbb80e756fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
/// <summary>
|
||||
/// XericUIrAttribute* 组件的 Editor 通用辅助方法
|
||||
/// </summary>
|
||||
internal static class XericUIrAttributeEditorHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 绘制 _entryTag 和 _tagIndex 字段
|
||||
/// 在 OnInspectorGUI 末尾调用
|
||||
/// </summary>
|
||||
public static void DrawAttributeTagFields(SerializedObject serializedObject)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Reflection UI Attribute Tag", EditorStyles.boldLabel);
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
var entryTagProp = serializedObject.FindProperty("_entryTag");
|
||||
var tagIndexProp = serializedObject.FindProperty("_tagIndex");
|
||||
|
||||
if (entryTagProp != null)
|
||||
EditorGUILayout.PropertyField(entryTagProp);
|
||||
|
||||
if (tagIndexProp != null)
|
||||
EditorGUILayout.PropertyField(tagIndexProp);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a59db39a3dc2734bb5f3adaafbed06c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeInputField))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class XericUIrAttributeInputFieldEditor : InputFieldEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
XericUIrAttributeEditorHelper.DrawAttributeTagFields(serializedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1ce54b154544da4c8cca4b4b8063e88
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeSlider))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class XericUIrAttributeSliderEditor : SliderEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
XericUIrAttributeEditorHelper.DrawAttributeTagFields(serializedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d0a860b1f96faa44a2536f607030df9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeText))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class XericUIrAttributeTextEditor : ImageEditor
|
||||
{
|
||||
SerializedProperty _targetTextProp;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
_targetTextProp = serializedObject.FindProperty("_targetText");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
if (_targetTextProp != null)
|
||||
EditorGUILayout.PropertyField(_targetTextProp);
|
||||
|
||||
XericUIrAttributeEditorHelper.DrawAttributeTagFields(serializedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a589d7a31bab924dadbb7b510489e86
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeTextMeshProText))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class XericUIrAttributeTextMeshProTextEditor : Editor
|
||||
{
|
||||
#if dUI_TextMeshPro
|
||||
SerializedProperty _targetTextProp;
|
||||
#endif
|
||||
SerializedProperty _entryTagProp;
|
||||
SerializedProperty _tagIndexProp;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
#if dUI_TextMeshPro
|
||||
_targetTextProp = serializedObject.FindProperty("_targetText");
|
||||
#endif
|
||||
_entryTagProp = serializedObject.FindProperty("_entryTag");
|
||||
_tagIndexProp = serializedObject.FindProperty("_tagIndex");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
var targetComp = target as XericUIrAttributeTextMeshProText;
|
||||
|
||||
EditorGUILayout.LabelField("XericUIrAttributeTextMeshProText", EditorStyles.boldLabel);
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// 提示信息
|
||||
EditorGUILayout.HelpBox(
|
||||
"此组件为 TMP_Text 的标记附加器,需挂在与 TMP_Text 同一个 GameObject 上。\n" +
|
||||
"_entryTag 和 _tagIndex 用于反射界面生成器自动绑定。",
|
||||
MessageType.Info);
|
||||
|
||||
#if dUI_TextMeshPro
|
||||
EditorGUILayout.PropertyField(_targetTextProp);
|
||||
#endif
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Reflection UI Attribute Tag", EditorStyles.boldLabel);
|
||||
|
||||
if (_entryTagProp != null)
|
||||
EditorGUILayout.PropertyField(_entryTagProp);
|
||||
|
||||
if (_tagIndexProp != null)
|
||||
EditorGUILayout.PropertyField(_tagIndexProp);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8226bbbc53d035e43b6811dc1f346f60
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
using UnityEditor;
|
||||
using XericUI;
|
||||
using XericUI.OverrideUI;
|
||||
|
||||
namespace XericUIEditor.OverrideUI
|
||||
{
|
||||
[CustomEditor(typeof(XericUIrAttributeToggle))]
|
||||
internal class XericUIrAttributeToggleEditor : XericToggleEditor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
XericUIrAttributeEditorHelper.DrawAttributeTagFields(serializedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ae7bafc6acd1b345b62d3467fc23cbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user