mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 07:20:08 +00:00
0.2版本,重构代码,增加Editor
This commit is contained in:
139
Scripts/Editor/PropertyDrawers/AxisDrawer.cs
Normal file
139
Scripts/Editor/PropertyDrawers/AxisDrawer.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis), true)]
|
||||
public class AxisDrawer : PropertyDrawer
|
||||
{
|
||||
private ReorderableList m_DataList;
|
||||
private bool m_DataFoldout = false;
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_AxisModuleToggle = false;
|
||||
|
||||
private void InitReorderableList(SerializedProperty prop)
|
||||
{
|
||||
if (m_DataList == null)
|
||||
{
|
||||
SerializedProperty data = prop.FindPropertyRelative("m_Data");
|
||||
m_DataList = new ReorderableList(data.serializedObject, data, false, false, true, true);
|
||||
m_DataList.elementHeight = EditorGUIUtility.singleLineHeight;
|
||||
m_DataList.drawHeaderCallback += delegate (Rect rect)
|
||||
{
|
||||
EditorGUI.LabelField(rect, data.displayName);
|
||||
};
|
||||
|
||||
m_DataList.drawElementCallback = delegate (Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
EditorGUI.PropertyField(rect, data.GetArrayElementAtIndex(index), true);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
SerializedProperty m_Show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
SerializedProperty m_TextRotation = prop.FindPropertyRelative("m_TextRotation");
|
||||
SerializedProperty m_ShowSplitLine = prop.FindPropertyRelative("m_ShowSplitLine");
|
||||
SerializedProperty m_SplitLineType = prop.FindPropertyRelative("m_SplitLineType");
|
||||
SerializedProperty m_BoundaryGap = prop.FindPropertyRelative("m_BoundaryGap");
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisModuleToggle, prop.displayName, m_Show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisModuleToggle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TextRotation);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_ShowSplitLine.boolValue)
|
||||
{
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowSplitLine);
|
||||
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 35;
|
||||
drawRect.width = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 55;
|
||||
EditorGUI.PropertyField(drawRect, m_SplitLineType, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_ShowSplitLine);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_BoundaryGap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (!m_AxisModuleToggle)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||
float height = 0;
|
||||
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 2;
|
||||
if (num > 50) num = 13;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/AxisDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/AxisDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0544f1db7f17644bb3cbe7c85da84d5
|
||||
timeCreated: 1554507809
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs
Normal file
46
Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis.AxisTick), true)]
|
||||
public class AxisTickDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_AxisTickToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_AlignWithLabel = prop.FindPropertyRelative("m_AlignWithLabel");
|
||||
SerializedProperty m_Inside = prop.FindPropertyRelative("m_Inside");
|
||||
SerializedProperty m_Length = prop.FindPropertyRelative("m_Length");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisTickToggle, "Axis Tick", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisTickToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_AlignWithLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Inside);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Length);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_AxisTickToggle)
|
||||
{
|
||||
height += 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c7d45bc59dedc140b08f6e9d26ccd9d
|
||||
timeCreated: 1555890921
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Scripts/Editor/PropertyDrawers/BarDrawer.cs
Normal file
48
Scripts/Editor/PropertyDrawers/BarDrawer.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(BarChart.Bar), true)]
|
||||
public class BarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_BarWidth;
|
||||
SerializedProperty m_Space;
|
||||
bool m_BarModuleToggle = true;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_BarWidth = prop.FindPropertyRelative("m_BarWidth");
|
||||
m_Space = prop.FindPropertyRelative("m_Space");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_BarModuleToggle, "Bar");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (m_BarModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_BarWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Space);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_BarModuleToggle)
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/BarDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/BarDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a443d39bebe073645a240a745feb9fc5
|
||||
timeCreated: 1554768582
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
54
Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs
Normal file
54
Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Coordinate), true)]
|
||||
public class CoordinateDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_CoordinateModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
SerializedProperty m_Left = prop.FindPropertyRelative("m_Left");
|
||||
SerializedProperty m_Right = prop.FindPropertyRelative("m_Right");
|
||||
SerializedProperty m_Top = prop.FindPropertyRelative("m_Top");
|
||||
SerializedProperty m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
SerializedProperty m_Tickness = prop.FindPropertyRelative("m_Tickness");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_CoordinateModuleToggle, "Coordinate");
|
||||
EditorGUI.LabelField(drawRect, "Coordinate",EditorStyles.boldLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_CoordinateModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Tickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_CoordinateModuleToggle)
|
||||
return 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38e8e72dd7107db429232ccab308e27c
|
||||
timeCreated: 1554506762
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
83
Scripts/Editor/PropertyDrawers/LegendDrawer.cs
Normal file
83
Scripts/Editor/PropertyDrawers/LegendDrawer.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Legend), true)]
|
||||
public class LegendDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataFoldout = false;
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_LegendModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty orient = prop.FindPropertyRelative("m_Orient");
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
SerializedProperty itemWidth = prop.FindPropertyRelative("m_ItemWidth");
|
||||
SerializedProperty itemHeight = prop.FindPropertyRelative("m_ItemHeight");
|
||||
SerializedProperty itemGap = prop.FindPropertyRelative("m_ItemGap");
|
||||
SerializedProperty itemFontSize = prop.FindPropertyRelative("m_ItemFontSize");
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LegendModuleToggle, "Legend", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_LegendModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, itemWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, itemHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, itemGap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, itemFontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, orient);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, location);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(location);
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_LegendModuleToggle)
|
||||
{
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(location);
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 1;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/LegendDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/LegendDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b96d10541649a23468168ba0bf1c0bc5
|
||||
timeCreated: 1554395454
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Scripts/Editor/PropertyDrawers/LineDrawer.cs
Normal file
93
Scripts/Editor/PropertyDrawers/LineDrawer.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Line), true)]
|
||||
public class LineDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Tickness;
|
||||
SerializedProperty m_Point;
|
||||
SerializedProperty m_PointWidth;
|
||||
SerializedProperty m_Smooth;
|
||||
SerializedProperty m_SmoothStyle;
|
||||
SerializedProperty m_Area;
|
||||
|
||||
private bool m_LineModuleToggle = false;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Tickness = prop.FindPropertyRelative("m_Tickness");
|
||||
m_Point = prop.FindPropertyRelative("m_Point");
|
||||
m_PointWidth = prop.FindPropertyRelative("m_PointWidth");
|
||||
m_Smooth = prop.FindPropertyRelative("m_Smooth");
|
||||
m_SmoothStyle = prop.FindPropertyRelative("m_SmoothStyle");
|
||||
m_Area = prop.FindPropertyRelative("m_Area");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LineModuleToggle, "Line");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_LineModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Tickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_Point);
|
||||
if (m_Point.boolValue)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||
EditorGUI.LabelField(drawRect,"Width");
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (tempWidth < 20) tempWidth = 20;
|
||||
drawRect.width = tempWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_PointWidth, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_Smooth);
|
||||
if (m_Smooth.boolValue)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||
EditorGUI.LabelField(drawRect, "Style");
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (tempWidth < 20) tempWidth = 20;
|
||||
drawRect.width = tempWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_SmoothStyle, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Area);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_LineModuleToggle)
|
||||
{
|
||||
return 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/LineDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/LineDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0eeb8c12e86239b4e93a6c75d766cb15
|
||||
timeCreated: 1554720052
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
87
Scripts/Editor/PropertyDrawers/LocationDrawer.cs
Normal file
87
Scripts/Editor/PropertyDrawers/LocationDrawer.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Location), true)]
|
||||
public class LocationDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty align = prop.FindPropertyRelative("m_Align");
|
||||
SerializedProperty left = prop.FindPropertyRelative("m_Left");
|
||||
SerializedProperty right = prop.FindPropertyRelative("m_Right");
|
||||
SerializedProperty top = prop.FindPropertyRelative("m_Top");
|
||||
SerializedProperty bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
EditorGUI.PropertyField(drawRect, align, new GUIContent("Location"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
switch ((Location.Align)align.enumValueIndex)
|
||||
{
|
||||
case Location.Align.TopCenter:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.TopLeft:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.TopRight:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomCenter:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomLeft:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomRight:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.Center:
|
||||
break;
|
||||
case Location.Align.CenterLeft:
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.CenterRight:
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
SerializedProperty align = prop.FindPropertyRelative("m_Align");
|
||||
switch ((Location.Align)align.enumValueIndex)
|
||||
{
|
||||
case Location.Align.Center:
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 0 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.BottomCenter:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.CenterRight:
|
||||
return 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
default:
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/LocationDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/LocationDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34092595791508d4b94b074a8788c388
|
||||
timeCreated: 1554307767
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
Scripts/Editor/PropertyDrawers/PieDrawer.cs
Normal file
79
Scripts/Editor/PropertyDrawers/PieDrawer.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Pie), true)]
|
||||
public class PieInfoDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Name;
|
||||
SerializedProperty m_InsideRadius;
|
||||
SerializedProperty m_OutsideRadius;
|
||||
SerializedProperty m_TooltipExtraRadius;
|
||||
SerializedProperty m_Rose;
|
||||
SerializedProperty m_Space;
|
||||
SerializedProperty m_Left;
|
||||
SerializedProperty m_Right;
|
||||
SerializedProperty m_Top;
|
||||
SerializedProperty m_Bottom;
|
||||
bool m_PieModuleToggle = true;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Name = prop.FindPropertyRelative("m_Name");
|
||||
m_InsideRadius = prop.FindPropertyRelative("m_InsideRadius");
|
||||
m_OutsideRadius = prop.FindPropertyRelative("m_OutsideRadius");
|
||||
m_TooltipExtraRadius = prop.FindPropertyRelative("m_TooltipExtraRadius");
|
||||
m_Rose = prop.FindPropertyRelative("m_Rose");
|
||||
m_Space = prop.FindPropertyRelative("m_Space");
|
||||
m_Left = prop.FindPropertyRelative("m_Left");
|
||||
m_Right = prop.FindPropertyRelative("m_Right");
|
||||
m_Top = prop.FindPropertyRelative("m_Top");
|
||||
m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_PieModuleToggle, "Pie");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_PieModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_InsideRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_OutsideRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipExtraRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rose);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Space);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_PieModuleToggle)
|
||||
return 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/PieDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/PieDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 019eadbd43e952945925f357ae8ef74b
|
||||
timeCreated: 1554773154
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
158
Scripts/Editor/PropertyDrawers/RadarDrawer.cs
Normal file
158
Scripts/Editor/PropertyDrawers/RadarDrawer.cs
Normal file
@@ -0,0 +1,158 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar), true)]
|
||||
public class RadarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Cricle;
|
||||
SerializedProperty m_Area;
|
||||
SerializedProperty m_Radius;
|
||||
SerializedProperty m_SplitNumber;
|
||||
SerializedProperty m_Left;
|
||||
SerializedProperty m_Right;
|
||||
SerializedProperty m_Top;
|
||||
SerializedProperty m_Bottom;
|
||||
SerializedProperty m_LineTickness;
|
||||
SerializedProperty m_LinePointSize;
|
||||
SerializedProperty m_LineColor;
|
||||
SerializedProperty m_BackgroundColorList;
|
||||
SerializedProperty m_Indicator;
|
||||
SerializedProperty m_IndicatorList;
|
||||
|
||||
private bool m_RadarModuleToggle = false;
|
||||
private bool m_IndicatorToggle = false;
|
||||
private bool m_IndicatorJsonAreaToggle = false;
|
||||
private string m_IndicatorJsonAreaText;
|
||||
private int m_IndicatorSize;
|
||||
private bool m_BackgroundColorToggle = false;
|
||||
private int m_BackgroundColorSize;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Cricle = prop.FindPropertyRelative("m_Cricle");
|
||||
m_Area = prop.FindPropertyRelative("m_Area");
|
||||
m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
m_Left = prop.FindPropertyRelative("m_Left");
|
||||
m_Right = prop.FindPropertyRelative("m_Right");
|
||||
m_Top = prop.FindPropertyRelative("m_Top");
|
||||
m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
m_LineTickness = prop.FindPropertyRelative("m_LineTickness");
|
||||
m_LinePointSize = prop.FindPropertyRelative("m_LinePointSize");
|
||||
m_LineColor = prop.FindPropertyRelative("m_LineColor");
|
||||
m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList");
|
||||
m_Indicator = prop.FindPropertyRelative("m_Indicator");
|
||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
float defaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
float defaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, "Radar");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUIUtility.fieldWidth = 10;
|
||||
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
drawRect.width = 60;
|
||||
EditorGUI.PropertyField(drawRect, m_Cricle);
|
||||
|
||||
EditorGUIUtility.labelWidth = 45;
|
||||
drawRect.x += 60;
|
||||
EditorGUI.PropertyField(drawRect, m_Area);
|
||||
|
||||
EditorGUIUtility.labelWidth = 70;
|
||||
drawRect.x += 55;
|
||||
drawRect.width = 80;
|
||||
EditorGUI.PropertyField(drawRect, m_Indicator);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
EditorGUIUtility.labelWidth = defaultLabelWidth;
|
||||
EditorGUIUtility.fieldWidth = defaultFieldWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_Radius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineTickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LinePointSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
m_BackgroundColorToggle = EditorGUI.Foldout(drawRect, m_BackgroundColorToggle, "BackgroundColors");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.width = pos.width;
|
||||
if (m_BackgroundColorToggle)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_BackgroundColorSize, m_BackgroundColorList);
|
||||
}
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_IndicatorToggle = EditorGUI.Foldout(drawRect, m_IndicatorToggle, "Indicators");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_IndicatorJsonAreaToggle, ref m_IndicatorJsonAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_IndicatorToggle)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_IndicatorSize, m_IndicatorList);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int propNum = 1;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
propNum += 12;
|
||||
|
||||
if (m_BackgroundColorToggle)
|
||||
{
|
||||
m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList");
|
||||
propNum += 2;
|
||||
propNum += m_BackgroundColorList.arraySize;
|
||||
}
|
||||
if (m_IndicatorJsonAreaToggle) propNum += 4;
|
||||
|
||||
|
||||
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum -1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (m_IndicatorToggle)
|
||||
{
|
||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
for(int i = 0; i < m_IndicatorSize; i++)
|
||||
{
|
||||
height += EditorGUI.GetPropertyHeight(m_IndicatorList.GetArrayElementAtIndex(i));
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/RadarDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/RadarDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09bf71ecf64f321468ac28af28bec878
|
||||
timeCreated: 1555563898
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs
Normal file
58
Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar.Indicator), true)]
|
||||
public class RadarIndicatorDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Name;
|
||||
SerializedProperty m_Max;
|
||||
|
||||
private bool m_RadarModuleToggle = false;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Name = prop.FindPropertyRelative("m_Name");
|
||||
m_Max = prop.FindPropertyRelative("m_Max");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
float defaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
float defaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
m_RadarModuleToggle = EditorGUI.Foldout(drawRect, m_RadarModuleToggle, "Indicator");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int propNum = 1;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
propNum += 2;
|
||||
return propNum * EditorGUIUtility.singleLineHeight + (propNum -1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fb5d2a98871919459956dc252632435
|
||||
timeCreated: 1556220585
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
77
Scripts/Editor/PropertyDrawers/SerieDrawer.cs
Normal file
77
Scripts/Editor/PropertyDrawers/SerieDrawer.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Serie), true)]
|
||||
public class SerieDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataFoldout = false;
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_SerieModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
//SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty stack = prop.FindPropertyRelative("m_Stack");
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
string moduleName = "Serie " + prop.displayName.Split(' ')[1];
|
||||
if (!string.IsNullOrEmpty(name.stringValue))
|
||||
moduleName += ":" + name.stringValue;
|
||||
m_SerieModuleToggle = EditorGUI.Foldout(drawRect, m_SerieModuleToggle, "Serie");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_SerieModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, stack);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (!m_SerieModuleToggle)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 1;
|
||||
if (num > 50) num = 13;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/SerieDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/SerieDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c30d9496b99e39944a6987e390bed91f
|
||||
timeCreated: 1555200849
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
53
Scripts/Editor/PropertyDrawers/SeriesDrawer.cs
Normal file
53
Scripts/Editor/PropertyDrawers/SeriesDrawer.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Series), true)]
|
||||
public class SeriesDrawer : PropertyDrawer
|
||||
{
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_SeriesModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Series = prop.FindPropertyRelative("m_Series");
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SeriesModuleToggle, "Series");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
//ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_SeriesModuleToggle)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Series);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_SeriesModuleToggle)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Series");
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
for (int i = 0; i < m_Data.arraySize; i++)
|
||||
{
|
||||
height += EditorGUI.GetPropertyHeight(m_Data.GetArrayElementAtIndex(i));
|
||||
}
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/SeriesDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/SeriesDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c2458b1901047547b1a59d097786816
|
||||
timeCreated: 1556016849
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
111
Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs
Normal file
111
Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ThemeInfo), true)]
|
||||
public class ThemeInfoDrawer : PropertyDrawer
|
||||
{
|
||||
ReorderableList m_ColorPaletteList;
|
||||
bool m_ColorPaletteFoldout;
|
||||
|
||||
private void InitReorderableList(SerializedProperty prop)
|
||||
{
|
||||
if (m_ColorPaletteList == null)
|
||||
{
|
||||
SerializedProperty colorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
m_ColorPaletteList = new ReorderableList(colorPalette.serializedObject, colorPalette, false, false, true, true);
|
||||
m_ColorPaletteList.elementHeight = EditorGUIUtility.singleLineHeight;
|
||||
m_ColorPaletteList.drawHeaderCallback += delegate (Rect rect)
|
||||
{
|
||||
EditorGUI.LabelField(rect, colorPalette.displayName);
|
||||
};
|
||||
|
||||
m_ColorPaletteList.drawElementCallback = delegate (Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
EditorGUI.PropertyField(rect, colorPalette.GetArrayElementAtIndex(index), true);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Font = prop.FindPropertyRelative("m_Font");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_ContrastColor = prop.FindPropertyRelative("m_ContrastColor");
|
||||
SerializedProperty m_TextColor = prop.FindPropertyRelative("m_TextColor");
|
||||
SerializedProperty m_SubTextColor = prop.FindPropertyRelative("m_SubTextColor");
|
||||
SerializedProperty m_LegendTextColor = prop.FindPropertyRelative("m_LegendTextColor");
|
||||
SerializedProperty m_UnableColor = prop.FindPropertyRelative("m_UnableColor");
|
||||
SerializedProperty m_AxisLineColor = prop.FindPropertyRelative("m_AxisLineColor");
|
||||
SerializedProperty m_AxisSplitLineColor = prop.FindPropertyRelative("m_AxisSplitLineColor");
|
||||
SerializedProperty m_TooltipBackgroundColor = prop.FindPropertyRelative("m_TooltipBackgroundColor");
|
||||
SerializedProperty m_TooltipFlagAreaColor = prop.FindPropertyRelative("m_TooltipFlagAreaColor");
|
||||
SerializedProperty m_TooltipTextColor = prop.FindPropertyRelative("m_TooltipTextColor");
|
||||
SerializedProperty m_ColorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Font);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ContrastColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SubTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LegendTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_UnableColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisLineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisSplitLineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipBackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipFlagAreaColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
m_ColorPaletteFoldout = EditorGUI.Foldout(drawRect, m_ColorPaletteFoldout, "ColorPalette");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_ColorPaletteFoldout)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < m_ColorPalette.arraySize; i++)
|
||||
{
|
||||
SerializedProperty element = m_ColorPalette.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
int propertyCount = 12;
|
||||
if (m_ColorPaletteFoldout)
|
||||
{
|
||||
SerializedProperty m_ColorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
propertyCount += m_ColorPalette.arraySize + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyCount += 1;
|
||||
}
|
||||
height += propertyCount * EditorGUIUtility.singleLineHeight + (propertyCount - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcac1baa719179549b24d7056f7e0cb5
|
||||
timeCreated: 1554541305
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
61
Scripts/Editor/PropertyDrawers/TitleDrawer.cs
Normal file
61
Scripts/Editor/PropertyDrawers/TitleDrawer.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Title), true)]
|
||||
public class TitleDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_TitleModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty text = prop.FindPropertyRelative("m_Text");
|
||||
SerializedProperty m_TextFontSize = prop.FindPropertyRelative("m_TextFontSize");
|
||||
SerializedProperty subText = prop.FindPropertyRelative("m_SubText");
|
||||
SerializedProperty m_SubTextFontSize = prop.FindPropertyRelative("m_SubTextFontSize");
|
||||
SerializedProperty m_ItemGap = prop.FindPropertyRelative("m_ItemGap");
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TitleModuleToggle, "Title", show);
|
||||
++EditorGUI.indentLevel;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_TitleModuleToggle)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, text);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_TextFontSize, new GUIContent("Font Size"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, subText);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_SubTextFontSize, new GUIContent("Font Size"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ItemGap, new GUIContent("Item Gap"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, location);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_TitleModuleToggle)
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
height += EditorGUI.GetPropertyHeight(location);
|
||||
}
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/TitleDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/TitleDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22ae7ec778f27c1409cb9151ce7b9aba
|
||||
timeCreated: 1554304641
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Scripts/Editor/PropertyDrawers/TooltipDrawer.cs
Normal file
26
Scripts/Editor/PropertyDrawers/TooltipDrawer.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Tooltip), true)]
|
||||
public class TooltipDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_TooltipModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
return 1 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/TooltipDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/TooltipDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5600b7009bc024a49800448cece012e2
|
||||
timeCreated: 1554419729
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user