mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 17:30:10 +00:00
3.0 - inspector
This commit is contained in:
@@ -18,7 +18,6 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected string m_ChartName;
|
||||
[SerializeField] protected ThemeStyle m_Theme = new ThemeStyle();
|
||||
[SerializeField] protected Settings m_Settings;
|
||||
[SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo();
|
||||
|
||||
#pragma warning disable 0414
|
||||
[SerializeField] [ListForComponent(typeof(AngleAxis))] private List<AngleAxis> m_AngleAxes = new List<AngleAxis>();
|
||||
@@ -33,7 +32,6 @@ namespace XCharts.Runtime
|
||||
[SerializeField] [ListForComponent(typeof(RadiusAxis))] private List<RadiusAxis> m_RadiusAxes = new List<RadiusAxis>();
|
||||
[SerializeField] [ListForComponent(typeof(Title))] private List<Title> m_Titles = new List<Title>();
|
||||
[SerializeField] [ListForComponent(typeof(Tooltip))] private List<Tooltip> m_Tooltips = new List<Tooltip>();
|
||||
[SerializeField] [ListForComponent(typeof(Vessel))] private List<Vessel> m_Vessels = new List<Vessel>();
|
||||
[SerializeField] [ListForComponent(typeof(VisualMap))] private List<VisualMap> m_VisualMaps = new List<VisualMap>();
|
||||
[SerializeField] [ListForComponent(typeof(XAxis))] private List<XAxis> m_XAxes = new List<XAxis>();
|
||||
[SerializeField] [ListForComponent(typeof(YAxis))] private List<YAxis> m_YAxes = new List<YAxis>();
|
||||
@@ -46,7 +44,6 @@ namespace XCharts.Runtime
|
||||
[SerializeField] [ListForSerie(typeof(EffectScatter))] private List<EffectScatter> m_SerieEffectScatters = new List<EffectScatter>();
|
||||
[SerializeField] [ListForSerie(typeof(Heatmap))] private List<Heatmap> m_SerieHeatmaps = new List<Heatmap>();
|
||||
[SerializeField] [ListForSerie(typeof(Line))] private List<Line> m_SerieLines = new List<Line>();
|
||||
[SerializeField] [ListForSerie(typeof(Liquid))] private List<Liquid> m_SerieLiquids = new List<Liquid>();
|
||||
[SerializeField] [ListForSerie(typeof(Pie))] private List<Pie> m_SeriePies = new List<Pie>();
|
||||
[SerializeField] [ListForSerie(typeof(Radar))] private List<Radar> m_SerieRadars = new List<Radar>();
|
||||
[SerializeField] [ListForSerie(typeof(Ring))] private List<Ring> m_SerieRings = new List<Ring>();
|
||||
@@ -212,7 +209,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var painter = GetPainter(index);
|
||||
if (painter == null) return;
|
||||
painter.SetActive(flag, m_DebugMode);
|
||||
painter.SetActive(flag, m_DebugInfo.showAllChildObject);
|
||||
}
|
||||
|
||||
protected virtual void CheckTheme()
|
||||
@@ -309,7 +306,7 @@ namespace XCharts.Runtime
|
||||
painter.index = m_PainterList.Count;
|
||||
painter.type = Painter.Type.Serie;
|
||||
painter.onPopulateMesh = OnDrawPainterSerie;
|
||||
painter.SetActive(false, m_DebugMode);
|
||||
painter.SetActive(false, m_DebugInfo.showAllChildObject);
|
||||
painter.material = settings.seriePainterMaterial;
|
||||
painter.transform.SetSiblingIndex(index + 1);
|
||||
m_PainterList.Add(painter);
|
||||
@@ -318,7 +315,7 @@ namespace XCharts.Runtime
|
||||
m_GraphMaxAnchor, m_GraphPivot, sizeDelta, chartHideFlags, 2 + settings.maxPainter);
|
||||
m_PainterTop.type = Painter.Type.Top;
|
||||
m_PainterTop.onPopulateMesh = OnDrawPainterTop;
|
||||
m_PainterTop.SetActive(true, m_DebugMode);
|
||||
m_PainterTop.SetActive(true, m_DebugInfo.showAllChildObject);
|
||||
m_PainterTop.material = settings.topPainterMaterial;
|
||||
m_PainterTop.transform.SetSiblingIndex(settings.maxPainter + 1);
|
||||
}
|
||||
@@ -626,6 +623,11 @@ namespace XCharts.Runtime
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
if (!UnityEditor.EditorUtility.IsDirty(this))
|
||||
return;
|
||||
UnityEditor.EditorUtility.ClearDirty(this);
|
||||
#endif
|
||||
InitListForFieldInfos();
|
||||
foreach (var kv in m_TypeListForSerie)
|
||||
{
|
||||
|
||||
@@ -143,12 +143,12 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除所有图表子节点,会自动重新初始化。
|
||||
/// 移除并重新初始化所有组件。
|
||||
/// </summary>
|
||||
public void RemoveChartObject()
|
||||
public void ReinitAllChartComponent()
|
||||
{
|
||||
ChartHelper.DestroyAllChildren(transform);
|
||||
//SetAllComponentDirty();
|
||||
SetAllComponentDirty();
|
||||
}
|
||||
|
||||
public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)
|
||||
|
||||
@@ -11,8 +11,9 @@ namespace XCharts.Runtime
|
||||
IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IPointerClickHandler,
|
||||
IDragHandler, IEndDragHandler, IScrollHandler
|
||||
{
|
||||
[SerializeField] protected bool m_DebugMode = false;
|
||||
|
||||
[SerializeField] protected bool m_EnableTextMeshPro = false;
|
||||
[SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo();
|
||||
|
||||
protected Painter m_Painter;
|
||||
protected int m_SiblingIndex;
|
||||
@@ -48,12 +49,11 @@ namespace XCharts.Runtime
|
||||
protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } }
|
||||
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
|
||||
protected Vector2 graphPivot { get { return m_GraphPivot; } }
|
||||
public HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
|
||||
|
||||
public HideFlags chartHideFlags { get { return m_DebugInfo.showAllChildObject ? HideFlags.None : HideFlags.HideInHierarchy; } }
|
||||
public DebugInfo debug { get { return m_DebugInfo; } }
|
||||
private ScrollRect m_ScrollRect;
|
||||
|
||||
public Painter painter { get { return m_Painter; } }
|
||||
internal bool debugModel { get { return m_DebugMode; } }
|
||||
|
||||
protected virtual void InitComponent()
|
||||
{
|
||||
@@ -100,7 +100,7 @@ namespace XCharts.Runtime
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
m_IsOnValidate = true;
|
||||
Update();
|
||||
//Update();
|
||||
}
|
||||
#endif
|
||||
m_PainerDirty = true;
|
||||
@@ -125,7 +125,7 @@ namespace XCharts.Runtime
|
||||
if (m_EnableTextMeshPro != enableTextMeshPro)
|
||||
{
|
||||
m_EnableTextMeshPro = enableTextMeshPro;
|
||||
RemoveChartObject();
|
||||
ReinitAllChartComponent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ namespace XCharts.Runtime
|
||||
m_ComponentDirty = false;
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ClearData()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
SerieLabelPool.ClearAll();
|
||||
chartList.Clear();
|
||||
if(Resources.Load<XCSettings>("XCSettings"))
|
||||
if (Resources.Load<XCSettings>("XCSettings"))
|
||||
XCThemeMgr.ReloadThemeList();
|
||||
SceneManager.sceneUnloaded += OnSceneLoaded;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace XCharts.Runtime
|
||||
public static List<BaseChart> GetCharts(string chartName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chartName)) return null;
|
||||
return chartList.FindAll(chart => chartName.Equals(chartName));
|
||||
return chartList.FindAll(chart => chartName.Equals(chart.chartName));
|
||||
}
|
||||
|
||||
public static void RemoveChart(string chartName)
|
||||
@@ -86,6 +86,33 @@ namespace XCharts.Runtime
|
||||
return chartList.Contains(chart);
|
||||
}
|
||||
|
||||
public static bool IsRepeatChartName(BaseChart chart, string chartName = null)
|
||||
{
|
||||
if (chartName == null)
|
||||
chartName = chart.chartName;
|
||||
if (string.IsNullOrEmpty(chartName))
|
||||
return false;
|
||||
foreach (var temp in chartList)
|
||||
{
|
||||
if (temp != chart && chartName.Equals(temp.chartName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string GetRepeatChartNameInfo(BaseChart chart, string chartName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chartName))
|
||||
return string.Empty;
|
||||
string result = "";
|
||||
foreach (var temp in chartList)
|
||||
{
|
||||
if (temp != chart && chartName.Equals(temp.chartName))
|
||||
result += ChartHelper.GetFullName(temp.transform) + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void RemoveAllChartObject()
|
||||
{
|
||||
if (chartList.Count == 0)
|
||||
@@ -95,7 +122,7 @@ namespace XCharts.Runtime
|
||||
foreach (var chart in chartList)
|
||||
{
|
||||
if (chart != null)
|
||||
chart.RemoveChartObject();
|
||||
chart.ReinitAllChartComponent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user