mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 21:38:49 +00:00
3.0 commit
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,6 +15,8 @@
|
|||||||
/Assets/Package.meta
|
/Assets/Package.meta
|
||||||
/Assets/TextMesh Pro
|
/Assets/TextMesh Pro
|
||||||
/Assets/TextMesh Pro.meta
|
/Assets/TextMesh Pro.meta
|
||||||
|
/Assets/XChartsExtensions
|
||||||
|
/Assets/XChartsExtensions.meta
|
||||||
/Doc/*.meta
|
/Doc/*.meta
|
||||||
|
|
||||||
/Assets/XChartsDemo/demo_test.unity
|
/Assets/XChartsDemo/demo_test.unity
|
||||||
|
|||||||
@@ -229,6 +229,7 @@
|
|||||||
* `{b}`为当前所指示或`index`为`0`的`serie`的数据项`serieData`的`name`,或者类目值(如折线图的`X`轴)。
|
* `{b}`为当前所指示或`index`为`0`的`serie`的数据项`serieData`的`name`,或者类目值(如折线图的`X`轴)。
|
||||||
* `{c}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)的数值。
|
* `{c}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)的数值。
|
||||||
* `{d}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)百分比值,注意不带`%`号。
|
* `{d}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)百分比值,注意不带`%`号。
|
||||||
|
* `{e}`为当前所指示或`index`为`0`的`serie`的数据项`serieData`的`name`。
|
||||||
* `{.1}`表示指定`index`为`1`的`serie`对应颜色的圆点。
|
* `{.1}`表示指定`index`为`1`的`serie`对应颜色的圆点。
|
||||||
* `{a1}`、`{b1}`、`{c1}`中的`1`表示指定`index`为`1`的`serie`。
|
* `{a1}`、`{b1}`、`{c1}`中的`1`表示指定`index`为`1`的`serie`。
|
||||||
* `{c1:2}`表示索引为`1`的`serie`的当前指示数据项的第`3`个数据(一个数据项有多个数据,index为`2`表示第`3`个数据)。
|
* `{c1:2}`表示索引为`1`的`serie`的当前指示数据项的第`3`个数据(一个数据项有多个数据,index为`2`表示第`3`个数据)。
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ Tooltip component.
|
|||||||
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`, or a `category` value (such as the X-axis of a line chart).
|
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`, or a `category` value (such as the X-axis of a line chart).
|
||||||
* `{c}` is the value of a Y-dimension (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`.
|
* `{c}` is the value of a Y-dimension (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`.
|
||||||
* `{d}` is the percentage value of Y-dimensions (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`, with no `%` sign.
|
* `{d}` is the percentage value of Y-dimensions (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`, with no `%` sign.
|
||||||
|
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`.
|
||||||
* `{.1}` represents a dot from serie corresponding color that specifies `index` as `1`.
|
* `{.1}` represents a dot from serie corresponding color that specifies `index` as `1`.
|
||||||
* `1` in `{a1}`, `{b1}`, `{c1}` represents a `serie` that specifies an `index` of `1`.
|
* `1` in `{a1}`, `{b1}`, `{c1}` represents a `serie` that specifies an `index` of `1`.
|
||||||
* `{c1:2}` represents the third data from `serie`'s current indication data item indexed to `1` (a data item has multiple data, `index` 2 represents the third data).
|
* `{c1:2}` represents the third data from `serie`'s current indication data item indexed to `1` (a data item has multiple data, `index` 2 represents the third data).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 0ad1e8940e4805b49a18ea7a2cbd4bce
|
guid: 8e7c19967ca244147b0fcbb129201b46
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
@@ -5,18 +6,18 @@
|
|||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
public static class ItemStyleHelper
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||||
|
public sealed class ComponentEditorAttribute : Attribute
|
||||||
{
|
{
|
||||||
public static bool IsNeedCorner(ItemStyle itemStyle)
|
public readonly Type componentType;
|
||||||
|
|
||||||
|
public ComponentEditorAttribute(Type componentType)
|
||||||
{
|
{
|
||||||
if (itemStyle.cornerRadius == null) return false;
|
this.componentType = componentType;
|
||||||
foreach (var value in itemStyle.cornerRadius)
|
|
||||||
{
|
|
||||||
if (value != 0) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1bc2ab7ace40d480e839052673b65a5d
|
guid: f433acf13ec404a6d91eb78352d18d4d
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
@@ -5,16 +6,18 @@
|
|||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
using UnityEngine;
|
using System;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
public static class ThemeHelper
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||||
|
public sealed class SerieEditorAttribute : Attribute
|
||||||
{
|
{
|
||||||
public static Color32 GetBackgroundColor(ChartTheme theme, Background background)
|
public readonly Type serieType;
|
||||||
|
|
||||||
|
public SerieEditorAttribute(Type serieType)
|
||||||
{
|
{
|
||||||
if (background.show && background.hideThemeBackgroundColor) return ChartConst.clearColor32;
|
this.serieType = serieType;
|
||||||
else return theme.backgroundColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5acea6fd06c0e9c498c434f941e4cba9
|
guid: dcdc7a72224af419d96584fa40f822c9
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 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();
|
|
||||||
if(target == null) return;
|
|
||||||
m_Chart = (BarChart)target;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnEndInspectorGUI()
|
|
||||||
{
|
|
||||||
base.OnEndInspectorGUI();
|
|
||||||
if (m_Chart == null && target == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,335 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/************************************************/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Editor class used to edit UI BaseChart.
|
|
||||||
/// </summary>
|
|
||||||
[CustomEditor(typeof(BaseChart), false)]
|
|
||||||
public class BaseChartEditor : Editor
|
|
||||||
{
|
|
||||||
#if UNITY_2019_3_OR_NEWER
|
|
||||||
private const float k_IconWidth = 14;
|
|
||||||
private const float k_IconGap = 0f;
|
|
||||||
private const float k_IconXOffset = 10f;
|
|
||||||
private const float k_IconYOffset = -1.5f;
|
|
||||||
#else
|
|
||||||
private const float k_IconWidth = 14;
|
|
||||||
private const float k_IconGap = 0f;
|
|
||||||
private const float k_IconXOffset = 4f;
|
|
||||||
private const float k_IconYOffset = -3f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected BaseChart m_Chart;
|
|
||||||
protected SerializedProperty m_Script;
|
|
||||||
protected SerializedProperty m_MultiComponentMode;
|
|
||||||
protected SerializedProperty m_EnableTextMeshPro;
|
|
||||||
protected SerializedProperty m_ChartWidth;
|
|
||||||
protected SerializedProperty m_ChartHeight;
|
|
||||||
protected SerializedProperty m_Settings;
|
|
||||||
protected SerializedProperty m_Theme;
|
|
||||||
protected SerializedProperty m_Background;
|
|
||||||
protected SerializedProperty m_Titles;
|
|
||||||
protected SerializedProperty m_Legends;
|
|
||||||
protected SerializedProperty m_Tooltips;
|
|
||||||
protected SerializedProperty m_Vessels;
|
|
||||||
protected SerializedProperty m_Radars;
|
|
||||||
protected SerializedProperty m_Series;
|
|
||||||
protected SerializedProperty m_Large;
|
|
||||||
protected SerializedProperty m_ChartName;
|
|
||||||
protected SerializedProperty m_DebugMode;
|
|
||||||
|
|
||||||
protected float m_DefaultLabelWidth;
|
|
||||||
protected float m_DefaultFieldWidth;
|
|
||||||
private int m_SeriesSize;
|
|
||||||
private Vector2 scrollPos;
|
|
||||||
private bool m_CheckWarning = false;
|
|
||||||
private StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
private bool m_BaseFoldout;
|
|
||||||
private bool m_CustomFoldout;
|
|
||||||
protected bool m_ShowAllComponent;
|
|
||||||
protected Dictionary<string, bool> m_Flodouts = new Dictionary<string, bool>();
|
|
||||||
|
|
||||||
protected virtual void OnEnable()
|
|
||||||
{
|
|
||||||
if (target == null) return;
|
|
||||||
m_Chart = (BaseChart)target;
|
|
||||||
m_Script = serializedObject.FindProperty("m_Script");
|
|
||||||
m_MultiComponentMode = serializedObject.FindProperty("m_MultiComponentMode");
|
|
||||||
m_EnableTextMeshPro = serializedObject.FindProperty("m_EnableTextMeshPro");
|
|
||||||
m_ChartName = serializedObject.FindProperty("m_ChartName");
|
|
||||||
m_ChartWidth = serializedObject.FindProperty("m_ChartWidth");
|
|
||||||
m_ChartHeight = serializedObject.FindProperty("m_ChartHeight");
|
|
||||||
m_Theme = serializedObject.FindProperty("m_Theme");
|
|
||||||
m_Settings = serializedObject.FindProperty("m_Settings");
|
|
||||||
m_Background = serializedObject.FindProperty("m_Background");
|
|
||||||
m_Titles = serializedObject.FindProperty("m_Titles");
|
|
||||||
m_Legends = serializedObject.FindProperty("m_Legends");
|
|
||||||
m_Tooltips = serializedObject.FindProperty("m_Tooltips");
|
|
||||||
m_Vessels = serializedObject.FindProperty("m_Vessels");
|
|
||||||
m_Series = serializedObject.FindProperty("m_Series");
|
|
||||||
m_Radars = serializedObject.FindProperty("m_Radars");
|
|
||||||
|
|
||||||
m_Large = serializedObject.FindProperty("m_Large");
|
|
||||||
m_DebugMode = serializedObject.FindProperty("m_DebugMode");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
|
||||||
{
|
|
||||||
if (m_Chart == null && target == null)
|
|
||||||
{
|
|
||||||
base.OnInspectorGUI();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
serializedObject.Update();
|
|
||||||
m_DefaultLabelWidth = EditorGUIUtility.labelWidth;
|
|
||||||
m_DefaultFieldWidth = EditorGUIUtility.fieldWidth;
|
|
||||||
|
|
||||||
OnStartInspectorGUI();
|
|
||||||
OnMiddleInspectorGUI();
|
|
||||||
OnEndInspectorGUI();
|
|
||||||
OnDebugInspectorGUI();
|
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnStartInspectorGUI()
|
|
||||||
{
|
|
||||||
BlockStart();
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
var version = string.Format("v{0}_{1}", XChartsMgr.version, XChartsMgr.versionDate);
|
|
||||||
if (m_EnableTextMeshPro.boolValue)
|
|
||||||
{
|
|
||||||
version += " TMP";
|
|
||||||
}
|
|
||||||
EditorGUILayout.LabelField(version);
|
|
||||||
|
|
||||||
if (GUILayout.Button("Github"))
|
|
||||||
{
|
|
||||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
|
|
||||||
}
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
BlockEnd();
|
|
||||||
|
|
||||||
BlockStart();
|
|
||||||
m_BaseFoldout = EditorGUILayout.Foldout(m_BaseFoldout, "Base", true);
|
|
||||||
if (m_BaseFoldout)
|
|
||||||
{
|
|
||||||
EditorGUILayout.PropertyField(m_Script);
|
|
||||||
EditorGUILayout.PropertyField(m_ChartName);
|
|
||||||
var fileds = m_Chart.GetCustomChartInspectorShowFileds();
|
|
||||||
if (fileds != null && fileds.Length > 0)
|
|
||||||
{
|
|
||||||
foreach (var filed in fileds)
|
|
||||||
{
|
|
||||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BlockEnd();
|
|
||||||
|
|
||||||
BlockField(m_Theme);
|
|
||||||
BlockField(m_Settings);
|
|
||||||
BlockField(m_Background);
|
|
||||||
|
|
||||||
m_ShowAllComponent = m_MultiComponentMode.boolValue;
|
|
||||||
BlockListField(m_ShowAllComponent, m_Titles);
|
|
||||||
BlockListField(m_ShowAllComponent, m_Legends);
|
|
||||||
BlockListField(m_ShowAllComponent, m_Tooltips);
|
|
||||||
BlockListField(m_ShowAllComponent, SerieType.Liquid, m_Vessels);
|
|
||||||
BlockListField(m_ShowAllComponent, SerieType.Radar, m_Radars);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnMiddleInspectorGUI()
|
|
||||||
{
|
|
||||||
BlockField(m_Series);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnEndInspectorGUI()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnDebugInspectorGUI()
|
|
||||||
{
|
|
||||||
BlockStart();
|
|
||||||
EditorGUILayout.PropertyField(m_DebugMode);
|
|
||||||
EditorGUILayout.PropertyField(m_MultiComponentMode);
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
MoreDebugInspector();
|
|
||||||
CheckWarning();
|
|
||||||
BlockEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void MoreDebugInspector()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void BlockStart()
|
|
||||||
{
|
|
||||||
if (XChartsSettings.editorBlockEnable) EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void BlockEnd()
|
|
||||||
{
|
|
||||||
if (XChartsSettings.editorBlockEnable) EditorGUILayout.EndVertical();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void BlockField(params SerializedProperty[] props)
|
|
||||||
{
|
|
||||||
if (props.Length == 0) return;
|
|
||||||
BlockStart();
|
|
||||||
foreach (var prop in props)
|
|
||||||
EditorGUILayout.PropertyField(prop, true);
|
|
||||||
BlockEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void BlockListField(bool all, params SerializedProperty[] props)
|
|
||||||
{
|
|
||||||
if (props.Length == 0) return;
|
|
||||||
BlockStart();
|
|
||||||
foreach (var prop in props)
|
|
||||||
{
|
|
||||||
if (all)
|
|
||||||
{
|
|
||||||
var flag = m_Flodouts.ContainsKey(prop.displayName) && m_Flodouts[prop.displayName];
|
|
||||||
m_Flodouts[prop.displayName] = EditorGUILayout.Foldout(flag, prop.displayName, true);
|
|
||||||
if (m_Flodouts[prop.displayName])
|
|
||||||
{
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
|
|
||||||
currRect.y -= EditorGUIUtility.singleLineHeight;
|
|
||||||
var rect1 = new Rect(currRect.width + k_IconXOffset,
|
|
||||||
currRect.y + k_IconYOffset,
|
|
||||||
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
|
||||||
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd, ChartEditorHelper.Styles.invisibleButton))
|
|
||||||
{
|
|
||||||
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
|
|
||||||
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
chart.RemoveChartObject();
|
|
||||||
chart.RefreshAllComponent();
|
|
||||||
}
|
|
||||||
for (int i = 0; i < prop.arraySize; i++)
|
|
||||||
{
|
|
||||||
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
|
|
||||||
currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
|
|
||||||
currRect.y -= EditorGUI.GetPropertyHeight(prop.GetArrayElementAtIndex(i));
|
|
||||||
rect1 = new Rect(currRect.width + k_IconXOffset,
|
|
||||||
currRect.y + k_IconYOffset,
|
|
||||||
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
|
||||||
var oldColor = GUI.contentColor;
|
|
||||||
GUI.contentColor = Color.black;
|
|
||||||
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconRemove, ChartEditorHelper.Styles.invisibleButton))
|
|
||||||
{
|
|
||||||
if (prop.arraySize == 1)
|
|
||||||
{
|
|
||||||
if (EditorUtility.DisplayDialog("Delete component", "Confirm to delete last component?", "Sure", "Cancel"))
|
|
||||||
{
|
|
||||||
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
|
||||||
prop.DeleteArrayElementAtIndex(i);
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
chart.RemoveChartObject();
|
|
||||||
chart.RefreshAllComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (i < prop.arraySize && i >= 0)
|
|
||||||
{
|
|
||||||
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
|
||||||
prop.DeleteArrayElementAtIndex(i);
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
chart.RemoveChartObject();
|
|
||||||
chart.RefreshAllComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var rect2 = new Rect(currRect.width + k_IconXOffset - k_IconWidth - k_IconGap,
|
|
||||||
currRect.y + k_IconYOffset,
|
|
||||||
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
|
||||||
if (GUI.Button(rect2, ChartEditorHelper.Styles.iconDown, ChartEditorHelper.Styles.invisibleButton))
|
|
||||||
{
|
|
||||||
if (i < prop.arraySize - 1) prop.MoveArrayElement(i, i + 1);
|
|
||||||
}
|
|
||||||
var rect3 = new Rect(currRect.width + k_IconXOffset - 2 * (k_IconWidth + k_IconGap),
|
|
||||||
currRect.y + k_IconYOffset,
|
|
||||||
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
|
||||||
if (GUI.Button(rect3, ChartEditorHelper.Styles.iconUp, ChartEditorHelper.Styles.invisibleButton))
|
|
||||||
{
|
|
||||||
if (i > 0) prop.MoveArrayElement(i, i - 1);
|
|
||||||
}
|
|
||||||
GUI.contentColor = oldColor;
|
|
||||||
}
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (prop.arraySize > 0) EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(0), true);
|
|
||||||
}
|
|
||||||
BlockEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void BlockListField(bool all, SerieType serieType, params SerializedProperty[] props)
|
|
||||||
{
|
|
||||||
if (!m_Chart.ContainsSerie(serieType)) return;
|
|
||||||
BlockListField(all, props);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckWarning()
|
|
||||||
{
|
|
||||||
if (GUILayout.Button("Remove All Chart Object"))
|
|
||||||
{
|
|
||||||
m_Chart.RemoveChartObject();
|
|
||||||
}
|
|
||||||
// if (GUILayout.Button("Check XCharts Update"))
|
|
||||||
// {
|
|
||||||
// CheckVersionEditor.ShowWindow();
|
|
||||||
// }
|
|
||||||
if (m_CheckWarning)
|
|
||||||
{
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
if (GUILayout.Button("Check Warning"))
|
|
||||||
{
|
|
||||||
m_CheckWarning = true;
|
|
||||||
m_Chart.CheckWarning();
|
|
||||||
}
|
|
||||||
if (GUILayout.Button("Hide Warning"))
|
|
||||||
{
|
|
||||||
m_CheckWarning = false;
|
|
||||||
}
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
sb.Length = 0;
|
|
||||||
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
|
|
||||||
if (!string.IsNullOrEmpty(m_Chart.warningInfo))
|
|
||||||
{
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.Append(m_Chart.warningInfo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.Append("Perfect! No warning!");
|
|
||||||
}
|
|
||||||
EditorGUILayout.HelpBox(sb.ToString(), MessageType.Warning);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (GUILayout.Button("Check warning"))
|
|
||||||
{
|
|
||||||
m_CheckWarning = true;
|
|
||||||
m_Chart.CheckWarning();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/************************************************/
|
|
||||||
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Editor class used to edit UI CandlestickChart.
|
|
||||||
/// </summary>
|
|
||||||
[CustomEditor(typeof(CandlestickChart), false)]
|
|
||||||
public class CandlestickChartEditor : CoordinateChartEditor
|
|
||||||
{
|
|
||||||
protected override void OnEnable()
|
|
||||||
{
|
|
||||||
base.OnEnable();
|
|
||||||
if(target == null) return;
|
|
||||||
m_Chart = (CandlestickChart)target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: cb0b30c9bc2c84f46a99514a69d7e462
|
guid: 9e4407eed14ec4e518a373f4d8ae9b3c
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
312
Assets/XCharts/Editor/Charts/BaseChartEditor.cs
Normal file
312
Assets/XCharts/Editor/Charts/BaseChartEditor.cs
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Text;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[CustomEditor(typeof(BaseChart), true)]
|
||||||
|
public class BaseChartEditor : Editor
|
||||||
|
{
|
||||||
|
protected BaseChart m_Chart;
|
||||||
|
protected SerializedProperty m_Script;
|
||||||
|
protected SerializedProperty m_EnableTextMeshPro;
|
||||||
|
protected SerializedProperty m_Settings;
|
||||||
|
protected SerializedProperty m_Theme;
|
||||||
|
protected SerializedProperty m_ChartName;
|
||||||
|
protected SerializedProperty m_DebugMode;
|
||||||
|
protected SerializedProperty m_DebugInfo;
|
||||||
|
protected SerializedProperty m_RaycastTarget;
|
||||||
|
|
||||||
|
protected List<SerializedProperty> m_Components = new List<SerializedProperty>();
|
||||||
|
protected List<SerializedProperty> m_Series = new List<SerializedProperty>();
|
||||||
|
|
||||||
|
private bool m_BaseFoldout;
|
||||||
|
private bool m_CheckWarning = false;
|
||||||
|
private int m_LastComponentCount = 0;
|
||||||
|
private int m_LastSerieCount = 0;
|
||||||
|
private StringBuilder sb = new StringBuilder();
|
||||||
|
MainComponentListEditor m_ComponentList;
|
||||||
|
SerieListEditor m_SerieList;
|
||||||
|
|
||||||
|
protected virtual void OnEnable()
|
||||||
|
{
|
||||||
|
if (target == null) return;
|
||||||
|
m_Chart = (BaseChart)target;
|
||||||
|
m_Script = serializedObject.FindProperty("m_Script");
|
||||||
|
m_EnableTextMeshPro = serializedObject.FindProperty("m_EnableTextMeshPro");
|
||||||
|
m_ChartName = serializedObject.FindProperty("m_ChartName");
|
||||||
|
m_Theme = serializedObject.FindProperty("m_Theme");
|
||||||
|
m_Settings = serializedObject.FindProperty("m_Settings");
|
||||||
|
m_DebugMode = serializedObject.FindProperty("m_DebugMode");
|
||||||
|
m_DebugInfo = serializedObject.FindProperty("m_DebugInfo");
|
||||||
|
m_RaycastTarget = serializedObject.FindProperty("m_RaycastTarget");
|
||||||
|
|
||||||
|
RefreshComponent();
|
||||||
|
m_ComponentList = new MainComponentListEditor(this);
|
||||||
|
m_ComponentList.Init(m_Chart, serializedObject, m_Components);
|
||||||
|
|
||||||
|
RefreshSeries();
|
||||||
|
m_SerieList = new SerieListEditor(this);
|
||||||
|
m_SerieList.Init(m_Chart, serializedObject, m_Series);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SerializedProperty> RefreshComponent()
|
||||||
|
{
|
||||||
|
m_Components.Clear();
|
||||||
|
serializedObject.Update();
|
||||||
|
foreach (var kv in m_Chart.typeListForComponent)
|
||||||
|
{
|
||||||
|
InitComponent(kv.Value.Name);
|
||||||
|
}
|
||||||
|
return m_Components;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SerializedProperty> RefreshSeries()
|
||||||
|
{
|
||||||
|
m_Series.Clear();
|
||||||
|
serializedObject.Update();
|
||||||
|
foreach (var kv in m_Chart.typeListForSerie)
|
||||||
|
{
|
||||||
|
InitSerie(kv.Value.Name);
|
||||||
|
}
|
||||||
|
return m_Series;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
if (m_Chart == null && target == null)
|
||||||
|
{
|
||||||
|
base.OnInspectorGUI();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
serializedObject.Update();
|
||||||
|
if (m_LastComponentCount != m_Chart.components.Count)
|
||||||
|
{
|
||||||
|
m_LastComponentCount = m_Chart.components.Count;
|
||||||
|
RefreshComponent();
|
||||||
|
m_ComponentList.UpdateComponentsProperty(m_Components);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (m_LastSerieCount != m_Chart.series.Count)
|
||||||
|
{
|
||||||
|
m_LastSerieCount = m_Chart.series.Count;
|
||||||
|
RefreshSeries();
|
||||||
|
m_SerieList.UpdateSeriesProperty(m_Series);
|
||||||
|
}
|
||||||
|
OnStartInspectorGUI();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
OnDebugInspectorGUI();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnStartInspectorGUI()
|
||||||
|
{
|
||||||
|
var version = string.Format("v{0}_{1}", XChartsMgr.version, XChartsMgr.versionDate);
|
||||||
|
if (m_EnableTextMeshPro.boolValue)
|
||||||
|
{
|
||||||
|
version += " TMP";
|
||||||
|
}
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.LabelField(version);
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
serializedObject.Update();
|
||||||
|
|
||||||
|
m_BaseFoldout = ChartEditorHelper.DrawHeader("Base", m_BaseFoldout, false, null, null);
|
||||||
|
if (m_BaseFoldout)
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(m_Script);
|
||||||
|
EditorGUILayout.PropertyField(m_ChartName);
|
||||||
|
EditorGUILayout.PropertyField(m_RaycastTarget);
|
||||||
|
}
|
||||||
|
EditorGUILayout.PropertyField(m_Theme);
|
||||||
|
EditorGUILayout.PropertyField(m_Settings);
|
||||||
|
|
||||||
|
m_ComponentList.OnGUI();
|
||||||
|
|
||||||
|
m_SerieList.OnGUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnDebugInspectorGUI()
|
||||||
|
{
|
||||||
|
AddSerie();
|
||||||
|
AddComponent();
|
||||||
|
CheckWarning();
|
||||||
|
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||||
|
EditorGUILayout.PropertyField(m_DebugMode);
|
||||||
|
EditorGUILayout.PropertyField(m_DebugInfo, true);
|
||||||
|
EditorGUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PropertyComponnetList(SerializedProperty prop)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < prop.arraySize; i++)
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitComponent(string propName)
|
||||||
|
{
|
||||||
|
var prop = serializedObject.FindProperty(propName);
|
||||||
|
for (int i = 0; i < prop.arraySize; i++)
|
||||||
|
{
|
||||||
|
m_Components.Add(prop.GetArrayElementAtIndex(i));
|
||||||
|
}
|
||||||
|
m_Components.Sort((a, b) => { return a.propertyPath.CompareTo(b.propertyPath); });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitSerie(string propName)
|
||||||
|
{
|
||||||
|
var prop = serializedObject.FindProperty(propName);
|
||||||
|
for (int i = 0; i < prop.arraySize; i++)
|
||||||
|
{
|
||||||
|
m_Series.Add(prop.GetArrayElementAtIndex(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddComponent()
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Add Component"))
|
||||||
|
{
|
||||||
|
var menu = new GenericMenu();
|
||||||
|
foreach (var type in GetMainComponentTypeNames())
|
||||||
|
{
|
||||||
|
var title = ChartEditorHelper.GetContent(type.Name);
|
||||||
|
bool exists = !m_Chart.CanAddChartComponent(type);
|
||||||
|
if (!exists)
|
||||||
|
menu.AddItem(title, false, () =>
|
||||||
|
{
|
||||||
|
m_ComponentList.AddChartComponent(type);
|
||||||
|
});
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu.AddDisabledItem(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.ShowAsContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddSerie()
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Add Serie"))
|
||||||
|
{
|
||||||
|
var menu = new GenericMenu();
|
||||||
|
foreach (var type in GetSerieTypeNames())
|
||||||
|
{
|
||||||
|
var title = ChartEditorHelper.GetContent(type.Name);
|
||||||
|
if (m_Chart.CanAddSerie(type))
|
||||||
|
{
|
||||||
|
menu.AddItem(title, false, () =>
|
||||||
|
{
|
||||||
|
m_SerieList.AddSerie(type);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu.AddDisabledItem(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menu.ShowAsContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Type> GetMainComponentTypeNames()
|
||||||
|
{
|
||||||
|
var list = new List<Type>();
|
||||||
|
var typeMap = RuntimeUtil.GetAllTypesDerivedFrom<MainComponent>();
|
||||||
|
foreach (var kvp in typeMap)
|
||||||
|
{
|
||||||
|
var type = kvp;
|
||||||
|
if (RuntimeUtil.HasSubclass(type)) continue;
|
||||||
|
|
||||||
|
if (type.IsDefined(typeof(ComponentHandlerAttribute), false))
|
||||||
|
{
|
||||||
|
var attribute = type.GetAttribute<ComponentHandlerAttribute>();
|
||||||
|
if (attribute != null && attribute.handler != null)
|
||||||
|
list.Add(type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.Add(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.Sort((a, b) => { return a.Name.CompareTo(b.Name); });
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
private List<Type> GetSerieTypeNames()
|
||||||
|
{
|
||||||
|
var list = new List<Type>();
|
||||||
|
var typeMap = RuntimeUtil.GetAllTypesDerivedFrom<Serie>();
|
||||||
|
foreach (var kvp in typeMap)
|
||||||
|
{
|
||||||
|
var type = kvp;
|
||||||
|
if (RuntimeUtil.HasSubclass(type))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
list.Add(type);
|
||||||
|
}
|
||||||
|
list.Sort((a, b) => { return a.Name.CompareTo(b.Name); });
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckWarning()
|
||||||
|
{
|
||||||
|
if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>())
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Covert XY Axis"))
|
||||||
|
m_Chart.CovertXYAxis(0);
|
||||||
|
}
|
||||||
|
if (GUILayout.Button("Remove All Chart Object"))
|
||||||
|
{
|
||||||
|
m_Chart.RemoveChartObject();
|
||||||
|
}
|
||||||
|
if (m_CheckWarning)
|
||||||
|
{
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
if (GUILayout.Button("Check Warning"))
|
||||||
|
{
|
||||||
|
m_CheckWarning = true;
|
||||||
|
m_Chart.CheckWarning();
|
||||||
|
}
|
||||||
|
if (GUILayout.Button("Hide Warning"))
|
||||||
|
{
|
||||||
|
m_CheckWarning = false;
|
||||||
|
}
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
sb.Length = 0;
|
||||||
|
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
|
||||||
|
if (!string.IsNullOrEmpty(m_Chart.warningInfo))
|
||||||
|
{
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.Append(m_Chart.warningInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.Append("Perfect! No warning!");
|
||||||
|
}
|
||||||
|
EditorGUILayout.HelpBox(sb.ToString(), MessageType.Warning);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Check warning"))
|
||||||
|
{
|
||||||
|
m_CheckWarning = true;
|
||||||
|
m_Chart.CheckWarning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 94d1c19509a514ffab61efb88d3281fd
|
guid: 7861b681552cf4bc9b2c2f16d25c628c
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Enable"))
|
if (MakeComponentFoldout(prop, "m_Enable"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_FadeInDuration");
|
PropertyField(prop, "m_FadeInDuration");
|
||||||
@@ -28,6 +27,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_DataChangeEnable");
|
PropertyField(prop, "m_DataChangeEnable");
|
||||||
PropertyField(prop, "m_DataChangeDuration");
|
PropertyField(prop, "m_DataChangeDuration");
|
||||||
PropertyField(prop, "m_ActualDuration");
|
PropertyField(prop, "m_ActualDuration");
|
||||||
|
PropertyField(prop, "m_AlongWithLinePath");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Origin");
|
PropertyField(prop, "m_Origin");
|
||||||
@@ -11,7 +11,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Settings), true)]
|
public delegate void DelegateMenuAction(Vector2 postion);
|
||||||
public class BasePropertyDrawer : PropertyDrawer
|
public class BasePropertyDrawer : PropertyDrawer
|
||||||
{
|
{
|
||||||
protected int m_Index;
|
protected int m_Index;
|
||||||
@@ -99,7 +99,7 @@ namespace XCharts
|
|||||||
var toggleKeyName = m_KeyName + relativePropName;
|
var toggleKeyName = m_KeyName + relativePropName;
|
||||||
m_DataToggles[toggleKeyName] = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
|
m_DataToggles[toggleKeyName] = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
|
||||||
prop.FindPropertyRelative(relativePropName),
|
prop.FindPropertyRelative(relativePropName),
|
||||||
m_DataToggles.ContainsKey(toggleKeyName) && m_DataToggles[toggleKeyName], showOrder);
|
m_DataToggles.ContainsKey(toggleKeyName) && m_DataToggles[toggleKeyName], showOrder, true);
|
||||||
m_Heights[m_KeyName] = height;
|
m_Heights[m_KeyName] = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +168,20 @@ namespace XCharts
|
|||||||
m_DisplayName, relativeProp);
|
m_DisplayName, relativeProp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected bool MakeComponentFoldout(SerializedProperty prop, string relativePropName, params HeaderMenuInfo[] menus)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(relativePropName))
|
||||||
|
{
|
||||||
|
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
|
||||||
|
m_DisplayName, null, menus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var relativeProp = prop.FindPropertyRelative(relativePropName);
|
||||||
|
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
|
||||||
|
m_DisplayName, relativeProp, menus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void DrawExtendeds(SerializedProperty prop)
|
protected virtual void DrawExtendeds(SerializedProperty prop)
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, ""))
|
if (MakeComponentFoldout(prop, ""))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
#if dUI_TextMeshPro
|
#if dUI_TextMeshPro
|
||||||
@@ -168,7 +168,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, ""))
|
if (MakeComponentFoldout(prop, ""))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_LineWidth");
|
PropertyField(prop, "m_LineWidth");
|
||||||
@@ -18,10 +18,11 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Label");
|
PropertyField(prop, "m_Label");
|
||||||
|
PropertyField(prop, "m_LabelLine");
|
||||||
PropertyField(prop, "m_ItemStyle");
|
PropertyField(prop, "m_ItemStyle");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_AxisLine");
|
PropertyField(prop, "m_AxisLine");
|
||||||
@@ -58,7 +58,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Width");
|
PropertyField(prop, "m_Width");
|
||||||
@@ -18,7 +18,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Layer");
|
PropertyField(prop, "m_Layer");
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Color");
|
PropertyField(prop, "m_Color");
|
||||||
@@ -10,19 +10,22 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Polar), true)]
|
[CustomPropertyDrawer(typeof(LabelLine), true)]
|
||||||
public class PolarDrawer : BasePropertyDrawer
|
public class LabelLineDrawer : BasePropertyDrawer
|
||||||
{
|
{
|
||||||
public override string ClassName { get { return "Polar"; } }
|
public override string ClassName { get { return "LabelLine"; } }
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyTwoFiled(prop, "m_Center");
|
PropertyField(prop, "m_LineType");
|
||||||
PropertyField(prop, "m_Radius");
|
PropertyField(prop, "m_LineColor");
|
||||||
PropertyField(prop, "m_BackgroundColor");
|
PropertyField(prop, "m_LineWidth");
|
||||||
|
PropertyField(prop, "m_LineGap");
|
||||||
|
PropertyField(prop, "m_LineLength1");
|
||||||
|
PropertyField(prop, "m_LineLength2");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1dd7acd8b13f3f14e9891af4e8dd0b0b
|
guid: 29a267a45c6e64454a982032947046c6
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -10,14 +10,14 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(SerieLabel), true)]
|
[CustomPropertyDrawer(typeof(LabelStyle), true)]
|
||||||
public class SerieLabelDrawer : BasePropertyDrawer
|
public class LabelStyleDrawer : BasePropertyDrawer
|
||||||
{
|
{
|
||||||
public override string ClassName { get { return "Label"; } }
|
public override string ClassName { get { return "Label"; } }
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Position");
|
PropertyField(prop, "m_Position");
|
||||||
@@ -33,13 +33,6 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_Border");
|
PropertyField(prop, "m_Border");
|
||||||
PropertyField(prop, "m_BorderWidth");
|
PropertyField(prop, "m_BorderWidth");
|
||||||
PropertyField(prop, "m_BorderColor");
|
PropertyField(prop, "m_BorderColor");
|
||||||
PropertyField(prop, "m_Line");
|
|
||||||
PropertyField(prop, "m_LineType");
|
|
||||||
PropertyField(prop, "m_LineColor");
|
|
||||||
PropertyField(prop, "m_LineWidth");
|
|
||||||
PropertyField(prop, "m_LineGap");
|
|
||||||
PropertyField(prop, "m_LineLength1");
|
|
||||||
PropertyField(prop, "m_LineLength2");
|
|
||||||
PropertyField(prop, "m_TextStyle");
|
PropertyField(prop, "m_TextStyle");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bd96c5068df484d1c95748a85d8380a8
|
guid: abd47f4015a9840b9acae8efb21db7c3
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -11,14 +11,14 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Arrow), true)]
|
[CustomPropertyDrawer(typeof(ArrowStyle), true)]
|
||||||
public class ArrowDrawer : BasePropertyDrawer
|
public class ArrowDrawer : BasePropertyDrawer
|
||||||
{
|
{
|
||||||
public override string ClassName { get { return "Arrow"; } }
|
public override string ClassName { get { return "Arrow"; } }
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, ""))
|
if (MakeComponentFoldout(prop, ""))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Width");
|
PropertyField(prop, "m_Width");
|
||||||
@@ -38,7 +38,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Position");
|
PropertyField(prop, "m_Position");
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
DrawExtendeds(prop);
|
DrawExtendeds(prop);
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Type");
|
PropertyField(prop, "m_Type");
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Align"))
|
if (MakeComponentFoldout(prop, "m_Align"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Top");
|
PropertyField(prop, "m_Top");
|
||||||
@@ -17,15 +17,12 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, ""))
|
if (MakeComponentFoldout(prop, "", new HeaderMenuInfo("Reset", () =>
|
||||||
{
|
|
||||||
var btnWidth = 50;
|
|
||||||
var btnRect = new Rect(pos.x + pos.width - btnWidth, pos.y, btnWidth, EditorGUIUtility.singleLineHeight);
|
|
||||||
if (GUI.Button(btnRect, new GUIContent("Reset", "Reset to default settings")))
|
|
||||||
{
|
{
|
||||||
var chart = prop.serializedObject.targetObject as BaseChart;
|
var chart = prop.serializedObject.targetObject as BaseChart;
|
||||||
chart.settings.Reset();
|
chart.settings.Reset();
|
||||||
}
|
})))
|
||||||
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_ReversePainter");
|
PropertyField(prop, "m_ReversePainter");
|
||||||
PropertyField(prop, "m_MaxPainter");
|
PropertyField(prop, "m_MaxPainter");
|
||||||
@@ -11,19 +11,19 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
|
[CustomPropertyDrawer(typeof(SymbolStyle), true)]
|
||||||
public class SerieSymbolDrawer : BasePropertyDrawer
|
public class SymbolStyleDrawer : BasePropertyDrawer
|
||||||
{
|
{
|
||||||
public override string ClassName { get { return "Symbol"; } }
|
public override string ClassName { get { return "Symbol"; } }
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
var type = (SerieSymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||||
PropertyField(prop, "m_Type");
|
PropertyField(prop, "m_Type");
|
||||||
if (type == SerieSymbolType.Custom)
|
if (type == SymbolType.Custom)
|
||||||
{
|
{
|
||||||
PropertyField(prop, "m_Image");
|
PropertyField(prop, "m_Image");
|
||||||
PropertyField(prop, "m_ImageType");
|
PropertyField(prop, "m_ImageType");
|
||||||
@@ -33,18 +33,18 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
PropertyField(prop, "m_Gap");
|
PropertyField(prop, "m_Gap");
|
||||||
PropertyField(prop, "m_SizeType");
|
PropertyField(prop, "m_SizeType");
|
||||||
switch ((SerieSymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||||
{
|
{
|
||||||
case SerieSymbolSizeType.Custom:
|
case SymbolSizeType.Custom:
|
||||||
PropertyField(prop, "m_Size");
|
PropertyField(prop, "m_Size");
|
||||||
PropertyField(prop, "m_SelectedSize");
|
PropertyField(prop, "m_SelectedSize");
|
||||||
break;
|
break;
|
||||||
case SerieSymbolSizeType.FromData:
|
case SymbolSizeType.FromData:
|
||||||
PropertyField(prop, "m_DataIndex");
|
PropertyField(prop, "m_DataIndex");
|
||||||
PropertyField(prop, "m_DataScale");
|
PropertyField(prop, "m_DataScale");
|
||||||
PropertyField(prop, "m_SelectedDataScale");
|
PropertyField(prop, "m_SelectedDataScale");
|
||||||
break;
|
break;
|
||||||
case SerieSymbolSizeType.Callback:
|
case SymbolSizeType.Callback:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PropertyField(prop, "m_StartIndex");
|
PropertyField(prop, "m_StartIndex");
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 72d557cf0b7134953b457ab973364520
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -17,7 +17,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Enable"))
|
if (MakeComponentFoldout(prop, "m_Enable"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_MaxWidth");
|
PropertyField(prop, "m_MaxWidth");
|
||||||
@@ -20,7 +20,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, ""))
|
if (MakeComponentFoldout(prop, ""))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
#if dUI_TextMeshPro
|
#if dUI_TextMeshPro
|
||||||
@@ -14,8 +14,8 @@ using TMPro;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(ChartTheme), true)]
|
[CustomPropertyDrawer(typeof(ThemeStyle), true)]
|
||||||
public class ThemeDrawer : BasePropertyDrawer
|
public class ThemeStyleDrawer : BasePropertyDrawer
|
||||||
{
|
{
|
||||||
public override string ClassName { get { return "Theme"; } }
|
public override string ClassName { get { return "Theme"; } }
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
@@ -23,69 +23,38 @@ namespace XCharts
|
|||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
var defaultWidth = pos.width;
|
var defaultWidth = pos.width;
|
||||||
var defaultX = pos.x;
|
var defaultX = pos.x;
|
||||||
var btnWidth = 50;
|
|
||||||
if (MakeFoldout(prop, ""))
|
|
||||||
{
|
|
||||||
var btnRect = new Rect(m_DrawRect);
|
|
||||||
btnRect.x = defaultX + defaultWidth - 2 * btnWidth - 2;
|
|
||||||
btnRect.y = m_DrawRect.y - EditorGUIUtility.singleLineHeight - 3;
|
|
||||||
btnRect.width = btnWidth;
|
|
||||||
var chart = prop.serializedObject.targetObject as BaseChart;
|
var chart = prop.serializedObject.targetObject as BaseChart;
|
||||||
if (GUI.Button(btnRect, new GUIContent("Reset", "Reset to theme default color")))
|
if (MakeComponentFoldout(prop, "", new HeaderMenuInfo("Reset|Reset to theme default color", () =>
|
||||||
{
|
{
|
||||||
chart.theme.ResetTheme();
|
chart.theme.sharedTheme.ResetTheme();
|
||||||
chart.RefreshAllComponent();
|
chart.RefreshAllComponent();
|
||||||
}
|
}), new HeaderMenuInfo("Export|Export theme to asset for a new theme", () =>
|
||||||
btnRect.x = defaultX + defaultWidth - btnWidth;
|
|
||||||
btnRect.width = btnWidth;
|
|
||||||
if (GUI.Button(btnRect, new GUIContent("Export", "Export theme to asset for a new theme")))
|
|
||||||
{
|
{
|
||||||
ExportThemeWindow.target = chart;
|
ExportThemeWindow.target = chart;
|
||||||
EditorWindow.GetWindow(typeof(ExportThemeWindow));
|
EditorWindow.GetWindow(typeof(ExportThemeWindow));
|
||||||
}
|
}), new HeaderMenuInfo("Sync color to custom|Sync shared theme color to custom color", () =>
|
||||||
|
{
|
||||||
|
chart.theme.SyncSharedThemeColorToCustom();
|
||||||
|
})))
|
||||||
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
var chartNameList = XThemeMgr.GetAllThemeNames();
|
var chartNameList = XCThemeMgr.GetAllThemeNames();
|
||||||
var lastIndex = chartNameList.IndexOf(chart.theme.themeName);
|
var lastIndex = chartNameList.IndexOf(chart.theme.themeName);
|
||||||
var y = pos.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
var y = pos.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
var selectedIndex = EditorGUI.Popup(new Rect(pos.x, y, pos.width, EditorGUIUtility.singleLineHeight),
|
var selectedIndex = EditorGUI.Popup(new Rect(pos.x, y, pos.width, EditorGUIUtility.singleLineHeight),
|
||||||
"Theme", lastIndex, chartNameList.ToArray());
|
"Shared Theme", lastIndex, chartNameList.ToArray());
|
||||||
AddSingleLineHeight();
|
AddSingleLineHeight();
|
||||||
if (lastIndex != selectedIndex)
|
if (lastIndex != selectedIndex)
|
||||||
{
|
{
|
||||||
XThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
|
XCThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
|
||||||
}
|
}
|
||||||
#if dUI_TextMeshPro
|
PropertyField(prop, "m_SharedTheme");
|
||||||
PropertyField(prop, "m_TMPFont");
|
PropertyField(prop, "m_EnableCustomTheme");
|
||||||
if(chart.theme.tmpFont == null && !string.IsNullOrEmpty(chart.theme.tmpFontName))
|
using (new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
|
||||||
{
|
{
|
||||||
var msg = string.Format("Can't find theme font asset:{0} in project.", chart.theme.tmpFontName);
|
PropertyField(prop, "m_CustomBackgroundColor");
|
||||||
EditorGUILayout.HelpBox(msg, MessageType.Error);
|
PropertyField(prop, "m_CustomColorPalette");
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
PropertyField(prop, "m_Font");
|
|
||||||
if (chart.theme.font == null && !string.IsNullOrEmpty(chart.theme.fontName))
|
|
||||||
{
|
|
||||||
var msg = string.Format("Can't find theme font asset:{0} in project.", chart.theme.fontName);
|
|
||||||
EditorGUILayout.HelpBox(msg, MessageType.Error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
PropertyField(prop, "m_ContrastColor");
|
|
||||||
PropertyField(prop, "m_BackgroundColor");
|
|
||||||
PropertyField(prop, "m_ColorPalette");
|
|
||||||
PropertyField(prop, "m_Common");
|
|
||||||
PropertyField(prop, "m_Title");
|
|
||||||
PropertyField(prop, "m_SubTitle");
|
|
||||||
PropertyField(prop, "m_Legend");
|
|
||||||
PropertyField(prop, "m_Axis");
|
|
||||||
PropertyField(prop, "m_RadiusAxis");
|
|
||||||
PropertyField(prop, "m_AngleAxis");
|
|
||||||
PropertyField(prop, "m_Polar");
|
|
||||||
PropertyField(prop, "m_Gauge");
|
|
||||||
PropertyField(prop, "m_Radar");
|
|
||||||
PropertyField(prop, "m_Tooltip");
|
|
||||||
PropertyField(prop, "m_DataZoom");
|
|
||||||
PropertyField(prop, "m_VisualMap");
|
|
||||||
PropertyField(prop, "m_Serie");
|
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +105,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GUILayout.Label(XThemeMgr.GetThemeAssetPath(m_ChartName));
|
GUILayout.Label(XCThemeMgr.GetThemeAssetPath(m_ChartName));
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.Space(20);
|
GUILayout.Space(20);
|
||||||
@@ -146,20 +115,20 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
ShowNotification(new GUIContent("ERROR:Need input a new name!"));
|
ShowNotification(new GUIContent("ERROR:Need input a new name!"));
|
||||||
}
|
}
|
||||||
else if (XThemeMgr.ContainsTheme(m_ChartName))
|
else if (XCThemeMgr.ContainsTheme(m_ChartName))
|
||||||
{
|
{
|
||||||
ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
|
ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
|
||||||
}
|
}
|
||||||
else if (IsAssetsExist(XThemeMgr.GetThemeAssetPath(m_ChartName)))
|
else if (IsAssetsExist(XCThemeMgr.GetThemeAssetPath(m_ChartName)))
|
||||||
{
|
{
|
||||||
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
|
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
|
||||||
+ XThemeMgr.GetThemeAssetPath(m_ChartName)));
|
+ XCThemeMgr.GetThemeAssetPath(m_ChartName)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XThemeMgr.ExportTheme(target.theme, m_ChartName);
|
XCThemeMgr.ExportTheme(target.theme.sharedTheme, m_ChartName);
|
||||||
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
|
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
|
||||||
+ XThemeMgr.GetThemeAssetPath(m_ChartName)));
|
+ XCThemeMgr.GetThemeAssetPath(m_ChartName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_TextStyle");
|
PropertyField(prop, "m_TextStyle");
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/************************************************/
|
|
||||||
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Editor class used to edit UI CoordinateChart.
|
|
||||||
/// </summary>
|
|
||||||
[CustomEditor(typeof(CoordinateChart), false)]
|
|
||||||
public class CoordinateChartEditor : BaseChartEditor
|
|
||||||
{
|
|
||||||
protected SerializedProperty m_Grids;
|
|
||||||
protected SerializedProperty m_MultipleXAxis;
|
|
||||||
protected SerializedProperty m_XAxes;
|
|
||||||
protected SerializedProperty m_MultipleYAxis;
|
|
||||||
protected SerializedProperty m_YAxes;
|
|
||||||
protected SerializedProperty m_DataZooms;
|
|
||||||
protected SerializedProperty m_VisualMaps;
|
|
||||||
|
|
||||||
protected override void OnEnable()
|
|
||||||
{
|
|
||||||
base.OnEnable();
|
|
||||||
if(target == null) return;
|
|
||||||
m_Chart = (CoordinateChart)target;
|
|
||||||
m_Grids = serializedObject.FindProperty("m_Grids");
|
|
||||||
m_XAxes = serializedObject.FindProperty("m_XAxes");
|
|
||||||
m_YAxes = serializedObject.FindProperty("m_YAxes");
|
|
||||||
m_DataZooms = serializedObject.FindProperty("m_DataZooms");
|
|
||||||
m_VisualMaps = serializedObject.FindProperty("m_VisualMaps");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnStartInspectorGUI()
|
|
||||||
{
|
|
||||||
base.OnStartInspectorGUI();
|
|
||||||
BlockListField(m_ShowAllComponent, m_DataZooms);
|
|
||||||
BlockListField(m_ShowAllComponent, m_VisualMaps);
|
|
||||||
BlockListField(m_ShowAllComponent, m_Grids);
|
|
||||||
BlockListField(m_ShowAllComponent, m_XAxes);
|
|
||||||
BlockListField(m_ShowAllComponent, m_YAxes);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void MoreDebugInspector()
|
|
||||||
{
|
|
||||||
base.MoreDebugInspector();
|
|
||||||
CovertXYAxis();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CovertXYAxis()
|
|
||||||
{
|
|
||||||
if (GUILayout.Button("Covert XY Axis"))
|
|
||||||
{
|
|
||||||
(m_Chart as CoordinateChart).CovertXYAxis(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/************************************************/
|
|
||||||
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Editor class used to edit UI GaugeChart.
|
|
||||||
/// </summary>
|
|
||||||
[CustomEditor(typeof(GaugeChart), false)]
|
|
||||||
public class GaugeChartEditor : BaseChartEditor
|
|
||||||
{
|
|
||||||
protected override void OnEnable()
|
|
||||||
{
|
|
||||||
base.OnEnable();
|
|
||||||
if(target == null) return;
|
|
||||||
m_Chart = (GaugeChart)target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 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();
|
|
||||||
if(target == null) return;
|
|
||||||
m_Chart = (HeatmapChart)target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1144057dfc00f4572913a63ba5291dd7
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 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();
|
|
||||||
if(target == null) return;
|
|
||||||
m_Chart = (LineChart)target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6bd1a238bc5b407408b8f902aa3db9fd
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/******************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/******************************************/
|
|
||||||
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Editor class used to edit UI LiquidChart.
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
[CustomEditor(typeof(LiquidChart), false)]
|
|
||||||
public class LiquidChartEditor : BaseChartEditor
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 307a1578a6be1403c98fdc27d99d1808
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d1d3ce01c4a6f4e3482c1dc22f388889
|
guid: f98ff753316eb48d58325ecd996f2a1f
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
210
Assets/XCharts/Editor/MainComponents/AxisEditor.cs
Normal file
210
Assets/XCharts/Editor/MainComponents/AxisEditor.cs
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(Axis))]
|
||||||
|
public class AxisEditor : MainComponentEditor<Axis>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
var m_Type = baseProperty.FindPropertyRelative("m_Type");
|
||||||
|
var m_LogBase = baseProperty.FindPropertyRelative("m_LogBase");
|
||||||
|
var m_MinMaxType = baseProperty.FindPropertyRelative("m_MinMaxType");
|
||||||
|
var type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
if (component is ParallelAxis)
|
||||||
|
{
|
||||||
|
PropertyField("m_ParallelIndex");
|
||||||
|
}
|
||||||
|
else if (!(component is SingleAxis))
|
||||||
|
{
|
||||||
|
PropertyField("m_GridIndex");
|
||||||
|
PropertyField("m_PolarIndex");
|
||||||
|
}
|
||||||
|
PropertyField("m_Type");
|
||||||
|
PropertyField("m_Position");
|
||||||
|
PropertyField("m_Offset");
|
||||||
|
if (type == Axis.AxisType.Log)
|
||||||
|
{
|
||||||
|
PropertyField("m_LogBaseE");
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
PropertyField("m_LogBase");
|
||||||
|
if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1)
|
||||||
|
{
|
||||||
|
m_LogBase.floatValue = 10;
|
||||||
|
}
|
||||||
|
EditorGUI.EndChangeCheck();
|
||||||
|
}
|
||||||
|
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
|
||||||
|
{
|
||||||
|
PropertyField("m_MinMaxType");
|
||||||
|
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++;
|
||||||
|
PropertyField("m_Min");
|
||||||
|
PropertyField("m_Max");
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PropertyField("m_CeilRate");
|
||||||
|
if (type == Axis.AxisType.Value)
|
||||||
|
{
|
||||||
|
PropertyField("m_Inverse");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyField("m_SplitNumber");
|
||||||
|
if (type == Axis.AxisType.Category)
|
||||||
|
{
|
||||||
|
//PropertyField("m_InsertDataToHead");
|
||||||
|
PropertyField("m_MaxCache");
|
||||||
|
PropertyField("m_BoundaryGap");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PropertyField("m_Interval");
|
||||||
|
PropertyField("m_BoundaryGap");
|
||||||
|
}
|
||||||
|
DrawExtendeds();
|
||||||
|
PropertyField("m_AxisLine");
|
||||||
|
PropertyField("m_AxisName");
|
||||||
|
PropertyField("m_AxisTick");
|
||||||
|
PropertyField("m_AxisLabel");
|
||||||
|
PropertyField("m_SplitLine");
|
||||||
|
PropertyField("m_SplitArea");
|
||||||
|
PropertyField("m_IconStyle");
|
||||||
|
PropertyListField("m_Icons", true);
|
||||||
|
if (type == Axis.AxisType.Category)
|
||||||
|
{
|
||||||
|
PropertyListField("m_Data", true, new HeaderMenuInfo("Import ECharts Axis Data", () =>
|
||||||
|
{
|
||||||
|
PraseExternalDataEditor.UpdateData(chart, null, component as Axis);
|
||||||
|
PraseExternalDataEditor.ShowWindow();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComponentEditor(typeof(XAxis))]
|
||||||
|
public class XAxisEditor : AxisEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComponentEditor(typeof(YAxis))]
|
||||||
|
public class YAxisEditor : AxisEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComponentEditor(typeof(SingleAxis))]
|
||||||
|
public class SingleAxisEditor : AxisEditor
|
||||||
|
{
|
||||||
|
protected override void DrawExtendeds()
|
||||||
|
{
|
||||||
|
base.DrawExtendeds();
|
||||||
|
PropertyField("m_Orient");
|
||||||
|
PropertyField("m_Left");
|
||||||
|
PropertyField("m_Right");
|
||||||
|
PropertyField("m_Top");
|
||||||
|
PropertyField("m_Bottom");
|
||||||
|
PropertyField("m_Width");
|
||||||
|
PropertyField("m_Height");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComponentEditor(typeof(AngleAxis))]
|
||||||
|
public class AngleAxisEditor : AxisEditor
|
||||||
|
{
|
||||||
|
protected override void DrawExtendeds()
|
||||||
|
{
|
||||||
|
base.DrawExtendeds();
|
||||||
|
PropertyField("m_StartAngle");
|
||||||
|
PropertyField("m_Clockwise");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComponentEditor(typeof(RadiusAxis))]
|
||||||
|
public class RadiusAxisEditor : AxisEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComponentEditor(typeof(ParallelAxis))]
|
||||||
|
public class ParallelAxisEditor : AxisEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(AxisLabel), true)]
|
||||||
|
public class AxisLabelDrawer : BasePropertyDrawer
|
||||||
|
{
|
||||||
|
public override string ClassName { get { return "AxisLabel"; } }
|
||||||
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
|
{
|
||||||
|
base.OnGUI(pos, prop, label);
|
||||||
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField(prop, "m_Inside");
|
||||||
|
PropertyField(prop, "m_Interval");
|
||||||
|
PropertyField(prop, "m_Margin");
|
||||||
|
PropertyField(prop, "m_Width");
|
||||||
|
PropertyField(prop, "m_Height");
|
||||||
|
PropertyField(prop, "m_Formatter");
|
||||||
|
PropertyField(prop, "m_NumericFormatter");
|
||||||
|
PropertyField(prop, "m_ShowAsPositiveNumber");
|
||||||
|
PropertyField(prop, "m_OnZero");
|
||||||
|
PropertyField(prop, "m_ShowStartLabel");
|
||||||
|
PropertyField(prop, "m_ShowEndLabel");
|
||||||
|
PropertyField(prop, "m_TextLimit");
|
||||||
|
PropertyField(prop, "m_TextStyle");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(AxisName), true)]
|
||||||
|
public class AxisNameDrawer : BasePropertyDrawer
|
||||||
|
{
|
||||||
|
public override string ClassName { get { return "AxisName"; } }
|
||||||
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
|
{
|
||||||
|
base.OnGUI(pos, prop, label);
|
||||||
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField(prop, "m_Name");
|
||||||
|
PropertyField(prop, "m_Location");
|
||||||
|
PropertyField(prop, "m_TextStyle");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(AxisSplitArea), true)]
|
||||||
|
public class AxisSplitAreaDrawer : BasePropertyDrawer
|
||||||
|
{
|
||||||
|
public override string ClassName { get { return "SplitArea"; } }
|
||||||
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
|
{
|
||||||
|
base.OnGUI(pos, prop, label);
|
||||||
|
if (MakeComponentFoldout(prop, "m_Show"))
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField(prop, "m_Color");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/AxisEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/AxisEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e6d7780afa9b49aa9081bf55d301955
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
28
Assets/XCharts/Editor/MainComponents/BackgroundEditor.cs
Normal file
28
Assets/XCharts/Editor/MainComponents/BackgroundEditor.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(Background))]
|
||||||
|
internal sealed class BackgroundEditor : MainComponentEditor<Background>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Image");
|
||||||
|
PropertyField("m_ImageType");
|
||||||
|
PropertyField("m_ImageColor");
|
||||||
|
PropertyField("m_HideThemeBackgroundColor");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 89d95a9a994ad4b4692832e9a548e9e4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
67
Assets/XCharts/Editor/MainComponents/DataZoomEditor.cs
Normal file
67
Assets/XCharts/Editor/MainComponents/DataZoomEditor.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(DataZoom))]
|
||||||
|
public class DataZoomEditor : MainComponentEditor<DataZoom>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
var m_SupportInside = baseProperty.FindPropertyRelative("m_SupportInside");
|
||||||
|
var m_SupportSlider = baseProperty.FindPropertyRelative("m_SupportSlider");
|
||||||
|
var m_Start = baseProperty.FindPropertyRelative("m_Start");
|
||||||
|
var m_End = baseProperty.FindPropertyRelative("m_End");
|
||||||
|
var m_MinShowNum = baseProperty.FindPropertyRelative("m_MinShowNum");
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Orient");
|
||||||
|
PropertyField("m_SupportInside");
|
||||||
|
if (m_SupportInside.boolValue)
|
||||||
|
{
|
||||||
|
PropertyField("m_SupportInsideScroll");
|
||||||
|
PropertyField("m_SupportInsideDrag");
|
||||||
|
}
|
||||||
|
PropertyField(m_SupportSlider);
|
||||||
|
PropertyField("m_ZoomLock");
|
||||||
|
PropertyField("m_ScrollSensitivity");
|
||||||
|
PropertyField("m_RangeMode");
|
||||||
|
PropertyField(m_Start);
|
||||||
|
PropertyField(m_End);
|
||||||
|
PropertyField(m_MinShowNum);
|
||||||
|
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
|
||||||
|
if (m_End.floatValue > 100) m_End.floatValue = 100;
|
||||||
|
if (m_MinShowNum.intValue < 0) m_MinShowNum.intValue = 0;
|
||||||
|
if (m_SupportSlider.boolValue)
|
||||||
|
{
|
||||||
|
PropertyField("m_ShowDataShadow");
|
||||||
|
PropertyField("m_ShowDetail");
|
||||||
|
PropertyField("m_BackgroundColor");
|
||||||
|
PropertyField("m_BorderWidth");
|
||||||
|
PropertyField("m_BorderColor");
|
||||||
|
PropertyField("m_FillerColor");
|
||||||
|
PropertyField("m_Left");
|
||||||
|
PropertyField("m_Right");
|
||||||
|
PropertyField("m_Top");
|
||||||
|
PropertyField("m_Bottom");
|
||||||
|
PropertyField("m_LineStyle");
|
||||||
|
PropertyField("m_AreaStyle");
|
||||||
|
PropertyListField("m_XAxisIndexs", true);
|
||||||
|
PropertyListField("m_YAxisIndexs", true);
|
||||||
|
PropertyField("m_TextStyle");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PropertyListField("m_XAxisIndexs", true);
|
||||||
|
PropertyListField("m_YAxisIndexs", true);
|
||||||
|
}
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/DataZoomEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/DataZoomEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 06bc176df52bf4953b8d46254523d2ca
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
27
Assets/XCharts/Editor/MainComponents/GridCoordEditor.cs
Normal file
27
Assets/XCharts/Editor/MainComponents/GridCoordEditor.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(GridCoord))]
|
||||||
|
public class GridCoordEditor : MainComponentEditor<GridCoord>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Left");
|
||||||
|
PropertyField("m_Right");
|
||||||
|
PropertyField("m_Top");
|
||||||
|
PropertyField("m_Bottom");
|
||||||
|
PropertyField("m_BackgroundColor");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/GridCoordEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/GridCoordEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bb28a0ae5edd34b63ae9cbce0986585b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
34
Assets/XCharts/Editor/MainComponents/LegendEditor.cs
Normal file
34
Assets/XCharts/Editor/MainComponents/LegendEditor.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(Legend))]
|
||||||
|
public class LegendEditor : MainComponentEditor<Legend>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_IconType");
|
||||||
|
PropertyField("m_ItemWidth");
|
||||||
|
PropertyField("m_ItemHeight");
|
||||||
|
PropertyField("m_ItemGap");
|
||||||
|
PropertyField("m_ItemAutoColor");
|
||||||
|
PropertyField("m_SelectedMode");
|
||||||
|
PropertyField("m_Orient");
|
||||||
|
PropertyField("m_Formatter");
|
||||||
|
PropertyField("m_Location");
|
||||||
|
PropertyField("m_TextStyle");
|
||||||
|
PropertyListField("m_Icons");
|
||||||
|
PropertyListField("m_Data");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/LegendEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/LegendEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5ef040b104aa2452f80d91c7c33775c4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
121
Assets/XCharts/Editor/MainComponents/MainComponentBaseEditor.cs
Normal file
121
Assets/XCharts/Editor/MainComponents/MainComponentBaseEditor.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Assertions;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
public class MainComponentBaseEditor
|
||||||
|
{
|
||||||
|
internal BaseChart chart { get; private set; }
|
||||||
|
internal MainComponent component { get; private set; }
|
||||||
|
|
||||||
|
//Editor m_Inspector;
|
||||||
|
internal SerializedProperty baseProperty;
|
||||||
|
internal SerializedProperty showProperty;
|
||||||
|
|
||||||
|
internal void Init(BaseChart chart, MainComponent target, SerializedProperty property, Editor inspector)
|
||||||
|
{
|
||||||
|
this.chart = chart;
|
||||||
|
this.component = target;
|
||||||
|
this.baseProperty = property;
|
||||||
|
//m_Inspector = inspector;
|
||||||
|
showProperty = baseProperty.FindPropertyRelative("m_Show");
|
||||||
|
if (showProperty == null)
|
||||||
|
showProperty = baseProperty.FindPropertyRelative("m_Enable");
|
||||||
|
OnEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnEnable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnDisable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void OnInternalInspectorGUI()
|
||||||
|
{
|
||||||
|
OnInspectorGUI();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void DrawExtendeds()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string GetDisplayTitle()
|
||||||
|
{
|
||||||
|
var num = chart.GetChartComponentNum(component.GetType());
|
||||||
|
if (num > 1)
|
||||||
|
return ObjectNames.NicifyVariableName(component.GetType().Name) + " " + component.index;
|
||||||
|
else
|
||||||
|
return ObjectNames.NicifyVariableName(component.GetType().Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SerializedProperty FindProperty(string path)
|
||||||
|
{
|
||||||
|
return baseProperty.FindPropertyRelative(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PropertyField(string path)
|
||||||
|
{
|
||||||
|
var property = FindProperty(path);
|
||||||
|
if (property != null)
|
||||||
|
{
|
||||||
|
var title = ChartEditorHelper.GetContent(property.displayName);
|
||||||
|
PropertyField(property, title);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("Property not exist:" + baseProperty.propertyPath + "," + path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PropertyField(SerializedProperty property)
|
||||||
|
{
|
||||||
|
Assert.IsNotNull(property);
|
||||||
|
var title = ChartEditorHelper.GetContent(property.displayName);
|
||||||
|
PropertyField(property, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PropertyField(SerializedProperty property, GUIContent title)
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(property, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus)
|
||||||
|
{
|
||||||
|
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||||
|
var height = 0f;
|
||||||
|
var prop = FindProperty(relativePropName);
|
||||||
|
prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
|
||||||
|
prop, prop.isExpanded, showOrder, true, menus);
|
||||||
|
if (prop.isExpanded)
|
||||||
|
{
|
||||||
|
GUILayoutUtility.GetRect(1f, height - 17);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PropertyTwoFiled(string relativePropName)
|
||||||
|
{
|
||||||
|
//TODO:
|
||||||
|
//PropertyField(relativePropName);
|
||||||
|
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||||
|
var prop = FindProperty(relativePropName);
|
||||||
|
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2909950e65ad44c2eb617a8b75845431
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
20
Assets/XCharts/Editor/MainComponents/MainComponentEditor.cs
Normal file
20
Assets/XCharts/Editor/MainComponents/MainComponentEditor.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
public class MainComponentEditor<T> : MainComponentBaseEditor
|
||||||
|
where T : MainComponent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 276997094e92e4b6590591727cb21349
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
172
Assets/XCharts/Editor/MainComponents/MainComponentListEditor.cs
Normal file
172
Assets/XCharts/Editor/MainComponents/MainComponentListEditor.cs
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.Assertions;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
public sealed class MainComponentListEditor
|
||||||
|
{
|
||||||
|
public BaseChart chart { get; private set; }
|
||||||
|
BaseChartEditor m_BaseEditor;
|
||||||
|
|
||||||
|
//SerializedObject m_SerializedObject;
|
||||||
|
List<SerializedProperty> m_ComponentsProperty;
|
||||||
|
SerializedProperty m_EnableProperty;
|
||||||
|
|
||||||
|
Dictionary<Type, Type> m_EditorTypes;
|
||||||
|
List<MainComponentBaseEditor> m_Editors;
|
||||||
|
|
||||||
|
public MainComponentListEditor(BaseChartEditor editor)
|
||||||
|
{
|
||||||
|
Assert.IsNotNull(editor);
|
||||||
|
m_BaseEditor = editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(BaseChart chart, SerializedObject serializedObject, List<SerializedProperty> componentProps)
|
||||||
|
{
|
||||||
|
Assert.IsNotNull(chart);
|
||||||
|
|
||||||
|
this.chart = chart;
|
||||||
|
m_ComponentsProperty = componentProps;
|
||||||
|
//m_SerializedObject = serializedObject;
|
||||||
|
|
||||||
|
Assert.IsNotNull(m_ComponentsProperty);
|
||||||
|
|
||||||
|
m_Editors = new List<MainComponentBaseEditor>();
|
||||||
|
m_EditorTypes = new Dictionary<Type, Type>();
|
||||||
|
|
||||||
|
var editorTypes = RuntimeUtil.GetAllTypesDerivedFrom<MainComponentBaseEditor>()
|
||||||
|
.Where(t => t.IsDefined(typeof(ComponentEditorAttribute), false) && !t.IsAbstract);
|
||||||
|
foreach (var editorType in editorTypes)
|
||||||
|
{
|
||||||
|
var attribute = editorType.GetAttribute<ComponentEditorAttribute>();
|
||||||
|
m_EditorTypes.Add(attribute.componentType, editorType);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateComponentsProperty(List<SerializedProperty> componentProps)
|
||||||
|
{
|
||||||
|
m_ComponentsProperty = componentProps;
|
||||||
|
RefreshEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
if (m_Editors == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var editor in m_Editors)
|
||||||
|
editor.OnDisable();
|
||||||
|
|
||||||
|
m_Editors.Clear();
|
||||||
|
m_EditorTypes.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnGUI()
|
||||||
|
{
|
||||||
|
if (chart == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// if (chart.isDirty)
|
||||||
|
// {
|
||||||
|
// RefreshEditors();
|
||||||
|
// chart.isDirty = false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Override list
|
||||||
|
for (int i = 0; i < m_Editors.Count; i++)
|
||||||
|
{
|
||||||
|
var editor = m_Editors[i];
|
||||||
|
string title = editor.GetDisplayTitle();
|
||||||
|
int id = i; // Needed for closure capture below
|
||||||
|
|
||||||
|
bool displayContent = ChartEditorHelper.DrawHeader(
|
||||||
|
title,
|
||||||
|
editor.baseProperty,
|
||||||
|
editor.showProperty,
|
||||||
|
() => { },
|
||||||
|
() => { RemoveComponentEditor(id); }
|
||||||
|
);
|
||||||
|
if (displayContent)
|
||||||
|
{
|
||||||
|
editor.OnInternalInspectorGUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Editors.Count > 0)
|
||||||
|
{
|
||||||
|
//EditorGUILayout.Space();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorGUILayout.HelpBox("No componnet.", MessageType.Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefreshEditors()
|
||||||
|
{
|
||||||
|
foreach (var editor in m_Editors)
|
||||||
|
editor.OnDisable();
|
||||||
|
|
||||||
|
m_Editors.Clear();
|
||||||
|
for (int i = 0; i < chart.components.Count; i++)
|
||||||
|
{
|
||||||
|
if (chart.components[i] != null)
|
||||||
|
{
|
||||||
|
CreateEditor(chart.components[i], m_ComponentsProperty[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateEditor(MainComponent component, SerializedProperty property, int index = -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
var settingsType = component.GetType();
|
||||||
|
Type editorType;
|
||||||
|
|
||||||
|
if (!m_EditorTypes.TryGetValue(settingsType, out editorType))
|
||||||
|
editorType = typeof(MainComponentBaseEditor);
|
||||||
|
var editor = (MainComponentBaseEditor)Activator.CreateInstance(editorType);
|
||||||
|
editor.Init(chart, component, property, m_BaseEditor);
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
m_Editors.Add(editor);
|
||||||
|
else
|
||||||
|
m_Editors[index] = editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddChartComponent(Type type)
|
||||||
|
{
|
||||||
|
chart.AddChartComponent(type);
|
||||||
|
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
|
||||||
|
RefreshEditors();
|
||||||
|
EditorUtility.SetDirty(chart);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveComponentEditor(int id)
|
||||||
|
{
|
||||||
|
m_Editors[id].OnDisable();
|
||||||
|
chart.RemoveChartComponent(m_Editors[id].component);
|
||||||
|
m_Editors.RemoveAt(id);
|
||||||
|
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
|
||||||
|
RefreshEditors();
|
||||||
|
EditorUtility.SetDirty(chart);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 62cc000ee006f492aadb05138ac6fe87
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
61
Assets/XCharts/Editor/MainComponents/MarkAreaEditor.cs
Normal file
61
Assets/XCharts/Editor/MainComponents/MarkAreaEditor.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(MarkArea))]
|
||||||
|
public class MarkAreaEditor : MainComponentEditor<MarkArea>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_SerieIndex");
|
||||||
|
PropertyField("m_Text");
|
||||||
|
PropertyField("m_ItemStyle");
|
||||||
|
PropertyField("m_Label");
|
||||||
|
PropertyField("m_Start");
|
||||||
|
PropertyField("m_End");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(MarkAreaData), true)]
|
||||||
|
public class MarkAreaDataDrawer : BasePropertyDrawer
|
||||||
|
{
|
||||||
|
public override string ClassName { get { return "MarkAreaData"; } }
|
||||||
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
|
{
|
||||||
|
base.OnGUI(pos, prop, label);
|
||||||
|
if (MakeComponentFoldout(prop, ""))
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
var type = (MarkAreaType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||||
|
PropertyField(prop, "m_Type");
|
||||||
|
PropertyField(prop, "m_Name");
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MarkAreaType.None:
|
||||||
|
PropertyField(prop, "m_XPosition");
|
||||||
|
PropertyField(prop, "m_YPosition");
|
||||||
|
PropertyField(prop, "m_XValue");
|
||||||
|
PropertyField(prop, "m_YValue");
|
||||||
|
break;
|
||||||
|
case MarkAreaType.Min:
|
||||||
|
case MarkAreaType.Max:
|
||||||
|
case MarkAreaType.Average:
|
||||||
|
case MarkAreaType.Median:
|
||||||
|
PropertyField(prop, "m_Dimension");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/MarkAreaEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/MarkAreaEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 83cc6f39a078f4ecfb2c3da09b116355
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/************************************************/
|
/************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
/* https://github.com/monitor1394 */
|
/* https://github.com/monitor1394 */
|
||||||
@@ -10,22 +10,18 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(MarkLine), true)]
|
[ComponentEditor(typeof(MarkLine))]
|
||||||
public class MarkLineDrawer : BasePropertyDrawer
|
public class MarkLineEditor : MainComponentEditor<MarkLine>
|
||||||
{
|
{
|
||||||
public override string ClassName { get { return "MarkLine"; } }
|
public override void OnInspectorGUI()
|
||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
|
||||||
{
|
|
||||||
base.OnGUI(pos, prop, label);
|
|
||||||
if (MakeFoldout(prop, "m_Show"))
|
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
PropertyField(prop, "m_Animation");
|
PropertyField("m_SerieIndex");
|
||||||
PropertyListField(prop, "m_Data", true);
|
PropertyField("m_Animation");
|
||||||
|
PropertyListField("m_Data", true);
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[CustomPropertyDrawer(typeof(MarkLineData), true)]
|
[CustomPropertyDrawer(typeof(MarkLineData), true)]
|
||||||
public class MarkLineDataDrawer : BasePropertyDrawer
|
public class MarkLineDataDrawer : BasePropertyDrawer
|
||||||
@@ -34,7 +30,7 @@ namespace XCharts
|
|||||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
if (MakeFoldout(prop, ""))
|
if (MakeComponentFoldout(prop, ""))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
var type = (MarkLineType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
var type = (MarkLineType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||||
11
Assets/XCharts/Editor/MainComponents/MarkLineEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/MarkLineEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 341fcecf4884e47519a2aff6defb30de
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
28
Assets/XCharts/Editor/MainComponents/ParallelCoordEditor.cs
Normal file
28
Assets/XCharts/Editor/MainComponents/ParallelCoordEditor.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(ParallelCoord))]
|
||||||
|
public class ParallelCoordEditor : MainComponentEditor<ParallelCoord>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Orient");
|
||||||
|
PropertyField("m_Left");
|
||||||
|
PropertyField("m_Right");
|
||||||
|
PropertyField("m_Top");
|
||||||
|
PropertyField("m_Bottom");
|
||||||
|
PropertyField("m_BackgroundColor");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f3d4d8d4d5c4b4197b021a25a7125390
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
25
Assets/XCharts/Editor/MainComponents/PolarCoordEditor.cs
Normal file
25
Assets/XCharts/Editor/MainComponents/PolarCoordEditor.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(PolarCoord))]
|
||||||
|
public class PolarCoordEditor : MainComponentEditor<PolarCoord>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyTwoFiled("m_Center");
|
||||||
|
PropertyField("m_Radius");
|
||||||
|
PropertyField("m_BackgroundColor");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f488cf12ded545de8737a2cde8bfead
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
56
Assets/XCharts/Editor/MainComponents/RadarCoordEditor.cs
Normal file
56
Assets/XCharts/Editor/MainComponents/RadarCoordEditor.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(RadarCoord))]
|
||||||
|
public class RadarCoordEditor : MainComponentEditor<RadarCoord>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Shape");
|
||||||
|
PropertyField("m_PositionType");
|
||||||
|
PropertyTwoFiled("m_Center");
|
||||||
|
PropertyField("m_Radius");
|
||||||
|
PropertyField("m_SplitNumber");
|
||||||
|
PropertyField("m_CeilRate");
|
||||||
|
PropertyField("m_IsAxisTooltip");
|
||||||
|
PropertyField("m_OutRangeColor");
|
||||||
|
PropertyField("m_ConnectCenter");
|
||||||
|
PropertyField("m_LineGradient");
|
||||||
|
PropertyField("m_AxisLine");
|
||||||
|
PropertyField("m_SplitLine");
|
||||||
|
PropertyField("m_SplitArea");
|
||||||
|
PropertyField("m_IndicatorList");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(RadarCoord.Indicator), true)]
|
||||||
|
public class RadarIndicatorDrawer : BasePropertyDrawer
|
||||||
|
{
|
||||||
|
public override string ClassName { get { return "Indicator"; } }
|
||||||
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
|
{
|
||||||
|
base.OnGUI(pos, prop, label);
|
||||||
|
if (MakeComponentFoldout(prop, ""))
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField(prop, "m_Name");
|
||||||
|
PropertyField(prop, "m_Min");
|
||||||
|
PropertyField(prop, "m_Max");
|
||||||
|
PropertyTwoFiled(prop, "m_Range");
|
||||||
|
PropertyField(prop, "m_TextStyle");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f1bfbd3f054624d42b854bcac720a58b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
40
Assets/XCharts/Editor/MainComponents/ThemeEditor.cs
Normal file
40
Assets/XCharts/Editor/MainComponents/ThemeEditor.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
#if dUI_TextMeshPro
|
||||||
|
using TMPro;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[CustomEditor(typeof(Theme))]
|
||||||
|
public class ThemeEditor : Editor
|
||||||
|
{
|
||||||
|
private Theme m_Theme;
|
||||||
|
void OnEnable()
|
||||||
|
{
|
||||||
|
m_Theme = target as Theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
// serializedObject.Update();
|
||||||
|
// EditorGUILayout.PropertyField(m_BackgroundColor);
|
||||||
|
// EditorGUILayout.PropertyField(m_ColorPalette);
|
||||||
|
// serializedObject.ApplyModifiedProperties();
|
||||||
|
base.OnInspectorGUI();
|
||||||
|
if (GUILayout.Button(new GUIContent("Reset", "Reset to default theme")))
|
||||||
|
{
|
||||||
|
m_Theme.ResetTheme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/ThemeEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/ThemeEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7856321df80e646c99317e95964991bc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
28
Assets/XCharts/Editor/MainComponents/TitleEditor.cs
Normal file
28
Assets/XCharts/Editor/MainComponents/TitleEditor.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(Title))]
|
||||||
|
public class TitleEditor : MainComponentEditor<Title>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Text");
|
||||||
|
PropertyField("m_SubText");
|
||||||
|
PropertyField("m_ItemGap");
|
||||||
|
PropertyField("m_Location");
|
||||||
|
PropertyField("m_TextStyle");
|
||||||
|
PropertyField("m_SubTextStyle");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/TitleEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/TitleEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c50c4d317d9274b32a5f137db0d66038
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
39
Assets/XCharts/Editor/MainComponents/TooltipEditor.cs
Normal file
39
Assets/XCharts/Editor/MainComponents/TooltipEditor.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(Tooltip))]
|
||||||
|
public class TooltipEditor : MainComponentEditor<Tooltip>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField("m_Type");
|
||||||
|
PropertyField("m_Trigger");
|
||||||
|
PropertyField("m_Formatter");
|
||||||
|
PropertyField("m_TitleFormatter");
|
||||||
|
PropertyField("m_ItemFormatter");
|
||||||
|
PropertyField("m_NumericFormatter");
|
||||||
|
PropertyField("m_FixedWidth");
|
||||||
|
PropertyField("m_FixedHeight");
|
||||||
|
PropertyField("m_MinWidth");
|
||||||
|
PropertyField("m_MinHeight");
|
||||||
|
PropertyField("m_PaddingLeftRight");
|
||||||
|
PropertyField("m_PaddingTopBottom");
|
||||||
|
PropertyField("m_BackgroundImage");
|
||||||
|
PropertyField("m_IgnoreDataDefaultContent");
|
||||||
|
PropertyField("m_Offset");
|
||||||
|
PropertyField("m_LineStyle");
|
||||||
|
PropertyField("m_TextStyle");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/TooltipEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/TooltipEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9179fea7bb2354601acce0feb82f8b17
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
42
Assets/XCharts/Editor/MainComponents/VesselEditor.cs
Normal file
42
Assets/XCharts/Editor/MainComponents/VesselEditor.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(Vessel))]
|
||||||
|
public class VesselEditor : MainComponentEditor<Vessel>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
var shape = (Vessel.Shape)baseProperty.FindPropertyRelative("m_Shape").intValue;
|
||||||
|
PropertyField("m_Shape");
|
||||||
|
PropertyField("m_ShapeWidth");
|
||||||
|
PropertyField("m_Gap");
|
||||||
|
PropertyTwoFiled("m_Center");
|
||||||
|
PropertyField("m_BackgroundColor");
|
||||||
|
PropertyField("m_Color");
|
||||||
|
PropertyField("m_AutoColor");
|
||||||
|
switch (shape)
|
||||||
|
{
|
||||||
|
case Vessel.Shape.Circle:
|
||||||
|
PropertyField("m_Radius");
|
||||||
|
PropertyField("m_Smoothness");
|
||||||
|
break;
|
||||||
|
case Vessel.Shape.Rect:
|
||||||
|
PropertyField("m_Width");
|
||||||
|
PropertyField("m_Height");
|
||||||
|
PropertyField("m_CornerRadius");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/VesselEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/VesselEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ffd6706dd3dd048d5ab9c538c133e963
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
68
Assets/XCharts/Editor/MainComponents/VisualMapEditor.cs
Normal file
68
Assets/XCharts/Editor/MainComponents/VisualMapEditor.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[ComponentEditor(typeof(VisualMap))]
|
||||||
|
public class VisualMapEditor : MainComponentEditor<VisualMap>
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
var type = (VisualMap.Type)baseProperty.FindPropertyRelative("m_Type").enumValueIndex;
|
||||||
|
var isPiece = type == VisualMap.Type.Piecewise;
|
||||||
|
PropertyField("m_Type");
|
||||||
|
PropertyField("m_SerieIndex");
|
||||||
|
PropertyField("m_AutoMinMax");
|
||||||
|
PropertyField("m_Min");
|
||||||
|
PropertyField("m_Max");
|
||||||
|
PropertyField("m_SplitNumber");
|
||||||
|
PropertyField("m_Dimension");
|
||||||
|
PropertyField("m_Show");
|
||||||
|
if (baseProperty.FindPropertyRelative("m_Show").boolValue)
|
||||||
|
{
|
||||||
|
PropertyField("m_SelectedMode");
|
||||||
|
PropertyTwoFiled("m_Range");
|
||||||
|
PropertyTwoFiled("m_Text");
|
||||||
|
PropertyTwoFiled("m_TextGap");
|
||||||
|
PropertyField("m_HoverLink");
|
||||||
|
PropertyField("m_Calculable");
|
||||||
|
PropertyField("m_ItemWidth");
|
||||||
|
PropertyField("m_ItemHeight");
|
||||||
|
if (isPiece) PropertyField("m_ItemGap");
|
||||||
|
PropertyField("m_BorderWidth");
|
||||||
|
PropertyField("m_Orient");
|
||||||
|
PropertyField("m_Location");
|
||||||
|
}
|
||||||
|
PropertyListField("m_OutOfRange");
|
||||||
|
PropertyListField(isPiece ? "m_Pieces" : "m_InRange");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(VisualMap.Pieces), true)]
|
||||||
|
public class PiecesDrawer : BasePropertyDrawer
|
||||||
|
{
|
||||||
|
public override string ClassName { get { return "Pieces"; } }
|
||||||
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||||
|
{
|
||||||
|
base.OnGUI(pos, prop, label);
|
||||||
|
if (MakeFoldout(prop, ""))
|
||||||
|
{
|
||||||
|
++EditorGUI.indentLevel;
|
||||||
|
PropertyField(prop, "m_Min");
|
||||||
|
PropertyField(prop, "m_Max");
|
||||||
|
PropertyField(prop, "m_Label");
|
||||||
|
PropertyField(prop, "m_Color");
|
||||||
|
--EditorGUI.indentLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/MainComponents/VisualMapEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/MainComponents/VisualMapEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 38b6413ab74484d6599bebbca7f5d437
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user