Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_ButtonEffectColor.c
Go to the documentation of this file.
1
2
[
BaseContainerProps
(configRoot :
true
), SCR_ButtonEffectTitleAttribute(
"Color"
,
"m_sWidgetName"
)]
3
class
SCR_ButtonEffectColor
: SCR_ButtonEffectWidgetBase
4
{
5
// Attributes
6
7
[
Attribute
(defvalue:
"0.2"
,
UIWidgets
.EditBox,
"How fast each animation proceeds"
)]
8
protected
float
m_fAnimationTime
;
9
10
[
Attribute
()]
11
ref
Color
m_cDefault
;
12
13
[
Attribute
()]
14
ref
Color
m_cHovered
;
15
16
[
Attribute
()]
17
ref
Color
m_cActivated
;
18
19
[
Attribute
()]
20
ref
Color
m_cActivatedHovered
;
21
22
[
Attribute
()]
23
ref
Color
m_cDisabled
;
24
25
[
Attribute
()]
26
ref
Color
m_cDisabledActivated
;
27
28
[
Attribute
()]
29
ref
Color
m_cClicked
;
30
31
[
Attribute
()]
32
ref
Color
m_cFocusGained
;
33
34
[
Attribute
()]
35
ref
Color
m_cFocusLost
;
36
37
[
Attribute
()]
38
ref
Color
m_cToggledOn
;
39
40
[
Attribute
()]
41
ref
Color
m_cToggledOff
;
42
43
//TODO: focus should probably be a state, not events
44
//TODO: Fix colors not matching the button's current state
45
46
//------------------------------------------------------------------------------------------------
47
override
void
OnStateDefault
(
bool
instant)
48
{
49
// This can get triggered on mouse leave while the button remains focused. The focus color must then have priority, as it is integral to gamepad navigation
50
Color
color =
m_cDefault
;
51
if
((m_eEvents &
EModularButtonEventFlag
.EVENT_FOCUS_GAINED) && m_Button.GetFocused())
52
color =
m_cFocusGained
;
53
54
Apply
(color, instant);
55
}
56
57
//------------------------------------------------------------------------------------------------
58
override
void
OnStateHovered
(
bool
instant)
59
{
60
Apply
(
m_cHovered
, instant);
61
}
62
63
//------------------------------------------------------------------------------------------------
64
override
void
OnStateActivated
(
bool
instant)
65
{
66
// If the modular button is toggled while focused, the focus state must have priority, as it is integral to gamepad navigation
67
Color
color =
m_cActivated
;
68
if
((m_eEvents &
EModularButtonEventFlag
.EVENT_FOCUS_GAINED) && m_Button.GetFocused())
69
color =
m_cFocusGained
;
70
71
Apply
(color, instant);
72
}
73
74
//------------------------------------------------------------------------------------------------
75
override
void
OnStateDisabled
(
bool
instant)
76
{
77
Apply
(
m_cDisabled
, instant);
78
}
79
80
//------------------------------------------------------------------------------------------------
81
override
void
OnStateDisabledActivated
(
bool
instant)
82
{
83
Apply
(
m_cDisabledActivated
, instant);
84
}
85
86
//------------------------------------------------------------------------------------------------
87
override
void
OnStateActivatedHovered
(
bool
instant)
88
{
89
Apply
(
m_cActivatedHovered
, instant);
90
}
91
92
//------------------------------------------------------------------------------------------------
93
override
void
OnClicked
(
bool
instant)
94
{
95
Apply
(
m_cClicked
, instant);
96
}
97
98
//------------------------------------------------------------------------------------------------
99
override
void
OnFocusGained
(
bool
instant)
100
{
101
Apply
(
m_cFocusGained
, instant);
102
}
103
104
//------------------------------------------------------------------------------------------------
105
override
void
OnFocusLost
(
bool
instant)
106
{
107
// Focusing away from an activated modular button must give priority to it's activated state color
108
Color
color =
m_cFocusLost
;
109
if
((m_eEvents &
EModularButtonEventFlag
.STATE_ACTIVATED) && m_Button.GetToggled())
110
color =
m_cActivated
;
111
112
//TODO: handle focus lost on activated hovered
113
Apply
(color, instant);
114
}
115
116
//------------------------------------------------------------------------------------------------
117
override
void
OnToggledOn
(
bool
instant)
118
{
119
Apply
(
m_cToggledOn
, instant);
120
}
121
122
//------------------------------------------------------------------------------------------------
123
override
void
OnToggledOff
(
bool
instant)
124
{
125
Apply
(
m_cToggledOff
, instant);
126
}
127
128
//------------------------------------------------------------------------------------------------
129
// Called when effect is disabled. Here you should stop all running effects.
130
override
void
OnDisabled
()
131
{
132
AnimateWidget
.
StopAnimation
(m_wTarget,
WidgetAnimationColor
);
133
}
134
135
//------------------------------------------------------------------------------------------------
136
protected
void
Apply
(
Color
color,
bool
instant)
137
{
138
if
(color && m_wTarget)
139
{
140
if
(!instant &&
m_fAnimationTime
!= 0)
141
{
142
AnimateWidget
.
Color
(m_wTarget, color, 1 /
m_fAnimationTime
);
143
}
144
else
145
{
146
AnimateWidget
.
StopAnimation
(m_wTarget,
WidgetAnimationColor
);
147
m_wTarget.SetColor(color);
148
}
149
}
150
}
151
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
EModularButtonEventFlag
EModularButtonEventFlag
Definition
SCR_ButtonEffectBase.c:6
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::StopAnimation
static bool StopAnimation(Widget w, typename typeName)
Definition
AnimateWidget.c:26
AnimateWidget::Color
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition
AnimateWidget.c:200
Color
Definition
Color.c:13
SCR_ButtonEffectColor
Effect which colorizes a widget with given name.
Definition
SCR_ButtonEffectColor.c:4
SCR_ButtonEffectColor::m_cToggledOff
ref Color m_cToggledOff
Definition
SCR_ButtonEffectColor.c:41
SCR_ButtonEffectColor::OnToggledOn
override void OnToggledOn(bool instant)
Definition
SCR_ButtonEffectColor.c:117
SCR_ButtonEffectColor::OnStateDefault
override void OnStateDefault(bool instant)
Definition
SCR_ButtonEffectColor.c:47
SCR_ButtonEffectColor::OnStateActivatedHovered
override void OnStateActivatedHovered(bool instant)
Definition
SCR_ButtonEffectColor.c:87
SCR_ButtonEffectColor::m_cFocusGained
ref Color m_cFocusGained
Definition
SCR_ButtonEffectColor.c:32
SCR_ButtonEffectColor::OnStateHovered
override void OnStateHovered(bool instant)
Definition
SCR_ButtonEffectColor.c:58
SCR_ButtonEffectColor::m_cFocusLost
ref Color m_cFocusLost
Definition
SCR_ButtonEffectColor.c:35
SCR_ButtonEffectColor::m_cClicked
ref Color m_cClicked
Definition
SCR_ButtonEffectColor.c:29
SCR_ButtonEffectColor::Apply
void Apply(Color color, bool instant)
Definition
SCR_ButtonEffectColor.c:136
SCR_ButtonEffectColor::OnStateDisabledActivated
override void OnStateDisabledActivated(bool instant)
Definition
SCR_ButtonEffectColor.c:81
SCR_ButtonEffectColor::OnFocusGained
override void OnFocusGained(bool instant)
Definition
SCR_ButtonEffectColor.c:99
SCR_ButtonEffectColor::OnToggledOff
override void OnToggledOff(bool instant)
Definition
SCR_ButtonEffectColor.c:123
SCR_ButtonEffectColor::OnStateDisabled
override void OnStateDisabled(bool instant)
Definition
SCR_ButtonEffectColor.c:75
SCR_ButtonEffectColor::OnDisabled
override void OnDisabled()
Definition
SCR_ButtonEffectColor.c:130
SCR_ButtonEffectColor::m_fAnimationTime
float m_fAnimationTime
Definition
SCR_ButtonEffectColor.c:8
SCR_ButtonEffectColor::m_cHovered
ref Color m_cHovered
Definition
SCR_ButtonEffectColor.c:14
SCR_ButtonEffectColor::m_cDisabledActivated
ref Color m_cDisabledActivated
Definition
SCR_ButtonEffectColor.c:26
SCR_ButtonEffectColor::m_cDisabled
ref Color m_cDisabled
Definition
SCR_ButtonEffectColor.c:23
SCR_ButtonEffectColor::m_cActivatedHovered
ref Color m_cActivatedHovered
Definition
SCR_ButtonEffectColor.c:20
SCR_ButtonEffectColor::OnClicked
override void OnClicked(bool instant)
Definition
SCR_ButtonEffectColor.c:93
SCR_ButtonEffectColor::OnFocusLost
override void OnFocusLost(bool instant)
Definition
SCR_ButtonEffectColor.c:105
SCR_ButtonEffectColor::m_cDefault
ref Color m_cDefault
Definition
SCR_ButtonEffectColor.c:11
SCR_ButtonEffectColor::OnStateActivated
override void OnStateActivated(bool instant)
Definition
SCR_ButtonEffectColor.c:64
SCR_ButtonEffectColor::m_cToggledOn
ref Color m_cToggledOn
Definition
SCR_ButtonEffectColor.c:38
SCR_ButtonEffectColor::m_cActivated
ref Color m_cActivated
Definition
SCR_ButtonEffectColor.c:17
UIWidgets
Definition
attributes.c:40
WidgetAnimationColor
Definition
WidgetAnimations.c:249
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
ButtonComponents
ModularButton
Effects
SCR_ButtonEffectColor.c
Generated by
1.17.0