mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
优化和重构Theme,解决引用相同或丢失的问题 #118
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if dUI_TextMeshPro
|
||||
using TMPro;
|
||||
#endif
|
||||
@@ -63,6 +64,7 @@ namespace XCharts
|
||||
[SerializeField] [Range(10, 50)] protected float m_VisualMapTriangeLen = 20f;
|
||||
[SerializeField] [Range(1, 20)] protected float m_PieTooltipExtraRadius = 8f;
|
||||
[SerializeField] [Range(1, 20)] protected float m_PieSelectedOffset = 8f;
|
||||
[SerializeField] protected List<TextAsset> m_CustomThemes = new List<TextAsset>();
|
||||
|
||||
public static Font font { get { return Instance.m_Font; } }
|
||||
#if dUI_TextMeshPro
|
||||
@@ -117,6 +119,7 @@ namespace XCharts
|
||||
public static float pieSelectedOffset { get { return Instance.m_PieSelectedOffset; } }
|
||||
#endregion
|
||||
|
||||
public static List<TextAsset> customThemes { get { return Instance.m_CustomThemes; } }
|
||||
|
||||
private static XChartsSettings s_Instance;
|
||||
public static XChartsSettings Instance
|
||||
@@ -146,5 +149,16 @@ namespace XCharts
|
||||
return s_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool AddJsonTheme(TextAsset theme)
|
||||
{
|
||||
if (theme == null) return false;
|
||||
if (!Instance.m_CustomThemes.Contains(theme))
|
||||
{
|
||||
Instance.m_CustomThemes.Add(theme);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user