mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
3.0
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace XCharts.Editor
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace XCharts.Editor
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
@@ -45,7 +44,7 @@ namespace XCharts.Editor
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
if (target == null) return;
|
||||
m_Chart = (BaseChart)target;
|
||||
m_Chart = (BaseChart) target;
|
||||
m_Script = serializedObject.FindProperty("m_Script");
|
||||
m_EnableTextMeshPro = serializedObject.FindProperty("m_EnableTextMeshPro");
|
||||
m_ChartName = serializedObject.FindProperty("m_ChartName");
|
||||
@@ -172,7 +171,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
m_Series.Add(prop.GetArrayElementAtIndex(i));
|
||||
}
|
||||
m_Series.Sort(delegate (SerializedProperty a, SerializedProperty b)
|
||||
m_Series.Sort(delegate(SerializedProperty a, SerializedProperty b)
|
||||
{
|
||||
var index1 = a.FindPropertyRelative("m_Index").intValue;
|
||||
var index2 = b.FindPropertyRelative("m_Index").intValue;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -110,7 +109,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
if (IngorePropertys.Contains(relativePropName)) return;
|
||||
if (!ChartEditorHelper.PropertyFieldWithMinValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
|
||||
relativePropName, minValue))
|
||||
relativePropName, minValue))
|
||||
{
|
||||
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
|
||||
}
|
||||
@@ -119,7 +118,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
if (IngorePropertys.Contains(relativePropName)) return;
|
||||
if (!ChartEditorHelper.PropertyFieldWithMaxValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
|
||||
relativePropName, maxValue))
|
||||
relativePropName, maxValue))
|
||||
{
|
||||
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
|
||||
}
|
||||
@@ -163,25 +162,40 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
protected bool MakeComponentFoldout(SerializedProperty prop, string relativePropName, bool relativePropEnable,
|
||||
params HeaderMenuInfo[] menus)
|
||||
params HeaderMenuInfo[] menus)
|
||||
{
|
||||
if (string.IsNullOrEmpty(relativePropName))
|
||||
{
|
||||
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
|
||||
m_DisplayName, null, relativePropEnable, menus);
|
||||
m_DisplayName, null, null, relativePropEnable, menus);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
var relativeProp = prop.FindPropertyRelative(relativePropName);
|
||||
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
|
||||
m_DisplayName, relativeProp, relativePropEnable, menus);
|
||||
m_DisplayName, relativeProp, null, relativePropEnable, menus);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DrawExtendeds(SerializedProperty prop)
|
||||
protected bool MakeComponentFoldout(SerializedProperty prop, string relativePropName, string relativePropName2,
|
||||
bool relativePropEnable, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
if (string.IsNullOrEmpty(relativePropName))
|
||||
{
|
||||
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
|
||||
m_DisplayName, null, null, relativePropEnable, menus);
|
||||
}
|
||||
else
|
||||
{
|
||||
var relativeProp = prop.FindPropertyRelative(relativePropName);
|
||||
var relativeProp2 = prop.FindPropertyRelative(relativePropName2);
|
||||
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
|
||||
m_DisplayName, relativeProp, relativeProp2, relativePropEnable, menus);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DrawExtendeds(SerializedProperty prop) { }
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
var key = GetKeyName(prop);
|
||||
|
||||
26
Editor/ChildComponents/CommentItemDrawer.cs
Normal file
26
Editor/ChildComponents/CommentItemDrawer.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(CommentItem), true)]
|
||||
public class CommentItemDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "CommentItem"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", "m_Content", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Content");
|
||||
PropertyField(prop, "m_Position");
|
||||
//PropertyField(prop, "m_MarkRect");
|
||||
//PropertyField(prop, "m_MarkStyle");
|
||||
PropertyField(prop, "m_LabelStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 418b81a68e59a4572ab57787b5362d5a
|
||||
guid: d485d6a729a1449cdb5032f380fba70f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
22
Editor/ChildComponents/CommentMarkStyleDrawer.cs
Normal file
22
Editor/ChildComponents/CommentMarkStyleDrawer.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(CommentMarkStyle), true)]
|
||||
public class CommentMarkStyleDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "MarkStyle"; } }
|
||||
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_LineStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/ChildComponents/CommentMarkStyleDrawer.cs.meta
Normal file
11
Editor/ChildComponents/CommentMarkStyleDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d74ed458b24774b129611ed816b6b6cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -59,6 +58,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
public override string ClassName { get { return "Axis"; } }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(RadiusAxisTheme), true)]
|
||||
public class RadiusAxisThemeDrawer : BaseAxisThemeDrawer
|
||||
{
|
||||
@@ -67,8 +67,9 @@ namespace XCharts.Editor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<string> {
|
||||
"m_TextBackgroundColor" ,
|
||||
return new List<string>
|
||||
{
|
||||
"m_TextBackgroundColor",
|
||||
"m_LineLength",
|
||||
"m_SplitLineLength",
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -23,4 +22,22 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisItemStyle), true)]
|
||||
public class EmphasisItemStyleDrawer : ItemStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisItemStyle"; } }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisLabelStyle), true)]
|
||||
public class EmphasisLabelStyleDrawer : LabelStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisLabel"; } }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisLabelLine), true)]
|
||||
public class EmphasisLabelLineDrawer : LabelLineDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisLabelLine"; } }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -28,6 +27,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Background");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
PropertyField(prop, "m_TextPadding");
|
||||
PropertyField(prop, "m_TextLimit");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -24,7 +23,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[CustomPropertyDrawer(typeof(LineArrow), true)]
|
||||
public class LineArrowStyleDrawer : BasePropertyDrawer
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -47,6 +46,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisTick), true)]
|
||||
public class AxisTickDrawer : BaseLineDrawer
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieDataBaseInfo), true)]
|
||||
public class SerieDataBaseInfoDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "BaseInfo"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", false))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Ignore");
|
||||
PropertyField(prop, "m_Selected");
|
||||
PropertyField(prop, "m_Radius");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -16,7 +15,7 @@ namespace XCharts.Editor
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
PropertyField(prop, "m_Type");
|
||||
if (type == SymbolType.Custom)
|
||||
{
|
||||
@@ -28,7 +27,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
PropertyField(prop, "m_Gap");
|
||||
PropertyField(prop, "m_SizeType");
|
||||
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||
switch ((SymbolSizeType) prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
PropertyField(prop, "m_Size");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -13,10 +12,10 @@ namespace XCharts.Editor
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", false, new HeaderMenuInfo("Reset", () =>
|
||||
{
|
||||
var chart = prop.serializedObject.targetObject as BaseChart;
|
||||
chart.settings.Reset();
|
||||
})))
|
||||
{
|
||||
var chart = prop.serializedObject.targetObject as BaseChart;
|
||||
chart.settings.Reset();
|
||||
})))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_ReversePainter");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -16,7 +15,7 @@ namespace XCharts.Editor
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
PropertyField(prop, "m_Type");
|
||||
if (type == SymbolType.Custom)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
#if dUI_TextMeshPro
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -20,17 +19,17 @@ namespace XCharts.Editor
|
||||
var defaultX = pos.x;
|
||||
var chart = prop.serializedObject.targetObject as BaseChart;
|
||||
if (MakeComponentFoldout(prop, "m_Show", false, 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();
|
||||
})))
|
||||
{
|
||||
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();
|
||||
@@ -46,12 +45,12 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_SharedTheme");
|
||||
PropertyField(prop, "m_TransparentBackground");
|
||||
PropertyField(prop, "m_EnableCustomTheme");
|
||||
using (new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
|
||||
{
|
||||
PropertyField(prop, "m_CustomBackgroundColor");
|
||||
PropertyField(prop, "m_CustomColorPalette");
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
using(new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
|
||||
{
|
||||
PropertyField(prop, "m_CustomBackgroundColor");
|
||||
PropertyField(prop, "m_CustomColorPalette");
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +70,7 @@ namespace XCharts.Editor
|
||||
private string m_ChartName;
|
||||
static void Init()
|
||||
{
|
||||
window = (ExportThemeWindow)EditorWindow.GetWindow(typeof(ExportThemeWindow), false, "Export Theme", true);
|
||||
window = (ExportThemeWindow) EditorWindow.GetWindow(typeof(ExportThemeWindow), false, "Export Theme", true);
|
||||
window.minSize = new Vector2(600, 50);
|
||||
window.maxSize = new Vector2(600, 50);
|
||||
window.Show();
|
||||
@@ -117,14 +116,14 @@ namespace XCharts.Editor
|
||||
}
|
||||
else if (IsAssetsExist(XCThemeMgr.GetThemeAssetPath(m_ChartName)))
|
||||
{
|
||||
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
|
||||
+ 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)));
|
||||
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath=" +
|
||||
XCThemeMgr.GetThemeAssetPath(m_ChartName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -13,7 +12,7 @@ namespace XCharts.Editor
|
||||
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;
|
||||
var type = (Axis.AxisType) m_Type.enumValueIndex;
|
||||
EditorGUI.indentLevel++;
|
||||
if (component is ParallelAxis)
|
||||
{
|
||||
@@ -41,7 +40,7 @@ namespace XCharts.Editor
|
||||
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
|
||||
{
|
||||
PropertyField("m_MinMaxType");
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType) m_MinMaxType.enumValueIndex;
|
||||
switch (minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
@@ -95,13 +94,11 @@ namespace XCharts.Editor
|
||||
|
||||
[ComponentEditor(typeof(XAxis))]
|
||||
public class XAxisEditor : AxisEditor
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
[ComponentEditor(typeof(YAxis))]
|
||||
public class YAxisEditor : AxisEditor
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
[ComponentEditor(typeof(SingleAxis))]
|
||||
public class SingleAxisEditor : AxisEditor
|
||||
@@ -132,13 +129,11 @@ namespace XCharts.Editor
|
||||
|
||||
[ComponentEditor(typeof(RadiusAxis))]
|
||||
public class RadiusAxisEditor : AxisEditor
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
[ComponentEditor(typeof(ParallelAxis))]
|
||||
public class ParallelAxisEditor : AxisEditor
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisLabel), true)]
|
||||
public class AxisLabelDrawer : BasePropertyDrawer
|
||||
@@ -159,6 +154,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_ShowEndLabel");
|
||||
|
||||
PropertyField(prop, "m_Rotate");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_Formatter");
|
||||
PropertyField(prop, "m_NumericFormatter");
|
||||
@@ -168,6 +164,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Background");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
PropertyField(prop, "m_TextPadding");
|
||||
PropertyField(prop, "m_TextLimit");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
18
Editor/MainComponents/CommentEditor.cs
Normal file
18
Editor/MainComponents/CommentEditor.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(Comment))]
|
||||
public class CommentEditor : MainComponentEditor<Comment>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_LabelStyle");
|
||||
//PropertyField("m_MarkStyle");
|
||||
PropertyListField("m_Items", true);
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/CommentEditor.cs.meta
Normal file
11
Editor/MainComponents/CommentEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2364066bf3174aa39b79020266ce72d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -15,12 +14,14 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ItemHeight");
|
||||
PropertyField("m_ItemGap");
|
||||
PropertyField("m_ItemAutoColor");
|
||||
PropertyField("m_ItemOpacity");
|
||||
PropertyField("m_SelectedMode");
|
||||
PropertyField("m_Orient");
|
||||
PropertyField("m_Formatter");
|
||||
PropertyField("m_Location");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyListField("m_Icons");
|
||||
PropertyListField("m_Colors");
|
||||
PropertyListField("m_Data");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
@@ -28,12 +27,10 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
public virtual void OnEnable()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
public virtual void OnDisable()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
internal void OnInternalInspectorGUI()
|
||||
{
|
||||
@@ -42,12 +39,10 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
public virtual void OnInspectorGUI()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
protected virtual void DrawExtendeds()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
public virtual string GetDisplayTitle()
|
||||
{
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class MainComponentEditor<T> : MainComponentBaseEditor
|
||||
where T : MainComponent
|
||||
{
|
||||
}
|
||||
where T : MainComponent
|
||||
{ }
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
@@ -84,7 +83,7 @@ namespace XCharts.Editor
|
||||
editor.showProperty,
|
||||
() => { ResetComponentEditor(id); },
|
||||
() => { RemoveComponentEditor(id); }
|
||||
);
|
||||
);
|
||||
if (displayContent)
|
||||
{
|
||||
editor.OnInternalInspectorGUI();
|
||||
@@ -120,7 +119,7 @@ namespace XCharts.Editor
|
||||
|
||||
if (!m_EditorTypes.TryGetValue(settingsType, out editorType))
|
||||
editorType = typeof(MainComponentBaseEditor);
|
||||
var editor = (MainComponentBaseEditor)Activator.CreateInstance(editorType);
|
||||
var editor = (MainComponentBaseEditor) Activator.CreateInstance(editorType);
|
||||
editor.Init(chart, component, property, m_BaseEditor);
|
||||
|
||||
if (index < 0)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -31,7 +30,7 @@ namespace XCharts.Editor
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (MarkAreaType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||
var type = (MarkAreaType) (prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||
PropertyField(prop, "m_Type");
|
||||
PropertyField(prop, "m_Name");
|
||||
switch (type)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -28,7 +27,7 @@ namespace XCharts.Editor
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (MarkLineType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||
var type = (MarkLineType) (prop.FindPropertyRelative("m_Type")).enumValueIndex;
|
||||
var group = prop.FindPropertyRelative("m_Group").intValue;
|
||||
PropertyField(prop, "m_Type");
|
||||
PropertyField(prop, "m_Name");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -12,7 +10,14 @@ namespace XCharts.Editor
|
||||
[CustomEditor(typeof(Theme))]
|
||||
public class ThemeEditor : UnityEditor.Editor
|
||||
{
|
||||
static class Styles
|
||||
{
|
||||
internal static GUIContent btnReset = new GUIContent("Reset", "Reset to default theme");
|
||||
internal static GUIContent btnSync = new GUIContent("Sync Font", "Sync main theme font to sub theme font");
|
||||
}
|
||||
|
||||
private Theme m_Theme;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
m_Theme = target as Theme;
|
||||
@@ -20,15 +25,15 @@ namespace XCharts.Editor
|
||||
|
||||
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")))
|
||||
if (GUILayout.Button(Styles.btnReset))
|
||||
{
|
||||
m_Theme.ResetTheme();
|
||||
}
|
||||
if (GUILayout.Button(Styles.btnSync))
|
||||
{
|
||||
m_Theme.SyncFontToSubComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -11,7 +10,7 @@ namespace XCharts.Editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (VisualMap.Type)baseProperty.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
var type = (VisualMap.Type) baseProperty.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
var isPiece = type == VisualMap.Type.Piecewise;
|
||||
PropertyField("m_Type");
|
||||
PropertyField("m_SerieIndex");
|
||||
@@ -39,19 +38,19 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Location");
|
||||
}
|
||||
PropertyListField("m_OutOfRange");
|
||||
PropertyListField(isPiece ? "m_Pieces" : "m_InRange");
|
||||
PropertyListField("m_InRange");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(VisualMapPieces), true)]
|
||||
public class PiecesDrawer : BasePropertyDrawer
|
||||
[CustomPropertyDrawer(typeof(VisualMapRange), true)]
|
||||
public class VisualMapRangeDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Pieces"; } }
|
||||
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, ""))
|
||||
if (MakeFoldout(prop, "m_Color"))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Min");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
PropertyField("m_RadarType");
|
||||
PropertyField("m_RadarIndex");
|
||||
|
||||
|
||||
PropertyField("m_Symbol");
|
||||
PropertyField("m_LineStyle");
|
||||
PropertyField("m_ItemStyle");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
@@ -17,6 +16,7 @@ namespace XCharts.Editor
|
||||
internal SerializedProperty baseProperty;
|
||||
internal SerializedProperty showProperty;
|
||||
internal List<HeaderMenuInfo> menus = new List<HeaderMenuInfo>();
|
||||
internal List<HeaderMenuInfo> serieDataMenus = new List<HeaderMenuInfo>();
|
||||
protected Dictionary<string, Type> m_CoordOptionsDic;
|
||||
protected List<string> m_CoordOptionsNames;
|
||||
private string m_DisplayName;
|
||||
@@ -62,12 +62,10 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
public virtual void OnEnable()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
public virtual void OnDisable()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
internal void OnInternalInspectorGUI()
|
||||
{
|
||||
@@ -76,12 +74,10 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
public virtual void OnInspectorGUI()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
protected virtual void DrawExtendeds()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
public virtual string GetDisplayTitle()
|
||||
{
|
||||
@@ -136,11 +132,11 @@ namespace XCharts.Editor
|
||||
{
|
||||
case SerializedPropertyType.Float:
|
||||
if (prop.floatValue < min)
|
||||
prop.floatValue = (float)min;
|
||||
prop.floatValue = (float) min;
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
if (prop.intValue < min)
|
||||
prop.intValue = (int)min;
|
||||
prop.intValue = (int) min;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -152,11 +148,11 @@ namespace XCharts.Editor
|
||||
{
|
||||
case SerializedPropertyType.Float:
|
||||
if (prop.floatValue > max)
|
||||
prop.floatValue = (float)max;
|
||||
prop.floatValue = (float) max;
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
if (prop.intValue > max)
|
||||
prop.intValue = (int)max;
|
||||
prop.intValue = (int) max;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -36,12 +35,11 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
public virtual void OnCustomInspectorGUI()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
private void OnExtraInspectorGUI()
|
||||
{
|
||||
foreach (var kv in Serie.extraComponentFieldNameDict)
|
||||
foreach (var kv in Serie.extraComponentMap)
|
||||
{
|
||||
var prop = FindProperty(kv.Value);
|
||||
if (prop.arraySize > 0)
|
||||
@@ -52,11 +50,11 @@ namespace XCharts.Editor
|
||||
private void PropertyFieldData()
|
||||
{
|
||||
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Import ECharts Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
new HeaderMenuInfo("Import ECharts Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
if (!m_DataFoldout) return;
|
||||
EditorGUI.indentLevel++;
|
||||
var m_Datas = FindProperty("m_Data");
|
||||
@@ -75,7 +73,7 @@ namespace XCharts.Editor
|
||||
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
|
||||
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
|
||||
}
|
||||
if (listSize > 30)// && !XCSettings.editorShowAllListData)
|
||||
if (listSize > 30) // && !XCSettings.editorShowAllListData)
|
||||
{
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
@@ -117,69 +115,69 @@ namespace XCharts.Editor
|
||||
}
|
||||
var fieldCount = dimension + (showName ? 1 : 0);
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + index, flag, false, null,
|
||||
delegate (Rect drawRect)
|
||||
{
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
var currentWidth = drawRect.width;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
delegate(Rect drawRect)
|
||||
{
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
var currentWidth = drawRect.width;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gap = 2;
|
||||
var namegap = 3;
|
||||
var gap = 2;
|
||||
var namegap = 3;
|
||||
#else
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
#endif
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
drawRect.x = startX;
|
||||
drawRect.xMax = maxX;
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
else
|
||||
{
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 2;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
while (dataCount > data.arraySize)
|
||||
while (2 > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 25;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
drawRect.x = startX;
|
||||
drawRect.xMax = maxX;
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
else
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 2;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
while (dataCount > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 25;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
});
|
||||
});
|
||||
if (m_DataElementFoldout[index])
|
||||
{
|
||||
if (!(serie is ISimplifiedSerie))
|
||||
@@ -192,113 +190,53 @@ namespace XCharts.Editor
|
||||
EditorGUI.indentLevel++;
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var m_Name = serieData.FindPropertyRelative("m_Name");
|
||||
var m_Id = serieData.FindPropertyRelative("m_Id");
|
||||
var m_ParentId = serieData.FindPropertyRelative("m_ParentId");
|
||||
|
||||
var m_BaseInfo = serieData.FindPropertyRelative("m_BaseInfos");
|
||||
var m_Label = serieData.FindPropertyRelative("m_Labels");
|
||||
var m_ItemStyle = serieData.FindPropertyRelative("m_ItemStyles");
|
||||
var m_Emphasis = serieData.FindPropertyRelative("m_Emphases");
|
||||
var m_Symbol = serieData.FindPropertyRelative("m_Symbols");
|
||||
var m_LineStyle = serieData.FindPropertyRelative("m_LineStyles");
|
||||
var m_AreaStyle = serieData.FindPropertyRelative("m_AreaStyles");
|
||||
var m_TitleStyle = serieData.FindPropertyRelative("m_TitleStyles");
|
||||
|
||||
PropertyField(m_Name);
|
||||
PropertyField(m_Id);
|
||||
PropertyField(m_ParentId);
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataExtraFieldAttribute), false))
|
||||
{
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataExtraFieldAttribute>();
|
||||
foreach (var field in attribute.fields)
|
||||
{
|
||||
PropertyField(serieData.FindPropertyRelative(field));
|
||||
}
|
||||
}
|
||||
|
||||
var componentNum = m_BaseInfo.arraySize + m_Label.arraySize + m_ItemStyle.arraySize + m_Emphasis.arraySize
|
||||
+ m_Symbol.arraySize + m_LineStyle.arraySize + m_AreaStyle.arraySize;
|
||||
var title = "Component";
|
||||
if (componentNum == 0) title += " (None)";
|
||||
m_DataComponentFoldout = ChartEditorHelper.DrawHeader(title, m_DataComponentFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Add BaseInfo", () =>
|
||||
serieDataMenus.Clear();
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataExtraComponentAttribute), false))
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<SerieDataBaseInfo>();
|
||||
}, m_BaseInfo.arraySize == 0),
|
||||
new HeaderMenuInfo("Add ItemStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<ItemStyle>();
|
||||
}, m_ItemStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Add Label", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<LabelStyle>();
|
||||
}, m_Label.arraySize == 0),
|
||||
new HeaderMenuInfo("Add Emphasis", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<Emphasis>();
|
||||
}, m_Emphasis.arraySize == 0),
|
||||
new HeaderMenuInfo("Add Symbol", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<SerieSymbol>();
|
||||
}, m_Symbol.arraySize == 0),
|
||||
new HeaderMenuInfo("Add LineStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<LineStyle>();
|
||||
}, m_LineStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Add AreaStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<AreaStyle>();
|
||||
}, m_AreaStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Add TitleStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<TitleStyle>();
|
||||
}, m_TitleStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Remove BaseInfo", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<SerieDataBaseInfo>();
|
||||
}, m_BaseInfo.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove ItemStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<ItemStyle>();
|
||||
}, m_ItemStyle.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove Label", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<LabelStyle>();
|
||||
}, m_Label.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove Emphasis", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<Emphasis>();
|
||||
}, m_Emphasis.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove Symbol", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<SerieSymbol>();
|
||||
}, m_Symbol.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove LineStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<LineStyle>();
|
||||
}, m_LineStyle.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove AreaStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<AreaStyle>();
|
||||
}, m_AreaStyle.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove TitleStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<TitleStyle>();
|
||||
}, m_TitleStyle.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove All", () =>
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataExtraComponentAttribute>();
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = serieData.FindPropertyRelative(SerieData.extraComponentMap[type]).arraySize;
|
||||
serieDataMenus.Add(new HeaderMenuInfo("Add " + type.Name, () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent(type);
|
||||
EditorUtility.SetDirty(chart);
|
||||
}, size == 0));
|
||||
}
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = serieData.FindPropertyRelative(SerieData.extraComponentMap[type]).arraySize;
|
||||
serieDataMenus.Add(new HeaderMenuInfo("Remove " + type.Name, () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent(type);
|
||||
EditorUtility.SetDirty(chart);
|
||||
}, size > 0));
|
||||
}
|
||||
}
|
||||
serieDataMenus.Add(new HeaderMenuInfo("Remove All", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveAllComponent();
|
||||
}, componentNum > 0));
|
||||
}, true));
|
||||
m_DataComponentFoldout = ChartEditorHelper.DrawHeader("Component", m_DataComponentFoldout, false, null, null, serieDataMenus);
|
||||
if (m_DataComponentFoldout)
|
||||
{
|
||||
if (m_BaseInfo.arraySize > 0)
|
||||
PropertyField(m_BaseInfo.GetArrayElementAtIndex(0));
|
||||
if (m_Label.arraySize > 0)
|
||||
PropertyField(m_Label.GetArrayElementAtIndex(0));
|
||||
if (m_ItemStyle.arraySize > 0)
|
||||
PropertyField(m_ItemStyle.GetArrayElementAtIndex(0));
|
||||
if (m_Emphasis.arraySize > 0)
|
||||
PropertyField(m_Emphasis.GetArrayElementAtIndex(0));
|
||||
if (m_Symbol.arraySize > 0)
|
||||
PropertyField(m_Symbol.GetArrayElementAtIndex(0));
|
||||
if (m_LineStyle.arraySize > 0)
|
||||
PropertyField(m_LineStyle.GetArrayElementAtIndex(0));
|
||||
if (m_AreaStyle.arraySize > 0)
|
||||
PropertyField(m_AreaStyle.GetArrayElementAtIndex(0));
|
||||
if (m_TitleStyle.arraySize > 0)
|
||||
PropertyField(m_TitleStyle.GetArrayElementAtIndex(0));
|
||||
foreach (var kv in SerieData.extraComponentMap)
|
||||
{
|
||||
var prop = serieData.FindPropertyRelative(kv.Value);
|
||||
if (prop.arraySize > 0)
|
||||
PropertyField(prop.GetArrayElementAtIndex(0));
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
@@ -22,7 +21,6 @@ namespace XCharts.Editor
|
||||
List<SerieBaseEditor> m_Editors;
|
||||
private bool m_SerieFoldout;
|
||||
|
||||
|
||||
public SerieListEditor(BaseChartEditor editor)
|
||||
{
|
||||
Assert.IsNotNull(editor);
|
||||
@@ -136,7 +134,7 @@ namespace XCharts.Editor
|
||||
|
||||
if (!m_EditorTypes.TryGetValue(settingsType, out editorType))
|
||||
editorType = typeof(SerieBaseEditor);
|
||||
var editor = (SerieBaseEditor)Activator.CreateInstance(editorType);
|
||||
var editor = (SerieBaseEditor) Activator.CreateInstance(editorType);
|
||||
editor.Init(chart, serie, property, m_BaseEditor);
|
||||
editor.menus.Clear();
|
||||
editor.menus.Add(new HeaderMenuInfo("Clone", () =>
|
||||
@@ -176,7 +174,7 @@ namespace XCharts.Editor
|
||||
var attribute = editor.serie.GetType().GetAttribute<SerieExtraComponentAttribute>();
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = editor.FindProperty(Serie.extraComponentFieldNameDict[type]).arraySize;
|
||||
var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize;
|
||||
editor.menus.Add(new HeaderMenuInfo("Add " + type.Name, () =>
|
||||
{
|
||||
editor.serie.AddExtraComponent(type);
|
||||
@@ -187,7 +185,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = editor.FindProperty(Serie.extraComponentFieldNameDict[type]).arraySize;
|
||||
var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize;
|
||||
editor.menus.Add(new HeaderMenuInfo("Remove " + type.Name, () =>
|
||||
{
|
||||
editor.serie.RemoveExtraComponent(type);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
@@ -53,7 +52,7 @@ namespace XCharts.Editor
|
||||
|
||||
public static void SecondField(Rect drawRect, SerializedProperty prop)
|
||||
{
|
||||
RectOffset offset = new RectOffset(-(int)EditorGUIUtility.labelWidth, 0, 0, 0);
|
||||
RectOffset offset = new RectOffset(-(int) EditorGUIUtility.labelWidth, 0, 0, 0);
|
||||
drawRect = offset.Add(drawRect);
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
drawRect = offset.Remove(drawRect);
|
||||
@@ -166,7 +165,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
public static bool MakeComponentFoldout(ref Rect drawRect, Dictionary<string, float> heights,
|
||||
Dictionary<string, bool> moduleToggle, string key, string content, SerializedProperty prop,
|
||||
bool propEnable, params HeaderMenuInfo[] menus)
|
||||
SerializedProperty prop2, bool propEnable, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var sourRect = drawRect;
|
||||
float defaultWidth = drawRect.width;
|
||||
@@ -181,10 +180,16 @@ namespace XCharts.Editor
|
||||
if (prop.propertyType == SerializedPropertyType.Boolean)
|
||||
{
|
||||
if (!propEnable)
|
||||
using (new EditorGUI.DisabledScope(true))
|
||||
MakeBool(drawRect, prop);
|
||||
using(new EditorGUI.DisabledScope(true))
|
||||
MakeBool(drawRect, prop);
|
||||
else
|
||||
MakeBool(drawRect, prop);
|
||||
if (prop2 != null && !moduleToggle[key])
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + ARROW_WIDTH + BOOL_WIDTH;
|
||||
drawRect.width = defaultWidth - drawRect.x + ARROW_WIDTH;
|
||||
EditorGUI.PropertyField(drawRect, prop2, GUIContent.none);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -201,8 +206,6 @@ namespace XCharts.Editor
|
||||
return moduleToggle[key];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void MakeBool(Rect drawRect, SerializedProperty boolProp, int index = 0, string name = null)
|
||||
{
|
||||
float defaultWidth = drawRect.width;
|
||||
@@ -378,9 +381,9 @@ namespace XCharts.Editor
|
||||
{
|
||||
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
|
||||
var isSerie = "Serie".Equals(element.type);
|
||||
var elementRect = isSerie
|
||||
? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height)
|
||||
: new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
|
||||
var elementRect = isSerie ?
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) :
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
|
||||
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
|
||||
var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
@@ -436,7 +439,7 @@ namespace XCharts.Editor
|
||||
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue < minValue)
|
||||
prop.floatValue = minValue;
|
||||
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue < minValue)
|
||||
prop.intValue = (int)minValue;
|
||||
prop.intValue = (int) minValue;
|
||||
var hig = EditorGUI.GetPropertyHeight(prop);
|
||||
drawRect.y += hig;
|
||||
heights[key] += hig;
|
||||
@@ -451,7 +454,7 @@ namespace XCharts.Editor
|
||||
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue > maxValue)
|
||||
prop.floatValue = maxValue;
|
||||
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue > maxValue)
|
||||
prop.intValue = (int)maxValue;
|
||||
prop.intValue = (int) maxValue;
|
||||
var hig = EditorGUI.GetPropertyHeight(prop);
|
||||
drawRect.y += hig;
|
||||
heights[key] += hig;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -9,12 +7,11 @@ namespace XCharts.Editor
|
||||
{
|
||||
static readonly Color splitterDark = new Color(0.12f, 0.12f, 0.12f, 0.5f);
|
||||
static readonly Color splitterLight = new Color(0.6f, 0.6f, 0.6f, 0.5f);
|
||||
static readonly Texture2D paneOptionsIconDark = (Texture2D)EditorGUIUtility.Load("Builtin Skins/DarkSkin/Images/pane options.png");
|
||||
static readonly Texture2D paneOptionsIconLight = (Texture2D)EditorGUIUtility.Load("Builtin Skins/LightSkin/Images/pane options.png");
|
||||
static readonly Texture2D paneOptionsIconDark = (Texture2D) EditorGUIUtility.Load("Builtin Skins/DarkSkin/Images/pane options.png");
|
||||
static readonly Texture2D paneOptionsIconLight = (Texture2D) EditorGUIUtility.Load("Builtin Skins/LightSkin/Images/pane options.png");
|
||||
static readonly Color headerBackgroundDark = new Color(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
static readonly Color headerBackgroundLight = new Color(1f, 1f, 1f, 0.2f);
|
||||
|
||||
|
||||
public static readonly GUIStyle headerStyle = UnityEditor.EditorStyles.boldLabel;
|
||||
public static readonly GUIStyle foldoutStyle = new GUIStyle(UnityEditor.EditorStyles.foldout)
|
||||
{
|
||||
@@ -28,7 +25,6 @@ namespace XCharts.Editor
|
||||
public static readonly GUIStyle invisibleButton = "InvisibleButton";
|
||||
public static readonly GUIStyle smallTickbox = new GUIStyle("ShurikenToggle");
|
||||
|
||||
|
||||
public static Color splitter { get { return EditorGUIUtility.isProSkin ? splitterDark : splitterLight; } }
|
||||
public static Texture2D paneOptionsIcon { get { return EditorGUIUtility.isProSkin ? paneOptionsIconDark : paneOptionsIconLight; } }
|
||||
public static Color headerBackground { get { return EditorGUIUtility.isProSkin ? headerBackgroundDark : headerBackgroundLight; } }
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
@@ -194,8 +193,7 @@ namespace XCharts.Editor
|
||||
else if (a.StartsWith("selected:"))
|
||||
{
|
||||
string selected = a.Substring(9, a.Length - 9);
|
||||
var baseInfo = serieData.GetOrAddComponent<SerieDataBaseInfo>();
|
||||
baseInfo.selected = bool.Parse(selected);
|
||||
serieData.selected = bool.Parse(selected);
|
||||
}
|
||||
}
|
||||
serie.AddSerieData(serieData);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
@@ -20,10 +19,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
XCResourcesImporter m_ResourceImporter;
|
||||
|
||||
public XCResourceImporterProvider()
|
||||
: base("Project/XCharts", SettingsScope.Project)
|
||||
{
|
||||
}
|
||||
public XCResourceImporterProvider() : base("Project/XCharts", SettingsScope.Project)
|
||||
{ }
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
@@ -134,6 +133,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
AddChart<CandlestickChart>("CandlestickChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart", priority = 54)]
|
||||
public static void PolarChart()
|
||||
|
||||
Reference in New Issue
Block a user