整理代码更新文档

This commit is contained in:
monitor1394
2020-06-12 09:22:51 +08:00
parent 42980e87e3
commit eccd5a8995
11 changed files with 47 additions and 54 deletions

View File

@@ -74,10 +74,7 @@ namespace XCharts
var tempWidth = (pos.width - startX + 35) / 2;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
var centerYRect = new Rect(centerXRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height);
while (m_Center.arraySize < 2)
{
m_Center.InsertArrayElementAtIndex(m_Center.arraySize);
}
while (m_Center.arraySize < 2) m_Center.arraySize++;
EditorGUI.PropertyField(centerXRect, m_Center.GetArrayElementAtIndex(0), GUIContent.none);
EditorGUI.PropertyField(centerYRect, m_Center.GetArrayElementAtIndex(1), GUIContent.none);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

View File

@@ -363,10 +363,8 @@ namespace XCharts
bool showSelected = (serieType == SerieType.Pie);
if (listSize != m_Datas.arraySize)
{
while (listSize > m_Datas.arraySize)
m_Datas.InsertArrayElementAtIndex(m_Datas.arraySize);
while (listSize < m_Datas.arraySize)
m_Datas.DeleteArrayElementAtIndex(m_Datas.arraySize - 1);
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
}
if (listSize > 30)
{
@@ -414,8 +412,9 @@ namespace XCharts
{
while (2 > data.arraySize)
{
data.InsertArrayElementAtIndex(data.arraySize);
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = 0;
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
if (showSelected)
@@ -452,8 +451,9 @@ namespace XCharts
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
data.InsertArrayElementAtIndex(data.arraySize);
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = 0;
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 40;

View File

@@ -320,7 +320,7 @@ namespace XCharts
{
while (i > m_CustomColorPalette.arraySize - 1)
{
m_CustomColorPalette.InsertArrayElementAtIndex(m_CustomColorPalette.arraySize);
m_CustomColorPalette.arraySize++;
}
var customElement = m_CustomColorPalette.GetArrayElementAtIndex(i);
color = !ChartHelper.IsClearColor(customElement.colorValue) ?