mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 12:08:46 +00:00
优化代码
This commit is contained in:
@@ -6,8 +6,6 @@ namespace XCharts
|
|||||||
[CustomPropertyDrawer(typeof(ChartModule), true)]
|
[CustomPropertyDrawer(typeof(ChartModule), true)]
|
||||||
public class ChartModuleDrawer : PropertyDrawer
|
public class ChartModuleDrawer : PropertyDrawer
|
||||||
{
|
{
|
||||||
bool m_BarModuleToggle = true;
|
|
||||||
|
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
Rect drawRect = pos;
|
Rect drawRect = pos;
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ public class Demo : MonoBehaviour
|
|||||||
|
|
||||||
void InitModuleButton()
|
void InitModuleButton()
|
||||||
{
|
{
|
||||||
var font = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
|
||||||
var btnPanel = transform.Find("chart_list");
|
var btnPanel = transform.Find("chart_list");
|
||||||
m_BtnClone = transform.Find("btn_clone").gameObject;
|
m_BtnClone = transform.Find("btn_clone").gameObject;
|
||||||
m_BtnClone.SetActive(false);
|
m_BtnClone.SetActive(false);
|
||||||
@@ -104,7 +103,7 @@ public class Demo : MonoBehaviour
|
|||||||
btn = GameObject.Instantiate(m_BtnClone);
|
btn = GameObject.Instantiate(m_BtnClone);
|
||||||
btn.SetActive(true);
|
btn.SetActive(true);
|
||||||
btn.name = btnName;
|
btn.name = btnName;
|
||||||
btn.transform.parent = btnPanel;
|
btn.transform.SetParent(btnPanel);
|
||||||
btn.transform.localPosition = Vector3.zero;
|
btn.transform.localPosition = Vector3.zero;
|
||||||
}
|
}
|
||||||
btn.transform.localScale = Vector3.one;
|
btn.transform.localScale = Vector3.one;
|
||||||
|
|||||||
@@ -28,15 +28,9 @@ namespace XCharts
|
|||||||
|
|
||||||
protected float m_DefaultLabelWidth;
|
protected float m_DefaultLabelWidth;
|
||||||
protected float m_DefaultFieldWidth;
|
protected float m_DefaultFieldWidth;
|
||||||
|
|
||||||
private int m_SeriesSize;
|
private int m_SeriesSize;
|
||||||
|
|
||||||
|
|
||||||
private bool m_ThemeModuleToggle = false;
|
|
||||||
private bool m_BaseModuleToggle = false;
|
private bool m_BaseModuleToggle = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected virtual void OnEnable()
|
protected virtual void OnEnable()
|
||||||
{
|
{
|
||||||
m_Target = (BaseChart)target;
|
m_Target = (BaseChart)target;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ namespace XCharts
|
|||||||
|
|
||||||
private List<bool> m_SerieModuleToggle = new List<bool>();
|
private List<bool> m_SerieModuleToggle = new List<bool>();
|
||||||
private List<bool> m_DataFoldout = new List<bool>();
|
private List<bool> m_DataFoldout = new List<bool>();
|
||||||
private int m_DataSize = 0;
|
|
||||||
private bool m_ShowJsonDataArea = false;
|
private bool m_ShowJsonDataArea = false;
|
||||||
private string m_JsonDataAreaText;
|
private string m_JsonDataAreaText;
|
||||||
|
|
||||||
@@ -160,8 +159,6 @@ namespace XCharts
|
|||||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||||
}
|
}
|
||||||
SerializedProperty element1 = data.GetArrayElementAtIndex(0);
|
|
||||||
SerializedProperty element2 = data.GetArrayElementAtIndex(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||||
|
|||||||
@@ -7,13 +7,6 @@ namespace XCharts
|
|||||||
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
|
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
|
||||||
public class SerieSymbolDrawer : PropertyDrawer
|
public class SerieSymbolDrawer : PropertyDrawer
|
||||||
{
|
{
|
||||||
|
|
||||||
private List<bool> m_SerieModuleToggle = new List<bool>();
|
|
||||||
private List<bool> m_DataFoldout = new List<bool>();
|
|
||||||
private int m_DataSize = 0;
|
|
||||||
private bool m_ShowJsonDataArea = false;
|
|
||||||
private string m_JsonDataAreaText;
|
|
||||||
|
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
Rect drawRect = pos;
|
Rect drawRect = pos;
|
||||||
@@ -26,9 +19,6 @@ namespace XCharts
|
|||||||
SerializedProperty m_DataScale = prop.FindPropertyRelative("m_DataScale");
|
SerializedProperty m_DataScale = prop.FindPropertyRelative("m_DataScale");
|
||||||
SerializedProperty m_SelectedDataScale = prop.FindPropertyRelative("m_SelectedDataScale");
|
SerializedProperty m_SelectedDataScale = prop.FindPropertyRelative("m_SelectedDataScale");
|
||||||
|
|
||||||
SerializedProperty m_SizeCallback = prop.FindPropertyRelative("m_SizeCallback");
|
|
||||||
SerializedProperty m_SelectedSizeCallback = prop.FindPropertyRelative("m_SelectedSizeCallback");
|
|
||||||
|
|
||||||
EditorGUI.PropertyField(drawRect, m_Type, new GUIContent("Symbol Type"));
|
EditorGUI.PropertyField(drawRect, m_Type, new GUIContent("Symbol Type"));
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_SizeType, new GUIContent("Symbol SizeType"));
|
EditorGUI.PropertyField(drawRect, m_SizeType, new GUIContent("Symbol SizeType"));
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ namespace XCharts
|
|||||||
serieNameSet.Clear();
|
serieNameSet.Clear();
|
||||||
for (int j = 0; j < seriesCount; j++)
|
for (int j = 0; j < seriesCount; j++)
|
||||||
{
|
{
|
||||||
var seriesHig = new Dictionary<int, float>();
|
|
||||||
var serieList = stackSeries[j];
|
var serieList = stackSeries[j];
|
||||||
seriesCurrHig.Clear();
|
seriesCurrHig.Clear();
|
||||||
if (seriesCurrHig.Capacity != serieList[0].dataCount)
|
if (seriesCurrHig.Capacity != serieList[0].dataCount)
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ namespace XCharts
|
|||||||
int maxCount = maxShowDataNumber > 0 ?
|
int maxCount = maxShowDataNumber > 0 ?
|
||||||
(maxShowDataNumber > serie.dataCount ? serie.dataCount : maxShowDataNumber)
|
(maxShowDataNumber > serie.dataCount ? serie.dataCount : maxShowDataNumber)
|
||||||
: serie.dataCount;
|
: serie.dataCount;
|
||||||
int dataCount = (maxCount - minShowDataNumber);
|
|
||||||
for (int n = minShowDataNumber; n < maxCount; n++)
|
for (int n = minShowDataNumber; n < maxCount; n++)
|
||||||
{
|
{
|
||||||
float xValue, yValue;
|
float xValue, yValue;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
obj = new GameObject();
|
obj = new GameObject();
|
||||||
obj.name = name;
|
obj.name = name;
|
||||||
obj.transform.parent = parent;
|
obj.transform.SetParent(parent);
|
||||||
obj.transform.localScale = Vector3.one;
|
obj.transform.localScale = Vector3.one;
|
||||||
obj.transform.localPosition = Vector3.zero;
|
obj.transform.localPosition = Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user