UI update 02

This commit is contained in:
FloatGaming
2026-06-30 21:21:30 +08:00
parent b2a1e307a4
commit f62f643cfc
1666 changed files with 211081 additions and 22799 deletions
@@ -0,0 +1,252 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
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_MaxCache");
PropertyField("m_MinCategorySpacing");
PropertyField("m_BoundaryGap");
}
else
{
PropertyField("m_Interval");
}
DrawExtendeds();
if (type != Axis.AxisType.Category)
{
PropertyField("m_Animation");
}
PropertyField("m_AxisLine");
PropertyField("m_AxisName");
PropertyField("m_AxisTick");
PropertyField("m_AxisLabel");
PropertyField("m_SplitLine");
PropertyField("m_SplitArea");
PropertyField("m_IndicatorLabel");
if (type != Axis.AxisType.Category)
{
PropertyField("m_MinorTick");
PropertyField("m_MinorSplitLine");
}
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, false);
PraseExternalDataEditor.ShowWindow();
}));
}
EditorGUI.indentLevel--;
}
}
[ComponentEditor(typeof(XAxis))]
public class XAxisEditor : AxisEditor
{
protected override void DrawExtendeds()
{
base.DrawExtendeds();
PropertyField("m_MainAxis");
}
}
[ComponentEditor(typeof(YAxis))]
public class YAxisEditor : AxisEditor
{
protected override void DrawExtendeds()
{
base.DrawExtendeds();
PropertyField("m_MainAxis");
}
}
[ComponentEditor(typeof(XAxis3D))]
public class XAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(YAxis3D))]
public class YAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(ZAxis3D))]
public class ZAxis3DEditor : 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", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_ShowZeroLabel");
PropertyField(prop, "m_ShowStartLabel");
PropertyField(prop, "m_ShowEndLabel");
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Icon");
PropertyField(prop, "m_Background");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_TextPadding");
PropertyField(prop, "m_TextLimit");
--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", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_LabelStyle");
--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", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisAnimation), true)]
public class AxisAnimationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Animation"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_UnscaledTime");
PropertyField(prop, "m_Duration");
--EditorGUI.indentLevel;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e6d7780afa9b49aa9081bf55d301955
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using UnityEditor;
using XCharts.Runtime;
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_AutoColor");
PropertyField("m_BorderStyle");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 89d95a9a994ad4b4692832e9a548e9e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,112 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using XCharts.Runtime;
namespace XCharts.Editor
{
public class BaseGraphEditor : UnityEditor.Editor
{
class Styles
{
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
}
public BaseGraph m_BaseGraph;
public static T AddUIComponent<T>(string chartName) where T : BaseGraph
{
return XChartsEditor.AddGraph<T>(chartName);
}
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
protected virtual void OnEnable()
{
m_Properties.Clear();
m_BaseGraph = (BaseGraph)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
PropertyField("m_Script");
OnStartInspectorGUI();
OnDebugInspectorGUI();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI() { }
protected virtual void OnDebugInspectorGUI()
{
EditorGUILayout.Space();
OnDebugStartInspectorGUI();
OnDebugEndInspectorGUI();
}
protected virtual void OnDebugStartInspectorGUI() { }
protected virtual void OnDebugEndInspectorGUI() { }
protected void PropertyField(string name)
{
if (!m_Properties.ContainsKey(name))
{
var prop = serializedObject.FindProperty(name);
if (prop == null)
{
Debug.LogError("Property " + name + " not found!");
return;
}
m_Properties.Add(name, prop);
}
EditorGUILayout.PropertyField(m_Properties[name]);
}
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);
}
protected SerializedProperty FindProperty(string path)
{
if (!m_Properties.ContainsKey(path))
{
m_Properties.Add(path, serializedObject.FindProperty(path));
}
return m_Properties[path];
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88786092000154d359c1aa954ce664f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(Comment))]
public class CommentEditor : MainComponentEditor<Comment>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Layer");
PropertyField("m_LabelStyle");
//PropertyField("m_MarkStyle");
PropertyListField("m_Items", true);
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2364066bf3174aa39b79020266ce72d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,66 @@
using UnityEditor;
using XCharts.Runtime;
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_SupportMarquee = baseProperty.FindPropertyRelative("m_SupportMarquee");
var m_Start = baseProperty.FindPropertyRelative("m_Start");
var m_End = baseProperty.FindPropertyRelative("m_End");
var m_MinZoomRatio = baseProperty.FindPropertyRelative("m_MinZoomRatio");
++EditorGUI.indentLevel;
PropertyField("m_Orient");
PropertyField("m_SupportInside");
if (m_SupportInside.boolValue)
{
PropertyField("m_SupportInsideScroll");
PropertyField("m_SupportInsideDrag");
}
PropertyField(m_SupportSlider);
PropertyField(m_SupportMarquee);
PropertyField("m_ZoomLock");
PropertyField("m_ScrollSensitivity");
PropertyField("m_RangeMode");
PropertyField(m_Start);
PropertyField(m_End);
PropertyField("m_StartLock");
PropertyField("m_EndLock");
PropertyField(m_MinZoomRatio);
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
if (m_End.floatValue > 100) m_End.floatValue = 100;
if (m_MinZoomRatio.floatValue < 0) m_MinZoomRatio.floatValue = 0;
if (m_MinZoomRatio.floatValue > 1) m_MinZoomRatio.floatValue = 1;
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");
PropertyField("m_LabelStyle");
PropertyListField("m_XAxisIndexs", true);
PropertyListField("m_YAxisIndexs", true);
}
else
{
PropertyListField("m_XAxisIndexs", true);
PropertyListField("m_YAxisIndexs", true);
}
PropertyField("m_MarqueeStyle");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 06bc176df52bf4953b8d46254523d2ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord3D))]
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Bottom");
PropertyField("m_BoxWidth");
PropertyField("m_BoxHeight");
PropertyField("m_BoxDepth");
PropertyField("m_XYExchanged");
PropertyField("m_ShowBorder");
PropertyField("m_ViewControl");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9a4a8a30b1124c4e996e234d5717a07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord))]
public class GridCoordEditor : MainComponentEditor<GridCoord>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
var layoutIndex = baseProperty.FindPropertyRelative("m_LayoutIndex").intValue;
PropertyField("m_LayoutIndex");
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_BackgroundColor");
PropertyField("m_ShowBorder");
PropertyField("m_BorderWidth");
PropertyField("m_BorderColor");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb28a0ae5edd34b63ae9cbce0986585b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridLayout))]
public class GridLayoutEditor : MainComponentEditor<GridLayout>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_Row");
PropertyField("m_Column");
PropertyField("m_Spacing");
PropertyField("m_Inverse");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4288bf299494d43d497436ace4b7a5a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
using UnityEditor;
using XCharts.Runtime;
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_ItemOpacity");
PropertyField("m_ItemInactiveOpacity");
PropertyField("m_SelectedMode");
PropertyField("m_Orient");
PropertyField("m_Location");
PropertyField("m_LabelStyle");
PropertyField("m_TextLimit");
PropertyField("m_Background");
PropertyField("m_Padding");
PropertyListField("m_Icons");
PropertyListField("m_Colors");
PropertyListField("m_Positions");
PropertyListField("m_Data");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ef040b104aa2452f80d91c7c33775c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,116 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using XCharts.Runtime;
namespace XCharts.Editor
{
public class MainComponentBaseEditor
{
protected const string MORE = "More";
protected bool m_MoreFoldout = false;
public BaseChart chart { get; private set; }
public MainComponent component { get; private set; }
public SerializedProperty baseProperty;
public SerializedProperty showProperty;
internal void Init(BaseChart chart, MainComponent target, SerializedProperty property, UnityEditor.Editor inspector)
{
this.chart = chart;
this.component = target;
this.baseProperty = property;
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);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2909950e65ad44c2eb617a8b75845431
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
using XCharts.Runtime;
namespace XCharts.Editor
{
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:
@@ -0,0 +1,184 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using XCharts.Runtime;
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;
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;
for (int i = 0; i < m_Editors.Count; i++)
{
var editor = m_Editors[i];
string title = editor.GetDisplayTitle();
int id = i;
bool displayContent = ChartEditorHelper.DrawHeader(
title,
editor.baseProperty,
editor.showProperty,
() => { if (EditorUtility.DisplayDialog("", "Sure reset " + editor.component.GetType().Name + "?", "Yes", "Cancel")) ResetComponentEditor(id); },
() => { if (EditorUtility.DisplayDialog("", "Sure remove " + editor.component.GetType().Name + "?", "Yes", "Cancel")) RemoveComponentEditor(id); },
() => { Application.OpenURL("https://xcharts-team.github.io/docs/configuration/#" + editor.component.GetType().Name.ToLower()); }
);
if (displayContent)
{
editor.OnInternalInspectorGUI();
}
}
if (m_Editors.Count == 0)
{
EditorGUILayout.HelpBox("No componnet.", MessageType.Info);
}
}
void RefreshEditors()
{
foreach (var editor in m_Editors)
editor.OnDisable();
m_Editors.Clear();
var count = Mathf.Min(chart.components.Count, m_ComponentsProperty.Count);
for (int i = 0; i < 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)
{
var component = chart.AddChartComponent(type);
if (component != null)
{
if (component is YAxis)
{
var yAxis = component as YAxis;
if (yAxis.index == 1)
{
yAxis.position = Axis.AxisPosition.Right;
}
}
else if (component is XAxis)
{
var xAxis = component as XAxis;
if (xAxis.index == 1)
{
xAxis.position = Axis.AxisPosition.Top;
}
}
}
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
RefreshEditors();
EditorUtility.SetDirty(chart);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
private void ResetComponentEditor(int id)
{
m_Editors[id].component.Reset();
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);
chart.RebuildChartObject();
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:
@@ -0,0 +1,55 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
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, "", true))
{
++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;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 83cc6f39a078f4ecfb2c3da09b116355
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,60 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(MarkLine))]
public class MarkLineEditor : MainComponentEditor<MarkLine>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_SerieIndex");
PropertyField("m_OnTop");
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, "", true))
{
++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.Custom:
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.Custom) PropertyField(prop, "m_ZeroPosition");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_StartSymbol");
PropertyField(prop, "m_EndSymbol");
PropertyField(prop, "m_Label");
--EditorGUI.indentLevel;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 341fcecf4884e47519a2aff6defb30de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using UnityEditor;
using XCharts.Runtime;
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;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f3d4d8d4d5c4b4197b021a25a7125390
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(PolarCoord))]
public class PolarCoordEditor : MainComponentEditor<PolarCoord>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyTwoFiled("m_Center");
PropertyTwoFiled("m_Radius");
PropertyField("m_BackgroundColor");
PropertyField("m_IndicatorLabelOffset");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5f488cf12ded545de8737a2cde8bfead
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(RadarCoord))]
public class RadarCoordEditor : MainComponentEditor<RadarCoord>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_GridIndex");
PropertyField("m_Shape");
PropertyField("m_PositionType");
PropertyTwoFiled("m_Center");
PropertyField("m_Radius");
PropertyField("m_SplitNumber");
PropertyField("m_StartAngle");
PropertyField("m_CeilRate");
PropertyField("m_IsAxisTooltip");
PropertyField("m_OutRangeColor");
PropertyField("m_ConnectCenter");
PropertyField("m_LineGradient");
PropertyField("m_AxisLine");
PropertyField("m_AxisName");
PropertyField("m_SplitLine");
PropertyField("m_SplitArea");
PropertyListField("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, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyTwoFiled(prop, "m_Range");
--EditorGUI.indentLevel;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f1bfbd3f054624d42b854bcac720a58b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
#if dUI_TextMeshPro
using TMPro;
#endif
namespace XCharts.Editor
{
[CustomEditor(typeof(Theme))]
public class ThemeEditor : UnityEditor.Editor
{
static class Styles
{
internal static GUIContent btnReset = new GUIContent("Reset to Default", "Reset to default theme");
internal static GUIContent btnSyncFontToSubTheme = new GUIContent("Sync Font to Sub Theme", "Sync main theme font to sub theme font");
internal static GUIContent btnSyncFontFromSetting = new GUIContent("Sync Font from Setting", "Sync main theme font and sub theme font from XCSetting font");
}
private Theme m_Theme;
void OnEnable()
{
m_Theme = target as Theme;
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (GUILayout.Button(Styles.btnReset))
{
if (EditorUtility.DisplayDialog(Styles.btnReset.text, Styles.btnReset.tooltip, "Yes", "Cancel"))
{
m_Theme.ResetTheme();
Debug.Log("XCharts: Reset Finish.");
}
}
if (GUILayout.Button(Styles.btnSyncFontFromSetting))
{
if (EditorUtility.DisplayDialog(Styles.btnSyncFontFromSetting.text, Styles.btnSyncFontFromSetting.tooltip, "Yes", "Cancel"))
{
m_Theme.common.font = XCSettings.font;
m_Theme.SyncFontToSubComponent();
#if dUI_TextMeshPro
m_Theme.common.tmpFont = XCSettings.tmpFont;
m_Theme.SyncTMPFontToSubComponent();
#endif
Debug.Log("XCharts: Sync Finish.");
}
}
if (GUILayout.Button(Styles.btnSyncFontToSubTheme))
{
if (EditorUtility.DisplayDialog(Styles.btnSyncFontToSubTheme.text, Styles.btnSyncFontToSubTheme.tooltip, "Yes", "Cancel"))
{
m_Theme.SyncFontToSubComponent();
#if dUI_TextMeshPro
m_Theme.SyncTMPFontToSubComponent();
#endif
Debug.Log("XCharts: Sync Finish.");
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7856321df80e646c99317e95964991bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using UnityEditor;
using XCharts.Runtime;
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_LabelStyle");
PropertyField("m_SubLabelStyle");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c50c4d317d9274b32a5f137db0d66038
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,49 @@
using UnityEditor;
using XCharts.Runtime;
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_TriggerOn");
PropertyField("m_Position");
PropertyField("m_FixedX");
PropertyField("m_FixedY");
PropertyField("m_Offset");
PropertyField("m_ShowContent");
PropertyField("m_AlwayShowContent");
PropertyField("m_TitleFormatter");
PropertyField("m_ItemFormatter");
PropertyField("m_NumericFormatter");
PropertyFiledMore(() =>
{
PropertyField("m_TitleHeight");
PropertyField("m_ItemHeight");
PropertyField("m_Marker");
PropertyField("m_BorderWidth");
PropertyField("m_BorderColor");
PropertyField("m_PaddingLeftRight");
PropertyField("m_PaddingTopBottom");
PropertyField("m_BackgroundImage");
PropertyField("m_BackgroundType");
PropertyField("m_BackgroundColor");
PropertyField("m_FixedWidth");
PropertyField("m_FixedHeight");
PropertyField("m_MinWidth");
PropertyField("m_MinHeight");
PropertyField("m_IgnoreDataDefaultContent");
});
PropertyField("m_LineStyle");
PropertyField("m_TitleLabelStyle");
PropertyListField("m_ColumnGapWidths");
PropertyListField("m_ContentLabelStyles");
--EditorGUI.indentLevel;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9179fea7bb2354601acce0feb82f8b17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,121 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using XCharts.Runtime;
namespace XCharts.Editor
{
public class UIComponentEditor : UnityEditor.Editor
{
class Styles
{
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
}
public UIComponent m_UIComponent;
public static T AddUIComponent<T>(string chartName) where T : UIComponent
{
return XChartsEditor.AddGraph<T>(chartName);
}
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
protected virtual void OnEnable()
{
m_Properties.Clear();
m_UIComponent = (UIComponent) target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
PropertyField("m_Script");
OnStartInspectorGUI();
OnDebugInspectorGUI();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI() { }
protected virtual void OnDebugInspectorGUI()
{
EditorGUILayout.Space();
PropertyField("m_DebugModel");
OnDebugStartInspectorGUI();
if (GUILayout.Button(Styles.btnRebuildChartObject))
{
m_UIComponent.RebuildChartObject();
}
if (GUILayout.Button(Styles.btnSaveAsImage))
{
m_UIComponent.SaveAsImage("png", "", 4f);
}
OnDebugEndInspectorGUI();
}
protected virtual void OnDebugStartInspectorGUI() { }
protected virtual void OnDebugEndInspectorGUI() { }
protected void PropertyField(string name)
{
if (!m_Properties.ContainsKey(name))
{
var prop = serializedObject.FindProperty(name);
if (prop == null)
{
Debug.LogError("Property " + name + " not found!");
return;
}
m_Properties.Add(name, prop);
}
EditorGUILayout.PropertyField(m_Properties[name]);
}
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);
}
protected SerializedProperty FindProperty(string path)
{
if (!m_Properties.ContainsKey(path))
{
m_Properties.Add(path, serializedObject.FindProperty(path));
}
return m_Properties[path];
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d226759112b0d463b8fba4830762893c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(UIComponentTheme), true)]
public class UIComponentThemeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Theme"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_SharedTheme");
PropertyField(prop, "m_TransparentBackground");
--EditorGUI.indentLevel;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dca2d7a2ed994420182384c2efa48c0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
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_WorkOnLine");
PropertyField("m_WorkOnArea");
PropertyField("m_ShowUI");
if (baseProperty.FindPropertyRelative("m_ShowUI").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("m_InRange");
--EditorGUI.indentLevel;
}
}
[CustomPropertyDrawer(typeof(VisualMapRange), true)]
public class VisualMapRangeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Range"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Color"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38b6413ab74484d6599bebbca7f5d437
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: