AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
IconStyle.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 using UnityEngine;
9 using UnityEngine.UI;
10 
11 namespace XCharts
12 {
13  [System.Serializable]
14  public class IconStyle : SubComponent
15  {
16  public enum Layer
17  {
18  UnderLabel,
19  AboveLabel
20  }
21  [SerializeField] private bool m_Show;
22  [SerializeField] private Layer m_Layer;
23  [SerializeField] private Align m_Align = Align.Left;
24  [SerializeField] private Sprite m_Sprite;
25  [SerializeField] private Color m_Color = Color.white;
26  [SerializeField] private float m_Width = 20;
27  [SerializeField] private float m_Height = 20;
28  [SerializeField] private Vector3 m_Offset;
29  [SerializeField] private bool m_AutoHideWhenLabelEmpty = false;
30 
31  public void Reset()
32  {
33  m_Show = false;
34  m_Layer = Layer.UnderLabel;
35  m_Sprite = null;
36  m_Color = Color.white;
37  m_Width = 20;
38  m_Height = 20;
39  m_Offset = Vector3.zero;
40  m_AutoHideWhenLabelEmpty = false;
41  }
46  public bool show { get { return m_Show; } set { m_Show = value; } }
50  public Layer layer { get { return m_Layer; } set { m_Layer = value; } }
55  public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
59  public Color color { get { return m_Color; } set { m_Color = value; } }
63  public float width { get { return m_Width; } set { m_Width = value; } }
67  public float height { get { return m_Height; } set { m_Height = value; } }
71  public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
75  public Align align { get { return m_Align; } set { m_Align = value; } }
79  public bool autoHideWhenLabelEmpty { get { return m_AutoHideWhenLabelEmpty; } set { m_AutoHideWhenLabelEmpty = value; } }
80  public IconStyle Clone()
81  {
82  var iconStyle = new IconStyle();
83  iconStyle.show = show;
84  iconStyle.layer = layer;
85  iconStyle.sprite = sprite;
86  iconStyle.color = color;
87  iconStyle.width = width;
88  iconStyle.height = height;
89  iconStyle.offset = offset;
90  iconStyle.align = align;
91  iconStyle.autoHideWhenLabelEmpty = autoHideWhenLabelEmpty;
92  return iconStyle;
93  }
94 
95  public void Copy(IconStyle iconStyle)
96  {
97  show = iconStyle.show;
98  layer = iconStyle.layer;
99  sprite = iconStyle.sprite;
100  color = iconStyle.color;
101  width = iconStyle.width;
102  height = iconStyle.height;
103  offset = iconStyle.offset;
104  align = iconStyle.align;
105  autoHideWhenLabelEmpty = iconStyle.autoHideWhenLabelEmpty;
106  }
107  }
108 }
XCharts.IconStyle.sprite
Sprite sprite
The image of icon. 图标的图片。
Definition: IconStyle.cs:55
XCharts.IconStyle.align
Align align
水平方向对齐方式。
Definition: IconStyle.cs:75
XCharts.IconStyle.height
float height
图标高。
Definition: IconStyle.cs:67
XCharts.Align
Align
对齐方式
Definition: Serie.cs:250
XCharts.SubComponent
Definition: ChartComponent.cs:71
XCharts.IconStyle
Definition: IconStyle.cs:14
XCharts
Definition: RewardChart.cs:14
XCharts.IconStyle.color
Color color
图标颜色。
Definition: IconStyle.cs:59
XCharts.IconStyle.show
bool show
Whether the data icon is show. 是否显示图标。
Definition: IconStyle.cs:46
XCharts.IconStyle.offset
Vector3 offset
图标偏移。
Definition: IconStyle.cs:71
XCharts.IconStyle.width
float width
图标宽。
Definition: IconStyle.cs:63
XCharts.IconStyle.layer
Layer layer
显示在上层还是在下层。
Definition: IconStyle.cs:50
XCharts.IconStyle.autoHideWhenLabelEmpty
bool autoHideWhenLabelEmpty
当label内容为空时是否自动隐藏图标
Definition: IconStyle.cs:79