mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 13:30:10 +00:00
54 lines
2.3 KiB
C#
54 lines
2.3 KiB
C#
|
|
/******************************************/
|
|||
|
|
/* */
|
|||
|
|
/* Copyright (c) 2018 monitor1394 */
|
|||
|
|
/* https://github.com/monitor1394 */
|
|||
|
|
/* */
|
|||
|
|
/******************************************/
|
|||
|
|
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEditor;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
namespace XCharts
|
|||
|
|
{
|
|||
|
|
[CustomPropertyDrawer(typeof(GaugeAxis.SplitLine), true)]
|
|||
|
|
public class GaugeAxisSplitDrawer : PropertyDrawer
|
|||
|
|
{
|
|||
|
|
private Dictionary<string, bool> m_Toggle = new Dictionary<string, bool>();
|
|||
|
|
|
|||
|
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
|||
|
|
{
|
|||
|
|
Rect drawRect = pos;
|
|||
|
|
drawRect.height = EditorGUIUtility.singleLineHeight;
|
|||
|
|
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
|||
|
|
SerializedProperty m_Length = prop.FindPropertyRelative("m_Length");
|
|||
|
|
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
|||
|
|
|
|||
|
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_Toggle, prop, "Split Line", show, false);
|
|||
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|||
|
|
if (ChartEditorHelper.IsToggle(m_Toggle, prop))
|
|||
|
|
{
|
|||
|
|
++EditorGUI.indentLevel;
|
|||
|
|
EditorGUI.PropertyField(drawRect, m_Length);
|
|||
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|||
|
|
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
|||
|
|
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
|||
|
|
--EditorGUI.indentLevel;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
|||
|
|
{
|
|||
|
|
if (ChartEditorHelper.IsToggle(m_Toggle, prop))
|
|||
|
|
{
|
|||
|
|
float height = 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
|||
|
|
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
|
|||
|
|
return height;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|