mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 09:50:15 +00:00
发布1.0.0版本
This commit is contained in:
34
Assets/XCharts/Editor/BarChartEditor.cs
Normal file
34
Assets/XCharts/Editor/BarChartEditor.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI BarChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(BarChart), false)]
|
||||
public class BarChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (BarChart)target;
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
if (m_Target == null && target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/BarChartEditor.cs.meta
Normal file
13
Assets/XCharts/Editor/BarChartEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5acea6fd06c0e9c498c434f941e4cba9
|
||||
timeCreated: 1554219116
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
92
Assets/XCharts/Editor/BaseChartEditor.cs
Normal file
92
Assets/XCharts/Editor/BaseChartEditor.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI BaseChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(BaseChart), false)]
|
||||
public class BaseChartEditor : Editor
|
||||
{
|
||||
protected BaseChart m_Target;
|
||||
protected SerializedProperty m_Script;
|
||||
protected SerializedProperty m_ChartWidth;
|
||||
protected SerializedProperty m_ChartHeight;
|
||||
protected SerializedProperty m_Theme;
|
||||
protected SerializedProperty m_ThemeInfo;
|
||||
protected SerializedProperty m_Title;
|
||||
protected SerializedProperty m_Legend;
|
||||
protected SerializedProperty m_Tooltip;
|
||||
protected SerializedProperty m_Series;
|
||||
protected SerializedProperty m_Settings;
|
||||
protected SerializedProperty m_Large;
|
||||
|
||||
protected float m_DefaultLabelWidth;
|
||||
protected float m_DefaultFieldWidth;
|
||||
private int m_SeriesSize;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Target = (BaseChart)target;
|
||||
m_Script = serializedObject.FindProperty("m_Script");
|
||||
m_ChartWidth = serializedObject.FindProperty("m_ChartWidth");
|
||||
m_ChartHeight = serializedObject.FindProperty("m_ChartHeight");
|
||||
m_Theme = serializedObject.FindProperty("m_Theme");
|
||||
m_ThemeInfo = serializedObject.FindProperty("m_ThemeInfo");
|
||||
m_Title = serializedObject.FindProperty("m_Title");
|
||||
m_Legend = serializedObject.FindProperty("m_Legend");
|
||||
m_Tooltip = serializedObject.FindProperty("m_Tooltip");
|
||||
m_Series = serializedObject.FindProperty("m_Series");
|
||||
|
||||
m_Large = serializedObject.FindProperty("m_Large");
|
||||
m_Settings = serializedObject.FindProperty("m_Settings");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (m_Target == null && target == null)
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
return;
|
||||
}
|
||||
serializedObject.Update();
|
||||
m_DefaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
m_DefaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
|
||||
OnStartInspectorGUI();
|
||||
OnMiddleInspectorGUI();
|
||||
OnEndInspectorGUI();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void OnStartInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Script);
|
||||
EditorGUILayout.PropertyField(m_ChartWidth);
|
||||
EditorGUILayout.PropertyField(m_ChartHeight);
|
||||
EditorGUILayout.PropertyField(m_ThemeInfo, true);
|
||||
EditorGUILayout.PropertyField(m_Title, true);
|
||||
EditorGUILayout.PropertyField(m_Legend, true);
|
||||
EditorGUILayout.PropertyField(m_Tooltip, true);
|
||||
}
|
||||
|
||||
protected virtual void OnMiddleInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Series, true);
|
||||
EditorGUILayout.PropertyField(m_Settings, true);
|
||||
}
|
||||
|
||||
protected virtual void OnEndInspectorGUI()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/BaseChartEditor.cs.meta
Normal file
13
Assets/XCharts/Editor/BaseChartEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7f1cff1e5bae244a872040086b1cfa8
|
||||
timeCreated: 1554217495
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
Assets/XCharts/Editor/CheckVersionEditor.cs
Normal file
79
Assets/XCharts/Editor/CheckVersionEditor.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class CheckVersionEditor : EditorWindow
|
||||
{
|
||||
private Vector2 scrollPos;
|
||||
private static CheckVersionEditor window;
|
||||
|
||||
[MenuItem("Component/XCharts/Check For Update")]
|
||||
private static void ShowWindow()
|
||||
{
|
||||
window = GetWindow<CheckVersionEditor>();
|
||||
window.titleContent = new GUIContent("XCharts Check For Update");
|
||||
window.minSize = new Vector2(550, window.minSize.y);
|
||||
window.Show();
|
||||
XChartsMgr.Instance.CheckVersion();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
var mgr = XChartsMgr.Instance;
|
||||
GUILayout.Label("");
|
||||
GUILayout.Label("当前版本:" + mgr.nowVersion);
|
||||
if (mgr.needUpdate && !mgr.isCheck)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("最新版本:" + mgr.newVersion);
|
||||
if (mgr.isCheck) GUILayout.Label("检测中...");
|
||||
else GUILayout.Label("有更新!");
|
||||
if (GUILayout.Button("去Github主页"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Label("");
|
||||
if (!string.IsNullOrEmpty(mgr.desc))
|
||||
{
|
||||
GUILayout.Label(mgr.desc);
|
||||
GUILayout.Label("");
|
||||
}
|
||||
|
||||
scrollPos = GUILayout.BeginScrollView(scrollPos);
|
||||
GUILayout.TextArea(mgr.changeLog);
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mgr.isCheck) GUILayout.Label("最新版本:检测中...");
|
||||
else GUILayout.Label("最新版本:" + mgr.newVersion);
|
||||
|
||||
if (!mgr.needUpdate && !mgr.isCheck)
|
||||
{
|
||||
GUILayout.Label("");
|
||||
GUILayout.Label("已是最新版本!");
|
||||
GUILayout.Label("");
|
||||
if (!string.IsNullOrEmpty(mgr.desc))
|
||||
{
|
||||
GUILayout.Label(mgr.desc);
|
||||
GUILayout.Label("");
|
||||
}
|
||||
if (GUILayout.Button("去Github主页"))
|
||||
{
|
||||
Application.OpenURL(mgr.homepage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/CheckVersionEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/CheckVersionEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98d1061c4167c4fff8ed25c3e8be8756
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/XCharts/Editor/CoordinateChartEditor.cs
Normal file
56
Assets/XCharts/Editor/CoordinateChartEditor.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI CoordinateChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(CoordinateChart), false)]
|
||||
public class CoordinateChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Grid;
|
||||
protected SerializedProperty m_MultipleXAxis;
|
||||
protected SerializedProperty m_XAxises;
|
||||
protected SerializedProperty m_MultipleYAxis;
|
||||
protected SerializedProperty m_YAxises;
|
||||
protected SerializedProperty m_DataZoom;
|
||||
protected SerializedProperty m_VisualMap;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (CoordinateChart)target;
|
||||
m_Grid = serializedObject.FindProperty("m_Grid");
|
||||
m_XAxises = serializedObject.FindProperty("m_XAxises");
|
||||
m_YAxises = serializedObject.FindProperty("m_YAxises");
|
||||
m_DataZoom = serializedObject.FindProperty("m_DataZoom");
|
||||
m_VisualMap = serializedObject.FindProperty("m_VisualMap");
|
||||
}
|
||||
|
||||
protected override void OnStartInspectorGUI()
|
||||
{
|
||||
base.OnStartInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_DataZoom);
|
||||
EditorGUILayout.PropertyField(m_VisualMap);
|
||||
EditorGUILayout.PropertyField(m_Grid);
|
||||
for (int i = 0; i < m_XAxises.arraySize; i++)
|
||||
{
|
||||
SerializedProperty axis = m_XAxises.GetArrayElementAtIndex(i);
|
||||
EditorGUILayout.PropertyField(axis);
|
||||
}
|
||||
for (int i = 0; i < m_YAxises.arraySize; i++)
|
||||
{
|
||||
SerializedProperty axis = m_YAxises.GetArrayElementAtIndex(i);
|
||||
EditorGUILayout.PropertyField(axis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/CoordinateChartEditor.cs.meta
Normal file
13
Assets/XCharts/Editor/CoordinateChartEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dd7acd8b13f3f14e9891af4e8dd0b0b
|
||||
timeCreated: 1554475249
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/XCharts/Editor/HeatmapChartEditor.cs
Normal file
30
Assets/XCharts/Editor/HeatmapChartEditor.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI HeatmapChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(HeatmapChart), false)]
|
||||
public class HeatmapChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (HeatmapChart)target;
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/HeatmapChartEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/HeatmapChartEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1144057dfc00f4572913a63ba5291dd7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/XCharts/Editor/LineChartEditor.cs
Normal file
25
Assets/XCharts/Editor/LineChartEditor.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI LineChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(LineChart), false)]
|
||||
public class LineChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (LineChart)target;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/LineChartEditor.cs.meta
Normal file
13
Assets/XCharts/Editor/LineChartEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bd1a238bc5b407408b8f902aa3db9fd
|
||||
timeCreated: 1554539035
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/XCharts/Editor/PieChartEditor.cs
Normal file
32
Assets/XCharts/Editor/PieChartEditor.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI PieChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(PieChart), false)]
|
||||
public class PieChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Pie;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (PieChart)target;
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PieChartEditor.cs.meta
Normal file
13
Assets/XCharts/Editor/PieChartEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28de30021bed0f945af09633584fcb44
|
||||
timeCreated: 1554768152
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/XCharts/Editor/PropertyDrawers.meta
Normal file
10
Assets/XCharts/Editor/PropertyDrawers.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ad1e8940e4805b49a18ea7a2cbd4bce
|
||||
folderAsset: yes
|
||||
timeCreated: 1554304641
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Assets/XCharts/Editor/PropertyDrawers/AnimationDrawer.cs
Normal file
67
Assets/XCharts/Editor/PropertyDrawers/AnimationDrawer.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Animation), true)]
|
||||
public class AnimationDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AnimationModuleToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
SerializedProperty m_Enable = prop.FindPropertyRelative("m_Enable");
|
||||
SerializedProperty m_Easting = prop.FindPropertyRelative("m_Easting");
|
||||
SerializedProperty m_Duration = prop.FindPropertyRelative("m_Duration");
|
||||
SerializedProperty m_Delay = prop.FindPropertyRelative("m_Delay");
|
||||
SerializedProperty m_Threshold = prop.FindPropertyRelative("m_Threshold");
|
||||
SerializedProperty m_ActualDuration = prop.FindPropertyRelative("m_ActualDuration");
|
||||
SerializedProperty m_CurrDetailProgress = prop.FindPropertyRelative("m_CurrDetailProgress");
|
||||
SerializedProperty m_DestDetailProgress = prop.FindPropertyRelative("m_DestDetailProgress");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AnimationModuleToggle, prop, null, m_Enable, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AnimationModuleToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Easting);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Duration);
|
||||
if (m_Duration.intValue < 0) m_Duration.intValue = 0;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Delay);
|
||||
if (m_Delay.intValue < 0) m_Delay.intValue = 0;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Threshold);
|
||||
if (m_Threshold.intValue < 0) m_Threshold.intValue = 0;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.LabelField(drawRect, "CurrDetailProgress:" + m_CurrDetailProgress.floatValue);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.LabelField(drawRect, "DestDetailProgress:" + m_DestDetailProgress.floatValue);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.LabelField(drawRect, "Actual duration:" + m_ActualDuration.intValue + " ms");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (ChartEditorHelper.IsToggle(m_AnimationModuleToggle, prop))
|
||||
return 8 * EditorGUIUtility.singleLineHeight + 7 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 844042f92a581474ba0491427f3fd592
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
69
Assets/XCharts/Editor/PropertyDrawers/AreaStyleDrawer.cs
Normal file
69
Assets/XCharts/Editor/PropertyDrawers/AreaStyleDrawer.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AreaStyle), true)]
|
||||
public class AreaStyleDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AreaStyleToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Origin = prop.FindPropertyRelative("m_Origin");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_ToColor = prop.FindPropertyRelative("m_ToColor");
|
||||
SerializedProperty m_HighlightColor = prop.FindPropertyRelative("m_HighlightColor");
|
||||
SerializedProperty m_HighlightToColor = prop.FindPropertyRelative("m_HighlightToColor");
|
||||
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
|
||||
SerializedProperty m_TooltipHighlight = prop.FindPropertyRelative("m_TooltipHighlight");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AreaStyleToggle, prop, "Area Style", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AreaStyleToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Origin);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ToColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_HighlightColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_HighlightToColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Opacity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipHighlight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AreaStyleToggle, prop))
|
||||
{
|
||||
height += 8 * EditorGUIUtility.singleLineHeight + 7 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c51fd822c8be44490832d81652d1aef5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
207
Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs
Normal file
207
Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis), true)]
|
||||
public class AxisDrawer : PropertyDrawer
|
||||
{
|
||||
private List<bool> m_AxisModuleToggle = 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;
|
||||
|
||||
|
||||
protected virtual string GetDisplayName(string displayName)
|
||||
{
|
||||
return displayName;
|
||||
}
|
||||
|
||||
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_Interval = prop.FindPropertyRelative("m_Interval");
|
||||
SerializedProperty m_AxisLabel = prop.FindPropertyRelative("m_AxisLabel");
|
||||
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_AxisLine = prop.FindPropertyRelative("m_AxisLine");
|
||||
SerializedProperty m_AxisName = prop.FindPropertyRelative("m_AxisName");
|
||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||
SerializedProperty m_SplitArea = prop.FindPropertyRelative("m_SplitArea");
|
||||
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
|
||||
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
|
||||
|
||||
int index = InitToggle(prop);
|
||||
bool toggle = m_AxisModuleToggle[index];
|
||||
m_AxisModuleToggle[index] = ChartEditorHelper.MakeFoldout(ref drawRect, ref toggle,
|
||||
GetDisplayName(prop.displayName), m_Show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisModuleToggle[index])
|
||||
{
|
||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (type == Axis.AxisType.Value)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_MinMaxType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
|
||||
switch (minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
break;
|
||||
case Axis.AxisMinMaxType.MinMax:
|
||||
break;
|
||||
case Axis.AxisMinMaxType.Custom:
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.PropertyField(drawRect, m_Min);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.indentLevel--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Interval);
|
||||
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_AxisLine);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLine);
|
||||
EditorGUI.PropertyField(drawRect, m_AxisName);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisName);
|
||||
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||
EditorGUI.PropertyField(drawRect, m_AxisLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLabel);
|
||||
EditorGUI.PropertyField(drawRect, m_SplitArea);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_SplitArea);
|
||||
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop, pos.width);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int index = InitToggle(prop);
|
||||
if (!m_AxisModuleToggle[index])
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||
SerializedProperty m_AxisLine = prop.FindPropertyRelative("m_AxisLine");
|
||||
SerializedProperty m_AxisName = prop.FindPropertyRelative("m_AxisName");
|
||||
SerializedProperty m_AxisLabel = prop.FindPropertyRelative("m_AxisLabel");
|
||||
SerializedProperty m_SplitArea = prop.FindPropertyRelative("m_SplitArea");
|
||||
float height = 0;
|
||||
height += 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
|
||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 2;
|
||||
if (num > 30) num = 14;
|
||||
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;
|
||||
}
|
||||
}
|
||||
else if (type == Axis.AxisType.Value)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||
if (m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisName);
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisLine);
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisLabel);
|
||||
height += EditorGUI.GetPropertyHeight(m_SplitArea);
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
private int InitToggle(SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
int.TryParse(prop.displayName.Split(' ')[1],out index);
|
||||
if (index >= m_DataFoldout.Count)
|
||||
{
|
||||
m_DataFoldout.Add(false);
|
||||
}
|
||||
if (index >= m_AxisModuleToggle.Count)
|
||||
{
|
||||
m_AxisModuleToggle.Add(false);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
68
Assets/XCharts/Editor/PropertyDrawers/AxisLabelDrawer.cs
Normal file
68
Assets/XCharts/Editor/PropertyDrawers/AxisLabelDrawer.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisLabel), true)]
|
||||
public class AxisLabelDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AxisLabelToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Formatter = prop.FindPropertyRelative("m_Formatter");
|
||||
SerializedProperty m_Inside = prop.FindPropertyRelative("m_Inside");
|
||||
SerializedProperty m_Interval = prop.FindPropertyRelative("m_Interval");
|
||||
SerializedProperty m_Rotate = prop.FindPropertyRelative("m_Rotate");
|
||||
SerializedProperty m_Margin = prop.FindPropertyRelative("m_Margin");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisLabelToggle, prop, "Axis Label", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLabelToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Inside);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Interval);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rotate);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Margin);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Formatter);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLabelToggle, prop))
|
||||
{
|
||||
height += 8 * EditorGUIUtility.singleLineHeight + 7 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f38952bcbcd448dbe12f98e9c9110d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
65
Assets/XCharts/Editor/PropertyDrawers/AxisLineDrawer.cs
Normal file
65
Assets/XCharts/Editor/PropertyDrawers/AxisLineDrawer.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisLine), true)]
|
||||
public class AxisLineDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AxisLineToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_OnZero = prop.FindPropertyRelative("m_OnZero");
|
||||
SerializedProperty m_Width = prop.FindPropertyRelative("m_Width");
|
||||
SerializedProperty m_Symbol = prop.FindPropertyRelative("m_Symbol");
|
||||
SerializedProperty m_SymbolWidth = prop.FindPropertyRelative("m_SymbolWidth");
|
||||
SerializedProperty m_SymbolHeight = prop.FindPropertyRelative("m_SymbolHeight");
|
||||
SerializedProperty m_SymbolOffset = prop.FindPropertyRelative("m_SymbolOffset");
|
||||
SerializedProperty m_SymbolDent = prop.FindPropertyRelative("m_SymbolDent");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisLineToggle, prop, "Axis Line", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLineToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_OnZero);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Width);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Symbol);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolDent);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLineToggle,prop))
|
||||
{
|
||||
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/AxisLineDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/AxisLineDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 866eefe266c3c47809d9dff3e89be0ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
74
Assets/XCharts/Editor/PropertyDrawers/AxisNameDrawer.cs
Normal file
74
Assets/XCharts/Editor/PropertyDrawers/AxisNameDrawer.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisName), true)]
|
||||
public class AxisNameDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AxisNameToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty m_Location = prop.FindPropertyRelative("m_Location");
|
||||
SerializedProperty m_Offset = prop.FindPropertyRelative("m_Offset");
|
||||
SerializedProperty m_Rotate = prop.FindPropertyRelative("m_Rotate");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisNameToggle, prop, "Axis Name", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisNameToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Location);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Offset);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Offset);
|
||||
// EditorGUI.LabelField(drawRect, "Offset");
|
||||
// var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
// var tempWidth = (pos.width - startX + 35) / 2;
|
||||
// var xRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
// var yRect = new Rect(xRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height);
|
||||
// var x = EditorGUI.FloatField(xRect, m_Offset.vector2Value.x);
|
||||
// var y = EditorGUI.FloatField(yRect, m_Offset.vector2Value.y);
|
||||
// m_Offset.vector2Value = new Vector2(x,y);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rotate);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisNameToggle, prop))
|
||||
{
|
||||
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/AxisNameDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/AxisNameDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93f4873273d9c4d76bd651c8d774637f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
61
Assets/XCharts/Editor/PropertyDrawers/AxisSplitAreaDrawer.cs
Normal file
61
Assets/XCharts/Editor/PropertyDrawers/AxisSplitAreaDrawer.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisSplitArea), true)]
|
||||
public class AxisSplitAreaDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_ColorFoldout = false;
|
||||
private int m_ColorSize = 0;
|
||||
private Dictionary<string, bool> m_SplitAreaToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Color = prop.FindPropertyRelative("m_Color");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SplitAreaToggle, prop, "Split Area", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_SplitAreaToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
m_ColorFoldout = EditorGUI.Foldout(drawRect, m_ColorFoldout, "Color");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.width = pos.width;
|
||||
if (m_ColorFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_ColorSize, m_Color);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_SplitAreaToggle, prop))
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_ColorFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Color");
|
||||
int num = m_Data.arraySize + 1;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 988570bd6485942da9879649ed4adb5b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
52
Assets/XCharts/Editor/PropertyDrawers/AxisTickDrawer.cs
Normal file
52
Assets/XCharts/Editor/PropertyDrawers/AxisTickDrawer.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(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
Assets/XCharts/Editor/PropertyDrawers/AxisTickDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
102
Assets/XCharts/Editor/PropertyDrawers/DataZoomDrawer.cs
Normal file
102
Assets/XCharts/Editor/PropertyDrawers/DataZoomDrawer.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(DataZoom), true)]
|
||||
public class DataZoomDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataZoomModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Enable");
|
||||
//SerializedProperty m_FilterMode = prop.FindPropertyRelative("m_FilterMode");
|
||||
//SerializedProperty m_Orient = prop.FindPropertyRelative("m_Orient");
|
||||
SerializedProperty m_SupportInside = prop.FindPropertyRelative("m_SupportInside");
|
||||
SerializedProperty m_SupportSlider = prop.FindPropertyRelative("m_SupportSlider");
|
||||
//SerializedProperty m_SupportSelect = prop.FindPropertyRelative("m_SupportSelect");
|
||||
SerializedProperty m_ShowDataShadow = prop.FindPropertyRelative("m_ShowDataShadow");
|
||||
SerializedProperty m_ShowDetail = prop.FindPropertyRelative("m_ShowDetail");
|
||||
SerializedProperty m_ZoomLock = prop.FindPropertyRelative("m_ZoomLock");
|
||||
// SerializedProperty m_Realtime = prop.FindPropertyRelative("m_Realtime");
|
||||
// SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_Height = prop.FindPropertyRelative("m_Height");
|
||||
SerializedProperty m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
SerializedProperty m_RangeMode = prop.FindPropertyRelative("m_RangeMode");
|
||||
SerializedProperty m_Start = prop.FindPropertyRelative("m_Start");
|
||||
SerializedProperty m_End = prop.FindPropertyRelative("m_End");
|
||||
SerializedProperty m_ScrollSensitivity = prop.FindPropertyRelative("m_ScrollSensitivity");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_DataZoomModuleToggle, "DataZoom", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataZoomModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_SupportInside);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SupportSlider);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_SupportSlider.boolValue)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowDataShadow);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowDetail);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// EditorGUI.PropertyField(drawRect, m_Realtime);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Height);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
//EditorGUI.PropertyField(drawRect, m_SupportSelect);
|
||||
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ZoomLock);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ScrollSensitivity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_RangeMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Start);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_End);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
|
||||
if (m_End.floatValue > 100) m_End.floatValue = 100;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
int num = 1;
|
||||
if (m_DataZoomModuleToggle)
|
||||
{
|
||||
num += 7;
|
||||
if (prop.FindPropertyRelative("m_SupportSlider").boolValue) num += 6;
|
||||
|
||||
}
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/DataZoomDrawer.cs.meta
Normal file
13
Assets/XCharts/Editor/PropertyDrawers/DataZoomDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cba26e421f79077499f05aaf10d06b4f
|
||||
timeCreated: 1559609801
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
Assets/XCharts/Editor/PropertyDrawers/EmphasisStyleDrawer.cs
Normal file
55
Assets/XCharts/Editor/PropertyDrawers/EmphasisStyleDrawer.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Emphasis), true)]
|
||||
public class EmphasisDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_EmphasisToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Label = prop.FindPropertyRelative("m_Label");
|
||||
SerializedProperty m_ItemStyle = prop.FindPropertyRelative("m_ItemStyle");
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_EmphasisToggle, prop, "Emphasis", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_EmphasisToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Label);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
|
||||
EditorGUI.PropertyField(drawRect, m_ItemStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_EmphasisToggle, prop))
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7de9b5e4c5d474fdd88ebb89f0924305
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/XCharts/Editor/PropertyDrawers/GridDrawer.cs
Normal file
58
Assets/XCharts/Editor/PropertyDrawers/GridDrawer.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Grid), true)]
|
||||
public class GridDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_GridModuleToggle = false;
|
||||
|
||||
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_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_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_GridModuleToggle, "Grid",m_Show);
|
||||
EditorGUI.LabelField(drawRect, "Grid", EditorStyles.boldLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_GridModuleToggle)
|
||||
{
|
||||
++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_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_GridModuleToggle)
|
||||
return 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/GridDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/GridDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4142159d55a64e1d88d81ac84b714d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
62
Assets/XCharts/Editor/PropertyDrawers/ItemStyleDrawer.cs
Normal file
62
Assets/XCharts/Editor/PropertyDrawers/ItemStyleDrawer.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ItemStyle), true)]
|
||||
public class ItemStyleDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_ItemStyleToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_BorderType = prop.FindPropertyRelative("m_BorderType");
|
||||
SerializedProperty m_BorderWidth = prop.FindPropertyRelative("m_BorderWidth");
|
||||
SerializedProperty m_BorderColor = prop.FindPropertyRelative("m_BorderColor");
|
||||
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_ItemStyleToggle, prop, "Item Style", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_ItemStyleToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BorderType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BorderWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BorderColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Opacity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_ItemStyleToggle, prop))
|
||||
{
|
||||
height += 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f40830a3b05574467ad0d8873c6c8790
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
95
Assets/XCharts/Editor/PropertyDrawers/LegendDrawer.cs
Normal file
95
Assets/XCharts/Editor/PropertyDrawers/LegendDrawer.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
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 m_SelectedMode = prop.FindPropertyRelative("m_SelectedMode");
|
||||
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_Formatter = prop.FindPropertyRelative("m_Formatter");
|
||||
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, m_SelectedMode);
|
||||
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);
|
||||
EditorGUI.PropertyField(drawRect, m_Formatter);
|
||||
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,pos.width);
|
||||
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 += 7 * EditorGUIUtility.singleLineHeight + 6 * 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 * 4 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/LegendDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
62
Assets/XCharts/Editor/PropertyDrawers/LineArrowDrawer.cs
Normal file
62
Assets/XCharts/Editor/PropertyDrawers/LineArrowDrawer.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(LineArrow), true)]
|
||||
public class LineArrowStyleDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_LineArrowToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Position = prop.FindPropertyRelative("m_Position");
|
||||
SerializedProperty m_Width = prop.FindPropertyRelative("m_Width");
|
||||
SerializedProperty m_Height = prop.FindPropertyRelative("m_Height");
|
||||
SerializedProperty m_Offset = prop.FindPropertyRelative("m_Offset");
|
||||
SerializedProperty m_Dent = prop.FindPropertyRelative("m_Dent");
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LineArrowToggle, prop, "Line Arrow", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_LineArrowToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Position);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Width);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Height);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Offset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Dent);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_LineArrowToggle, prop))
|
||||
{
|
||||
height += 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 817d27d232da94f6c9dab9e3d0c22631
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
59
Assets/XCharts/Editor/PropertyDrawers/LineStyleDrawer.cs
Normal file
59
Assets/XCharts/Editor/PropertyDrawers/LineStyleDrawer.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(LineStyle), true)]
|
||||
public class LineStyleDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_LineStyleToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_Width = prop.FindPropertyRelative("m_Width");
|
||||
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LineStyleToggle, prop, "Line Style", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_LineStyleToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Width);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Opacity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_LineStyleToggle, prop))
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a36d5076e1414d619b53d1ef998806f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Assets/XCharts/Editor/PropertyDrawers/LocationDrawer.cs
Normal file
93
Assets/XCharts/Editor/PropertyDrawers/LocationDrawer.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
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 + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.BottomCenter:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.CenterRight:
|
||||
return 2 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
default:
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/LocationDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
128
Assets/XCharts/Editor/PropertyDrawers/RadarDrawer.cs
Normal file
128
Assets/XCharts/Editor/PropertyDrawers/RadarDrawer.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar), true)]
|
||||
public class RadarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Shape;
|
||||
SerializedProperty m_Radius;
|
||||
SerializedProperty m_SplitNumber;
|
||||
SerializedProperty m_Center;
|
||||
SerializedProperty m_LineStyle;
|
||||
SerializedProperty m_SplitArea;
|
||||
SerializedProperty m_Indicator;
|
||||
SerializedProperty m_IndicatorList;
|
||||
|
||||
private Dictionary<string, bool> m_RadarModuleToggle = new Dictionary<string, bool>();
|
||||
private Dictionary<string, bool> m_IndicatorToggle = new Dictionary<string, bool>();
|
||||
private bool m_IndicatorJsonAreaToggle = false;
|
||||
private string m_IndicatorJsonAreaText;
|
||||
private int m_IndicatorSize;
|
||||
private int m_BackgroundColorSize;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Shape = prop.FindPropertyRelative("m_Shape");
|
||||
m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
m_Center = prop.FindPropertyRelative("m_Center");
|
||||
m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
||||
m_SplitArea = prop.FindPropertyRelative("m_SplitArea");
|
||||
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;
|
||||
int index = ChartEditorHelper.GetIndexFromPath(prop);
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, prop, "Radar " + index, null, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUIUtility.labelWidth = defaultLabelWidth;
|
||||
EditorGUIUtility.fieldWidth = defaultFieldWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_Shape);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.LabelField(drawRect, "Center");
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
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);
|
||||
}
|
||||
EditorGUI.PropertyField(centerXRect, m_Center.GetArrayElementAtIndex(0), GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, m_Center.GetArrayElementAtIndex(1), GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
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_LineStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_SplitArea);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_SplitArea);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_IndicatorToggle, prop, "Indicators", m_Indicator, false);
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_IndicatorJsonAreaToggle, ref m_IndicatorJsonAreaText, prop, pos.width, 20);
|
||||
drawRect.width = pos.width;
|
||||
drawRect.x = pos.x;
|
||||
if (ChartEditorHelper.IsToggle(m_IndicatorToggle, prop))
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_IndicatorSize, m_IndicatorList);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int propNum = 1;
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
propNum += 6;
|
||||
if (m_IndicatorJsonAreaToggle) propNum += 4;
|
||||
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_SplitArea"));
|
||||
|
||||
if (ChartEditorHelper.IsToggle(m_IndicatorToggle, prop))
|
||||
{
|
||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
for (int i = 0; i < m_IndicatorList.arraySize; i++)
|
||||
{
|
||||
height += EditorGUI.GetPropertyHeight(m_IndicatorList.GetArrayElementAtIndex(i));
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/RadarDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
@@ -0,0 +1,62 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar.Indicator), true)]
|
||||
public class RadarIndicatorDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_RadarModuleToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
SerializedProperty m_Name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
|
||||
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
Rect drawRect = pos;
|
||||
float defaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
float defaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
int index = ChartEditorHelper.GetIndexFromPath(prop);
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, prop, "Indicator " + index, m_Name, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Min);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
return 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
411
Assets/XCharts/Editor/PropertyDrawers/SerieDrawer.cs
Normal file
411
Assets/XCharts/Editor/PropertyDrawers/SerieDrawer.cs
Normal file
@@ -0,0 +1,411 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Serie), true)]
|
||||
public class SerieDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_SerieModuleToggle = new Dictionary<string, bool>();
|
||||
private List<bool> m_DataFoldout = new List<bool>();
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
|
||||
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_AxisIndex = prop.FindPropertyRelative("m_AxisIndex");
|
||||
SerializedProperty m_RadarIndex = prop.FindPropertyRelative("m_RadarIndex");
|
||||
SerializedProperty m_MinShow = prop.FindPropertyRelative("m_MinShow");
|
||||
SerializedProperty m_MaxShow = prop.FindPropertyRelative("m_MaxShow");
|
||||
SerializedProperty m_MaxCache = prop.FindPropertyRelative("m_MaxCache");
|
||||
|
||||
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
||||
SerializedProperty m_ItemStyle = prop.FindPropertyRelative("m_ItemStyle");
|
||||
SerializedProperty m_LineArrow = prop.FindPropertyRelative("m_LineArrow");
|
||||
SerializedProperty m_LineType = prop.FindPropertyRelative("m_LineType");
|
||||
SerializedProperty m_SampleDist = prop.FindPropertyRelative("m_SampleDist");
|
||||
SerializedProperty m_SampleType = prop.FindPropertyRelative("m_SampleType");
|
||||
SerializedProperty m_SampleAverage = prop.FindPropertyRelative("m_SampleAverage");
|
||||
SerializedProperty m_BarType = prop.FindPropertyRelative("m_BarType");
|
||||
SerializedProperty m_BarPercentStack = prop.FindPropertyRelative("m_BarPercentStack");
|
||||
SerializedProperty m_BarWidth = prop.FindPropertyRelative("m_BarWidth");
|
||||
SerializedProperty m_BarGap = prop.FindPropertyRelative("m_BarGap");
|
||||
SerializedProperty m_BarZebraWidth = prop.FindPropertyRelative("m_BarZebraWidth");
|
||||
SerializedProperty m_BarZebraGap = prop.FindPropertyRelative("m_BarZebraGap");
|
||||
SerializedProperty m_AreaStyle = prop.FindPropertyRelative("m_AreaStyle");
|
||||
SerializedProperty m_Symbol = prop.FindPropertyRelative("m_Symbol");
|
||||
SerializedProperty m_RoseType = prop.FindPropertyRelative("m_RoseType");
|
||||
SerializedProperty m_Space = prop.FindPropertyRelative("m_Space");
|
||||
SerializedProperty m_Center = prop.FindPropertyRelative("m_Center");
|
||||
SerializedProperty m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
SerializedProperty m_Label = prop.FindPropertyRelative("m_Label");
|
||||
SerializedProperty m_Emphasis = prop.FindPropertyRelative("m_Emphasis");
|
||||
SerializedProperty m_Animation = prop.FindPropertyRelative("m_Animation");
|
||||
SerializedProperty m_DataDimension = prop.FindPropertyRelative("m_ShowDataDimension");
|
||||
SerializedProperty m_ShowDataName = prop.FindPropertyRelative("m_ShowDataName");
|
||||
SerializedProperty m_ShowDataIcon = prop.FindPropertyRelative("m_ShowDataIcon");
|
||||
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
int index = InitToggle(prop);
|
||||
string moduleName = "Serie " + index;
|
||||
var toggle = ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieModuleToggle, prop, moduleName, show);
|
||||
if (!toggle)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2 + 20;
|
||||
drawRect.width = pos.width - drawRect.x + 15;
|
||||
EditorGUI.PropertyField(drawRect, type, GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
var serieType = (SerieType)type.enumValueIndex;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, type);
|
||||
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;
|
||||
if (serieType == SerieType.Radar)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_RadarIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_AxisIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_MinShow);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_MaxShow);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_MaxCache);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_MinShow.intValue < 0) m_MinShow.intValue = 0;
|
||||
if (m_MinShow.intValue < 0) m_MinShow.intValue = 0;
|
||||
if (m_MaxCache.intValue < 0) m_MaxCache.intValue = 0;
|
||||
if (serieType == SerieType.Line)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_LineType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SampleDist);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SampleType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SampleAverage);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (serieType == SerieType.Line
|
||||
|| serieType == SerieType.Scatter
|
||||
|| serieType == SerieType.EffectScatter
|
||||
|| serieType == SerieType.Radar)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_Symbol);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
|
||||
}
|
||||
if (serieType == SerieType.Bar)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_BarType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BarPercentStack);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BarWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BarGap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BarZebraWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BarZebraGap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (serieType == SerieType.Pie)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_RoseType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Space);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Radius, "Radius");
|
||||
}
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
||||
if (serieType == SerieType.Line)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_LineArrow);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_LineArrow);
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_ItemStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_AreaStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AreaStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_Label);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
|
||||
EditorGUI.PropertyField(drawRect, m_Emphasis);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
|
||||
EditorGUI.PropertyField(drawRect, m_Animation);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Animation);
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop, pos.width);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
float nameWid = 40;
|
||||
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height), m_DataDimension);
|
||||
var nameRect = new Rect(pos.width - 2 * nameWid + 14, drawRect.y, nameWid, pos.height);
|
||||
if (GUI.Button(nameRect, new GUIContent("Name")))
|
||||
{
|
||||
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
|
||||
}
|
||||
var iconRect = new Rect(pos.width - nameWid + 14, drawRect.y, nameWid, pos.height);
|
||||
if (GUI.Button(iconRect, new GUIContent("Icon")))
|
||||
{
|
||||
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
var listSize = m_Datas.arraySize;
|
||||
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (listSize < 0) listSize = 0;
|
||||
if (m_DataDimension.intValue < 1) m_DataDimension.intValue = 1;
|
||||
int dimension = m_DataDimension.intValue;
|
||||
bool showName = m_ShowDataName.boolValue;
|
||||
bool showIcon = m_ShowDataIcon.boolValue;
|
||||
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);
|
||||
}
|
||||
if (listSize > 30)
|
||||
{
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
|
||||
}
|
||||
if (num >= 10)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, "...");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, listSize - 1, pos.width);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_Datas.arraySize; i++)
|
||||
{
|
||||
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDataElement(ref Rect drawRect, int dimension, SerializedProperty m_Datas, bool showName,
|
||||
bool showIconDetail, bool showSelected, int index, float currentWidth)
|
||||
{
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var selected = serieData.FindPropertyRelative("m_Selected");
|
||||
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
var fieldCount = dimension + (showName ? 1 : 0);
|
||||
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
data.InsertArrayElementAtIndex(data.arraySize);
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
if (showSelected)
|
||||
{
|
||||
drawRect.width = drawRect.width - 18;
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
drawRect.x = currentWidth - 45;
|
||||
EditorGUI.PropertyField(drawRect, selected, GUIContent.none);
|
||||
drawRect.x = lastX;
|
||||
drawRect.width = lastWid;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
}
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, "Element " + index);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 4;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
if (i >= data.arraySize - 1)
|
||||
{
|
||||
data.InsertArrayElementAtIndex(data.arraySize);
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 40;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = lastX;
|
||||
drawRect.width = lastWid;
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
if (showIconDetail)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var m_ShowIcon = serieData.FindPropertyRelative("m_ShowIcon");
|
||||
var m_IconImage = serieData.FindPropertyRelative("m_IconImage");
|
||||
var m_IconColor = serieData.FindPropertyRelative("m_IconColor");
|
||||
var m_IconWidth = serieData.FindPropertyRelative("m_IconWidth");
|
||||
var m_IconHeight = serieData.FindPropertyRelative("m_IconHeight");
|
||||
var m_IconOffset = serieData.FindPropertyRelative("m_IconOffset");
|
||||
EditorGUI.PropertyField(drawRect, m_ShowIcon);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_IconImage);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_IconColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_IconWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_IconHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.LabelField(drawRect, "Icon Offset");
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var tempWidth = (drawRect.width - startX + 72) / 2;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - 58, drawRect.y, tempWidth, drawRect.height);
|
||||
var x = EditorGUI.FloatField(centerXRect, m_IconOffset.vector3Value.x);
|
||||
var y = EditorGUI.FloatField(centerYRect, m_IconOffset.vector3Value.y);
|
||||
m_IconOffset.vector3Value = new Vector3(x, y);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
int index = InitToggle(prop);
|
||||
if (!m_SerieModuleToggle[prop.propertyPath])
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 9 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_AreaStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
|
||||
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
||||
var serieType = (SerieType)type.enumValueIndex;
|
||||
if (serieType == SerieType.Line
|
||||
|| serieType == SerieType.Scatter
|
||||
|| serieType == SerieType.EffectScatter
|
||||
|| serieType == SerieType.Radar)
|
||||
{
|
||||
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Symbol"));
|
||||
}
|
||||
if (serieType == SerieType.Pie)
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (serieType == SerieType.Line)
|
||||
{
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineArrow"));
|
||||
height += 4 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (serieType == SerieType.Bar)
|
||||
{
|
||||
height += 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 2;
|
||||
if (num > 30) num = 15;
|
||||
if (prop.FindPropertyRelative("m_ShowDataIcon").boolValue)
|
||||
{
|
||||
num *= 5;
|
||||
num += 2;
|
||||
}
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
private int InitToggle(SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
var sindex = prop.propertyPath.LastIndexOf('[');
|
||||
var eindex = prop.propertyPath.LastIndexOf(']');
|
||||
if (sindex >= 0 && eindex >= 0)
|
||||
{
|
||||
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
|
||||
int.TryParse(str, out index);
|
||||
}
|
||||
if (index >= m_DataFoldout.Count)
|
||||
{
|
||||
m_DataFoldout.Add(false);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/SerieDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
121
Assets/XCharts/Editor/PropertyDrawers/SerieLabelDrawer.cs
Normal file
121
Assets/XCharts/Editor/PropertyDrawers/SerieLabelDrawer.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieLabel), true)]
|
||||
public class SerieLabelDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_SerieLabelToggle = new Dictionary<string, bool>();
|
||||
|
||||
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_Position = prop.FindPropertyRelative("m_Position");
|
||||
SerializedProperty m_Formatter = prop.FindPropertyRelative("m_Formatter");
|
||||
SerializedProperty m_Offset = prop.FindPropertyRelative("m_Offset");
|
||||
SerializedProperty m_Rotate = prop.FindPropertyRelative("m_Rotate");
|
||||
SerializedProperty m_PaddingLeftRight = prop.FindPropertyRelative("m_PaddingLeftRight");
|
||||
SerializedProperty m_PaddingTopBottom = prop.FindPropertyRelative("m_PaddingTopBottom");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_BackgroundWidth = prop.FindPropertyRelative("m_BackgroundWidth");
|
||||
SerializedProperty m_BackgroundHeight = prop.FindPropertyRelative("m_BackgroundHeight");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
SerializedProperty m_Line = prop.FindPropertyRelative("m_Line");
|
||||
SerializedProperty m_LineType = prop.FindPropertyRelative("m_LineType");
|
||||
SerializedProperty m_LineColor = prop.FindPropertyRelative("m_LineColor");
|
||||
SerializedProperty m_LineWidth = prop.FindPropertyRelative("m_LineWidth");
|
||||
SerializedProperty m_LineLength1 = prop.FindPropertyRelative("m_LineLength1");
|
||||
SerializedProperty m_LineLength2 = prop.FindPropertyRelative("m_LineLength2");
|
||||
SerializedProperty m_Border = prop.FindPropertyRelative("m_Border");
|
||||
SerializedProperty m_BorderWidth = prop.FindPropertyRelative("m_BorderWidth");
|
||||
SerializedProperty m_BorderColor = prop.FindPropertyRelative("m_BorderColor");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieLabelToggle, prop, null, show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_SerieLabelToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Position);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.LabelField(drawRect, "Offset");
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var tempWidth = (drawRect.width - startX + 52) / 2;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - 38, drawRect.y, tempWidth, drawRect.height);
|
||||
var x = EditorGUI.FloatField(centerXRect, m_Offset.vector3Value.x);
|
||||
var y = EditorGUI.FloatField(centerYRect, m_Offset.vector3Value.y);
|
||||
m_Offset.vector3Value = new Vector3(x, y);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Formatter);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rotate);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_PaddingLeftRight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_PaddingTopBottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Border);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BorderWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BorderColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Line);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineLength1);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineLength2);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_SerieLabelToggle, prop))
|
||||
{
|
||||
height += 22 * EditorGUIUtility.singleLineHeight + 21 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d30d82b48b553451fad726478777a02e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
101
Assets/XCharts/Editor/PropertyDrawers/SerieSymbolDrawer.cs
Normal file
101
Assets/XCharts/Editor/PropertyDrawers/SerieSymbolDrawer.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
|
||||
public class SerieSymbolDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_SerieSymbolToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_SizeType = prop.FindPropertyRelative("m_SizeType");
|
||||
SerializedProperty m_Size = prop.FindPropertyRelative("m_Size");
|
||||
SerializedProperty m_SelectedSize = prop.FindPropertyRelative("m_SelectedSize");
|
||||
SerializedProperty m_DataIndex = prop.FindPropertyRelative("m_DataIndex");
|
||||
SerializedProperty m_DataScale = prop.FindPropertyRelative("m_DataScale");
|
||||
SerializedProperty m_SelectedDataScale = prop.FindPropertyRelative("m_SelectedDataScale");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
|
||||
SerializedProperty m_StartIndex = prop.FindPropertyRelative("m_StartIndex");
|
||||
SerializedProperty m_Interval = prop.FindPropertyRelative("m_Interval");
|
||||
SerializedProperty m_ForceShowLast = prop.FindPropertyRelative("m_ForceShowLast");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieSymbolToggle, prop, null, m_Type, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_SerieSymbolToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_SizeType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
SerieSymbolSizeType sizeType = (SerieSymbolSizeType)m_SizeType.enumValueIndex;
|
||||
switch (sizeType)
|
||||
{
|
||||
case SerieSymbolSizeType.Custom:
|
||||
EditorGUI.PropertyField(drawRect, m_Size);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case SerieSymbolSizeType.FromData:
|
||||
EditorGUI.PropertyField(drawRect, m_DataIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_DataScale);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedDataScale);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case SerieSymbolSizeType.Callback:
|
||||
break;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Opacity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_StartIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Interval);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ForceShowLast);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (ChartEditorHelper.IsToggle(m_SerieSymbolToggle, prop))
|
||||
{
|
||||
SerializedProperty m_SizeType = prop.FindPropertyRelative("m_SizeType");
|
||||
SerieSymbolSizeType sizeType = (SerieSymbolSizeType)m_SizeType.enumValueIndex;
|
||||
switch (sizeType)
|
||||
{
|
||||
case SerieSymbolSizeType.Custom:
|
||||
return 9 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case SerieSymbolSizeType.FromData:
|
||||
return 10 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case SerieSymbolSizeType.Callback:
|
||||
return 9 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return 9 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0c4d3c3303994821bde654cf67d414d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/XCharts/Editor/PropertyDrawers/SeriesDrawer.cs
Normal file
58
Assets/XCharts/Editor/PropertyDrawers/SeriesDrawer.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
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
Assets/XCharts/Editor/PropertyDrawers/SeriesDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
65
Assets/XCharts/Editor/PropertyDrawers/SettingsDrawer.cs
Normal file
65
Assets/XCharts/Editor/PropertyDrawers/SettingsDrawer.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Settings), true)]
|
||||
public class SettingsDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_SettingsModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
SerializedProperty m_LineSmoothStyle = prop.FindPropertyRelative("m_LineSmoothStyle");
|
||||
SerializedProperty m_LineSmoothness = prop.FindPropertyRelative("m_LineSmoothness");
|
||||
SerializedProperty m_LineSegmentDistance = prop.FindPropertyRelative("m_LineSegmentDistance");
|
||||
SerializedProperty m_CicleSmoothness = prop.FindPropertyRelative("m_CicleSmoothness");
|
||||
SerializedProperty m_VisualMapTriangeLen = prop.FindPropertyRelative("m_VisualMapTriangeLen");
|
||||
SerializedProperty m_PieTooltipExtraRadius = prop.FindPropertyRelative("m_PieTooltipExtraRadius");
|
||||
SerializedProperty m_PieSelectedOffset = prop.FindPropertyRelative("m_PieSelectedOffset");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SettingsModuleToggle, "Settings");
|
||||
EditorGUI.LabelField(drawRect, "Settings", EditorStyles.boldLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_SettingsModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_LineSmoothStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineSmoothness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineSegmentDistance);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_CicleSmoothness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_VisualMapTriangeLen);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_PieTooltipExtraRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_PieSelectedOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int num = 1;
|
||||
if (m_SettingsModuleToggle)
|
||||
{
|
||||
num = 8;
|
||||
}
|
||||
return num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/SettingsDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/SettingsDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70536a1ba3af245e7ad3b11e97682d8d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
367
Assets/XCharts/Editor/PropertyDrawers/ThemeInfoDrawer.cs
Normal file
367
Assets/XCharts/Editor/PropertyDrawers/ThemeInfoDrawer.cs
Normal file
@@ -0,0 +1,367 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ThemeInfo), true)]
|
||||
public class ThemeInfoDrawer : PropertyDrawer
|
||||
{
|
||||
ReorderableList m_ColorPaletteList;
|
||||
bool m_ColorPaletteFoldout;
|
||||
bool m_ThemeModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
var defaultWidth = drawRect.width;
|
||||
var defaultX = drawRect.x;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Theme = prop.FindPropertyRelative("m_Theme");
|
||||
SerializedProperty m_Font = prop.FindPropertyRelative("m_Font");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_TextColor = prop.FindPropertyRelative("m_TitleTextColor");
|
||||
SerializedProperty m_SubTextColor = prop.FindPropertyRelative("m_TitleSubTextColor");
|
||||
SerializedProperty m_LegendTextColor = prop.FindPropertyRelative("m_LegendTextColor");
|
||||
SerializedProperty m_LegendUnableColor = prop.FindPropertyRelative("m_LegendUnableColor");
|
||||
SerializedProperty m_AxisTextColor = prop.FindPropertyRelative("m_AxisTextColor");
|
||||
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_TooltipLabelColor = prop.FindPropertyRelative("m_TooltipLabelColor");
|
||||
SerializedProperty m_TooltipLineColor = prop.FindPropertyRelative("m_TooltipLineColor");
|
||||
SerializedProperty m_DataZoomLineColor = prop.FindPropertyRelative("m_DataZoomLineColor");
|
||||
SerializedProperty m_DataZoomSelectedColor = prop.FindPropertyRelative("m_DataZoomSelectedColor");
|
||||
SerializedProperty m_DataZoomTextColor = prop.FindPropertyRelative("m_DataZoomTextColor");
|
||||
SerializedProperty m_VisualMapBackgroundColor = prop.FindPropertyRelative("m_VisualMapBackgroundColor");
|
||||
SerializedProperty m_VisualMapBorderColor = prop.FindPropertyRelative("m_VisualMapBorderColor");
|
||||
SerializedProperty m_ColorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
|
||||
SerializedProperty m_CustomFont = prop.FindPropertyRelative("m_CustomFont");
|
||||
SerializedProperty m_CustomBackgroundColor = prop.FindPropertyRelative("m_CustomBackgroundColor");
|
||||
SerializedProperty m_CustomTextColor = prop.FindPropertyRelative("m_CustomTitleTextColor");
|
||||
SerializedProperty m_CustomSubTextColor = prop.FindPropertyRelative("m_CustomTitleSubTextColor");
|
||||
SerializedProperty m_CustomLegendTextColor = prop.FindPropertyRelative("m_CustomLegendTextColor");
|
||||
SerializedProperty m_CustomLegendUnableColor = prop.FindPropertyRelative("m_CustomLegendUnableColor");
|
||||
SerializedProperty m_CustomAxisTextColor = prop.FindPropertyRelative("m_CustomAxisTextColor");
|
||||
SerializedProperty m_CustomAxisLineColor = prop.FindPropertyRelative("m_CustomAxisLineColor");
|
||||
SerializedProperty m_CustomAxisSplitLineColor = prop.FindPropertyRelative("m_CustomAxisSplitLineColor");
|
||||
SerializedProperty m_CustomTooltipBackgroundColor = prop.FindPropertyRelative("m_CustomTooltipBackgroundColor");
|
||||
SerializedProperty m_CustomTooltipFlagAreaColor = prop.FindPropertyRelative("m_CustomTooltipFlagAreaColor");
|
||||
SerializedProperty m_CustomTooltipTextColor = prop.FindPropertyRelative("m_CustomTooltipTextColor");
|
||||
SerializedProperty m_CustomTooltipLabelColor = prop.FindPropertyRelative("m_CustomTooltipLabelColor");
|
||||
SerializedProperty m_CustomTooltipLineColor = prop.FindPropertyRelative("m_CustomTooltipLineColor");
|
||||
SerializedProperty m_CustomDataZoomLineColor = prop.FindPropertyRelative("m_CustomDataZoomLineColor");
|
||||
SerializedProperty m_CustomDataZoomSelectedColor = prop.FindPropertyRelative("m_CustomDataZoomSelectedColor");
|
||||
SerializedProperty m_CustomDataZoomTextColor = prop.FindPropertyRelative("m_CustomDataZoomTextColor");
|
||||
SerializedProperty m_CustomVisualMapBackgroundColor = prop.FindPropertyRelative("m_CustomVisualMapBackgroundColor");
|
||||
SerializedProperty m_CustomVisualMapBorderColor = prop.FindPropertyRelative("m_CustomVisualMapBorderColor");
|
||||
SerializedProperty m_CustomColorPalette = prop.FindPropertyRelative("m_CustomColorPalette");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_ThemeModuleToggle, "Theme");
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2;
|
||||
drawRect.width = defaultWidth - EditorGUIUtility.labelWidth - (m_ThemeModuleToggle ? 45 : 0);
|
||||
EditorGUI.PropertyField(drawRect, m_Theme, GUIContent.none);
|
||||
if (m_ThemeModuleToggle)
|
||||
{
|
||||
drawRect.x = defaultWidth - 30;
|
||||
drawRect.width = 45;
|
||||
if (GUI.Button(drawRect, new GUIContent("Reset", "Reset to theme default color")))
|
||||
{
|
||||
m_CustomFont.objectReferenceValue = null;
|
||||
m_CustomBackgroundColor.colorValue = Color.clear;
|
||||
m_CustomTextColor.colorValue = Color.clear;
|
||||
m_CustomSubTextColor.colorValue = Color.clear;
|
||||
m_CustomLegendTextColor.colorValue = Color.clear;
|
||||
m_CustomLegendUnableColor.colorValue = Color.clear;
|
||||
m_CustomAxisTextColor.colorValue = Color.clear;
|
||||
m_CustomAxisLineColor.colorValue = Color.clear;
|
||||
m_CustomAxisSplitLineColor.colorValue = Color.clear;
|
||||
m_CustomTooltipBackgroundColor.colorValue = Color.clear;
|
||||
m_CustomTooltipFlagAreaColor.colorValue = Color.clear;
|
||||
m_CustomTooltipTextColor.colorValue = Color.clear;
|
||||
m_CustomTooltipLabelColor.colorValue = Color.clear;
|
||||
m_CustomTooltipLineColor.colorValue = Color.clear;
|
||||
m_CustomDataZoomLineColor.colorValue = Color.clear;
|
||||
m_CustomDataZoomSelectedColor.colorValue = Color.clear;
|
||||
m_CustomDataZoomTextColor.colorValue = Color.clear;
|
||||
m_CustomVisualMapBackgroundColor.colorValue = Color.clear;
|
||||
m_CustomVisualMapBorderColor.colorValue = Color.clear;
|
||||
for (int i = 0; i < m_CustomColorPalette.arraySize; i++)
|
||||
{
|
||||
m_CustomColorPalette.GetArrayElementAtIndex(i).colorValue = Color.clear;
|
||||
}
|
||||
|
||||
ThemeInfo defaultThemeInfo = ThemeInfo.Default;
|
||||
switch (m_Theme.enumValueIndex)
|
||||
{
|
||||
case ((int)Theme.Default): defaultThemeInfo = ThemeInfo.Default; break;
|
||||
case ((int)Theme.Light): defaultThemeInfo = ThemeInfo.Light; break;
|
||||
case ((int)Theme.Dark): defaultThemeInfo = ThemeInfo.Dark; break;
|
||||
}
|
||||
m_Font.objectReferenceValue = defaultThemeInfo.font;
|
||||
m_BackgroundColor.colorValue = defaultThemeInfo.backgroundColor;
|
||||
m_TextColor.colorValue = defaultThemeInfo.titleTextColor;
|
||||
m_SubTextColor.colorValue = defaultThemeInfo.titleSubTextColor;
|
||||
m_LegendTextColor.colorValue = defaultThemeInfo.legendTextColor;
|
||||
m_LegendUnableColor.colorValue = defaultThemeInfo.legendUnableColor;
|
||||
m_AxisTextColor.colorValue = defaultThemeInfo.axisTextColor;
|
||||
m_AxisLineColor.colorValue = defaultThemeInfo.axisLineColor;
|
||||
m_AxisSplitLineColor.colorValue = defaultThemeInfo.axisSplitLineColor;
|
||||
m_TooltipBackgroundColor.colorValue = defaultThemeInfo.tooltipBackgroundColor;
|
||||
m_TooltipFlagAreaColor.colorValue = defaultThemeInfo.tooltipFlagAreaColor;
|
||||
m_TooltipTextColor.colorValue = defaultThemeInfo.tooltipTextColor;
|
||||
m_TooltipLabelColor.colorValue = defaultThemeInfo.tooltipLabelColor;
|
||||
m_TooltipLineColor.colorValue = defaultThemeInfo.tooltipLineColor;
|
||||
m_DataZoomLineColor.colorValue = defaultThemeInfo.dataZoomLineColor;
|
||||
m_DataZoomSelectedColor.colorValue = defaultThemeInfo.dataZoomSelectedColor;
|
||||
m_DataZoomTextColor.colorValue = defaultThemeInfo.dataZoomTextColor;
|
||||
m_VisualMapBackgroundColor.colorValue = defaultThemeInfo.visualMapBackgroundColor;
|
||||
m_VisualMapBorderColor.colorValue = defaultThemeInfo.visualMapBorderColor;
|
||||
for (int i = 0; i < m_ColorPalette.arraySize; i++)
|
||||
{
|
||||
m_ColorPalette.GetArrayElementAtIndex(i).colorValue = defaultThemeInfo.GetColor(i);
|
||||
}
|
||||
}
|
||||
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = defaultX;
|
||||
drawRect.width = defaultWidth;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var font =m_CustomFont.objectReferenceValue != null?m_CustomFont: m_Font;
|
||||
EditorGUI.PropertyField(drawRect, font);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomFont.objectReferenceValue = font.objectReferenceValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var color = m_CustomBackgroundColor.colorValue != Color.clear ? m_CustomBackgroundColor : m_BackgroundColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Background Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomBackgroundColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTextColor.colorValue != Color.clear ? m_CustomTextColor : m_TextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Title Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomSubTextColor.colorValue != Color.clear ? m_CustomSubTextColor : m_SubTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Title SubText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomSubTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomLegendTextColor.colorValue != Color.clear ? m_CustomLegendTextColor : m_LegendTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("LegendText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomLegendTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomLegendUnableColor.colorValue != Color.clear ? m_CustomLegendUnableColor : m_LegendUnableColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("LegendUnable Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomLegendUnableColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomAxisTextColor.colorValue != Color.clear ? m_CustomAxisTextColor : m_AxisTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("AxisText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomAxisTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomAxisLineColor.colorValue != Color.clear ? m_CustomAxisLineColor : m_AxisLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("AxisLine Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomAxisLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomAxisSplitLineColor.colorValue != Color.clear ? m_CustomAxisSplitLineColor : m_AxisSplitLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("AxisSplitLine Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomAxisSplitLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipBackgroundColor.colorValue != Color.clear ? m_CustomTooltipBackgroundColor : m_TooltipBackgroundColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Background Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipBackgroundColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipFlagAreaColor.colorValue != Color.clear ? m_CustomTooltipFlagAreaColor : m_TooltipFlagAreaColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip FlagArea Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipFlagAreaColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipTextColor.colorValue != Color.clear ? m_CustomTooltipTextColor : m_TooltipTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipLabelColor.colorValue != Color.clear ? m_CustomTooltipLabelColor : m_TooltipLabelColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Label Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipLabelColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipLineColor.colorValue != Color.clear ? m_CustomTooltipLineColor : m_TooltipLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Line Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomDataZoomLineColor.colorValue != Color.clear ? m_CustomDataZoomLineColor : m_DataZoomLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("DataZoom Line Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomDataZoomLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomDataZoomSelectedColor.colorValue != Color.clear ? m_CustomDataZoomSelectedColor : m_DataZoomSelectedColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("DataZoom Selected Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomDataZoomSelectedColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomDataZoomTextColor.colorValue != Color.clear ? m_CustomDataZoomTextColor : m_DataZoomTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("DataZoom Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomDataZoomTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomVisualMapBackgroundColor.colorValue != Color.clear ? m_CustomVisualMapBackgroundColor : m_VisualMapBackgroundColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("VisualMap Background Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomVisualMapBackgroundColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomVisualMapBorderColor.colorValue != Color.clear ? m_CustomVisualMapBorderColor : m_VisualMapBorderColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("VisualMap Border Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomVisualMapBorderColor.colorValue = color.colorValue;
|
||||
}
|
||||
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++)
|
||||
{
|
||||
while (i > m_CustomColorPalette.arraySize - 1)
|
||||
{
|
||||
m_CustomColorPalette.InsertArrayElementAtIndex(m_CustomColorPalette.arraySize);
|
||||
}
|
||||
var customElement = m_CustomColorPalette.GetArrayElementAtIndex(i);
|
||||
color = customElement.colorValue != Color.clear ?
|
||||
customElement :
|
||||
m_ColorPalette.GetArrayElementAtIndex(i);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.PropertyField(drawRect, color);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
customElement.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (!m_ThemeModuleToggle)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
float height = 0;
|
||||
int propertyCount = 20;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
67
Assets/XCharts/Editor/PropertyDrawers/TitleDrawer.cs
Normal file
67
Assets/XCharts/Editor/PropertyDrawers/TitleDrawer.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
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
Assets/XCharts/Editor/PropertyDrawers/TitleDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
63
Assets/XCharts/Editor/PropertyDrawers/TooltipDrawer.cs
Normal file
63
Assets/XCharts/Editor/PropertyDrawers/TooltipDrawer.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
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");
|
||||
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_Formatter = prop.FindPropertyRelative("m_Formatter");
|
||||
SerializedProperty m_FixedWidth = prop.FindPropertyRelative("m_FixedWidth");
|
||||
SerializedProperty m_FixedHeight = prop.FindPropertyRelative("m_FixedHeight");
|
||||
SerializedProperty m_MinWidth = prop.FindPropertyRelative("m_MinWidth");
|
||||
SerializedProperty m_MinHeight = prop.FindPropertyRelative("m_MinHeight");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_TooltipModuleToggle)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Formatter);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FixedWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FixedHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_MinWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_MinHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_TooltipModuleToggle)
|
||||
return 9 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/PropertyDrawers/TooltipDrawer.cs.meta
Normal file
13
Assets/XCharts/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:
|
||||
145
Assets/XCharts/Editor/PropertyDrawers/VisualMapDrawer.cs
Normal file
145
Assets/XCharts/Editor/PropertyDrawers/VisualMapDrawer.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(VisualMap), true)]
|
||||
public class VisualMapDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_VisualMapModuleToggle = false;
|
||||
private bool m_InRangeFoldout;
|
||||
private bool m_OutOfRangeFoldout;
|
||||
private int m_InRangeSize;
|
||||
private int m_OutOfRangeSize;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Enable = prop.FindPropertyRelative("m_Enable");
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_Show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_SelectedMode = prop.FindPropertyRelative("m_SelectedMode");
|
||||
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
|
||||
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
|
||||
SerializedProperty m_Range = prop.FindPropertyRelative("m_Range");
|
||||
SerializedProperty m_Text = prop.FindPropertyRelative("m_Text");
|
||||
// SerializedProperty m_TextGap = prop.FindPropertyRelative("m_TextGap");
|
||||
SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
SerializedProperty m_Calculable = prop.FindPropertyRelative("m_Calculable");
|
||||
SerializedProperty m_ItemWidth = prop.FindPropertyRelative("m_ItemWidth");
|
||||
SerializedProperty m_ItemHeight = prop.FindPropertyRelative("m_ItemHeight");
|
||||
SerializedProperty m_BorderWidth = prop.FindPropertyRelative("m_BorderWidth");
|
||||
SerializedProperty m_Dimension = prop.FindPropertyRelative("m_Dimension");
|
||||
SerializedProperty m_HoverLink = prop.FindPropertyRelative("m_HoverLink");
|
||||
SerializedProperty m_Orient = prop.FindPropertyRelative("m_Orient");
|
||||
SerializedProperty m_Location = prop.FindPropertyRelative("m_Location");
|
||||
SerializedProperty m_InRange = prop.FindPropertyRelative("m_InRange");
|
||||
// SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_VisualMapModuleToggle, "Visual Map", m_Enable);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_VisualMapModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Min);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Dimension);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_HoverLink);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
m_InRangeFoldout = EditorGUI.Foldout(drawRect, m_InRangeFoldout, "InRange");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_InRangeFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_InRangeSize, m_InRange);
|
||||
}
|
||||
|
||||
// drawRect.width = pos.width;
|
||||
// m_OutOfRangeFoldout = EditorGUI.Foldout(drawRect, m_OutOfRangeFoldout, "OutOfRange");
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// if (m_OutOfRangeFoldout)
|
||||
// {
|
||||
// ChartEditorHelper.MakeList(ref drawRect, ref m_OutOfRangeSize, m_OutOfRange);
|
||||
// }
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_Show.boolValue)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Range, "Range");
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Text, "Text");
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Text, "TextGap");
|
||||
EditorGUI.PropertyField(drawRect, m_Calculable);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ItemWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ItemHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BorderWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Orient);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Location);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Location);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
int num = 1;
|
||||
if (m_VisualMapModuleToggle)
|
||||
{
|
||||
num += 8;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (m_InRangeFoldout)
|
||||
{
|
||||
SerializedProperty m_InRange = prop.FindPropertyRelative("m_InRange");
|
||||
int size = m_InRange.arraySize + 1;
|
||||
height += size * EditorGUIUtility.singleLineHeight + (size - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
// if (m_OutOfRangeFoldout)
|
||||
// {
|
||||
// SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange");
|
||||
// int size = m_OutOfRange.arraySize + 1;
|
||||
// height += size * EditorGUIUtility.singleLineHeight + (size - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
// height += EditorGUIUtility.standardVerticalSpacing;
|
||||
// }
|
||||
if (prop.FindPropertyRelative("m_Show").boolValue)
|
||||
{
|
||||
height += 9 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Location"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fe31d791669a4014ac78fd7a2af9a6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/XCharts/Editor/PropertyDrawers/XAxisDrawer.cs
Normal file
24
Assets/XCharts/Editor/PropertyDrawers/XAxisDrawer.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(XAxis), true)]
|
||||
public class XAxisDrawer : AxisDrawer
|
||||
{
|
||||
protected override string GetDisplayName(string displayName)
|
||||
{
|
||||
if (displayName.StartsWith("Element"))
|
||||
{
|
||||
displayName = displayName.Replace("Element", "X Axis");
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/XAxisDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/XAxisDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 723807bbaeaa64991a421011ce530266
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/XCharts/Editor/PropertyDrawers/YAxisDrawer.cs
Normal file
24
Assets/XCharts/Editor/PropertyDrawers/YAxisDrawer.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(YAxis), true)]
|
||||
public class YAxisDrawer : AxisDrawer
|
||||
{
|
||||
protected override string GetDisplayName(string displayName)
|
||||
{
|
||||
if (displayName.StartsWith("Element"))
|
||||
{
|
||||
displayName = displayName.Replace("Element", "Y Axis");
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/YAxisDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/YAxisDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d1fca6c98f3d41fd989d0e41fbd4eb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/XCharts/Editor/RadarChartEditor.cs
Normal file
35
Assets/XCharts/Editor/RadarChartEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI RadarChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(RadarChart), false)]
|
||||
public class RadarChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Radar;
|
||||
protected SerializedProperty m_Radars;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (RadarChart)target;
|
||||
m_Radars = serializedObject.FindProperty("m_Radars");
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_Radars, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/RadarChartEditor.cs.meta
Normal file
13
Assets/XCharts/Editor/RadarChartEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ea6609b1e1634241947b4ef14c38849
|
||||
timeCreated: 1555512890
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/XCharts/Editor/ScatterChartEditor.cs
Normal file
30
Assets/XCharts/Editor/ScatterChartEditor.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI ScatterChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(ScatterChart), false)]
|
||||
public class ScatterChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (ScatterChart)target;
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/ScatterChartEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/ScatterChartEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3995bd8e5f80b49008624a5746622f68
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/XCharts/Editor/Utility.meta
Normal file
10
Assets/XCharts/Editor/Utility.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb0b30c9bc2c84f46a99514a69d7e462
|
||||
folderAsset: yes
|
||||
timeCreated: 1555303340
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
212
Assets/XCharts/Editor/Utility/ChartEditorHelper.cs
Normal file
212
Assets/XCharts/Editor/Utility/ChartEditorHelper.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ChartEditorHelper
|
||||
{
|
||||
public static GUIStyle headerStyle = EditorStyles.boldLabel;
|
||||
public static GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout)
|
||||
{
|
||||
font = headerStyle.font,
|
||||
fontStyle = headerStyle.fontStyle,
|
||||
};
|
||||
|
||||
public static void SecondField(Rect drawRect, SerializedProperty prop)
|
||||
{
|
||||
RectOffset offset = new RectOffset(-(int)EditorGUIUtility.labelWidth, 0, 0, 0);
|
||||
drawRect = offset.Add(drawRect);
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
drawRect = offset.Remove(drawRect);
|
||||
}
|
||||
|
||||
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name)
|
||||
{
|
||||
while (arrayProp.arraySize < 2)
|
||||
{
|
||||
arrayProp.InsertArrayElementAtIndex(arrayProp.arraySize);
|
||||
}
|
||||
MakeTwoField(ref drawRect, rectWidth, arrayProp.GetArrayElementAtIndex(0), arrayProp.GetArrayElementAtIndex(1), name);
|
||||
}
|
||||
|
||||
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty prop1, SerializedProperty prop2, string name)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var diff = 14 + EditorGUI.indentLevel * 14;
|
||||
var offset = diff - 15;
|
||||
var tempWidth = (rectWidth - startX + diff) / 2;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth, drawRect.height);
|
||||
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
public static void MakeJsonData(ref Rect drawRect, ref bool showTextArea, ref string inputString,
|
||||
SerializedProperty prop, float currentWidth, float diff = 0)
|
||||
{
|
||||
SerializedProperty stringDataProp = prop.FindPropertyRelative("m_JsonData");
|
||||
SerializedProperty needParseProp = prop.FindPropertyRelative("m_DataFromJson");
|
||||
float defalutX = drawRect.x;
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 14 + diff;
|
||||
drawRect.width = currentWidth - EditorGUIUtility.labelWidth - diff;
|
||||
if (GUI.Button(drawRect, new GUIContent("Parse JsonData", "Parse data from input json")))
|
||||
{
|
||||
showTextArea = !showTextArea;
|
||||
bool needParse = !showTextArea;
|
||||
if (needParse)
|
||||
{
|
||||
stringDataProp.stringValue = inputString;
|
||||
needParseProp.boolValue = true;
|
||||
}
|
||||
}
|
||||
drawRect.x = defalutX;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (showTextArea)
|
||||
{
|
||||
drawRect.width = currentWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight * 4;
|
||||
inputString = EditorGUI.TextArea(drawRect, inputString);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool MakeFoldout(ref Rect drawRect, ref bool moduleToggle, string content,
|
||||
SerializedProperty prop = null, bool bold = true)
|
||||
{
|
||||
float defaultWidth = drawRect.width;
|
||||
float defaultX = drawRect.x;
|
||||
drawRect.width = EditorGUIUtility.labelWidth;
|
||||
moduleToggle = EditorGUI.Foldout(drawRect, moduleToggle, content, bold ? foldoutStyle : EditorStyles.foldout);
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2;
|
||||
drawRect.width = 40;
|
||||
if (prop != null)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
}
|
||||
drawRect.width = defaultWidth;
|
||||
drawRect.x = defaultX;
|
||||
return moduleToggle;
|
||||
}
|
||||
|
||||
public static bool MakeFoldout(ref Rect drawRect, ref Dictionary<string, bool> moduleToggle, SerializedProperty prop,
|
||||
string moduleName, SerializedProperty showProp = null, bool bold = true)
|
||||
{
|
||||
var key = prop.propertyPath;
|
||||
if (!moduleToggle.ContainsKey(key))
|
||||
{
|
||||
moduleToggle.Add(key, false);
|
||||
}
|
||||
var toggle = moduleToggle[key];
|
||||
|
||||
float defaultWidth = drawRect.width;
|
||||
float defaultX = drawRect.x;
|
||||
drawRect.width = EditorGUIUtility.labelWidth;
|
||||
var displayName = string.IsNullOrEmpty(moduleName) ? prop.displayName : moduleName;
|
||||
toggle = EditorGUI.Foldout(drawRect, toggle, displayName, bold ? foldoutStyle : EditorStyles.foldout);
|
||||
if (moduleToggle[key] != toggle)
|
||||
{
|
||||
moduleToggle[key] = toggle;
|
||||
}
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2;
|
||||
if (showProp != null)
|
||||
{
|
||||
if (showProp.propertyType == SerializedPropertyType.Boolean)
|
||||
{
|
||||
drawRect.width = 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect.width = defaultWidth - drawRect.x + 15;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, showProp, GUIContent.none);
|
||||
}
|
||||
drawRect.width = defaultWidth;
|
||||
drawRect.x = defaultX;
|
||||
return toggle;
|
||||
}
|
||||
|
||||
public static void MakeList(ref Rect drawRect, ref int listSize, SerializedProperty listProp, SerializedProperty large = null)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
listSize = listProp.arraySize;
|
||||
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
||||
if (listSize < 0) listSize = 0;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (listSize != listProp.arraySize)
|
||||
{
|
||||
while (listSize > listProp.arraySize)
|
||||
listProp.InsertArrayElementAtIndex(listProp.arraySize);
|
||||
while (listSize < listProp.arraySize)
|
||||
listProp.DeleteArrayElementAtIndex(listProp.arraySize - 1);
|
||||
}
|
||||
if (listSize > 30)
|
||||
{
|
||||
SerializedProperty element;
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
element = listProp.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (num >= 10)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, "...");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
element = listProp.GetArrayElementAtIndex(listSize - 1);
|
||||
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + (listSize - 1)));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < listProp.arraySize; i++)
|
||||
{
|
||||
SerializedProperty element = listProp.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
public static int InitModuleToggle(ref List<bool> moduleToggle, SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
var temp = prop.displayName.Split(' ');
|
||||
if (temp == null || temp.Length < 2)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int.TryParse(temp[1], out index);
|
||||
}
|
||||
if (index >= moduleToggle.Count)
|
||||
{
|
||||
moduleToggle.Add(false);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public static int GetIndexFromPath(SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
var sindex = prop.propertyPath.LastIndexOf('[');
|
||||
var eindex = prop.propertyPath.LastIndexOf(']');
|
||||
if (sindex >= 0 && eindex >= 0)
|
||||
{
|
||||
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
|
||||
int.TryParse(str, out index);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public static bool IsToggle(Dictionary<string, bool> toggle, SerializedProperty prop)
|
||||
{
|
||||
return toggle.ContainsKey(prop.propertyPath) && toggle[prop.propertyPath] == true;
|
||||
}
|
||||
}
|
||||
13
Assets/XCharts/Editor/Utility/ChartEditorHelper.cs.meta
Normal file
13
Assets/XCharts/Editor/Utility/ChartEditorHelper.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd22466b776d93c4cb0b252ee510cc7a
|
||||
timeCreated: 1555303340
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/XCharts/Editor/XCharts.Editor.asmdef
Normal file
16
Assets/XCharts/Editor/XCharts.Editor.asmdef
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "XCharts.Editor",
|
||||
"references": [
|
||||
"XCharts.Runtime"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": []
|
||||
}
|
||||
7
Assets/XCharts/Editor/XCharts.Editor.asmdef.meta
Normal file
7
Assets/XCharts/Editor/XCharts.Editor.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9639efc34ea6e4056830a23233b99b16
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user