AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
Settings.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 using UnityEngine;
9 using System;
10 
11 namespace XCharts
12 {
17  [Serializable]
18  public class Settings : MainComponent
19  {
20  [SerializeField] [Range(1, 20)] protected int m_MaxPainter = 10;
21  [SerializeField] protected bool m_ReversePainter = false;
22  [SerializeField] protected Material m_BasePainterMaterial;
23  [SerializeField] protected Material m_SeriePainterMaterial;
24  [SerializeField] protected Material m_TopPainterMaterial;
25  [SerializeField] [Range(1, 10)] protected float m_LineSmoothStyle = 3f;
26  [SerializeField] [Range(1f, 20)] protected float m_LineSmoothness = 2f;
27  [SerializeField] [Range(0.5f, 20)] protected float m_LineSegmentDistance = 3f;
28  [SerializeField] [Range(1, 10)] protected float m_CicleSmoothness = 2f;
29  [SerializeField] protected float m_LegendIconLineWidth = 2;
30  [SerializeField] private float[] m_LegendIconCornerRadius = new float[] { 0.25f, 0.25f, 0.25f, 0.25f };
31 
36  public int maxPainter
37  {
38  get { return m_MaxPainter; }
39  set { if (PropertyUtil.SetStruct(ref m_MaxPainter, value < 0 ? 1 : value)) SetVerticesDirty(); }
40  }
44  public bool reversePainter
45  {
46  get { return m_ReversePainter; }
47  set { if (PropertyUtil.SetStruct(ref m_ReversePainter, value)) SetVerticesDirty(); }
48  }
52  public Material basePainterMaterial
53  {
54  get { return m_BasePainterMaterial; }
55  set { if (PropertyUtil.SetClass(ref m_BasePainterMaterial, value)) SetComponentDirty(); }
56  }
60  public Material seriePainterMaterial
61  {
62  get { return m_SeriePainterMaterial; }
63  set { if (PropertyUtil.SetClass(ref m_SeriePainterMaterial, value)) SetComponentDirty(); }
64  }
68  public Material topPainterMaterial
69  {
70  get { return m_TopPainterMaterial; }
71  set { if (PropertyUtil.SetClass(ref m_TopPainterMaterial, value)) SetComponentDirty(); }
72  }
78  public float lineSmoothStyle
79  {
80  get { return m_LineSmoothStyle; }
81  set { if (PropertyUtil.SetStruct(ref m_LineSmoothStyle, value < 0 ? 1f : value)) SetVerticesDirty(); }
82  }
89  public float lineSmoothness
90  {
91  get { return m_LineSmoothness; }
92  set { if (PropertyUtil.SetStruct(ref m_LineSmoothStyle, value < 0 ? 1f : value)) SetVerticesDirty(); }
93  }
101  public float lineSegmentDistance
102  {
103  get { return m_LineSegmentDistance; }
104  set { if (PropertyUtil.SetStruct(ref m_LineSegmentDistance, value < 0 ? 1f : value)) SetVerticesDirty(); }
105  }
110  public float cicleSmoothness
111  {
112  get { return m_CicleSmoothness; }
113  set { if (PropertyUtil.SetStruct(ref m_CicleSmoothness, value < 0 ? 1f : value)) SetVerticesDirty(); }
114  }
115 
120  public float legendIconLineWidth
121  {
122  get { return m_LegendIconLineWidth; }
123  set { if (PropertyUtil.SetStruct(ref m_LegendIconLineWidth, value)) SetVerticesDirty(); }
124  }
125 
130  public float[] legendIconCornerRadius
131  {
132  get { return m_LegendIconCornerRadius; }
133  set { if (PropertyUtil.SetClass(ref m_LegendIconCornerRadius, value, true)) SetVerticesDirty(); }
134  }
135 
136  public void Copy(Settings settings)
137  {
138  m_ReversePainter = settings.reversePainter;
139  m_MaxPainter = settings.maxPainter;
140  m_BasePainterMaterial = settings.basePainterMaterial;
141  m_SeriePainterMaterial = settings.seriePainterMaterial;
142  m_TopPainterMaterial = settings.topPainterMaterial;
143  m_LineSmoothStyle = settings.lineSmoothStyle;
144  m_LineSmoothness = settings.lineSmoothness;
145  m_LineSegmentDistance = settings.lineSegmentDistance;
146  m_CicleSmoothness = settings.cicleSmoothness;
147  m_LegendIconLineWidth = settings.legendIconLineWidth;
148  ChartHelper.CopyArray(m_LegendIconCornerRadius, settings.legendIconCornerRadius);
149  }
150 
151  public void Reset()
152  {
153  Copy(DefaultSettings);
154  }
155 
156  public static Settings DefaultSettings
157  {
158  get
159  {
160  return new Settings()
161  {
162  m_ReversePainter = false,
163  m_MaxPainter = XChartsSettings.maxPainter,
164  m_LineSmoothStyle = XChartsSettings.lineSmoothStyle,
165  m_LineSmoothness = XChartsSettings.lineSmoothness,
166  m_LineSegmentDistance = XChartsSettings.lineSegmentDistance,
167  m_CicleSmoothness = XChartsSettings.cicleSmoothness,
168  m_LegendIconLineWidth = 2,
169  m_LegendIconCornerRadius = new float[] { 0.25f, 0.25f, 0.25f, 0.25f }
170  };
171  }
172  }
173  }
174 }
XCharts.Settings.lineSmoothStyle
float? lineSmoothStyle
Curve smoothing factor. By adjusting the smoothing coefficient, the curvature of the curve can be cha...
Definition: Settings.cs:79
XCharts.Settings.lineSmoothness
float? lineSmoothness
Smoothness of curve. The smaller the value, the smoother the curve, but the number of vertices will i...
Definition: Settings.cs:90
XCharts.MainComponent
Definition: ChartComponent.cs:67
XCharts.Settings.legendIconLineWidth
float legendIconLineWidth
the width of line serie legend. Line类型图例图标的线条宽度。
Definition: Settings.cs:121
XCharts
Definition: RewardChart.cs:14
XCharts.Settings.lineSegmentDistance
float? lineSegmentDistance
The partition distance of a line segment. A line in a normal line chart is made up of many segments,...
Definition: Settings.cs:102
XCharts.Settings.legendIconCornerRadius
float[] legendIconCornerRadius
The radius of rounded corner. Its unit is px. Use array to respectively specify the 4 corner radiuses...
Definition: Settings.cs:131
XCharts.Settings.reversePainter
bool reversePainter
Painter是否逆序。逆序时index大的serie最先绘制。
Definition: Settings.cs:45
XCharts.Settings.seriePainterMaterial
Material seriePainterMaterial
Serie Pointer 材质球,设置后会影响所有Serie。
Definition: Settings.cs:61
XCharts.Settings.topPainterMaterial
Material topPainterMaterial
Top Pointer 材质球,设置后会影响Tooltip等。
Definition: Settings.cs:69
XCharts.Settings.basePainterMaterial
Material basePainterMaterial
Base Pointer 材质球,设置后会影响Axis等。
Definition: Settings.cs:53
XCharts.Settings.cicleSmoothness
float? cicleSmoothness
the smoothess of cricle. 圆形的平滑度。数越小圆越平滑,但顶点数也会随之增加。
Definition: Settings.cs:111
XCharts.Settings.maxPainter
int? maxPainter
max painter. 设定的painter数量。
Definition: Settings.cs:37
XCharts.Settings
Global parameter setting component. The default value can be used in general, and can be adjusted whe...
Definition: Settings.cs:18