Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
DialogUI.c
Go to the documentation of this file.
1
class
DialogUI
:
ChimeraMenuBase
2
{
3
protected
SCR_DialogDataComponent
m_DialogData
;
4
5
protected
Widget
m_wCancelButton
;
6
protected
Widget
m_wConfirmButton
;
7
protected
SCR_InputButtonComponent
m_Cancel
;
8
protected
SCR_InputButtonComponent
m_Confirm
;
9
10
protected
ImageWidget
m_wImgTopLine
;
11
protected
ImageWidget
m_wImgTitleIcon
;
12
13
protected
TextWidget
m_wTitle
;
14
protected
TextWidget
m_wContent
;
15
ref
ScriptInvoker
m_OnConfirm
=
new
ScriptInvoker
();
16
ref
ScriptInvoker
m_OnCancel
=
new
ScriptInvoker
();
17
protected
float
m_fAnimationRate
=
UIConstants
.FADE_RATE_FAST;
18
19
protected
EDialogType
m_iDialogType
;
20
21
protected
SCR_DynamicFooterComponent
m_DynamicFooter
;
22
23
//------------------------------------------------------------------------------------------------
24
override
void
OnMenuOpen
()
25
{
26
super.OnMenuOpen();
27
28
Widget
w =
GetRootWidget
();
29
30
// Cancel button
31
m_wCancelButton
= w.FindAnyWidget(
"Cancel"
);
32
if
(
m_wCancelButton
)
33
{
34
m_Cancel
=
SCR_InputButtonComponent
.
FindComponent
(
m_wCancelButton
);
35
if
(
m_Cancel
)
36
m_Cancel
.m_OnActivated.Insert(
OnCancel
);
37
}
38
39
// Confirm button
40
m_wConfirmButton
= w.FindAnyWidget(
"Confirm"
);
41
if
(
m_wConfirmButton
)
42
{
43
m_Confirm
=
SCR_InputButtonComponent
.
FindComponent
(
m_wConfirmButton
);
44
if
(
m_Confirm
)
45
m_Confirm
.m_OnActivated.Insert(
OnConfirm
);
46
}
47
48
// Images
49
m_wImgTopLine
=
ImageWidget
.Cast(w.FindAnyWidget(
"Separator"
));
50
m_wImgTitleIcon
=
ImageWidget
.Cast(w.FindAnyWidget(
"ImgTitleIcon"
));
51
52
// Texts
53
m_wTitle
=
TextWidget
.Cast(w.FindAnyWidget(
"Title"
));
54
m_wContent
=
TextWidget
.Cast(w.FindAnyWidget(
"Message"
));
55
56
// Find dialog component
57
m_DialogData
=
SCR_DialogDataComponent
.Cast( w.FindHandler(
SCR_DialogDataComponent
));
58
59
// Set dialog type
60
if
(
m_DialogData
)
61
SetDialogType
(
m_DialogData
.m_iDialogType);
62
63
SCR_MenuHelper
.
OnDialogOpen
(
this
);
64
}
65
66
//------------------------------------------------------------------------------------------------
67
override
void
OnMenuInit
()
68
{
69
super.OnMenuInit();
70
71
m_DynamicFooter
=
SCR_DynamicFooterComponent
.FindComponentInHierarchy(
GetRootWidget
());
72
}
73
74
//------------------------------------------------------------------------------------------------
75
override
void
OnMenuClose
()
76
{
77
super.OnMenuClose();
78
SCR_MenuHelper
.
OnDialogClose
(
this
);
79
}
80
81
//------------------------------------------------------------------------------------------------
82
override
void
OnMenuUpdate
(
float
tDelta)
83
{
84
super.OnMenuUpdate(tDelta);
85
86
GetGame
().GetInputManager().ActivateContext(
"DialogContext"
);
87
}
88
89
//------------------------------------------------------------------------------------------------
90
protected
void
OnConfirm
()
91
{
92
m_OnConfirm
.Invoke();
93
//CloseAnimated();
94
Close
();
95
}
96
97
//------------------------------------------------------------------------------------------------
98
protected
void
OnCancel
()
99
{
100
m_OnCancel
.Invoke();
101
Close
();
102
}
103
104
105
//------------------------------------------------------------------------------------------------
107
protected
void
SetDialogType
(
EDialogType
type
)
108
{
109
m_iDialogType
=
type
;
110
111
// Check widgets
112
if
(!
m_wImgTopLine
|| !
m_wImgTitleIcon
)
113
return
;
114
115
// Select color
116
Color
color =
Color
.FromInt(
Color
.WHITE);
117
118
switch
(
m_iDialogType
)
119
{
120
case
EDialogType
.ACTION:
121
color =
Color
.FromInt(
UIColors
.CONTRAST_CLICKED_HOVERED.PackToInt());
122
break
;
123
124
case
EDialogType
.WARNING:
125
color =
Color
.FromInt(
UIColors
.WARNING.PackToInt());
126
break
;
127
128
case
EDialogType
.POSITIVE:
129
color =
Color
.FromInt(
UIColors
.CONFIRM.PackToInt());
130
break
;
131
132
case
EDialogType
.ONLINE:
133
color =
Color
.FromInt(
UIColors
.ONLINE.PackToInt());
134
break
;
135
}
136
137
// Set colors
138
m_wImgTopLine
.SetColor(color);
139
m_wImgTitleIcon
.SetColor(color);
140
}
141
142
//------------------------------------------------------------------------------------------------
143
void
SetTitle
(
string
text)
144
{
145
if
(
m_wTitle
)
146
m_wTitle
.SetText(text);
147
}
148
149
//------------------------------------------------------------------------------------------------
150
string
GetTitle
()
151
{
152
if
(!
m_wTitle
)
153
return
string
.Empty;
154
155
return
m_wTitle
.GetText();
156
}
157
158
//------------------------------------------------------------------------------------------------
159
void
SetMessage
(
string
text)
160
{
161
if
(
m_wContent
)
162
m_wContent
.SetText(text);
163
}
164
165
//------------------------------------------------------------------------------------------------
166
string
GetMessage
()
167
{
168
if
(!
m_wContent
)
169
return
string
.Empty;
170
171
return
m_wContent
.GetText();
172
}
173
174
//------------------------------------------------------------------------------------------------
175
void
SetConfirmText
(
string
text)
176
{
177
if
(
m_Confirm
)
178
m_Confirm
.SetLabel(text);
179
}
180
181
//------------------------------------------------------------------------------------------------
182
void
SetCancelText
(
string
text)
183
{
184
if
(
m_Cancel
)
185
m_Cancel
.SetLabel(text);
186
}
187
188
//------------------------------------------------------------------------------------------------
189
void
SetType
(
EDialogType
type
)
190
{
191
m_iDialogType
=
type
;
192
}
193
194
//------------------------------------------------------------------------------------------------
196
void
SetTitleIcon
(
ResourceName
image,
string
imageName)
197
{
198
if
(!
m_wImgTitleIcon
)
199
return
;
200
201
// Set image by input
202
if
(image.EndsWith(
"imageset"
))
203
m_wImgTitleIcon
.LoadImageFromSet(0, image, imageName);
204
else
205
m_wImgTitleIcon
.LoadImageTexture(0, image);
206
}
207
208
//------------------------------------------------------------------------------------------------
210
void
SetTitleIcon
(
string
imageName)
211
{
212
if
(!
m_DialogData
)
213
return
;
214
215
m_wImgTitleIcon
.LoadImageFromSet(0,
m_DialogData
.m_sIconSet, imageName);
216
}
217
218
//------------------------------------------------------------------------------------------------
220
void
CloseAnimated
()
221
{
222
AnimateWidget
.
Opacity
(
GetRootWidget
(), 0,
m_fAnimationRate
);
223
int
delay;
224
if
(
m_fAnimationRate
> 0)
225
delay = 1 /
m_fAnimationRate
* 1000;
226
GetGame
().GetCallqueue().CallLater(Close, delay);
227
}
228
229
//------------------------------------------------------------------------------------------------
230
SCR_DynamicFooterComponent
GetFooterComponent
()
231
{
232
return
m_DynamicFooter
;
233
}
234
};
235
236
enum
EDialogType
237
{
238
MESSAGE
,
239
ACTION
,
240
WARNING
,
241
POSITIVE
,
242
ONLINE
243
};
EDialogType
EDialogType
Definition
DialogUI.c:237
MESSAGE
@ MESSAGE
Definition
DialogUI.c:238
POSITIVE
@ POSITIVE
Definition
ENotificationColor.c:8
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ACTION
@ ACTION
Definition
SCR_AIDebugMessage.c:8
type
EDamageType type
Definition
SCR_DestructibleTreeV2.c:32
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
ONLINE
enum SCR_EServicePointType ONLINE
Close
proto native void Close()
Definition
SCR_WorkshopDialogs.c:77
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::Opacity
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
Definition
AnimateWidget.c:167
ChimeraMenuBase
Constant variables used in various menus.
Definition
ChimeraMenuBase.c:72
Color
Definition
Color.c:13
DialogUI
Definition
DialogUI.c:2
DialogUI::m_wCancelButton
Widget m_wCancelButton
Definition
DialogUI.c:5
DialogUI::OnMenuClose
override void OnMenuClose()
Definition
DialogUI.c:75
DialogUI::SetMessage
void SetMessage(string text)
Definition
DialogUI.c:159
DialogUI::GetFooterComponent
SCR_DynamicFooterComponent GetFooterComponent()
Definition
DialogUI.c:230
DialogUI::SetTitleIcon
void SetTitleIcon(string imageName)
Set title icon by image name from image set in dialog data.
Definition
DialogUI.c:210
DialogUI::m_wImgTopLine
ImageWidget m_wImgTopLine
Definition
DialogUI.c:10
DialogUI::CloseAnimated
void CloseAnimated()
animates dialog closure
Definition
DialogUI.c:220
DialogUI::OnMenuUpdate
override void OnMenuUpdate(float tDelta)
Definition
DialogUI.c:82
DialogUI::m_OnConfirm
ref ScriptInvoker m_OnConfirm
Definition
DialogUI.c:15
DialogUI::m_wImgTitleIcon
ImageWidget m_wImgTitleIcon
Definition
DialogUI.c:11
DialogUI::SetTitle
void SetTitle(string text)
Definition
DialogUI.c:143
DialogUI::m_Cancel
SCR_InputButtonComponent m_Cancel
Definition
DialogUI.c:7
DialogUI::m_DialogData
SCR_DialogDataComponent m_DialogData
Definition
DialogUI.c:3
DialogUI::m_OnCancel
ref ScriptInvoker m_OnCancel
Definition
DialogUI.c:16
DialogUI::m_wConfirmButton
Widget m_wConfirmButton
Definition
DialogUI.c:6
DialogUI::m_DynamicFooter
SCR_DynamicFooterComponent m_DynamicFooter
Definition
DialogUI.c:21
DialogUI::GetTitle
string GetTitle()
Definition
DialogUI.c:150
DialogUI::SetCancelText
void SetCancelText(string text)
Definition
DialogUI.c:182
DialogUI::m_fAnimationRate
float m_fAnimationRate
Definition
DialogUI.c:17
DialogUI::OnConfirm
void OnConfirm()
Definition
DialogUI.c:90
DialogUI::SetTitleIcon
void SetTitleIcon(ResourceName image, string imageName)
Set title icons with custom image.
Definition
DialogUI.c:196
DialogUI::m_iDialogType
EDialogType m_iDialogType
Definition
DialogUI.c:19
DialogUI::OnMenuInit
override void OnMenuInit()
Definition
DialogUI.c:67
DialogUI::OnMenuOpen
override void OnMenuOpen()
Definition
DialogUI.c:24
DialogUI::m_Confirm
SCR_InputButtonComponent m_Confirm
Definition
DialogUI.c:8
DialogUI::OnCancel
void OnCancel()
Definition
DialogUI.c:98
DialogUI::SetConfirmText
void SetConfirmText(string text)
Definition
DialogUI.c:175
DialogUI::m_wContent
TextWidget m_wContent
Definition
DialogUI.c:14
DialogUI::m_wTitle
TextWidget m_wTitle
Definition
DialogUI.c:13
DialogUI::SetDialogType
void SetDialogType(EDialogType type)
Set color based on dialog type.
Definition
DialogUI.c:107
DialogUI::GetMessage
string GetMessage()
Definition
DialogUI.c:166
DialogUI::SetType
void SetType(EDialogType type)
Definition
DialogUI.c:189
ImageWidget
Definition
ImageWidget.c:13
ResourceName
Definition
ResourceName.c:13
SCR_DialogDataComponent
Definition
SCR_MenuDialogComponent.c:7
SCR_DynamicFooterComponent
Definition
SCR_DynamicFooterComponent.c:8
SCR_InputButtonComponent
Definition
SCR_InputButtonComponent.c:2
SCR_InputButtonComponent::FindComponent
static SCR_InputButtonComponent FindComponent(notnull Widget w)
Definition
SCR_InputButtonComponent.c:1078
SCR_MenuHelper
Definition
SCR_MenuHelper.c:19
SCR_MenuHelper::OnDialogClose
static void OnDialogClose(DialogUI dialog)
Called by DialogUI.
Definition
SCR_MenuHelper.c:167
SCR_MenuHelper::OnDialogOpen
static void OnDialogOpen(DialogUI dialog)
Definition
SCR_MenuHelper.c:159
TextWidget
Definition
TextWidget.c:16
UIColors
Definition
Constants.c:17
UIConstants
Definition
Constants.c:151
Widget
Definition
Widget.c:13
WARNING
@ WARNING
Definition
LogLevel.c:19
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
UI
Menu
DialogUI.c
Generated by
1.17.0