2019-10-22 04:09:04 +08:00
|
|
|
|
/******************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using UnityEditor;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
|
{
|
|
|
|
|
|
[CustomPropertyDrawer(typeof(Tooltip), true)]
|
|
|
|
|
|
public class TooltipDrawer : PropertyDrawer
|
|
|
|
|
|
{
|
|
|
|
|
|
private bool m_TooltipModuleToggle = false;
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
|
|
|
|
|
{
|
|
|
|
|
|
Rect drawRect = pos;
|
|
|
|
|
|
drawRect.height = EditorGUIUtility.singleLineHeight;
|
|
|
|
|
|
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
2019-07-18 09:42:36 +08:00
|
|
|
|
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
2019-09-23 09:23:51 +08:00
|
|
|
|
SerializedProperty m_Formatter = prop.FindPropertyRelative("m_Formatter");
|
2019-12-21 20:12:27 +08:00
|
|
|
|
SerializedProperty m_TitleFormatter = prop.FindPropertyRelative("m_TitleFormatter");
|
|
|
|
|
|
SerializedProperty m_ItemFormatter = prop.FindPropertyRelative("m_ItemFormatter");
|
2019-09-19 09:06:04 +08:00
|
|
|
|
SerializedProperty m_FixedWidth = prop.FindPropertyRelative("m_FixedWidth");
|
|
|
|
|
|
SerializedProperty m_FixedHeight = prop.FindPropertyRelative("m_FixedHeight");
|
|
|
|
|
|
SerializedProperty m_MinWidth = prop.FindPropertyRelative("m_MinWidth");
|
|
|
|
|
|
SerializedProperty m_MinHeight = prop.FindPropertyRelative("m_MinHeight");
|
2019-10-26 05:02:32 +08:00
|
|
|
|
SerializedProperty m_ForceENotation = prop.FindPropertyRelative("m_ForceENotation");
|
2020-02-11 21:01:01 +08:00
|
|
|
|
SerializedProperty m_PaddingLeftRight = prop.FindPropertyRelative("m_PaddingLeftRight");
|
|
|
|
|
|
SerializedProperty m_PaddingTopBottom = prop.FindPropertyRelative("m_PaddingTopBottom");
|
2020-02-11 21:30:20 +08:00
|
|
|
|
SerializedProperty m_BackgroundImage = prop.FindPropertyRelative("m_BackgroundImage");
|
2020-03-10 12:35:19 +08:00
|
|
|
|
SerializedProperty m_IgnoreDataDefaultContent = prop.FindPropertyRelative("m_IgnoreDataDefaultContent");
|
2020-02-11 20:37:48 +08:00
|
|
|
|
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
2020-02-13 09:23:30 +08:00
|
|
|
|
SerializedProperty m_TextStyle = prop.FindPropertyRelative("m_TextStyle");
|
2019-05-11 04:33:54 +08:00
|
|
|
|
|
|
|
|
|
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
2019-05-29 09:53:30 +08:00
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
if (m_TooltipModuleToggle)
|
|
|
|
|
|
{
|
2020-02-11 20:37:48 +08:00
|
|
|
|
EditorGUI.indentLevel++;
|
2019-07-18 09:42:36 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, type);
|
2019-05-29 09:53:30 +08:00
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-09-23 09:23:51 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_Formatter);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-12-21 20:12:27 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_TitleFormatter);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_ItemFormatter);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-09-19 09:06:04 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_FixedWidth);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_FixedHeight);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_MinWidth);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_MinHeight);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2020-02-11 21:01:01 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_PaddingLeftRight);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_PaddingTopBottom);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2020-02-11 21:30:20 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_BackgroundImage);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-10-26 05:02:32 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_ForceENotation);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2020-03-10 12:35:19 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_IgnoreDataDefaultContent);
|
2020-03-10 09:12:47 +08:00
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2020-02-11 20:37:48 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
|
|
|
|
|
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
2020-02-13 09:23:30 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_TextStyle);
|
|
|
|
|
|
drawRect.y += EditorGUI.GetPropertyHeight(m_TextStyle);
|
2020-02-11 20:37:48 +08:00
|
|
|
|
EditorGUI.indentLevel--;
|
2019-05-29 09:53:30 +08:00
|
|
|
|
}
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
|
|
|
|
|
{
|
2019-06-21 09:34:33 +08:00
|
|
|
|
if (m_TooltipModuleToggle)
|
2020-03-10 09:12:47 +08:00
|
|
|
|
return 14 * EditorGUIUtility.singleLineHeight + 13 * EditorGUIUtility.standardVerticalSpacing +
|
2020-02-13 09:23:30 +08:00
|
|
|
|
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle")) +
|
|
|
|
|
|
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_TextStyle"));
|
2019-05-29 09:53:30 +08:00
|
|
|
|
else
|
2019-07-18 09:42:36 +08:00
|
|
|
|
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|