mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 01:10:08 +00:00
整理代码更新文档
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) ?
|
||||
|
||||
@@ -32,19 +32,13 @@ public class ChartEditorHelper
|
||||
|
||||
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name)
|
||||
{
|
||||
while (arrayProp.arraySize < 2)
|
||||
{
|
||||
arrayProp.InsertArrayElementAtIndex(arrayProp.arraySize);
|
||||
}
|
||||
while (arrayProp.arraySize < 2) arrayProp.arraySize++;
|
||||
MakeTwoField(ref drawRect, rectWidth, arrayProp.GetArrayElementAtIndex(0), arrayProp.GetArrayElementAtIndex(1), name);
|
||||
}
|
||||
|
||||
public static void MakeDivideList(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name, int showNum)
|
||||
{
|
||||
while (arrayProp.arraySize < showNum)
|
||||
{
|
||||
arrayProp.InsertArrayElementAtIndex(arrayProp.arraySize);
|
||||
}
|
||||
while (arrayProp.arraySize < showNum) arrayProp.arraySize++;
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gap = 2;
|
||||
@@ -214,7 +208,7 @@ public class ChartEditorHelper
|
||||
var iconRect = new Rect(drawRect.width - nameWid + temp, drawRect.y, nameWid, drawRect.height);
|
||||
if (GUI.Button(iconRect, new GUIContent("+", "add")))
|
||||
{
|
||||
listProp.InsertArrayElementAtIndex(listProp.arraySize);
|
||||
listProp.arraySize++;
|
||||
}
|
||||
listSize = listProp.arraySize;
|
||||
listSize = EditorGUI.IntField(elementRect, "Size", listSize);
|
||||
@@ -228,10 +222,8 @@ public class ChartEditorHelper
|
||||
|
||||
if (listSize != listProp.arraySize)
|
||||
{
|
||||
while (listSize > listProp.arraySize)
|
||||
listProp.InsertArrayElementAtIndex(listProp.arraySize);
|
||||
while (listSize < listProp.arraySize)
|
||||
listProp.DeleteArrayElementAtIndex(listProp.arraySize - 1);
|
||||
while (listSize > listProp.arraySize) listProp.arraySize++;
|
||||
while (listSize < listProp.arraySize) listProp.arraySize--;
|
||||
}
|
||||
}
|
||||
if (listSize > 30)
|
||||
|
||||
Reference in New Issue
Block a user