Files
XCharts/Editor/ChildComponents/LineDrawer.cs

93 lines
3.2 KiB
C#
Raw Normal View History

2021-01-11 08:54:28 +08:00
using UnityEditor;
using UnityEngine;
2022-02-19 22:37:57 +08:00
using XCharts.Runtime;
2021-01-11 08:54:28 +08:00
2021-12-24 13:33:09 +08:00
namespace XCharts.Editor
2021-01-11 08:54:28 +08:00
{
[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);
2022-03-09 07:26:15 +08:00
if (MakeComponentFoldout(prop, "m_Show", true))
2021-01-11 08:54:28 +08:00
{
++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");
2022-02-19 17:35:22 +08:00
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_ShowStartLine");
PropertyField(prop, "m_ShowEndLine");
2024-04-22 22:25:12 +08:00
PropertyField(prop, "m_ShowZLine");
2021-01-11 08:54:28 +08:00
}
}
2022-05-22 22:17:38 +08:00
[CustomPropertyDrawer(typeof(AxisMinorSplitLine), true)]
public class AxisMinorSplitLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "MinorSplitLine"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
//PropertyField(prop, "m_Distance");
//PropertyField(prop, "m_AutoColor");
}
}
2021-01-11 08:54:28 +08:00
[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");
2021-01-11 08:54:28 +08:00
PropertyField(prop, "m_Inside");
2021-04-14 08:59:03 +08:00
PropertyField(prop, "m_ShowStartTick");
PropertyField(prop, "m_ShowEndTick");
2022-02-19 17:35:22 +08:00
PropertyField(prop, "m_SplitNumber");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoColor");
2021-01-11 08:54:28 +08:00
}
}
[CustomPropertyDrawer(typeof(AxisMinorTick), true)]
public class AxisMinorTickDrawer : BaseLineDrawer
{
public override string ClassName { get { return "MinorTick"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_SplitNumber");
//PropertyField(prop, "m_AutoColor");
}
}
2021-01-11 08:54:28 +08:00
}