Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
connectiondialogue.c
Go to the documentation of this file.
1
class
ConnectionDialogue
extends
UIScriptedMenu
2
{
3
protected
bool
m_DebugMonitorHidden
;
4
5
protected
MultilineTextWidget
m_Description
;
6
protected
ButtonWidget
m_DisconnectBtn
;
7
#ifdef PLATFORM_CONSOLE
8
protected
RichTextWidget
m_DisconnectBtnLabel;
9
protected
Widget
m_ConsoleToolbar;
10
#endif
11
12
void
ConnectionDialogue
() {}
13
14
void
~ConnectionDialogue
()
15
{
16
#ifdef PLATFORM_CONSOLE
17
if
(
g_Game
.GetMission())
18
{
19
g_Game
.GetMission().GetOnInputDeviceChanged().Remove(
OnInputDeviceChanged
);
20
}
21
#endif
22
}
23
24
override
Widget
Init
()
25
{
26
layoutRoot =
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/day_z_connection_dialogue.layout"
);
27
m_DisconnectBtn
= ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"DCButton"
));
28
#ifdef PLATFORM_CONSOLE
29
m_DisconnectBtnLabel =
RichTextWidget
.Cast(layoutRoot.FindAnyWidget(
"DCButtonLabel"
));
30
m_ConsoleToolbar = layoutRoot.FindAnyWidget(
"ConsoleToolbar"
);
31
#endif
32
33
#ifdef PLATFORM_CONSOLE
34
if
(
g_Game
.GetMission())
35
{
36
g_Game
.GetMission().GetOnInputDeviceChanged().Insert(
OnInputDeviceChanged
);
37
}
38
#endif
39
40
RichTextWidget
toolbar_text =
RichTextWidget
.Cast(layoutRoot.FindAnyWidget(
"ContextToolbarText"
));
41
string
context =
string
.Format(
" %1"
,
InputUtils
.
GetRichtextButtonIconFromInputAction
(
"UAUISelect"
,
"#main_menu_exit"
, EUAINPUT_DEVICE_CONTROLLER,
InputUtils
.
ICON_SCALE_TOOLBAR
));
42
toolbar_text.SetText(context);
43
44
#ifdef PLATFORM_CONSOLE
45
OnInputDeviceChanged
(
g_Game
.GetInput().GetCurrentInputDevice());
46
#endif
47
48
return
layoutRoot;
49
}
50
51
#ifdef PLATFORM_CONSOLE
52
protected
void
OnInputDeviceChanged
(
EInputDeviceType
pInputDeviceType)
53
{
54
switch
(pInputDeviceType)
55
{
56
case
EInputDeviceType
.CONTROLLER:
57
{
58
g_Game
.GetUIManager().ShowUICursor(
false
);
59
m_DisconnectBtnLabel.SetText(
"#main_menu_exit"
);
60
SetFocus
(m_DisconnectBtn);
61
}
62
break
;
63
default
:
64
{
65
if
(
g_Game
.GetInput().IsEnabledMouseAndKeyboard())
66
{
67
g_Game
.GetUIManager().ShowUICursor(
true
);
68
m_DisconnectBtnLabel.SetText(
string
.Format(
" %1"
,InputUtils.GetRichtextButtonIconFromInputAction(
"UAUISelect"
,
"#main_menu_exit"
, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_NORMAL)));
69
SetFocus
(null);
70
}
71
}
72
break
;
73
}
74
75
UpdateControlsElementVisibility
();
76
}
77
78
protected
void
UpdateControlsElementVisibility
()
79
{
80
bool
toolbarShow = !
g_Game
.GetInput().IsEnabledMouseAndKeyboard() ||
g_Game
.GetInput().GetCurrentInputDevice() ==
EInputDeviceType
.CONTROLLER;
81
m_ConsoleToolbar.Show(toolbarShow);
82
}
83
84
override
bool
OnFocus
(
Widget
w,
int
x
,
int
y
)
85
{
86
if
(w == m_DisconnectBtn)
87
{
88
m_DisconnectBtn.SetColor(
ARGB
(255, 255, 0, 0));
89
return
true
;
90
}
91
return
false
;
92
}
93
94
override
bool
OnFocusLost
(
Widget
w,
int
x
,
int
y
)
95
{
96
if
(w == m_DisconnectBtn)
97
{
98
m_DisconnectBtn.SetColor(
ARGB
(0, 0, 0, 0));
99
return
true
;
100
}
101
return
false
;
102
}
103
#endif
104
105
override
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button)
106
{
107
super.OnClick(w,
x
,
y
, button);
108
109
if
(w ==
m_DisconnectBtn
)
110
{
111
CloseDialog
();
112
}
113
114
return
false
;
115
}
116
117
override
bool
OnMouseEnter
(
Widget
w,
int
x
,
int
y
)
118
{
119
if
(w ==
m_DisconnectBtn
)
120
{
121
m_DisconnectBtn
.SetColor(
ARGB
(255, 255, 0, 0));
122
return
true
;
123
}
124
return
false
;
125
}
126
127
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x
,
int
y
)
128
{
129
if
(w ==
m_DisconnectBtn
)
130
{
131
m_DisconnectBtn
.SetColor(
ARGB
(0, 0, 0, 0));
132
return
true
;
133
}
134
return
false
;
135
}
136
137
override
void
OnShow
()
138
{
139
super.OnShow();
140
141
SetFocus
(null);
142
PPERequesterBank.GetRequester(PPERequester_LatencyBlur).Start();
143
MissionGameplay
mission
= MissionGameplay.Cast(
g_Game
.GetMission());
144
if
(
mission
)
145
{
146
mission
.GetHud().ShowHud(
false
);
147
mission
.GetHud().ShowQuickBar(
false
);
148
mission
.AddActiveInputExcludes({
"menu"
});
149
mission
.AddActiveInputRestriction(EInputRestrictors.INVENTORY);
150
GetUApi
().
SupressNextFrame
(
true
);
151
153
if
(
mission
&&
mission
.m_DebugMonitor &&
mission
.m_DebugMonitor.IsVisible())
154
{
155
mission
.m_DebugMonitor.Hide();
156
m_DebugMonitorHidden
=
true
;
157
}
158
}
159
160
if
(
GetDayZGame
())
161
{
162
GetDayZGame
().SetConnectivityStatState(
EConnectivityStatType
.CONN_LOST, EConnectivityStatLevel.LEVEL1);
163
}
164
165
#ifdef PLATFORM_PS4
166
OnlineServices
.
SetMultiplayState
(
false
);
167
#endif
168
}
169
170
override
void
OnHide
()
171
{
172
super.OnHide();
173
174
PPERequesterBank.GetRequester(PPERequester_LatencyBlur).Stop();
175
MissionGameplay
mission
= MissionGameplay.Cast(
g_Game
.GetMission());
176
if
(
mission
)
177
{
178
// make sure certain input restrictions are removed if present
179
mission
.RemoveActiveInputExcludes({
"menu"
},
true
);
180
mission
.RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
181
mission
.GetHud().ShowHud(
true
);
182
mission
.GetHud().ShowQuickBar(
true
);
183
185
if
(
m_DebugMonitorHidden
)
186
{
187
if
(
mission
.m_DebugMonitor)
188
{
189
mission
.m_DebugMonitor.Show();
190
}
191
m_DebugMonitorHidden
=
false
;
192
}
193
}
194
195
if
(
GetDayZGame
())
196
{
197
GetDayZGame
().SetConnectivityStatState(
EConnectivityStatType
.CONN_LOST, EConnectivityStatLevel.OFF);
198
}
199
200
#ifdef PLATFORM_PS4
201
OnlineServices
.
SetMultiplayState
(
true
);
202
#endif
203
}
204
205
override
void
Update
(
float
timeslice)
206
{
207
#ifdef PLATFORM_CONSOLE
208
if
(
GetUApi
().GetInputByID(UAUISelect).LocalValue())
209
{
210
CloseDialog
();
211
return
;
212
}
213
#endif
214
}
215
216
void
CloseDialog
()
217
{
218
if
(
g_Game
)
219
{
220
g_Game
.GetUIManager().CloseMenu(
MENU_CONNECTION_DIALOGUE
);
221
g_Game
.GetCallQueue(
CALL_CATEGORY_SYSTEM
).Call(
g_Game
.DisconnectSessionForce);
222
}
223
}
224
}
InputUtils
Definition
inpututils.c:2
InputUtils::ICON_SCALE_TOOLBAR
static const float ICON_SCALE_TOOLBAR
Definition
inpututils.c:15
InputUtils::GetRichtextButtonIconFromInputAction
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition
inpututils.c:167
OnlineServices
Definition
onlineservices.c:2
OnlineServices::SetMultiplayState
static void SetMultiplayState(bool state)
Definition
onlineservices.c:520
RichTextWidget
Definition
gameplay.c:317
UAInputAPI::SupressNextFrame
proto native void SupressNextFrame(bool bForce)
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
UIScriptedMenu::UpdateControlsElementVisibility
void UpdateControlsElementVisibility()
Definition
controlsxboxnew.c:545
UIScriptedMenu::Update
override void Update(float timeslice)
Definition
connectiondialogue.c:205
UIScriptedMenu::ConnectionDialogue
void ConnectionDialogue()
Definition
connectiondialogue.c:12
UIScriptedMenu::OnShow
override void OnShow()
Definition
connectiondialogue.c:137
UIScriptedMenu::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
connectiondialogue.c:127
UIScriptedMenu::~ConnectionDialogue
void ~ConnectionDialogue()
Definition
connectiondialogue.c:14
UIScriptedMenu::m_DisconnectBtn
ButtonWidget m_DisconnectBtn
Definition
connectiondialogue.c:6
UIScriptedMenu::OnInputDeviceChanged
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition
controlsxboxnew.c:71
UIScriptedMenu::OnHide
override void OnHide()
Definition
connectiondialogue.c:170
UIScriptedMenu::CloseDialog
void CloseDialog()
Definition
connectiondialogue.c:216
UIScriptedMenu::m_Description
MultilineTextWidget m_Description
Definition
connectiondialogue.c:5
UIScriptedMenu::Init
override Widget Init()
Definition
connectiondialogue.c:24
UIScriptedMenu::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
cameratoolsmenu.c:950
UIScriptedMenu::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
connectiondialogue.c:117
UIScriptedMenu::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
cameratoolsmenu.c:940
UIScriptedMenu::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
connectiondialogue.c:105
UIScriptedMenu::m_DebugMonitorHidden
bool m_DebugMonitorHidden
Definition
connectiondialogue.c:3
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
GetDayZGame
DayZGame GetDayZGame()
Definition
dayzgame.c:3944
mission
Mission mission
Definition
displaystatus.c:28
EConnectivityStatType
EConnectivityStatType
Definition
egamestateicons.c:2
MENU_CONNECTION_DIALOGUE
const int MENU_CONNECTION_DIALOGUE
Definition
constants.c:215
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition
tools.c:8
SetFocus
proto native void SetFocus(Widget w)
Widget
WorkspaceWidget Widget
Defined in code.
x
Icon x
y
Icon y
EInputDeviceType
EInputDeviceType
Definition
input.c:3
ARGB
int ARGB(int a, int r, int g, int b)
Definition
proto.c:322
GetUApi
proto native UAInputAPI GetUApi()
Games
Dayz
scripts
5_mission
gui
connectiondialogue.c
Generated by
1.17.0