AirControl
1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
TitleStyle.cs
1
/*
2
/************************************************/
3
/* */
4
/* Copyright (c) 2018 - 2021 monitor1394 */
5
/* https://github.com/monitor1394 */
6
/* */
7
/************************************************/
8
9
using
System;
10
using
UnityEngine;
11
using
UnityEngine.UI;
12
using
UnityEngine.Serialization;
13
14
namespace
XCharts
15
{
20
[Serializable]
21
public
class
TitleStyle
:
SubComponent
22
{
23
[SerializeField]
private
bool
m_Show;
24
[FormerlySerializedAs(
"m_textStyle"
)]
25
[SerializeField]
private
TextStyle
m_TextStyle =
new
TextStyle
();
26
31
public
bool
show
32
{
33
get
{
return
m_Show; }
34
set
{
if
(PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
35
}
36
41
public
TextStyle
textStyle
42
{
43
get
{
return
m_TextStyle; }
44
set
{
if
(PropertyUtil.SetClass(ref m_TextStyle, value,
true
)) SetComponentDirty(); }
45
}
46
47
public
override
bool
componentDirty {
get
{
return
m_ComponentDirty ||
textStyle
.
componentDirty
; } }
48
49
public
override
void
ClearComponentDirty()
50
{
51
base.ClearComponentDirty();
52
textStyle
.ClearComponentDirty();
53
}
54
55
public
ChartText runtimeText {
get
;
set
; }
56
57
public
bool
IsInited()
58
{
59
return
runtimeText !=
null
;
60
}
61
62
public
void
SetActive(
bool
active)
63
{
64
if
(runtimeText !=
null
)
65
{
66
runtimeText.SetActive(active);
67
}
68
}
69
70
public
void
UpdatePosition(Vector3 pos)
71
{
72
if
(runtimeText !=
null
)
73
{
74
runtimeText.SetLocalPosition(pos +
new
Vector3(m_TextStyle.
offset
.x, m_TextStyle.
offset
.y));
75
}
76
}
77
78
public
void
SetText(
string
text)
79
{
80
if
(runtimeText ==
null
)
return
;
81
var oldText = runtimeText.GetText();
82
if
(oldText !=
null
&& !oldText.Equals(text))
83
{
84
if
(!ChartHelper.IsClearColor(
textStyle
.
color
)) runtimeText.SetColor(
textStyle
.
color
);
85
runtimeText.SetText(text);
86
}
87
}
88
89
public
void
SetColor(Color color)
90
{
91
if
(runtimeText !=
null
)
92
{
93
runtimeText.SetColor(color);
94
}
95
}
96
}
97
}
XCharts.TitleStyle.show
bool show
Whether to show title. 是否显示标题。
Definition:
TitleStyle.cs:32
XCharts.TextStyle
Settings related to text. 文本的相关设置。
Definition:
TextStyle.cs:21
XCharts.TitleStyle
the title of serie. 标题相关设置。
Definition:
TitleStyle.cs:21
XCharts.ChartComponent.componentDirty
virtual bool componentDirty
组件重新初始化标记。
Definition:
ChartComponent.cs:25
XCharts.SubComponent
Definition:
ChartComponent.cs:71
XCharts
Definition:
RewardChart.cs:14
XCharts.TextStyle.offset
Vector2 offset
the offset of position. 坐标偏移。 [Default: Vector2.zero]
Definition:
TextStyle.cs:55
XCharts.TitleStyle.textStyle
TextStyle textStyle
the color of text. 文本的颜色。
Definition:
TitleStyle.cs:42
XCharts.TextStyle.color
Color color
the color of text. 文本的颜色。 [default: Color.clear]
Definition:
TextStyle.cs:68
Assets
XCharts
Runtime
Component
Sub
TitleStyle.cs
Github
|
About
| Developed with ❤️ in India