AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
Title.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]
19  {
20  [SerializeField] private bool m_Show = true;
21  [SerializeField] private string m_Text;
22  [SerializeField] private TextStyle m_TextStyle = new TextStyle();
23  [SerializeField] private string m_SubText;
24  [SerializeField] private TextStyle m_SubTextStyle = new TextStyle();
25  [SerializeField] private float m_ItemGap = 8;
26  [SerializeField] private Location m_Location = Location.defaultTop;
27 
33  public bool show { get { return m_Show; } set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } }
38  public string text { get { return m_Text; } set { if (PropertyUtil.SetClass(ref m_Text, value)) SetComponentDirty(); } }
43  public TextStyle textStyle
44  {
45  get { return m_TextStyle; }
46  set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
47  }
52  public string subText
53  {
54  get { return m_SubText; }
55  set { if (PropertyUtil.SetClass(ref m_SubText, value)) SetComponentDirty(); }
56  }
61  public TextStyle subTextStyle
62  {
63  get { return m_SubTextStyle; }
64  set { if (PropertyUtil.SetClass(ref m_SubTextStyle, value)) SetComponentDirty(); }
65  }
71  public float itemGap
72  {
73  get { return m_ItemGap; }
74  set { if (PropertyUtil.SetStruct(ref m_ItemGap, value)) SetComponentDirty(); }
75  }
80  public Location location
81  {
82  get { return m_Location; }
83  set { if (PropertyUtil.SetClass(ref m_Location, value)) SetComponentDirty(); }
84  }
85 
86  public int index { get; internal set; }
87 
88  public override bool vertsDirty { get { return false; } }
89  public override bool componentDirty
90  {
91  get { return m_ComponentDirty || location.componentDirty || textStyle.componentDirty || subTextStyle.componentDirty; }
92  }
93 
94  public override void ClearComponentDirty()
95  {
96  base.ClearComponentDirty();
97  location.ClearComponentDirty();
98  textStyle.ClearComponentDirty();
99  subTextStyle.ClearComponentDirty();
100  }
101 
102  public static Title defaultTitle
103  {
104  get
105  {
106  var title = new Title
107  {
108  m_Show = true,
109  m_Text = "Chart Title",
110  m_TextStyle = new TextStyle(),
111  m_SubText = "",
112  m_SubTextStyle = new TextStyle(),
113  m_ItemGap = 0,
114  m_Location = Location.defaultTop
115  };
116  return title;
117  }
118  }
119 
120  public void OnChanged()
121  {
122  m_Location.OnChanged();
123  }
124  }
125 }
XCharts.Title.text
string text
The main title text, supporting for newlines. 主标题文本,支持使用 换行。
Definition: Title.cs:38
XCharts.Title.location
Location location
The location of title component. 标题显示位置。
Definition: Title.cs:81
XCharts.IPropertyChanged
属性变更接口
Definition: IPropertyChanged.cs:13
XCharts.Location
Location type. Quick to set the general location. 位置类型。通过Align快速设置大体位置,再通过left,right,top,bottom微调具体位置...
Definition: Location.cs:21
XCharts.Title
Title component, including main title and subtitle. 标题组件,包含主标题和副标题。
Definition: Title.cs:18
XCharts.MainComponent
Definition: ChartComponent.cs:67
XCharts.TextStyle
Settings related to text. 文本的相关设置。
Definition: TextStyle.cs:21
XCharts.ChartComponent.componentDirty
virtual bool componentDirty
组件重新初始化标记。
Definition: ChartComponent.cs:25
XCharts
Definition: RewardChart.cs:14
XCharts.Title.textStyle
TextStyle textStyle
The text style of main title. 主标题文本样式。
Definition: Title.cs:44
XCharts.Title.itemGap
float itemGap
[default:8] The gap between the main title and subtitle. 主副标题之间的间距。
Definition: Title.cs:72
XCharts.Title.show
bool show
[default:true] Set this to false to prevent the title from showing. 是否显示标题组件。
Definition: Title.cs:33
XCharts.Title.subText
string subText
Subtitle text, supporting for for newlines. 副标题文本,支持使用 换行。
Definition: Title.cs:53
XCharts.Location.OnChanged
void OnChanged()
属性变更时更新textAnchor,minAnchor,maxAnchor,pivot
Definition: Location.cs:313
XCharts.Title.subTextStyle
TextStyle subTextStyle
The text style of sub title. 副标题文本样式。
Definition: Title.cs:62