3.0 - unitypackage

This commit is contained in:
monitor1394
2022-01-05 21:40:48 +08:00
parent c160867765
commit 228a4b2840
846 changed files with 105 additions and 467693 deletions

8
Editor/Attributes.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8e7c19967ca244147b0fcbb129201b46
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using System;
namespace XCharts.Editor
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class ComponentEditorAttribute : Attribute
{
public readonly Type componentType;
public ComponentEditorAttribute(Type componentType)
{
this.componentType = componentType;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f433acf13ec404a6d91eb78352d18d4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using System;
namespace XCharts.Editor
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class SerieEditorAttribute : Attribute
{
public readonly Type serieType;
public SerieEditorAttribute(Type serieType)
{
this.serieType = serieType;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dcdc7a72224af419d96584fa40f822c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/Charts.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9e4407eed14ec4e518a373f4d8ae9b3c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,304 @@

using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomEditor(typeof(BaseChart), true)]
public class BaseChartEditor : UnityEditor.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 (type.IsDefined(typeof(SerieHandlerAttribute), false))
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();
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d7f1cff1e5bae244a872040086b1cfa8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7861b681552cf4bc9b2c2f16d25c628c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(AnimationStyle), true)]
public class AnimationDrawer : 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_Enable"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_FadeInDuration");
PropertyField(prop, "m_FadeInDelay");
PropertyField(prop, "m_FadeOutDuration");
PropertyField(prop, "m_FadeOutDelay");
PropertyField(prop, "m_DataChangeEnable");
PropertyField(prop, "m_DataChangeDuration");
PropertyField(prop, "m_ActualDuration");
PropertyField(prop, "m_AlongWithLinePath");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 844042f92a581474ba0491427f3fd592
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(AreaStyle), true)]
public class AreaStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AreaStyle"; } }
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_Origin");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_HighlightColor");
PropertyField(prop, "m_HighlightToColor");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_TooltipHighlight");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c51fd822c8be44490832d81652d1aef5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,196 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
public delegate void DelegateMenuAction(Vector2 postion);
public class BasePropertyDrawer : PropertyDrawer
{
protected int m_Index;
protected int m_DataSize;
protected float m_DefaultWidth;
protected string m_DisplayName;
protected string m_KeyName;
protected Rect m_DrawRect;
protected Dictionary<string, float> m_Heights = new Dictionary<string, float>();
protected Dictionary<string, bool> m_PropToggles = new Dictionary<string, bool>();
protected Dictionary<string, bool> m_DataToggles = new Dictionary<string, bool>();
public virtual string ClassName { get { return ""; } }
public virtual List<string> IngorePropertys { get { return new List<string> { }; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
m_DrawRect = pos;
m_DrawRect.height = EditorGUIUtility.singleLineHeight;
m_DefaultWidth = pos.width;
var list = prop.displayName.Split(' ');
if (list.Length > 0)
{
if (!int.TryParse(list[list.Length - 1], out m_Index))
{
m_Index = 0;
m_DisplayName = prop.displayName;
m_KeyName = prop.propertyPath + "_" + m_Index;
}
else
{
m_DisplayName = ClassName + " " + m_Index;
m_KeyName = prop.propertyPath + "_" + m_Index;
}
}
else
{
m_DisplayName = prop.displayName;
}
if (!m_PropToggles.ContainsKey(m_KeyName))
{
m_PropToggles.Add(m_KeyName, false);
}
if (!m_DataToggles.ContainsKey(m_KeyName))
{
m_DataToggles.Add(m_KeyName, false);
}
if (!m_Heights.ContainsKey(m_KeyName))
{
m_Heights.Add(m_KeyName, 0);
}
else
{
m_Heights[m_KeyName] = 0;
}
}
private string GetKeyName(SerializedProperty prop)
{
var index = 0;
var list = prop.displayName.Split(' ');
if (list.Length > 0)
{
int.TryParse(list[list.Length - 1], out index);
}
return prop.propertyPath + "_" + index;
}
protected void AddSingleLineHeight()
{
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
m_DrawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected void AddHeight(float height)
{
m_Heights[m_KeyName] += height;
m_DrawRect.y += height;
}
protected void PropertyListField(SerializedProperty prop, string relativePropName, bool showOrder = true)
{
if (IngorePropertys.Contains(relativePropName)) return;
var height = m_Heights[m_KeyName];
var toggleKeyName = m_KeyName + relativePropName;
m_DataToggles[toggleKeyName] = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
prop.FindPropertyRelative(relativePropName),
m_DataToggles.ContainsKey(toggleKeyName) && m_DataToggles[toggleKeyName], showOrder, true);
m_Heights[m_KeyName] = height;
}
protected void PropertyField(SerializedProperty prop, string relativePropName)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyField(ref m_DrawRect, m_Heights, m_KeyName, prop, relativePropName))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMin(SerializedProperty prop, string relativePropName, float minValue)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFieldWithMinValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
relativePropName, minValue))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMax(SerializedProperty prop, string relativePropName, float maxValue)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFieldWithMaxValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
relativePropName, maxValue))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyField(SerializedProperty prop, SerializedProperty relativeProp)
{
if (!ChartEditorHelper.PropertyField(ref m_DrawRect, m_Heights, m_KeyName, relativeProp))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativeProp);
}
}
protected void PropertyTwoFiled(SerializedProperty prop, string relativeListProp, string labelName = null)
{
PropertyTwoFiled(prop, prop.FindPropertyRelative(relativeListProp), labelName);
}
protected void PropertyTwoFiled(SerializedProperty prop, SerializedProperty relativeListProp,
string labelName = null)
{
if (string.IsNullOrEmpty(labelName))
{
labelName = relativeListProp.displayName;
}
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DefaultWidth, relativeListProp, labelName);
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected bool MakeFoldout(SerializedProperty prop, string relativePropName)
{
if (string.IsNullOrEmpty(relativePropName))
{
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, null);
}
else
{
var relativeProp = prop.FindPropertyRelative(relativePropName);
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
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)
{
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
var key = GetKeyName(prop);
if (m_Heights.ContainsKey(key)) return m_Heights[key] + GetExtendedHeight();
else return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected virtual float GetExtendedHeight()
{
return 0;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e5a04ce1f0a841b9b966a6d74de00e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,185 @@

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ComponentTheme), true)]
public class ComponentThemeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return ""; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, ""))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFont");
#else
PropertyField(prop, "m_Font");
#endif
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_TextColor");
//PropertyField(prop, "m_TextBackgroundColor");
DrawExtendeds(prop);
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(BaseAxisTheme), true)]
public class BaseAxisThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "Axis"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineLength");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_SplitLineType");
PropertyField(prop, "m_SplitLineWidth");
PropertyField(prop, "m_SplitLineLength");
PropertyField(prop, "m_SplitLineColor");
PropertyField(prop, "m_TickWidth");
PropertyField(prop, "m_TickLength");
PropertyField(prop, "m_TickColor");
PropertyField(prop, "m_SplitAreaColors");
}
}
[CustomPropertyDrawer(typeof(AxisTheme), true)]
public class AxisThemeDrawer : BaseAxisThemeDrawer
{
public override string ClassName { get { return "Axis"; } }
}
[CustomPropertyDrawer(typeof(RadiusAxisTheme), true)]
public class RadiusAxisThemeDrawer : BaseAxisThemeDrawer
{
public override string ClassName { get { return "Radius Axis"; } }
public override List<string> IngorePropertys
{
get
{
return new List<string> {
"m_TextBackgroundColor" ,
"m_LineLength",
"m_SplitLineLength",
};
}
}
}
[CustomPropertyDrawer(typeof(GaugeAxisTheme), true)]
public class GaugeAxisThemeDrawer : AxisThemeDrawer
{
public override string ClassName { get { return "Gauge Axis"; } }
public override List<string> IngorePropertys
{
get
{
return new List<string> {
"m_TextBackgroundColor" ,
"m_LineLength",
};
}
}
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_BarBackgroundColor");
PropertyField(prop, "m_StageColor");
}
}
[CustomPropertyDrawer(typeof(DataZoomTheme), true)]
public class DataZoomThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "DataZoom"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_DataLineWidth");
PropertyField(prop, "m_DataLineColor");
PropertyField(prop, "m_FillerColor");
PropertyField(prop, "m_DataAreaColor");
}
}
[CustomPropertyDrawer(typeof(LegendTheme), true)]
public class LegendThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "Legend"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_UnableColor");
}
}
[CustomPropertyDrawer(typeof(TooltipTheme), true)]
public class TooltipThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "Tooltip"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_AreaColor");
PropertyField(prop, "m_LabelTextColor");
PropertyField(prop, "m_LabelBackgroundColor");
}
}
[CustomPropertyDrawer(typeof(VisualMapTheme), true)]
public class VisualMapThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "VisualMap"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
// PropertyField(prop, "m_BorderWidth");
// PropertyField(prop, "m_BorderColor");
// PropertyField(prop, "m_BackgroundColor");
}
}
[CustomPropertyDrawer(typeof(SerieTheme), true)]
public class SerieThemeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Serie"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, ""))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineSymbolSize");
PropertyField(prop, "m_ScatterSymbolSize");
PropertyField(prop, "m_SelectedRate");
PropertyField(prop, "m_PieTooltipExtraRadius");
PropertyField(prop, "m_PieSelectedOffset");
PropertyField(prop, "m_CandlestickColor");
PropertyField(prop, "m_CandlestickColor0");
PropertyField(prop, "m_CandlestickBorderColor");
PropertyField(prop, "m_CandlestickBorderColor0");
PropertyField(prop, "m_CandlestickBorderWidth");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7937a2a7addd42299e960c5cfb75e34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Emphasis), true)]
public class EmphasisDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Emphasis"; } }
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_Label");
PropertyField(prop, "m_LabelLine");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7de9b5e4c5d474fdd88ebb89f0924305
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,29 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(IconStyle), true)]
public class IconStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "IconStyle"; } }
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_Layer");
PropertyField(prop, "m_Align");
PropertyField(prop, "m_Sprite");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_AutoHideWhenLabelEmpty");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cae26ad61d224d8a97d41bdc52ec0b7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ItemStyle), true)]
public class ItemStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ItemStyle"; } }
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");
PropertyField(prop, "m_Color0");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_ToColor2");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_CenterColor");
PropertyField(prop, "m_CenterGap");
PropertyField(prop, "m_BorderType");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_BorderColor0");
PropertyField(prop, "m_BorderToColor");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_ItemMarker");
PropertyField(prop, "m_ItemFormatter");
PropertyField(prop, "m_NumericFormatter");
PropertyListField(prop, "m_CornerRadius", true);
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f40830a3b05574467ad0d8873c6c8790
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LabelLine), true)]
public class LabelLineDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LabelLine"; } }
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_LineType");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineGap");
PropertyField(prop, "m_LineLength1");
PropertyField(prop, "m_LineLength2");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 29a267a45c6e64454a982032947046c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LabelStyle), true)]
public class LabelStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Label"; } }
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_Position");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_AutoOffset");
PropertyField(prop, "m_Margin");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_BackgroundHeight");
PropertyField(prop, "m_PaddingLeftRight");
PropertyField(prop, "m_PaddingTopBottom");
PropertyField(prop, "m_Border");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abd47f4015a9840b9acae8efb21db7c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ArrowStyle), true)]
public class ArrowDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Arrow"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, ""))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Dent");
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(LineArrow), true)]
public class LineArrowStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LineArrow"; } }
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_Position");
PropertyField(prop, "m_Arrow");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 817d27d232da94f6c9dab9e3d0c22631
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,60 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(BaseLine), true)]
public class BaseLineDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Line"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
DrawExtendeds(prop);
PropertyField(prop, "m_LineStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisLine), true)]
public class AxisLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "AxisLine"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_ShowArrow");
PropertyField(prop, "m_Arrow");
}
}
[CustomPropertyDrawer(typeof(AxisSplitLine), true)]
public class AxisSplitLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "SplitLine"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_Interval");
}
}
[CustomPropertyDrawer(typeof(AxisTick), true)]
public class AxisTickDrawer : BaseLineDrawer
{
public override string ClassName { get { return "AxisTick"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_AlignWithLabel");
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_ShowStartTick");
PropertyField(prop, "m_ShowEndTick");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e69f60c7d200439abcf3407c15f8c4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LineStyle), true)]
public class LineStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LineStyle"; } }
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_Type");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_ToColor2");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Length");
PropertyField(prop, "m_Opacity");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4a36d5076e1414d619b53d1ef998806f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Location), true)]
public class LocationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Location"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Align"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_Left");
PropertyField(prop, "m_Right");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34092595791508d4b94b074a8788c388
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,36 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Settings), true)]
public class SettingsDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Settings"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", new HeaderMenuInfo("Reset", () =>
{
var chart = prop.serializedObject.targetObject as BaseChart;
chart.settings.Reset();
})))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_ReversePainter");
PropertyField(prop, "m_MaxPainter");
PropertyField(prop, "m_BasePainterMaterial");
PropertyField(prop, "m_SeriePainterMaterial");
PropertyField(prop, "m_TopPainterMaterial");
PropertyField(prop, "m_LineSmoothStyle");
PropertyField(prop, "m_LineSmoothness");
PropertyField(prop, "m_LineSegmentDistance");
PropertyField(prop, "m_CicleSmoothness");
PropertyField(prop, "m_LegendIconLineWidth");
PropertyListField(prop, "m_LegendIconCornerRadius", true);
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70536a1ba3af245e7ad3b11e97682d8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,52 @@

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SymbolStyle), true)]
public class SymbolStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
PropertyField(prop, "m_Type");
if (type == SymbolType.Custom)
{
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_Width");
// PropertyField(prop, "m_Height");
// PropertyField(prop, "m_Offset");
}
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_SizeType");
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
{
case SymbolSizeType.Custom:
PropertyField(prop, "m_Size");
PropertyField(prop, "m_SelectedSize");
break;
case SymbolSizeType.FromData:
PropertyField(prop, "m_DataIndex");
PropertyField(prop, "m_DataScale");
PropertyField(prop, "m_SelectedDataScale");
break;
case SymbolSizeType.Callback:
break;
}
PropertyField(prop, "m_StartIndex");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ForceShowLast");
PropertyField(prop, "m_Repeat");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 72d557cf0b7134953b457ab973364520
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@

using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TextLimit), true)]
public class TextLimitDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "TextLimit"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_MaxWidth");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_Suffix");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 842d3986d1c1747d8b0668649e8b1a0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@

using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TextStyle), true)]
public class TextStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "TextStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, ""))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFont");
#else
PropertyField(prop, "m_Font");
#endif
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_ExtraWidth");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_LineSpacing");
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFontStyle");
PropertyField(prop, "m_TMPAlignment");
#else
PropertyField(prop, "m_FontStyle");
PropertyField(prop, "m_Alignment");
PropertyField(prop, "m_AutoWrap");
PropertyField(prop, "m_AutoAlign");
#endif
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f14c425fb2bff44f2bf9ddb8d6ff1741
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,135 @@

using System.IO;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ThemeStyle), true)]
public class ThemeStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Theme"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
var defaultWidth = pos.width;
var defaultX = pos.x;
var chart = prop.serializedObject.targetObject as BaseChart;
if (MakeComponentFoldout(prop, "", new HeaderMenuInfo("Reset|Reset to theme default color", () =>
{
chart.theme.sharedTheme.ResetTheme();
chart.RefreshAllComponent();
}), new HeaderMenuInfo("Export|Export theme to asset for a new theme", () =>
{
ExportThemeWindow.target = chart;
EditorWindow.GetWindow(typeof(ExportThemeWindow));
}), new HeaderMenuInfo("Sync color to custom|Sync shared theme color to custom color", () =>
{
chart.theme.SyncSharedThemeColorToCustom();
})))
{
++EditorGUI.indentLevel;
var chartNameList = XCThemeMgr.GetAllThemeNames();
var lastIndex = chartNameList.IndexOf(chart.theme.themeName);
var y = pos.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
var selectedIndex = EditorGUI.Popup(new Rect(pos.x, y, pos.width, EditorGUIUtility.singleLineHeight),
"Shared Theme", lastIndex, chartNameList.ToArray());
AddSingleLineHeight();
if (lastIndex != selectedIndex)
{
XCThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
}
PropertyField(prop, "m_SharedTheme");
PropertyField(prop, "m_EnableCustomTheme");
using (new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
{
PropertyField(prop, "m_CustomBackgroundColor");
PropertyField(prop, "m_CustomColorPalette");
}
--EditorGUI.indentLevel;
}
}
private void AddPropertyField(Rect pos, SerializedProperty prop, ref float y)
{
float height = EditorGUI.GetPropertyHeight(prop, new GUIContent(prop.displayName), true);
EditorGUI.PropertyField(new Rect(pos.x, y, pos.width, height), prop, true);
y += height + EditorGUIUtility.standardVerticalSpacing;
m_Heights[m_KeyName] += height + EditorGUIUtility.standardVerticalSpacing;
}
}
public class ExportThemeWindow : UnityEditor.EditorWindow
{
public static BaseChart target;
private static ExportThemeWindow window;
private string m_ChartName;
static void Init()
{
window = (ExportThemeWindow)EditorWindow.GetWindow(typeof(ExportThemeWindow), false, "Export Theme", true);
window.minSize = new Vector2(600, 50);
window.maxSize = new Vector2(600, 50);
window.Show();
}
void OnInspectorUpdate()
{
Repaint();
}
private void OnGUI()
{
if (target == null)
{
Close();
return;
}
GUILayout.Space(10);
GUILayout.Label("Input a new name for theme:");
m_ChartName = GUILayout.TextField(m_ChartName);
GUILayout.Space(10);
GUILayout.Label("Export path:");
if (string.IsNullOrEmpty(m_ChartName))
{
GUILayout.Label("Need input a new name.");
}
else
{
GUILayout.Label(XCThemeMgr.GetThemeAssetPath(m_ChartName));
}
GUILayout.Space(20);
if (GUILayout.Button("Export"))
{
if (string.IsNullOrEmpty(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:Need input a new name!"));
}
else if (XCThemeMgr.ContainsTheme(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
}
else if (IsAssetsExist(XCThemeMgr.GetThemeAssetPath(m_ChartName)))
{
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
+ XCThemeMgr.GetThemeAssetPath(m_ChartName)));
}
else
{
XCThemeMgr.ExportTheme(target.theme.sharedTheme, m_ChartName);
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
+ XCThemeMgr.GetThemeAssetPath(m_ChartName)));
}
}
}
private bool IsAssetsExist(string path)
{
return File.Exists(Application.dataPath + "/../" + path);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 704e7c2793bca4050821c6e0756c8316
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TitleStyle), true)]
public class TitleStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "TitleStyle"; } }
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_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e451ee4c9f65a414784fd5fd9cad6ec1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f98ff753316eb48d58325ecd996f2a1f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e6d7780afa9b49aa9081bf55d301955
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 89d95a9a994ad4b4692832e9a548e9e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 06bc176df52bf4953b8d46254523d2ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb28a0ae5edd34b63ae9cbce0986585b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ef040b104aa2452f80d91c7c33775c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2909950e65ad44c2eb617a8b75845431
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
namespace XCharts.Editor
{
public class MainComponentEditor<T> : MainComponentBaseEditor
where T : MainComponent
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 276997094e92e4b6590591727cb21349
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 62cc000ee006f492aadb05138ac6fe87
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 83cc6f39a078f4ecfb2c3da09b116355
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 341fcecf4884e47519a2aff6defb30de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f3d4d8d4d5c4b4197b021a25a7125390
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5f488cf12ded545de8737a2cde8bfead
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f1bfbd3f054624d42b854bcac720a58b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7856321df80e646c99317e95964991bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c50c4d317d9274b32a5f137db0d66038
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9179fea7bb2354601acce0feb82f8b17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ffd6706dd3dd048d5ab9c538c133e963
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38b6413ab74484d6599bebbca7f5d437
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/Series.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 303691ade88f04660abab870b613cc3a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Bar))]
public class BarEditor : SerieEditor<Bar>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_Stack");
if (serie.IsUseCoord<PolarCoord>())
{
PropertyField("m_PolarIndex");
}
else
{
PropertyField("m_XAxisIndex");
PropertyField("m_YAxisIndex");
}
PropertyField("m_BarType");
PropertyField("m_BarPercentStack");
PropertyField("m_BarWidth");
PropertyField("m_BarGap");
if (serie.barType == BarType.Zebra)
{
PropertyField("m_BarZebraWidth");
PropertyField("m_BarZebraGap");
}
PropertyFiledMore(() =>
{
PropertyFieldLimitMin("m_MinShow", 0);
PropertyFieldLimitMin("m_MaxShow", 0);
PropertyFieldLimitMin("m_MaxCache", 0);
PropertyField("m_Ignore");
PropertyField("m_IgnoreValue");
PropertyField("m_IgnoreLineBreak");
PropertyField("m_ShowAsPositiveNumber");
PropertyField("m_Large");
PropertyField("m_LargeThreshold");
PropertyField("m_Clip");
});
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3b924d2e0412243769e4ac6ee8bd5fa6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Candlestick))]
public class CandlestickEditor : SerieEditor<Candlestick>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_XAxisIndex");
PropertyField("m_YAxisIndex");
PropertyFieldLimitMin("m_MinShow", 0);
PropertyFieldLimitMin("m_MaxShow", 0);
PropertyFieldLimitMin("m_MaxCache", 0);
PropertyField("m_BarWidth");
PropertyField("m_Clip");
PropertyField("m_ShowAsPositiveNumber");
PropertyField("m_Large");
PropertyField("m_LargeThreshold");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 713afd224d3194435b9559720035a5fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(EffectScatter))]
public class EffectScatterEditor : SerieEditor<EffectScatter>
{
public override void OnCustomInspectorGUI()
{
if (serie.IsUseCoord<SingleAxisCoord>())
{
PropertyField("m_SingleAxisIndex");
}
else
{
PropertyField("m_XAxisIndex");
PropertyField("m_YAxisIndex");
}
PropertyField("m_Clip");
PropertyField("m_Symbol");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc8fce25209234fa3b6c3cb79d02b47e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Heatmap))]
public class HeatmapEditor : SerieEditor<Heatmap>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_Ignore");
PropertyField("m_IgnoreValue");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3137acf1aff4f4cd29af0d3c3ca78bca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Line))]
public class LineEditor : SerieEditor<Line>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_Stack");
if (serie.IsUseCoord<PolarCoord>())
{
PropertyField("m_PolarIndex");
}
else
{
PropertyField("m_XAxisIndex");
PropertyField("m_YAxisIndex");
}
PropertyField("m_LineType");
PropertyFiledMore(() =>
{
PropertyFieldLimitMin("m_MinShow", 0);
PropertyFieldLimitMin("m_MaxShow", 0);
PropertyFieldLimitMin("m_MaxCache", 0);
PropertyField("m_SampleDist");
PropertyField("m_SampleType");
PropertyField("m_SampleAverage");
PropertyField("m_Ignore");
PropertyField("m_IgnoreValue");
PropertyField("m_IgnoreLineBreak");
PropertyField("m_ShowAsPositiveNumber");
PropertyField("m_Large");
PropertyField("m_LargeThreshold");
PropertyField("m_Clip");
});
PropertyField("m_Symbol");
PropertyField("m_LineStyle");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 065fbd043ce6e40609cfb52114aaaa6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Liquid))]
public class LiquidEditor : SerieEditor<Liquid>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_VesselIndex");
PropertyField("m_Min");
PropertyField("m_Max");
PropertyField("m_WaveLength");
PropertyField("m_WaveHeight");
PropertyField("m_WaveSpeed");
PropertyField("m_WaveOffset");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d62c400d54e9f412abb6a9befbfa3937
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Parallel))]
public class ParallelEditor : SerieEditor<Parallel>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_ParallelIndex");
PropertyField("m_LineType");
PropertyField("m_LineStyle");
PropertyField("m_Animation");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 01af34b37a31d4876bd2d9ca7687ccd1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
namespace XCharts.Editor
{
[SerieEditor(typeof(Pie))]
public class PieEditor : SerieEditor<Pie>
{
public override void OnCustomInspectorGUI()
{
PropertyField("m_RoseType");
PropertyField("m_Space");
PropertyTwoFiled("m_Center");
PropertyTwoFiled("m_Radius");
PropertyFiledMore(() =>
{
PropertyField("m_MinAngle");
PropertyField("m_RoundCap");
PropertyField("m_Ignore");
PropertyField("m_IgnoreValue");
PropertyField("m_AvoidLabelOverlap");
});
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}
}
}

Some files were not shown because too many files have changed in this diff Show More