[feature][serie] support EmphasisStle,BlurStyle and SelectStyle

This commit is contained in:
monitor1394
2022-07-25 07:46:03 +08:00
parent 8dde322c04
commit 4f93628667
61 changed files with 1052 additions and 758 deletions

View File

@@ -17,8 +17,6 @@ namespace XCharts.Editor
PropertyField(prop, "m_Origin");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_HighlightColor");
PropertyField(prop, "m_HighlightToColor");
PropertyField(prop, "m_Opacity");
--EditorGUI.indentLevel;
}

View File

@@ -1,43 +0,0 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
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", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Label");
PropertyField(prop, "m_LabelLine");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}
}
}
[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"; } }
}
}

View File

@@ -0,0 +1,54 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(StateStyle), true)]
public class StateStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "StateStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
OnCustomGUI(prop);
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_LabelLine");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_AreaStyle");
--EditorGUI.indentLevel;
}
}
protected virtual void OnCustomGUI(SerializedProperty prop) { }
}
[CustomPropertyDrawer(typeof(EmphasisStyle), true)]
public class EmphasisStyleDrawer : StateStyleDrawer
{
public override string ClassName { get { return "EmphasisStyle"; } }
protected override void OnCustomGUI(SerializedProperty prop)
{
PropertyField(prop, "m_Scale");
PropertyField(prop, "m_Focus");
PropertyField(prop, "m_BlurScope");
}
}
[CustomPropertyDrawer(typeof(BlurStyle), true)]
public class BlurStyleDrawer : StateStyleDrawer
{
public override string ClassName { get { return "BlurStyle"; } }
}
[CustomPropertyDrawer(typeof(SelectStyle), true)]
public class SelectStyleDrawer : StateStyleDrawer
{
public override string ClassName { get { return "SelectStyle"; } }
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7de9b5e4c5d474fdd88ebb89f0924305
guid: 3aad8ee99115742729ec5a963274fae0
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -16,7 +16,6 @@ namespace XCharts.Editor
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
//PropertyField("m_InsertDataToHead");
PropertyField("m_SerieName");
if (m_CoordOptionsNames != null && m_CoordOptionsNames.Count > 1)
{
@@ -28,6 +27,7 @@ namespace XCharts.Editor
serie.coordSystem = m_CoordOptionsDic[typeName].Name;
}
}
PropertyField("m_State");
OnCustomInspectorGUI();
OnExtraInspectorGUI();
PropertyFieldData();
@@ -189,9 +189,8 @@ namespace XCharts.Editor
{
EditorGUI.indentLevel++;
var serieData = m_Datas.GetArrayElementAtIndex(index);
var m_Name = serieData.FindPropertyRelative("m_Name");
PropertyField(m_Name);
PropertyField(serieData.FindPropertyRelative("m_Name"));
PropertyField(serieData.FindPropertyRelative("m_State"));
if (serie.GetType().IsDefined(typeof(SerieDataExtraFieldAttribute), false))
{
var attribute = serie.GetType().GetAttribute<SerieDataExtraFieldAttribute>();