mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-19 23:10:06 +00:00
优化代码,修复报错
This commit is contained in:
@@ -18,6 +18,23 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public partial class BaseChart
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of chart.
|
||||
/// </summary>
|
||||
public string chartName
|
||||
{
|
||||
get { return m_ChartName; }
|
||||
set
|
||||
{
|
||||
if (XChartsMgr.Instance.ContainsChart(value)) Debug.LogError("chartName repeated:" + value);
|
||||
else
|
||||
{
|
||||
m_ChartName = value;
|
||||
m_ChartUUID = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string chartUUID { get { return m_ChartUUID; } }
|
||||
/// <summary>
|
||||
/// The theme info.
|
||||
/// </summary>
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace XCharts
|
||||
protected static readonly string s_SerieLabelObjectName = "label";
|
||||
protected static readonly string s_SerieTitleObjectName = "serie";
|
||||
|
||||
[SerializeField] protected string m_ChartName;
|
||||
[SerializeField] protected string m_ChartUUID;
|
||||
[SerializeField] protected float m_ChartWidth;
|
||||
[SerializeField] protected float m_ChartHeight;
|
||||
[SerializeField] protected float m_ChartX;
|
||||
@@ -97,6 +99,7 @@ namespace XCharts
|
||||
InitComponent();
|
||||
m_Series.AnimationReset();
|
||||
m_Series.AnimationFadeIn();
|
||||
XChartsMgr.Instance.AddChart(this);
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace XCharts
|
||||
{
|
||||
private static readonly string s_DefaultDataZoom = "datazoom";
|
||||
private static readonly string s_DefaultAxisName = "name";
|
||||
private static readonly string s_DefaultAxisLabel = "label";
|
||||
|
||||
[SerializeField] protected Grid m_Grid = Grid.defaultGrid;
|
||||
[SerializeField] protected List<XAxis> m_XAxises = new List<XAxis>();
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace XCharts
|
||||
private static CultureInfo ci = new CultureInfo("en-us");// "en-us", "zh-cn", "ar-iq", "de-de"
|
||||
private static Dictionary<Color, string> s_ColorToStr = new Dictionary<Color, string>(100);
|
||||
private static Dictionary<int, string> s_SerieLabelName = new Dictionary<int, string>(1000);
|
||||
private static Dictionary<int, string> s_AxisLabelName = new Dictionary<int, string>(1000);
|
||||
private static Dictionary<Color, string> s_ColorDotStr = new Dictionary<Color, string>(100);
|
||||
private static Dictionary<int, string> s_XAxisName = new Dictionary<int, string>();
|
||||
private static Dictionary<int, string> s_YAxisName = new Dictionary<int, string>();
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace XCharts
|
||||
public static class ChartDrawer
|
||||
{
|
||||
private static readonly Vector2 zeroVector2 = Vector2.zero;
|
||||
private static readonly Vector3 zeroVector3 = Vector3.zero;
|
||||
private static UIVertex[] vertex = new UIVertex[4];
|
||||
private static List<Vector3> s_CurvesPosList = new List<Vector3>();
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
@@ -8,9 +9,11 @@
|
||||
using System.Text;
|
||||
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
@@ -23,6 +26,7 @@ namespace XCharts
|
||||
public string homepage = "";
|
||||
}
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class XChartsMgr : MonoBehaviour
|
||||
{
|
||||
public const string version = "1.4.0";
|
||||
@@ -30,7 +34,7 @@ namespace XCharts
|
||||
|
||||
[SerializeField] private string m_NowVersion;
|
||||
[SerializeField] private string m_NewVersion;
|
||||
|
||||
private Dictionary<string, BaseChart> m_ChartDic = new Dictionary<string, BaseChart>();
|
||||
private static XChartsMgr m_XCharts;
|
||||
|
||||
public static XChartsMgr Instance
|
||||
@@ -216,5 +220,43 @@ namespace XCharts
|
||||
return request.isHttpError;
|
||||
}
|
||||
#endif
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
SceneManager.sceneUnloaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
SceneManager.sceneUnloaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnSceneLoaded(Scene scene)
|
||||
{
|
||||
SerieLabelPool.ClearAll();
|
||||
}
|
||||
|
||||
public void AddChart(BaseChart chart)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
||||
public BaseChart GetChart(string uuid)
|
||||
{
|
||||
return m_ChartDic[uuid];
|
||||
}
|
||||
|
||||
public void RemoveChart(string uuid)
|
||||
{
|
||||
if (m_ChartDic.ContainsKey(uuid))
|
||||
{
|
||||
m_ChartDic.Remove(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsChart(string uuid)
|
||||
{
|
||||
return m_ChartDic.ContainsKey(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user