增加LegenditemInactiveOpacity可设置非激活状态时的颜色透明度 (#343)

This commit is contained in:
monitor1394
2025-03-27 22:35:02 +08:00
parent 546ff1f61a
commit 85b92ca2cc
12 changed files with 108 additions and 33 deletions

View File

@@ -1,5 +1,6 @@
using System;
using UnityEngine;
using UnityEngine.Serialization;
#if dUI_TextMeshPro
using TMPro;
#endif
@@ -9,27 +10,37 @@ namespace XCharts.Runtime
[Serializable]
public class LegendTheme : ComponentTheme
{
[SerializeField] protected Color m_UnableColor;
[SerializeField][FormerlySerializedAs("m_UnableColor")] protected Color m_InactiveColor;
/// <summary>
/// the color of text.
/// ||文本颜色。
/// </summary>
[Obsolete("Use inactiveColor instead.", true)]
public Color unableColor
{
get { return m_UnableColor; }
set { if (PropertyUtil.SetColor(ref m_UnableColor, value)) SetComponentDirty(); }
get { return m_InactiveColor; }
set { if (PropertyUtil.SetColor(ref m_InactiveColor, value)) SetComponentDirty(); }
}
/// <summary>
/// the color when the component is inactive.
/// ||非激活状态时的颜色。
/// </summary>
public Color inactiveColor
{
get { return m_InactiveColor; }
set { if (PropertyUtil.SetColor(ref m_InactiveColor, value)) SetComponentDirty(); }
}
public void Copy(LegendTheme theme)
{
base.Copy(theme);
m_UnableColor = theme.unableColor;
m_InactiveColor = theme.inactiveColor;
}
public LegendTheme(ThemeType theme) : base(theme)
{
m_UnableColor = ColorUtil.GetColor("#cccccc");
m_InactiveColor = ColorUtil.GetColor("#cccccc");
}
}