添加了一键替换组件的方法。

修改了xericlibrary的api。
修改了菜单路径。
This commit is contained in:
2026-04-16 10:22:39 +08:00
parent a7ce860f56
commit 60d5822a82
11 changed files with 497 additions and 6 deletions
+22 -2
View File
@@ -1,13 +1,33 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using XericUI.Helper;
namespace XericUI.OverrideUI
{
[AddComponentMenu("Xeric UI Vessel/Toggle Group", 31)]
[AddComponentMenu("Xeric UI Vessel/ToggleGroup", 31)]
[DisallowMultipleComponent]
public class XericToggleGroup : ToggleGroup
{
// public List<>
#region 组件替换
#if UNITY_EDITOR
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To XericToggleGroup", true)]
private static bool ValidateReplaceToXeric(UnityEditor.MenuCommand command)
=> command.context is ToggleGroup and not XericToggleGroup;
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To XericToggleGroup", false, 10)]
private static void ReplaceToXeric(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<ToggleGroup, XericToggleGroup>();
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To ToggleGroup", true)]
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
=> command.context is XericToggleGroup;
[UnityEditor.MenuItem("CONTEXT/ToggleGroup/Replace To ToggleGroup", false, 10)]
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
=> command.ReplaceCommandContext<XericToggleGroup, ToggleGroup>();
#endif
#endregion
}
}