mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 22:40:10 +00:00
3.0 - unitypackage
This commit is contained in:
204
Editor/MainComponents/AxisEditor.cs
Normal file
204
Editor/MainComponents/AxisEditor.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/AxisEditor.cs.meta
Normal file
11
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:
|
||||
21
Editor/MainComponents/BackgroundEditor.cs
Normal file
21
Editor/MainComponents/BackgroundEditor.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/BackgroundEditor.cs.meta
Normal file
11
Editor/MainComponents/BackgroundEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89d95a9a994ad4b4692832e9a548e9e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Editor/MainComponents/DataZoomEditor.cs
Normal file
60
Editor/MainComponents/DataZoomEditor.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/DataZoomEditor.cs.meta
Normal file
11
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:
|
||||
20
Editor/MainComponents/GridCoordEditor.cs
Normal file
20
Editor/MainComponents/GridCoordEditor.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/GridCoordEditor.cs.meta
Normal file
11
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:
|
||||
27
Editor/MainComponents/LegendEditor.cs
Normal file
27
Editor/MainComponents/LegendEditor.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/LegendEditor.cs.meta
Normal file
11
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:
|
||||
122
Editor/MainComponents/MainComponentBaseEditor.cs
Normal file
122
Editor/MainComponents/MainComponentBaseEditor.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class MainComponentBaseEditor
|
||||
{
|
||||
protected const string MORE = "More";
|
||||
protected bool m_MoreFoldout = false;
|
||||
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, UnityEditor.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 PropertyFiledMore(System.Action action)
|
||||
{
|
||||
m_MoreFoldout = ChartEditorHelper.DrawHeader(MORE, m_MoreFoldout, false, null, null);
|
||||
if (m_MoreFoldout)
|
||||
{
|
||||
if (action != null) action();
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var prop = FindProperty(relativePropName);
|
||||
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/MainComponentBaseEditor.cs.meta
Normal file
11
Editor/MainComponents/MainComponentBaseEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2909950e65ad44c2eb617a8b75845431
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Editor/MainComponents/MainComponentEditor.cs
Normal file
9
Editor/MainComponents/MainComponentEditor.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class MainComponentEditor<T> : MainComponentBaseEditor
|
||||
where T : MainComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/MainComponentEditor.cs.meta
Normal file
11
Editor/MainComponents/MainComponentEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 276997094e92e4b6590591727cb21349
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
165
Editor/MainComponents/MainComponentListEditor.cs
Normal file
165
Editor/MainComponents/MainComponentListEditor.cs
Normal file
@@ -0,0 +1,165 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/MainComponentListEditor.cs.meta
Normal file
11
Editor/MainComponents/MainComponentListEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62cc000ee006f492aadb05138ac6fe87
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
Editor/MainComponents/MarkAreaEditor.cs
Normal file
55
Editor/MainComponents/MarkAreaEditor.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/MarkAreaEditor.cs.meta
Normal file
11
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:
|
||||
59
Editor/MainComponents/MarkLineEditor.cs
Normal file
59
Editor/MainComponents/MarkLineEditor.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(MarkLine))]
|
||||
public class MarkLineEditor : MainComponentEditor<MarkLine>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_SerieIndex");
|
||||
PropertyField("m_Animation");
|
||||
PropertyListField("m_Data", true);
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(MarkLineData), true)]
|
||||
public class MarkLineDataDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "MarkLineData"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, ""))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (MarkLineType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||
var group = prop.FindPropertyRelative("m_Group").intValue;
|
||||
PropertyField(prop, "m_Type");
|
||||
PropertyField(prop, "m_Name");
|
||||
switch (type)
|
||||
{
|
||||
case MarkLineType.None:
|
||||
PropertyField(prop, "m_XPosition");
|
||||
PropertyField(prop, "m_YPosition");
|
||||
PropertyField(prop, "m_XValue");
|
||||
PropertyField(prop, "m_YValue");
|
||||
break;
|
||||
case MarkLineType.Min:
|
||||
case MarkLineType.Max:
|
||||
case MarkLineType.Average:
|
||||
case MarkLineType.Median:
|
||||
PropertyField(prop, "m_Dimension");
|
||||
break;
|
||||
}
|
||||
PropertyField(prop, "m_Group");
|
||||
if (group > 0 && type == MarkLineType.None) PropertyField(prop, "m_ZeroPosition");
|
||||
PropertyField(prop, "m_LineStyle");
|
||||
PropertyField(prop, "m_StartSymbol");
|
||||
PropertyField(prop, "m_EndSymbol");
|
||||
PropertyField(prop, "m_Label");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/MarkLineEditor.cs.meta
Normal file
11
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:
|
||||
21
Editor/MainComponents/ParallelCoordEditor.cs
Normal file
21
Editor/MainComponents/ParallelCoordEditor.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/ParallelCoordEditor.cs.meta
Normal file
11
Editor/MainComponents/ParallelCoordEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3d4d8d4d5c4b4197b021a25a7125390
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Editor/MainComponents/PolarCoordEditor.cs
Normal file
18
Editor/MainComponents/PolarCoordEditor.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/PolarCoordEditor.cs.meta
Normal file
11
Editor/MainComponents/PolarCoordEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f488cf12ded545de8737a2cde8bfead
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
50
Editor/MainComponents/RadarCoordEditor.cs
Normal file
50
Editor/MainComponents/RadarCoordEditor.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/RadarCoordEditor.cs.meta
Normal file
11
Editor/MainComponents/RadarCoordEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1bfbd3f054624d42b854bcac720a58b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Editor/MainComponents/ThemeEditor.cs
Normal file
33
Editor/MainComponents/ThemeEditor.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
#if dUI_TextMeshPro
|
||||
using TMPro;
|
||||
#endif
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomEditor(typeof(Theme))]
|
||||
public class ThemeEditor : UnityEditor.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
Editor/MainComponents/ThemeEditor.cs.meta
Normal file
11
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:
|
||||
21
Editor/MainComponents/TitleEditor.cs
Normal file
21
Editor/MainComponents/TitleEditor.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/TitleEditor.cs.meta
Normal file
11
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:
|
||||
47
Editor/MainComponents/TooltipEditor.cs
Normal file
47
Editor/MainComponents/TooltipEditor.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(Tooltip))]
|
||||
public class TooltipEditor : MainComponentEditor<Tooltip>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Type");
|
||||
PropertyField("m_Trigger");
|
||||
PropertyField("m_AlwayShow");
|
||||
PropertyField("m_TitleFormatter");
|
||||
PropertyField("m_ItemFormatter");
|
||||
PropertyField("m_NumericFormatter");
|
||||
PropertyField("m_TitleHeight");
|
||||
PropertyField("m_ItemHeight");
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
PropertyField("m_Marker");
|
||||
PropertyField("m_BorderWidth");
|
||||
PropertyField("m_BorderColor");
|
||||
PropertyField("m_PaddingLeftRight");
|
||||
PropertyField("m_PaddingTopBottom");
|
||||
PropertyField("m_BackgroundImage");
|
||||
PropertyField("m_BackgroundColor");
|
||||
PropertyField("m_FixedWidth");
|
||||
PropertyField("m_FixedHeight");
|
||||
PropertyField("m_MinWidth");
|
||||
PropertyField("m_MinHeight");
|
||||
PropertyField("m_IgnoreDataDefaultContent");
|
||||
PropertyField("m_Offset");
|
||||
PropertyField("m_FixedXEnable");
|
||||
PropertyField("m_FixedX");
|
||||
PropertyField("m_FixedYEnable");
|
||||
PropertyField("m_FixedY");
|
||||
});
|
||||
PropertyField("m_LineStyle");
|
||||
PropertyField("m_LabelTextStyle");
|
||||
PropertyField("m_TitleTextStyle");
|
||||
PropertyListField("m_ColumnsTextStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/TooltipEditor.cs.meta
Normal file
11
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:
|
||||
35
Editor/MainComponents/VesselEditor.cs
Normal file
35
Editor/MainComponents/VesselEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/VesselEditor.cs.meta
Normal file
11
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:
|
||||
62
Editor/MainComponents/VisualMapEditor.cs
Normal file
62
Editor/MainComponents/VisualMapEditor.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[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
Editor/MainComponents/VisualMapEditor.cs.meta
Normal file
11
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:
|
||||
Reference in New Issue
Block a user