增加Symbol配置Serie标志图形的显示

This commit is contained in:
monitor1394
2019-07-20 12:18:07 +08:00
parent 1576308254
commit 2296fb66ff
10 changed files with 163 additions and 99 deletions

View File

@@ -7,9 +7,6 @@ namespace XCharts
public class LineDrawer : PropertyDrawer
{
SerializedProperty m_Tickness;
SerializedProperty m_Point;
SerializedProperty m_PointWidth;
SerializedProperty m_PointSelectedWidth;
SerializedProperty m_Smooth;
SerializedProperty m_SmoothStyle;
SerializedProperty m_Area;
@@ -21,9 +18,6 @@ namespace XCharts
private void InitProperty(SerializedProperty prop)
{
m_Tickness = prop.FindPropertyRelative("m_Tickness");
m_Point = prop.FindPropertyRelative("m_Point");
m_PointWidth = prop.FindPropertyRelative("m_PointWidth");
m_PointSelectedWidth = prop.FindPropertyRelative("m_PointSelectedWidth");
m_Smooth = prop.FindPropertyRelative("m_Smooth");
m_SmoothStyle = prop.FindPropertyRelative("m_SmoothStyle");
m_Area = prop.FindPropertyRelative("m_Area");
@@ -45,18 +39,6 @@ namespace XCharts
EditorGUI.PropertyField(drawRect, m_Tickness);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Point);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_Point.boolValue)
{
++EditorGUI.indentLevel;
EditorGUI.PropertyField(drawRect, m_PointWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_PointSelectedWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
--EditorGUI.indentLevel;
}
drawRect.width = EditorGUIUtility.labelWidth + 10;
EditorGUI.PropertyField(drawRect, m_Smooth);
if (m_Smooth.boolValue)
@@ -101,10 +83,6 @@ namespace XCharts
if (m_LineModuleToggle)
{
height = 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
var m_Point = prop.FindPropertyRelative("m_Point");
if(m_Point.boolValue){
height += 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
}
return height;
}
else

View File

@@ -22,6 +22,9 @@ namespace XCharts
SerializedProperty name = prop.FindPropertyRelative("m_Name");
SerializedProperty stack = prop.FindPropertyRelative("m_Stack");
SerializedProperty m_AxisIndex = prop.FindPropertyRelative("m_AxisIndex");
SerializedProperty m_Symbol = prop.FindPropertyRelative("m_Symbol");
SerializedProperty m_SymbolSize = prop.FindPropertyRelative("m_SymbolSize");
SerializedProperty m_SymbolSelectedSize = prop.FindPropertyRelative("m_SymbolSelectedSize");
SerializedProperty m_TwoDimensionData = prop.FindPropertyRelative("m_TwoDimensionData");
SerializedProperty m_XData = prop.FindPropertyRelative("m_XData");
SerializedProperty m_YData = prop.FindPropertyRelative("m_YData");
@@ -42,6 +45,15 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_AxisIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (type.enumValueIndex == (int)SerieType.Line || type.enumValueIndex == (int)SerieType.Scatter)
{
EditorGUI.PropertyField(drawRect, m_Symbol);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SymbolSize);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SymbolSelectedSize);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
EditorGUI.PropertyField(drawRect, m_TwoDimensionData);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.width = EditorGUIUtility.labelWidth + 10;
@@ -132,6 +144,11 @@ namespace XCharts
else
{
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
SerializedProperty type = prop.FindPropertyRelative("m_Type");
if (type.enumValueIndex == (int)SerieType.Line || type.enumValueIndex == (int)SerieType.Scatter)
{
height += 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
}
if (m_DataFoldout[index])
{
SerializedProperty m_Data = prop.FindPropertyRelative("m_YData");
@@ -150,7 +167,7 @@ namespace XCharts
private int InitToggle(SerializedProperty prop)
{
int index = 0;
int.TryParse(prop.displayName.Split(' ')[1],out index);
int.TryParse(prop.displayName.Split(' ')[1], out index);
if (index >= m_DataFoldout.Count)
{
m_DataFoldout.Add(false);