修复stylefield显示为红色字段的问题。
This commit is contained in:
@@ -19,7 +19,6 @@ namespace XericUI.Core.StyleSheetUI
|
||||
|
||||
#region 序列化字段
|
||||
|
||||
[Header("五态样式路径")]
|
||||
[SerializeField]
|
||||
[Tooltip("正常状态")]
|
||||
private StyleField m_Normal = new StyleField { Namespace = k_DefaultNamespace, StylePath = k_DefaultColorBasePath + "/NormalColor" };
|
||||
@@ -40,7 +39,6 @@ namespace XericUI.Core.StyleSheetUI
|
||||
[Tooltip("禁用状态")]
|
||||
private StyleField m_Disabled = new StyleField { Namespace = k_DefaultNamespace, StylePath = k_DefaultColorBasePath + "/DisabledColor" };
|
||||
|
||||
[Header("过渡")]
|
||||
[SerializeField]
|
||||
[Range(0.001f, 1f)]
|
||||
[Tooltip("渐变持续时间")]
|
||||
|
||||
@@ -184,11 +184,11 @@ namespace XericUI.OverrideUI
|
||||
t.onClick = d.onClick;
|
||||
});
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button (Native)", true)]
|
||||
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericButton;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button (Native)", false, 100)]
|
||||
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericButton, Button,
|
||||
(Graphic targetGraphic, ButtonClickedEvent onClick)>(
|
||||
|
||||
@@ -41,11 +41,11 @@ namespace XericUI.OverrideUI
|
||||
t.sprite = d;
|
||||
});
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image (Native)", true)]
|
||||
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericImage;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image (Native)", false, 100)]
|
||||
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericImage, Image, Sprite>(
|
||||
o =>
|
||||
|
||||
@@ -198,11 +198,11 @@ namespace XericUI.OverrideUI
|
||||
t.navigation = d.navigation;
|
||||
});
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button (Style)", true)]
|
||||
private static bool ValidateReplaceStyleToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericStyleButton;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button (Style)", false, 100)]
|
||||
private static void ReplaceStyleToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericStyleButton, Button,
|
||||
(Graphic targetGraphic, ButtonClickedEvent onClick, Navigation navigation)>(
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace XericUI.OverrideUI
|
||||
{
|
||||
#region 序列化字段
|
||||
|
||||
[Header("图像样式")]
|
||||
[SerializeField]
|
||||
[Tooltip("颜色样式路径")]
|
||||
private StyleField m_ColorStyle = new StyleField();
|
||||
@@ -176,11 +175,11 @@ namespace XericUI.OverrideUI
|
||||
o => o.sprite,
|
||||
(t, d) => { t.sprite = d; });
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image (Style)", true)]
|
||||
private static bool ValidateReplaceStyleImageToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericStyleImage;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image (Style)", false, 100)]
|
||||
private static void ReplaceStyleImageToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericStyleImage, Image, Sprite>(
|
||||
o => o.sprite,
|
||||
|
||||
@@ -253,11 +253,11 @@ namespace XericUI.OverrideUI
|
||||
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)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle (Style)", true)]
|
||||
private static bool ValidateReplaceStyleToggleToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericStyleToggle;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle (Style)", false, 100)]
|
||||
private static void ReplaceStyleToggleToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericStyleToggle, Toggle,
|
||||
(Graphic graphic, ToggleGroup group, ToggleEvent onValueChanged, Navigation navigation)>(
|
||||
|
||||
@@ -299,11 +299,11 @@ namespace XericUI
|
||||
Debug.Log("请手动替换toggle下的Checkmark Image组件为XericImage,这样Toggle关闭时取消选中的状态会保持为ison状态");
|
||||
}
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle (Native)", true)]
|
||||
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericToggle;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle (Native)", false, 100)]
|
||||
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericToggle, Toggle,
|
||||
(Graphic graphic, ToggleGroup group, ToggleEvent onValueChanged)>(
|
||||
|
||||
@@ -38,11 +38,11 @@ namespace XericUI.OverrideUI
|
||||
o => (o.targetGraphic, o.onClick),
|
||||
(t, d) => { t.targetGraphic = d.targetGraphic; t.onClick = d.onClick; });
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button (Attribute)", true)]
|
||||
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericUIrAttributeButton;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Button/Replace To/Unity Button (Attribute)", false, 100)]
|
||||
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericUIrAttributeButton, Button,
|
||||
(Graphic targetGraphic, Button.ButtonClickedEvent onClick)>(
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace XericUI.OverrideUI
|
||||
o => o.sprite,
|
||||
(t, d) => { t.sprite = d; });
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image (Attribute)", true)]
|
||||
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericUIrAttributeText;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Image/Replace To/Unity Image (Attribute)", false, 100)]
|
||||
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericUIrAttributeText, Image, Sprite>(
|
||||
o => o.sprite,
|
||||
|
||||
@@ -42,11 +42,11 @@ namespace XericUI.OverrideUI
|
||||
t.onValueChanged = d.onValueChanged;
|
||||
});
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", true)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle (Attribute)", true)]
|
||||
private static bool ValidateReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.context is XericUIrAttributeToggle;
|
||||
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle", false, 100)]
|
||||
[UnityEditor.MenuItem("CONTEXT/Toggle/Replace To/Unity Toggle (Attribute)", false, 100)]
|
||||
private static void ReplaceToUnity(UnityEditor.MenuCommand command)
|
||||
=> command.ReplaceCommandContext<XericUIrAttributeToggle, Toggle,
|
||||
(Graphic graphic, ToggleGroup group, Toggle.ToggleEvent onValueChanged)>(
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace XericUI.XTable.Rendering.Elements
|
||||
RegisterField("/cell/font/size", OnStyleChanged);
|
||||
RegisterField("/cell/font/alignment", OnStyleChanged);
|
||||
RegisterField("/cell/font/richText", OnStyleChanged);
|
||||
RegisterField("/cell/font/fontAsset", OnStyleChanged);
|
||||
|
||||
m_IsBound = true;
|
||||
RefreshAll();
|
||||
@@ -123,20 +122,6 @@ namespace XericUI.XTable.Rendering.Elements
|
||||
StyleValue richVal = GetStyleValue("/cell/font/richText");
|
||||
if (richVal != null && TextComponent != null)
|
||||
TextComponent.richText = (bool)richVal;
|
||||
|
||||
// 字体资源
|
||||
StyleValue fontVal = GetStyleValue("/cell/font/fontAsset");
|
||||
if (fontVal != null && TextComponent != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
TextComponent.font = fontVal.GetValueAs<TMP_FontAsset>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
/* 类型不匹配时忽略 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -47,3 +47,21 @@ cell/default/ {
|
||||
height = 40:System.Single @Desc:默认行高
|
||||
width = 100:System.Single @Desc:默认列宽
|
||||
}
|
||||
|
||||
|
||||
/button/TargetGraphic/ColorTint:UnityEngine.UI.ColorBlock/ {
|
||||
.NormalColor = (1,1,1,1)
|
||||
.HighlightedColor = (0.96,0.96,0.96,1)
|
||||
.PressedColor = (0.78,0.78,0.78,1)
|
||||
.SelectedColor = (0.96,0.96,0.96,1)
|
||||
.DisabledColor = (0.6,0.6,0.6,0.8)
|
||||
}
|
||||
|
||||
/toggle/TargetGraphic/ColorTint:UnityEngine.UI.ColorBlock/ {
|
||||
.NormalColor = (1,1,1,1)
|
||||
.HighlightedColor = (0.96,0.96,0.96,1)
|
||||
.PressedColor = (0.78,0.78,0.78,1)
|
||||
.SelectedColor = (0.96,0.96,0.96,1)
|
||||
.DisabledColor = (0.6,0.6,0.6,0.8)
|
||||
.DisabledColor = (0.6,0.6,0.6,0.8)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user