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

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: