3.0 - optimize code

This commit is contained in:
monitor1394
2022-03-04 22:17:32 +08:00
parent 1ee0df09eb
commit 5745fea9a1
59 changed files with 482 additions and 435 deletions

View File

@@ -0,0 +1,38 @@

using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LevelStyle), true)]
public class LevelStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LevelStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyListField(prop, "m_Levels");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(Level), true)]
public class LevelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Level"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
++EditorGUI.indentLevel;
PropertyField(prop, "m_Label");
PropertyField(prop, "m_UpperLabel");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}
}
}