AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
GaugeAxisDrawer.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 using UnityEditor;
9 using UnityEngine;
10 
11 namespace XCharts
12 {
13  [CustomPropertyDrawer(typeof(GaugeAxis), true)]
15  {
16  public override string ClassName { get { return "Gauge Axis"; } }
17  public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
18  {
19  base.OnGUI(pos, prop, label);
20  if (MakeFoldout(prop, "m_Show"))
21  {
22  ++EditorGUI.indentLevel;
23  PropertyField(prop, "m_AxisLine");
24  PropertyField(prop, "m_SplitLine");
25  PropertyField(prop, "m_AxisTick");
26  PropertyField(prop, "m_AxisLabel");
27  PropertyField(prop, "m_AxisLabelText");
28  --EditorGUI.indentLevel;
29  }
30  }
31  }
32 
33 
34  [CustomPropertyDrawer(typeof(StageColor), true)]
36  {
37  public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
38  {
39  Rect drawRect = pos;
40  drawRect.height = EditorGUIUtility.singleLineHeight;
41  SerializedProperty m_Percent = prop.FindPropertyRelative("m_Percent");
42  SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
43 
44  ChartEditorHelper.MakeTwoField(ref drawRect, drawRect.width, m_Percent, m_Color, "Stage");
45  drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
46  }
47 
48  public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
49  {
50  return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
51  }
52  }
53 
54  [CustomPropertyDrawer(typeof(GaugePointer), true)]
56  {
57  public override string ClassName { get { return "Gauge Pointer"; } }
58  public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
59  {
60  base.OnGUI(pos, prop, label);
61  if (MakeFoldout(prop, "m_Show"))
62  {
63  ++EditorGUI.indentLevel;
64  PropertyField(prop, "m_Width");
65  PropertyField(prop, "m_Length");
66  --EditorGUI.indentLevel;
67  }
68  }
69  }
70 }
XCharts.ChartEditorHelper
Definition: ChartEditorHelper.cs:14
XCharts.BasePropertyDrawer
Definition: BasePropertyDrawer.cs:15
XCharts.StageColor
Definition: GaugeAxisLine.cs:14
XCharts.GaugeAxisDrawer
Definition: GaugeAxisDrawer.cs:14
XCharts
Definition: RewardChart.cs:14
XCharts.GaugePointerDrawer
Definition: GaugeAxisDrawer.cs:55
XCharts.SerieSymbolType.Rect
@ Rect
正方形。可通过设置itemStyle的cornerRadius变成圆角矩形。
XCharts.GaugePointer
Settings related to gauge pointer. 仪表盘指针相关设置。
Definition: GaugePointer.cs:19
XCharts.GaugeAxisLineStageColorDrawer
Definition: GaugeAxisDrawer.cs:35