添加一个表格组件,原理上贴近现代表格系统,理论上可以应对超大型表格以及离散数据集合。

This commit is contained in:
2026-06-26 19:14:48 +08:00
parent 55ace8d02b
commit 61bb0b012e
78 changed files with 4409 additions and 57 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
using TMPro;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using XericUI.Helper;
@@ -168,11 +168,11 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Button/Replace To XericButton", true)]
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Xeric Button", true)]
private static bool ValidateReplaceToXeric(UnityEditor.MenuCommand command)
=> command.context is Button and not XericButton;
[UnityEditor.MenuItem("CONTEXT/Button/Replace To XericButton", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Xeric Button", false, 10)]
private static void ReplaceToXeric(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Button, XericButton,
(Graphic targetGraphic, ButtonClickedEvent onClick)>(
@@ -184,11 +184,11 @@ namespace XericUI.OverrideUI
t.onClick = d.onClick;
});
[UnityEditor.MenuItem("CONTEXT/Button/Replace To Button", true)]
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericButton;
[UnityEditor.MenuItem("CONTEXT/Button/Replace To Button", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericButton, Button,
(Graphic targetGraphic, ButtonClickedEvent onClick)>(
+5 -5
View File
@@ -1,4 +1,4 @@
using System;
using System;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
@@ -27,11 +27,11 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Image/Replace To XericImage", true)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Xeric Image", true)]
private static bool ValidateReplaceToXeric(UnityEditor.MenuCommand command)
=> command.context is Image and not XericImage;
[UnityEditor.MenuItem("CONTEXT/Image/Replace To XericImage", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Xeric Image", false, 10)]
private static void ReplaceToXeric(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Image, XericImage, Sprite>(
o =>
@@ -41,11 +41,11 @@ namespace XericUI.OverrideUI
t.sprite = d;
});
[UnityEditor.MenuItem("CONTEXT/Image/Replace To Image", true)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericImage;
[UnityEditor.MenuItem("CONTEXT/Image/Replace To Image", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericImage, Image, Sprite>(
o =>
+172
View File
@@ -0,0 +1,172 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XericLibrary.Runtime.SuperStyleSheet;
using XericUI.Core.StyleSheetUI;
using XericUI.Helper;
namespace XericUI.OverrideUI
{
/// <summary>
/// 基于 SuperStyleSheet 的按钮组件。
/// 通过两个独立的 StyleSheetState 实例分别管理颜色和纹理的五态样式切换,
/// 替代 Unity 内置的 ColorBlock 和 SpriteState。
/// </summary>
[AddComponentMenu("Xeric UI Vessel/UI/Style Button", 51)]
public class XericStyleButton : Button
{
#region 序列化字段
[Header("样式表状态")]
[SerializeField]
[Tooltip("五态颜色样式块")]
private StyleSheetState m_ColorState = StyleSheetState.Default;
[SerializeField]
[Tooltip("五态纹理样式块")]
private StyleSheetState m_TextureState = StyleSheetState.Default;
[SerializeField]
[Tooltip("启用样式表驱动过渡(关闭则回退为 Unity ColorBlock)")]
private bool m_EnableStyleTransition = true;
#endregion
#region 运行时
[System.NonSerialized] private StyleSheetSelectionState m_CurrentState = StyleSheetSelectionState.Normal;
[System.NonSerialized] private Graphic m_TargetGraphic;
[System.NonSerialized] private Image m_TargetImage;
#endregion
#region 生命周期
protected override void Awake()
{
base.Awake();
m_TargetGraphic = targetGraphic;
m_TargetImage = m_TargetGraphic as Image;
}
protected override void OnEnable()
{
base.OnEnable();
m_ColorState?.RegisterAll();
m_TextureState?.RegisterAll();
m_ColorState?.SubscribeAll(OnStyleChanged);
m_TextureState?.SubscribeAll(OnStyleChanged);
ApplyForState(m_CurrentState);
}
protected override void OnDisable()
{
m_ColorState?.UnsubscribeAll(OnStyleChanged);
m_TextureState?.UnsubscribeAll(OnStyleChanged);
m_ColorState?.UnregisterAll();
m_TextureState?.UnregisterAll();
base.OnDisable();
}
#endregion
#region 状态过渡
protected override void DoStateTransition(SelectionState state, bool instant)
{
if (!gameObject.activeInHierarchy) return;
m_CurrentState = (StyleSheetSelectionState)(int)state;
if (m_EnableStyleTransition)
ApplyForState(m_CurrentState, instant);
else
base.DoStateTransition(state, instant);
}
#endregion
#region 样式应用
private void ApplyForState(StyleSheetSelectionState state, bool instant = false)
{
// 颜色
if (m_ColorState != null)
{
StyleField colorField = m_ColorState.GetForState(state);
if (colorField != null && m_TargetGraphic != null)
{
StyleValue val = colorField.GetValue();
if (val != null)
m_TargetGraphic.CrossFadeColor((Color)val,
instant ? 0f : m_ColorState.FadeDuration, true, true);
}
}
// 纹理
if (m_TextureState != null && m_TargetImage != null)
{
StyleField texField = m_TextureState.GetForState(state);
if (texField != null)
{
StyleValue val = texField.GetValue();
Texture2D tex = val?.GetValueAs<Texture2D>();
if (tex != null)
m_TargetImage.overrideSprite = Sprite.Create(tex,
new Rect(0, 0, tex.width, tex.height),
new Vector2(0.5f, 0.5f));
}
}
}
private void OnStyleChanged(StyleValue _)
{
if (gameObject.activeInHierarchy)
ApplyForState(m_CurrentState);
}
#endregion
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Xeric (Style)", true)]
private static bool ValidateReplaceToStyleButton(UnityEditor.MenuCommand command)
=> command.context is Button and not XericStyleButton;
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Xeric (Style)", false, 11)]
private static void ReplaceToStyleButton(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Button, XericStyleButton,
(Graphic targetGraphic, ButtonClickedEvent onClick, Navigation navigation)>(
o => (o.targetGraphic, o.onClick, o.navigation),
(t, d) =>
{
t.targetGraphic = d.targetGraphic;
t.onClick = d.onClick;
t.navigation = d.navigation;
});
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", true)]
private static bool ValidateReplaceStyleToUnity(UnityEditor.MenuCommand command)
=> command.context is XericStyleButton;
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", false, 100)]
private static void ReplaceStyleToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericStyleButton, Button,
(Graphic targetGraphic, ButtonClickedEvent onClick, Navigation navigation)>(
o => (o.targetGraphic, o.onClick, o.navigation),
(t, d) =>
{
t.targetGraphic = d.targetGraphic;
t.onClick = d.onClick;
t.navigation = d.navigation;
});
#endif
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac135f8a0c9ac114aabb20e033ab1331
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+140
View File
@@ -0,0 +1,140 @@
using UnityEngine;
using UnityEngine.UI;
using XericLibrary.Runtime.SuperStyleSheet;
using XericUI.Helper;
namespace XericUI.OverrideUI
{
/// <summary>
/// 基于 SuperStyleSheet 的图像组件。
/// 使用 StyleField 引用样式表中的颜色和纹理路径,样式变更时自动刷新。
/// </summary>
[AddComponentMenu("Xeric UI Vessel/UI/Style Image", 53)]
public class XericStyleImage : Image
{
#region 序列化字段
[Header("图像样式")]
[SerializeField]
[Tooltip("颜色样式路径")]
private StyleField m_ColorStyle = new StyleField();
[SerializeField]
[Tooltip("纹理/精灵样式路径")]
private StyleField m_TextureStyle = new StyleField();
[SerializeField]
[Tooltip("材质样式路径")]
private StyleField m_MaterialStyle = new StyleField();
[SerializeField]
[Tooltip("启用样式表自动刷新")]
private bool m_AutoRefresh = true;
#endregion
#region 运行时
[System.NonSerialized] private Sprite m_ResolvedSprite;
#endregion
#region 生命周期
protected override void OnEnable()
{
base.OnEnable();
if (!m_AutoRefresh) return;
m_ColorStyle?.Register();
m_TextureStyle?.Register();
m_MaterialStyle?.Register();
m_ColorStyle.OnValueChanged += OnStyleChanged;
m_TextureStyle.OnValueChanged += OnStyleChanged;
m_MaterialStyle.OnValueChanged += OnStyleChanged;
ApplyAllStyles();
}
protected override void OnDisable()
{
if (m_ColorStyle != null) { m_ColorStyle.OnValueChanged -= OnStyleChanged; m_ColorStyle.Unregister(); }
if (m_TextureStyle != null) { m_TextureStyle.OnValueChanged -= OnStyleChanged; m_TextureStyle.Unregister(); }
if (m_MaterialStyle != null) { m_MaterialStyle.OnValueChanged -= OnStyleChanged; m_MaterialStyle.Unregister(); }
base.OnDisable();
}
#endregion
#region 样式应用
public void ApplyAllStyles()
{
if (m_ColorStyle != null)
{
StyleValue val = m_ColorStyle.GetValue();
if (val != null) color = val;
}
if (m_TextureStyle != null)
{
StyleValue val = m_TextureStyle.GetValue();
Sprite sp = val?.GetValueAs<Sprite>();
if (sp != null) { m_ResolvedSprite = sp; sprite = sp; }
else
{
Texture2D tex = val?.GetValueAs<Texture2D>();
if (tex != null)
{
m_ResolvedSprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
sprite = m_ResolvedSprite;
}
}
}
if (m_MaterialStyle != null)
{
StyleValue val = m_MaterialStyle.GetValue();
Material mat = val?.GetValueAs<Material>();
if (mat != null) material = mat;
}
}
private void OnStyleChanged(StyleValue val)
{
if (gameObject.activeInHierarchy)
ApplyAllStyles();
}
#endregion
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Xeric (Style)", true)]
private static bool ValidateReplaceToStyleImage(UnityEditor.MenuCommand command)
=> command.context is Image and not XericStyleImage;
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Xeric (Style)", false, 11)]
private static void ReplaceToStyleImage(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Image, XericStyleImage, Sprite>(
o => o.sprite,
(t, d) => { t.sprite = d; });
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", true)]
private static bool ValidateReplaceStyleImageToUnity(UnityEditor.MenuCommand command)
=> command.context is XericStyleImage;
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", false, 100)]
private static void ReplaceStyleImageToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericStyleImage, Image, Sprite>(
o => o.sprite,
(t, d) => { t.sprite = d; });
#endif
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dff7107391ce75149acdb57d775d7d3c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+209
View File
@@ -0,0 +1,209 @@
using UnityEngine;
using UnityEngine.UI;
using XericLibrary.Runtime.SuperStyleSheet;
using XericUI.Core.StyleSheetUI;
using XericUI.Helper;
namespace XericUI.OverrideUI
{
/// <summary>
/// 基于 SuperStyleSheet 的开关组件。
/// 使用两个 StyleSheetState 实例管理五态颜色和纹理样式,
/// 额外支持 isOn 覆盖和 Checkmark 样式。
/// </summary>
[AddComponentMenu("Xeric UI Vessel/UI/Style Toggle", 52)]
public class XericStyleToggle : Toggle
{
#region 序列化字段
[Header("样式表状态")]
[SerializeField]
private StyleSheetState m_ColorState = StyleSheetState.Default;
[SerializeField]
private StyleSheetState m_TextureState = StyleSheetState.Default;
[Header("Toggle 专用")]
[SerializeField]
[Tooltip("isOn=true 时的颜色覆盖")]
private StyleField m_OnOverrideColor = new StyleField();
[SerializeField]
[Tooltip("isOn=true 时的纹理覆盖")]
private StyleField m_OnOverrideTexture = new StyleField();
[SerializeField]
[Tooltip("Checkmark 打勾标志的样式")]
private StyleField m_CheckmarkStyle = new StyleField();
[SerializeField]
[Tooltip("启用样式表驱动过渡")]
private bool m_EnableStyleTransition = true;
#endregion
#region 运行时
[System.NonSerialized] private StyleSheetSelectionState m_CurrentState = StyleSheetSelectionState.Normal;
[System.NonSerialized] private Graphic m_TargetGraphic;
[System.NonSerialized] private Image m_TargetImage;
[System.NonSerialized] private Graphic m_CheckmarkGraphic;
[System.NonSerialized] private Image m_CheckmarkImage;
#endregion
#region 生命周期
protected override void Awake()
{
base.Awake();
m_TargetGraphic = targetGraphic;
m_TargetImage = m_TargetGraphic as Image;
Transform checkmark = transform.Find("Background/Checkmark")
?? transform.Find("Checkmark");
if (checkmark != null)
{
m_CheckmarkGraphic = checkmark.GetComponent<Graphic>();
m_CheckmarkImage = checkmark.GetComponent<Image>();
}
}
protected override void OnEnable()
{
base.OnEnable();
m_ColorState?.RegisterAll();
m_TextureState?.RegisterAll();
m_ColorState?.SubscribeAll(OnStyleChanged);
m_TextureState?.SubscribeAll(OnStyleChanged);
m_OnOverrideColor?.Register();
m_OnOverrideColor.OnValueChanged += OnStyleChanged;
m_OnOverrideTexture?.Register();
m_OnOverrideTexture.OnValueChanged += OnStyleChanged;
m_CheckmarkStyle?.Register();
m_CheckmarkStyle.OnValueChanged += OnStyleChanged;
onValueChanged.AddListener(OnToggleValueChanged);
ApplyForState(m_CurrentState);
}
protected override void OnDisable()
{
onValueChanged.RemoveListener(OnToggleValueChanged);
m_ColorState?.UnsubscribeAll(OnStyleChanged);
m_TextureState?.UnsubscribeAll(OnStyleChanged);
m_ColorState?.UnregisterAll();
m_TextureState?.UnregisterAll();
if (m_OnOverrideColor != null) { m_OnOverrideColor.OnValueChanged -= OnStyleChanged; m_OnOverrideColor.Unregister(); }
if (m_OnOverrideTexture != null) { m_OnOverrideTexture.OnValueChanged -= OnStyleChanged; m_OnOverrideTexture.Unregister(); }
if (m_CheckmarkStyle != null) { m_CheckmarkStyle.OnValueChanged -= OnStyleChanged; m_CheckmarkStyle.Unregister(); }
base.OnDisable();
}
#endregion
#region 状态过渡
protected override void DoStateTransition(SelectionState state, bool instant)
{
if (!gameObject.activeInHierarchy) return;
m_CurrentState = (StyleSheetSelectionState)(int)state;
if (m_EnableStyleTransition)
ApplyForState(m_CurrentState, instant);
else
base.DoStateTransition(state, instant);
}
private void OnToggleValueChanged(bool _)
{
if (m_EnableStyleTransition)
ApplyForState(m_CurrentState);
}
#endregion
#region 样式应用
private void ApplyForState(StyleSheetSelectionState state, bool instant = false)
{
// 颜色:On 覆盖优先
StyleField colorField = isOn && m_OnOverrideColor?.GetValue() != null
? m_OnOverrideColor
: m_ColorState?.GetForState(state);
if (colorField != null && m_TargetGraphic != null)
{
StyleValue val = colorField.GetValue();
if (val != null)
{
float dur = instant ? 0f : (m_ColorState?.FadeDuration ?? 0.1f);
m_TargetGraphic.CrossFadeColor((Color)val, dur, true, true);
}
}
// 纹理:On 覆盖优先
StyleField texField = isOn && m_OnOverrideTexture?.GetValue() != null
? m_OnOverrideTexture
: m_TextureState?.GetForState(state);
if (texField != null && m_TargetImage != null)
{
StyleValue val = texField.GetValue();
Texture2D tex = val?.GetValueAs<Texture2D>();
if (tex != null)
m_TargetImage.overrideSprite = Sprite.Create(tex,
new Rect(0, 0, tex.width, tex.height),
new Vector2(0.5f, 0.5f));
}
// Checkmark
if (m_CheckmarkGraphic != null && m_CheckmarkStyle != null)
{
StyleValue val = m_CheckmarkStyle.GetValue();
if (val != null) m_CheckmarkGraphic.color = val;
}
}
private void OnStyleChanged(StyleValue _)
{
if (gameObject.activeInHierarchy)
ApplyForState(m_CurrentState);
}
#endregion
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Xeric (Style)", true)]
private static bool ValidateReplaceToStyleToggle(UnityEditor.MenuCommand command)
=> command.context is Toggle and not XericStyleToggle;
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Xeric (Style)", false, 11)]
private static void ReplaceToStyleToggle(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Toggle, XericStyleToggle,
(Graphic graphic, ToggleGroup group, ToggleEvent onValueChanged, Navigation navigation)>(
o => (o.graphic, o.group, o.onValueChanged, o.navigation),
(t, d) => { t.graphic = d.graphic; t.group = d.group; t.onValueChanged = d.onValueChanged; t.navigation = d.navigation; });
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", true)]
private static bool ValidateReplaceStyleToggleToUnity(UnityEditor.MenuCommand command)
=> command.context is XericStyleToggle;
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", false, 100)]
private static void ReplaceStyleToggleToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericStyleToggle, Toggle,
(Graphic graphic, ToggleGroup group, ToggleEvent onValueChanged, Navigation navigation)>(
o => (o.graphic, o.group, o.onValueChanged, o.navigation),
(t, d) => { t.graphic = d.graphic; t.group = d.group; t.onValueChanged = d.onValueChanged; t.navigation = d.navigation; });
#endif
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4002f96b2337614f96d13d1beeb2542
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+7 -7
View File
@@ -89,7 +89,7 @@ namespace XericUI
m_ximage = graphic.GetComponent<XericImage>();
if (m_ximage)
return m_ximage;
Debug.Log("注意替换toggle的checkmark为XericImage以支持完整的功能");
Debug.Log("ע���滻toggle��checkmarkΪXericImage��֧�������Ĺ���");
return null;
}
}
@@ -226,13 +226,13 @@ namespace XericUI
#endif
}
#region 组件替换
#region ����滻
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To XericToggle", true)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Xeric Toggle", true)]
private static bool ValidateReplaceToXeric(UnityEditor.MenuCommand command)
=> command.context is Toggle and not XericToggle;
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To XericToggle", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Xeric Toggle", false, 10)]
private static void ReplaceToXeric(UnityEditor.MenuCommand command)
{
command.ReplaceCommandContext<Toggle, XericToggle,
@@ -245,14 +245,14 @@ namespace XericUI
t.group = d.group;
t.onValueChanged = d.onValueChanged;
});
Debug.Log("请手动替换toggle下的Checkmark Image组件为XericImage,否则Toggle工作时取消选择的状态会保持为ison状态。");
Debug.Log("���ֶ��滻toggle�µ�Checkmark Image���ΪXericImage������Toggle����ʱȡ��ѡ���״̬�ᱣ��Ϊison״̬��");
}
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To Toggle", true)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericToggle;
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To Toggle", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericToggle, Toggle,
(Graphic graphic, ToggleGroup group, ToggleEvent onValueChanged)>(
+5 -5
View File
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using XericUI.Helper;
@@ -12,19 +12,19 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To XericToggleGroup", true)]
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To/Xeric ToggleGroup", true)]
private static bool ValidateReplaceToXeric(UnityEditor.MenuCommand command)
=> command.context is ToggleGroup and not XericToggleGroup;
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To XericToggleGroup", false, 10)]
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To/Xeric ToggleGroup", false, 10)]
private static void ReplaceToXeric(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<ToggleGroup, XericToggleGroup>();
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To ToggleGroup", true)]
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To/Unity ToggleGroup", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericToggleGroup;
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To ToggleGroup", false, 10)]
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To/Unity ToggleGroup", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericToggleGroup, ToggleGroup>();
#endif
@@ -27,22 +27,22 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Button/Replace To XericUIrAttributeButton", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToXeric(UnityEditor.MenuCommand command)
=> command.context is Button and not XericUIrAttributeButton;
[UnityEditor.MenuItem("CONTEXT/Button/Replace To XericUIrAttributeButton", false, 11)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Xeric (Attribute)", false, 12)]
private static void ReplaceToXeric(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Button, XericUIrAttributeButton,
(Graphic targetGraphic, Button.ButtonClickedEvent onClick)>(
o => (o.targetGraphic, o.onClick),
(t, d) => { t.targetGraphic = d.targetGraphic; t.onClick = d.onClick; });
[UnityEditor.MenuItem("CONTEXT/Button/Replace To Button", true)]
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeButton;
[UnityEditor.MenuItem("CONTEXT/Button/Replace To Button", false, 11)]
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericUIrAttributeButton, Button,
(Graphic targetGraphic, Button.ButtonClickedEvent onClick)>(
@@ -27,11 +27,11 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To XericUIrAttributeDropdown", true)]
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.context is Dropdown and not XericUIrAttributeDropdown;
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To XericUIrAttributeDropdown", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To/Xeric (Attribute)", false, 10)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Dropdown, XericUIrAttributeDropdown,
(Graphic targetGraphic, int value, List<OptionData> options, DropdownEvent onValueChanged)>(
@@ -45,11 +45,11 @@ namespace XericUI.OverrideUI
t.onValueChanged = d.onValueChanged;
});
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To Dropdown", true)]
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To/Unity Dropdown", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeDropdown;
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To Dropdown", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Dropdown/Replace To/Unity Dropdown", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericUIrAttributeDropdown, Dropdown,
(Graphic targetGraphic, int value, List<OptionData> options, DropdownEvent onValueChanged)>(
@@ -26,11 +26,11 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To XericUIrAttributeInputField", true)]
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.context is InputField and not XericUIrAttributeInputField;
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To XericUIrAttributeInputField", false, 10)]
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To/Xeric (Attribute)", false, 10)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<InputField, XericUIrAttributeInputField,
(Graphic targetGraphic, string text, InputField.OnChangeEvent onValueChanged, InputField.EndEditEvent onEndEdit)>(
@@ -43,11 +43,11 @@ namespace XericUI.OverrideUI
t.onEndEdit = d.onEndEdit;
});
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To InputField", true)]
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To/Unity InputField", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeInputField;
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To InputField", false, 10)]
[UnityEditor.MenuItem("CONTEXT/InputField/Replace To/Unity InputField", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericUIrAttributeInputField, InputField,
(Graphic targetGraphic, string text, InputField.OnChangeEvent onValueChanged, InputField.EndEditEvent onEndEdit)>(
@@ -26,11 +26,11 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To XericUIrAttributeSlider", true)]
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.context is Slider and not XericUIrAttributeSlider;
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To XericUIrAttributeSlider", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To/Xeric (Attribute)", false, 10)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Slider, XericUIrAttributeSlider,
(Graphic targetGraphic, float value, Slider.SliderEvent onValueChanged)>(
@@ -43,11 +43,11 @@ namespace XericUI.OverrideUI
t.onValueChanged = d.onValueChanged;
});
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To Slider", true)]
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To/Unity Slider", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeSlider;
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To Slider", false, 10)]
[UnityEditor.MenuItem("CONTEXT/Slider/Replace To/Unity Slider", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericUIrAttributeSlider, Slider,
(Graphic targetGraphic, float value, Slider.SliderEvent onValueChanged)>(
+4 -4
View File
@@ -45,21 +45,21 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Image/Replace To XericUIrAttributeText", true)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Xeric (AttributeText)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.context is Image and not XericUIrAttributeText;
[UnityEditor.MenuItem("CONTEXT/Image/Replace To XericUIrAttributeText", false, 11)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Xeric (AttributeText)", false, 13)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Image, XericUIrAttributeText, Sprite>(
o => o.sprite,
(t, d) => { t.sprite = d; });
[UnityEditor.MenuItem("CONTEXT/Image/Replace To Image", true)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeText;
[UnityEditor.MenuItem("CONTEXT/Image/Replace To Image", false, 11)]
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericUIrAttributeText, Image, Sprite>(
o => o.sprite,
@@ -59,7 +59,7 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To XericUIrAttributeTextMeshProInputField", true)]
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
{
#if dUI_TextMeshPro
@@ -69,7 +69,7 @@ namespace XericUI.OverrideUI
#endif
}
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To XericUIrAttributeTextMeshProInputField", false, 10)]
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To/Xeric (Attribute)", false, 10)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
{
#if dUI_TextMeshPro
@@ -79,11 +79,11 @@ namespace XericUI.OverrideUI
#endif
}
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To TMP_InputField", true)]
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To/Unity TMP_InputField", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeTextMeshProInputField;
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To TMP_InputField", false, 10)]
[UnityEditor.MenuItem("CONTEXT/TMP_InputField/Replace To/Unity TMP_InputField", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
{
var comp = command.context as XericUIrAttributeTextMeshProInputField;
@@ -56,7 +56,7 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To XericUIrAttributeTextMeshProText", true)]
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
{
#if dUI_TextMeshPro
@@ -66,7 +66,7 @@ namespace XericUI.OverrideUI
#endif
}
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To XericUIrAttributeTextMeshProText", false, 10)]
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To/Xeric (Attribute)", false, 10)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
{
#if dUI_TextMeshPro
@@ -76,11 +76,11 @@ namespace XericUI.OverrideUI
#endif
}
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To TextMeshProUGUI", true)]
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To/Unity TextMeshPro", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeTextMeshProText;
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To TextMeshProUGUI", false, 10)]
[UnityEditor.MenuItem("CONTEXT/TextMeshProUGUI/Replace To/Unity TextMeshPro", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
{
var comp = command.context as XericUIrAttributeTextMeshProText;
@@ -26,11 +26,11 @@ namespace XericUI.OverrideUI
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To XericUIrAttributeToggle", true)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Xeric (Attribute)", true)]
private static bool ValidateReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.context is Toggle and not XericUIrAttributeToggle;
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To XericUIrAttributeToggle", false, 11)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Xeric (Attribute)", false, 12)]
private static void ReplaceToAttribute(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<Toggle, XericUIrAttributeToggle,
(Graphic graphic, ToggleGroup group, Toggle.ToggleEvent onValueChanged)>(
@@ -42,11 +42,11 @@ namespace XericUI.OverrideUI
t.onValueChanged = d.onValueChanged;
});
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To Toggle", true)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericUIrAttributeToggle;
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To Toggle", false, 11)]
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", false, 100)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericUIrAttributeToggle, Toggle,
(Graphic graphic, ToggleGroup group, Toggle.ToggleEvent onValueChanged)>(