This commit is contained in:
monitor1394
2022-03-30 08:24:47 +08:00
parent 1ad87920d0
commit 4ade064266
3 changed files with 23 additions and 17 deletions

View File

@@ -41,7 +41,8 @@ namespace XCharts.Runtime
{
[SerializeField] private bool m_Show = true;
[SerializeField] private Theme m_SharedTheme;
[SerializeField] private bool m_EnableCustomTheme;
[SerializeField] private bool m_TransparentBackground = false;
[SerializeField] private bool m_EnableCustomTheme = false;
[SerializeField] private Font m_CustomFont;
[SerializeField] private Color32 m_CustomBackgroundColor;
#if UNITY_2020_2
@@ -83,8 +84,27 @@ namespace XCharts.Runtime
/// </summary>
public Color32 backgroundColor
{
get { return m_EnableCustomTheme ? m_CustomBackgroundColor : sharedTheme.backgroundColor; }
get
{
if (m_TransparentBackground) return ColorUtil.clearColor32;
else return m_EnableCustomTheme ? m_CustomBackgroundColor : sharedTheme.backgroundColor;
}
}
/// <summary>
/// Whether the background color is transparent. When true, the background color is not drawn.
/// 是否透明背景颜色。当设置为true时不绘制背景颜色。
/// </summary>
public bool transparentBackground
{
get { return m_TransparentBackground; }
set { m_TransparentBackground = value; SetAllDirty(); }
}
/// <summary>
/// Whether to customize theme colors. When set to true,
/// you can use 'sync color to custom' to synchronize the theme color to the custom color. It can also be set manually.
/// |是否自定义主题颜色。当设置为true时可以用sync color to custom同步主题的颜色到自定义颜色。也可以手动设置。
/// </summary>
/// <value></value>
public bool enableCustomTheme
{
get { return m_EnableCustomTheme; }