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_AttributeTickboxUIComponent.c
Go to the documentation of this file.
1
2
4
class
SCR_AttributeTickboxUIComponent
:
ScriptedWidgetComponent
5
{
6
7
[
Attribute
()]
8
protected
string
m_sTickBoxImageName
;
9
10
[
Attribute
()]
11
protected
string
m_sTickBoxButtonName
;
12
13
// Visuals
14
[
Attribute
()]
15
protected
ResourceName
m_sTickBoxImageToggled
;
16
17
[
Attribute
()]
18
protected
ResourceName
m_sTickBoxImageUntoggled
;
19
20
// Reference
21
protected
SCR_BaseEditorAttributeUIComponent
m_AttributeUI
;
22
protected
typename
m_LinkedOverrideAttributeType
=
typename
.Empty;
23
protected
Widget
m_Root
;
24
protected
ImageWidget
m_TickBoxImage
;
25
protected
Widget
m_TickBoxButton
;
26
27
protected
float
m_fDisabledAlphaColor
= 0.25;
28
29
// States
30
protected
bool
m_bToggled
;
31
protected
bool
m_bEnabled
=
true
;
32
33
// Events
34
protected
ref
ScriptInvokerBool
m_OnToggleChanged
;
35
36
//------------------------------------------------------------------------------------------------
39
void
ToggleTickbox
(
bool
toggled)
40
{
41
if
(!
m_bEnabled
)
42
return
;
43
44
m_bToggled
= toggled;
45
46
if
(
m_OnToggleChanged
)
47
m_OnToggleChanged
.Invoke(toggled);
48
49
if
(toggled)
50
{
51
m_TickBoxImage
.LoadImageTexture(0,
m_sTickBoxImageToggled
);
52
m_TickBoxImage
.SetImage(0);
53
}
54
else
55
{
56
m_TickBoxImage
.LoadImageTexture(0,
m_sTickBoxImageUntoggled
);
57
m_TickBoxImage
.SetImage(0);
58
}
59
60
SCR_AttributesManagerEditorComponent attributesManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
61
if
(!attributesManager)
62
return
;
63
64
if
(
m_LinkedOverrideAttributeType
!=
typename
.Empty)
65
{
66
SCR_BaseEditorAttributeVar
overideValue =
new
SCR_BaseEditorAttributeVar
();
67
overideValue.
SetBool
(toggled);
68
attributesManager.SetAttributeVariable(
m_LinkedOverrideAttributeType
, overideValue);
69
}
70
}
71
72
//------------------------------------------------------------------------------------------------
75
void
ToggleEnableByAttribute
(
bool
enabled)
76
{
77
SetEnabled
(enabled);
78
}
79
80
//------------------------------------------------------------------------------------------------
81
protected
void
OnButtonToggle
()
82
{
83
ToggleTickbox
(!
m_bToggled
);
84
}
85
86
//------------------------------------------------------------------------------------------------
89
bool
GetToggled
()
90
{
91
return
m_bToggled
;
92
}
93
94
//------------------------------------------------------------------------------------------------
97
bool
IsVisibleAndEnabled
()
98
{
99
return
m_TickBoxButton
.IsEnabled() &&
m_Root
.IsVisible();
100
}
101
102
//------------------------------------------------------------------------------------------------
103
ScriptInvokerBool
GetOnToggleChanged
()
104
{
105
if
(!
m_OnToggleChanged
)
106
m_OnToggleChanged
=
new
ScriptInvokerBool
();
107
108
return
m_OnToggleChanged
;
109
}
110
111
//------------------------------------------------------------------------------------------------
115
protected
void
SetVisible
(
bool
frameVisible,
bool
buttonVisible)
116
{
117
m_Root
.SetVisible(frameVisible);
118
m_TickBoxButton
.SetVisible(buttonVisible);
119
}
120
121
//------------------------------------------------------------------------------------------------
122
protected
void
SetEnabled
(
bool
enabled)
123
{
124
m_bEnabled
= enabled;
125
126
//m_TickBoxImage.LoadImageTexture(0, m_sNonConfictingTickBoxImage);
127
Color
color =
Color
.FromInt(
m_TickBoxImage
.GetColor().PackToInt());
128
if
(!enabled)
129
color.SetA(
m_fDisabledAlphaColor
);
130
else
131
color.SetA(1);
132
133
m_TickBoxImage
.SetColor(color);
134
135
m_TickBoxButton
.SetEnabled(enabled);
136
}
137
138
//------------------------------------------------------------------------------------------------
141
bool
GetEnabled
()
142
{
143
return
m_bEnabled
;
144
}
145
146
//------------------------------------------------------------------------------------------------
152
void
InitTickbox
(
bool
toggleState,
SCR_BaseEditorAttributeUIComponent
attributeUI,
typename
linkedOverrideAttributeType =
typename
.Empty)
153
{
154
m_LinkedOverrideAttributeType
= linkedOverrideAttributeType;
155
156
SetVisible
(
true
,
true
);
157
ToggleTickbox
(toggleState);
158
m_AttributeUI
= attributeUI;
159
160
if
(
m_AttributeUI
)
161
{
162
m_AttributeUI
.GetOnEnabledByAttribute().Insert(
OnAttributeEnabledByAttribute
);
163
SetEnabled
(
m_AttributeUI
.GetAttribute().IsEnabled());
164
}
165
}
166
167
//------------------------------------------------------------------------------------------------
169
void
InitDisabled
()
170
{
171
SetVisible
(
true
,
true
);
172
SetEnabled
(
false
);
173
m_bToggled
=
true
;
174
m_TickBoxImage
.LoadImageTexture(0,
m_sTickBoxImageToggled
);
175
m_TickBoxImage
.SetImage(0);
176
}
177
178
//------------------------------------------------------------------------------------------------
179
protected
void
OnAttributeEnabledByAttribute
(
bool
enabled)
180
{
181
SetEnabled
(enabled);
182
}
183
184
//------------------------------------------------------------------------------------------------
185
override
void
HandlerAttached
(
Widget
w)
186
{
187
m_Root
= w;
188
189
m_TickBoxImage
=
ImageWidget
.Cast(w.FindAnyWidget(
m_sTickBoxImageName
));
190
if
(!
m_TickBoxImage
)
191
return
;
192
193
m_TickBoxButton
= w.FindAnyWidget(
m_sTickBoxButtonName
);
194
if
(!
m_TickBoxButton
)
195
return
;
196
197
ScriptInvoker
onButton =
ButtonActionComponent
.GetOnAction(w,
m_sTickBoxButtonName
);
198
if
(onButton) onButton.Insert(
OnButtonToggle
);
199
}
200
201
//------------------------------------------------------------------------------------------------
202
override
void
HandlerDeattached
(
Widget
w)
203
{
204
if
(
m_AttributeUI
)
205
m_AttributeUI
.GetOnEnabledByAttribute().Remove(
OnAttributeEnabledByAttribute
);
206
}
207
}
ScriptInvokerBool
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
Definition
SCR_ScriptInvokerHelper.c:41
ButtonActionComponent
Component to execute action when the button or its shortcut is pressed.
Definition
ButtonActionComponent.c:3
Color
Definition
Color.c:13
ImageWidget
Definition
ImageWidget.c:13
ResourceName
Definition
ResourceName.c:13
SCR_AttributeTickboxUIComponent
Using a controller will show/hide the Select button hint if the attribute with this script is focused...
Definition
SCR_AttributeTickboxUIComponent.c:5
SCR_AttributeTickboxUIComponent::ToggleEnableByAttribute
void ToggleEnableByAttribute(bool enabled)
Definition
SCR_AttributeTickboxUIComponent.c:75
SCR_AttributeTickboxUIComponent::OnAttributeEnabledByAttribute
void OnAttributeEnabledByAttribute(bool enabled)
Definition
SCR_AttributeTickboxUIComponent.c:179
SCR_AttributeTickboxUIComponent::InitDisabled
void InitDisabled()
On init as overriding attributes (multiple entities with the same attribute) but non of them are conf...
Definition
SCR_AttributeTickboxUIComponent.c:169
SCR_AttributeTickboxUIComponent::GetEnabled
bool GetEnabled()
Definition
SCR_AttributeTickboxUIComponent.c:141
SCR_AttributeTickboxUIComponent::m_TickBoxButton
Widget m_TickBoxButton
Definition
SCR_AttributeTickboxUIComponent.c:25
SCR_AttributeTickboxUIComponent::m_AttributeUI
SCR_BaseEditorAttributeUIComponent m_AttributeUI
Definition
SCR_AttributeTickboxUIComponent.c:21
SCR_AttributeTickboxUIComponent::m_bEnabled
bool m_bEnabled
Definition
SCR_AttributeTickboxUIComponent.c:31
SCR_AttributeTickboxUIComponent::m_sTickBoxImageName
string m_sTickBoxImageName
Definition
SCR_AttributeTickboxUIComponent.c:8
SCR_AttributeTickboxUIComponent::m_sTickBoxButtonName
string m_sTickBoxButtonName
Definition
SCR_AttributeTickboxUIComponent.c:11
SCR_AttributeTickboxUIComponent::OnButtonToggle
void OnButtonToggle()
Definition
SCR_AttributeTickboxUIComponent.c:81
SCR_AttributeTickboxUIComponent::m_sTickBoxImageUntoggled
ResourceName m_sTickBoxImageUntoggled
Definition
SCR_AttributeTickboxUIComponent.c:18
SCR_AttributeTickboxUIComponent::GetOnToggleChanged
ScriptInvokerBool GetOnToggleChanged()
Definition
SCR_AttributeTickboxUIComponent.c:103
SCR_AttributeTickboxUIComponent::m_sTickBoxImageToggled
ResourceName m_sTickBoxImageToggled
Definition
SCR_AttributeTickboxUIComponent.c:15
SCR_AttributeTickboxUIComponent::m_bToggled
bool m_bToggled
Definition
SCR_AttributeTickboxUIComponent.c:30
SCR_AttributeTickboxUIComponent::m_TickBoxImage
ImageWidget m_TickBoxImage
Definition
SCR_AttributeTickboxUIComponent.c:24
SCR_AttributeTickboxUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_AttributeTickboxUIComponent.c:202
SCR_AttributeTickboxUIComponent::m_LinkedOverrideAttributeType
m_LinkedOverrideAttributeType
Definition
SCR_AttributeTickboxUIComponent.c:22
SCR_AttributeTickboxUIComponent::SetVisible
void SetVisible(bool frameVisible, bool buttonVisible)
Definition
SCR_AttributeTickboxUIComponent.c:115
SCR_AttributeTickboxUIComponent::m_fDisabledAlphaColor
float m_fDisabledAlphaColor
Definition
SCR_AttributeTickboxUIComponent.c:27
SCR_AttributeTickboxUIComponent::IsVisibleAndEnabled
bool IsVisibleAndEnabled()
Definition
SCR_AttributeTickboxUIComponent.c:97
SCR_AttributeTickboxUIComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_AttributeTickboxUIComponent.c:185
SCR_AttributeTickboxUIComponent::m_OnToggleChanged
ref ScriptInvokerBool m_OnToggleChanged
Definition
SCR_AttributeTickboxUIComponent.c:34
SCR_AttributeTickboxUIComponent::InitTickbox
void InitTickbox(bool toggleState, SCR_BaseEditorAttributeUIComponent attributeUI, typename linkedOverrideAttributeType=typename.Empty)
Definition
SCR_AttributeTickboxUIComponent.c:152
SCR_AttributeTickboxUIComponent::ToggleTickbox
void ToggleTickbox(bool toggled)
Definition
SCR_AttributeTickboxUIComponent.c:39
SCR_AttributeTickboxUIComponent::SetEnabled
void SetEnabled(bool enabled)
Definition
SCR_AttributeTickboxUIComponent.c:122
SCR_AttributeTickboxUIComponent::GetToggled
bool GetToggled()
Definition
SCR_AttributeTickboxUIComponent.c:89
SCR_AttributeTickboxUIComponent::m_Root
Widget m_Root
Definition
SCR_AttributeTickboxUIComponent.c:23
SCR_BaseEditorAttributeUIComponent
Definition
SCR_BaseEditorAttributeUIComponent.c:4
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::SetBool
void SetBool(bool value)
Definition
SCR_BaseEditorAttributeVar.c:48
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Editor
UI
Components
Attributes
SCR_AttributeTickboxUIComponent.c
Generated by
1.17.0