Files
XCharts/Editor/PropertyDrawers/SettingsDrawer.cs
monitor1394 489095865d XCharts 2.0
2021-01-11 08:54:28 +08:00

40 lines
1.5 KiB
C#

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[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 (MakeFoldout(prop, ""))
{
var btnWidth = 50;
var btnRect = new Rect(pos.x + pos.width - btnWidth, pos.y, btnWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(btnRect, new GUIContent("Reset", "Reset to default settings")))
{
var chart = prop.serializedObject.targetObject as BaseChart;
chart.settings.Reset();
}
++EditorGUI.indentLevel;
PropertyField(prop, "m_MaxPainter");
PropertyField(prop, "m_LineSmoothStyle");
PropertyField(prop, "m_LineSmoothness");
PropertyField(prop, "m_LineSegmentDistance");
PropertyField(prop, "m_CicleSmoothness");
--EditorGUI.indentLevel;
}
}
}
}