Files
XCharts/Editor/PropertyDrawers/VesselDrawer.cs

47 lines
1.8 KiB
C#
Raw Normal View History

2021-01-11 08:54:28 +08:00
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
2020-07-06 08:41:28 +08:00
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Vessel), true)]
2021-01-11 08:54:28 +08:00
public class VesselDrawer : BasePropertyDrawer
2020-07-06 08:41:28 +08:00
{
2021-01-11 08:54:28 +08:00
public override string ClassName { get { return "Vessel"; } }
2020-07-06 08:41:28 +08:00
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
2021-01-11 08:54:28 +08:00
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
2020-07-06 08:41:28 +08:00
{
2021-01-11 08:54:28 +08:00
++EditorGUI.indentLevel;
var shape = (Vessel.Shape)prop.FindPropertyRelative("m_Shape").intValue;
2021-01-11 08:54:28 +08:00
PropertyField(prop, "m_Shape");
PropertyField(prop, "m_ShapeWidth");
PropertyField(prop, "m_Gap");
PropertyTwoFiled(prop, "m_Center");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_AutoColor");
switch (shape)
{
case Vessel.Shape.Circle:
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_Smoothness");
break;
case Vessel.Shape.Rect:
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_CornerRadius");
break;
}
2021-01-11 08:54:28 +08:00
--EditorGUI.indentLevel;
2020-07-06 08:41:28 +08:00
}
}
}
}