Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
mainmenu.c
Go to the documentation of this file.
1
class
MainMenu
extends
UIScriptedMenu
2
{
3
protected
ref MainMenuStats
m_Stats
;
4
protected
ref MainMenuVideo
m_Video
;
5
6
protected
MissionMainMenu
m_Mission
;
7
protected
DayZIntroScenePC
m_ScenePC
;
8
9
protected
TextWidget
m_PlayerName
;
10
protected
TextWidget
m_Version
;
11
12
protected
Widget
m_CharacterRotationFrame
;
13
14
protected
Widget
m_Play
;
15
protected
Widget
m_ChooseServer
;
16
protected
Widget
m_CustomizeCharacter
;
17
protected
Widget
m_PlayVideo
;
18
protected
Widget
m_Feedback
;
19
protected
Widget
m_Tutorials
;
20
protected
Widget
m_TutorialButton
;
21
protected
Widget
m_MessageButton
;
22
protected
Widget
m_SettingsButton
;
23
protected
Widget
m_Exit
;
24
protected
Widget
m_NewsMain
;
25
protected
Widget
m_NewsSec1
;
26
protected
Widget
m_NewsSec2
;
27
protected
Widget
m_PrevCharacter
;
28
protected
Widget
m_NextCharacter
;
29
30
protected
Widget
m_LastPlayedTooltip
;
31
protected
Widget
m_LastPlayedTooltipLabel
;
32
protected
TextWidget
m_LastPlayedTooltipName
;
33
protected
TextWidget
m_LastPlayedTooltipIP
;
34
protected
TextWidget
m_LastPlayedTooltipPort
;
35
36
protected
ref WidgetFadeTimer
m_LastPlayedTooltipTimer
;
37
protected
ref
Widget
m_LastFocusedButton
;
38
39
protected
ref
TextWidget
m_ModdedWarning
;
40
protected
ref ModsMenuSimple
m_ModsSimple
;
41
protected
ref ModsMenuDetailed
m_ModsDetailed
;
42
protected
ref ModsMenuTooltip
m_ModsTooltip
;
43
44
protected
Widget
m_DlcFrame
;
45
46
protected
Widget
m_NewsCarouselFrame
;
47
protected
ref
NewsCarousel
m_NewsCarousel
;
48
protected
bool
m_DisplayCarousel
;
49
50
protected
int
m_PrevWidth
,
m_PrevHeight
;
51
protected
int
m_Width
,
m_Height
;
52
53
override
Widget
Init
()
54
{
55
layoutRoot =
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/main_menu.layout"
);
56
57
m_Play
= layoutRoot.FindAnyWidget(
"play"
);
58
m_ChooseServer
= layoutRoot.FindAnyWidget(
"choose_server"
);
59
m_CustomizeCharacter
= layoutRoot.FindAnyWidget(
"customize_character"
);
60
m_PlayVideo
= layoutRoot.FindAnyWidget(
"play_video"
);
61
m_Feedback
= layoutRoot.FindAnyWidget(
"feedback_button"
);
62
m_Tutorials
= layoutRoot.FindAnyWidget(
"tutorials"
);
63
m_TutorialButton
= layoutRoot.FindAnyWidget(
"tutorial_button"
);
64
m_MessageButton
= layoutRoot.FindAnyWidget(
"message_button"
);
65
m_SettingsButton
= layoutRoot.FindAnyWidget(
"settings_button"
);
66
m_Exit
= layoutRoot.FindAnyWidget(
"exit_button"
);
67
m_PrevCharacter
= layoutRoot.FindAnyWidget(
"prev_character"
);
68
m_NextCharacter
= layoutRoot.FindAnyWidget(
"next_character"
);
69
70
m_DlcFrame
= layoutRoot.FindAnyWidget(
"dlc_Frame"
);
71
m_NewsCarouselFrame
= layoutRoot.FindAnyWidget(
"carousel_Frame"
);
72
m_Version
=
TextWidget
.Cast(layoutRoot.FindAnyWidget(
"version"
));
73
m_ModdedWarning
=
TextWidget
.Cast(layoutRoot.FindAnyWidget(
"ModdedWarning"
));
74
m_CharacterRotationFrame
= layoutRoot.FindAnyWidget(
"character_rotation_frame"
);
75
76
m_LastPlayedTooltip
= layoutRoot.FindAnyWidget(
"last_server_info"
);
77
m_LastPlayedTooltip
.Show(
false
);
78
m_LastPlayedTooltipLabel
=
m_LastPlayedTooltip
.FindAnyWidget(
"last_server_info_label"
);
79
m_LastPlayedTooltipName
=
TextWidget
.Cast(
m_LastPlayedTooltip
.FindAnyWidget(
"last_server_info_name"
));
80
m_LastPlayedTooltipIP
=
TextWidget
.Cast(
m_LastPlayedTooltip
.FindAnyWidget(
"last_server_info_ip"
));
81
m_LastPlayedTooltipPort
=
TextWidget
.Cast(
m_LastPlayedTooltip
.FindAnyWidget(
"last_server_info_port"
));
82
83
m_LastPlayedTooltipTimer
=
new
WidgetFadeTimer();
84
85
m_Stats
=
new
MainMenuStats(layoutRoot.FindAnyWidget(
"character_stats_root"
));
86
87
m_Mission
= MissionMainMenu.Cast(
g_Game
.GetMission());
88
89
m_LastFocusedButton
=
m_Play
;
90
91
m_ScenePC
=
m_Mission
.GetIntroScenePC();
92
93
if
(
m_ScenePC
)
94
{
95
m_ScenePC
.ResetIntroCamera();
96
}
97
98
m_PlayVideo
.Show(
false
);
99
100
m_PlayerName
=
TextWidget
.Cast(layoutRoot.FindAnyWidget(
"character_name_text"
));
101
102
// Set Version
103
string
version;
104
g_Game
.GetVersion(version);
105
m_Version
.SetText(
"#main_menu_version"
+
" "
+ version);
106
107
g_Game
.GetUIManager().ScreenFadeOut(0);
108
109
SetFocus
(null);
110
111
Refresh
();
112
113
LoadMods
();
114
115
CheckWidth
();
116
117
#ifndef BUILD_EXPERIMENTAL
118
m_NewsCarousel
=
new
NewsCarousel
(
m_NewsCarouselFrame
,
this
);
119
#else
120
m_NewsCarousel
= null;
121
#endif
122
123
ShowNewsCarousel
(
true
);
124
125
g_Game
.GetMission().GetOnModMenuVisibilityChanged().Insert(
ShowNewsCarousel
);
126
GetDayZGame
().GetBacklit().MainMenu_OnShow();
127
128
g_Game
.SetLoadState(DayZLoadState.MAIN_MENU_CONTROLLER_SELECT);
129
130
return
layoutRoot;
131
}
132
133
void
~MainMenu
()
134
{
135
if
(
g_Game
.GetMission())
136
{
137
g_Game
.GetMission().GetOnModMenuVisibilityChanged().Remove(
ShowNewsCarousel
);
138
}
139
}
140
141
void
ShowNewsCarousel
(
bool
show)
142
{
143
m_NewsCarouselFrame
.Show(show);
144
if
(
m_NewsCarousel
)
145
m_NewsCarousel
.ShowNewsCarousel(show);
146
}
147
148
void
LoadMods
()
149
{
150
if
(
m_ModsSimple
)
151
delete
m_ModsSimple
;
152
if
(
m_ModsDetailed
)
153
delete
m_ModsDetailed
;
154
155
m_ModdedWarning
.Show(
g_Game
.GetModToBeReported());
156
157
MainMenuData
.
LoadMods
();
158
159
array<ref ModInfo>
modArray =
MainMenuData
.
GetAllMods
();
160
FilterDlcsEx
(modArray);
161
162
if
(modArray.Count() > 0)
163
{
164
layoutRoot.FindAnyWidget(
"ModsSimple"
).Show(
true
);
165
m_ModsTooltip
=
new
ModsMenuTooltip(layoutRoot);
166
m_ModsDetailed
=
new
ModsMenuDetailed(modArray, layoutRoot.FindAnyWidget(
"ModsDetailed"
),
m_ModsTooltip
,
this
);
167
m_ModsSimple
=
new
ModsMenuSimple(modArray, layoutRoot.FindAnyWidget(
"ModsSimple"
),
m_ModsDetailed
);
168
}
169
}
170
171
void
FilterDlcsEx
(inout
array<ref ModInfo>
modArray)
172
{
173
ModInfo
info;
174
for
(
int
i = modArray.Count() - 1; i > -1; i--)
175
{
176
info = modArray[i];
177
if
(info.
GetIsDLC
())
178
{
179
modArray.Remove(i);
180
}
181
}
182
}
183
184
override
bool
OnMouseButtonDown
(
Widget
w,
int
x
,
int
y
,
int
button)
185
{
186
if
(w ==
m_CharacterRotationFrame
)
187
{
188
if
(
m_ScenePC
)
189
m_ScenePC
.CharacterRotationStart();
190
return
true
;
191
}
192
193
return
false
;
194
}
195
196
override
bool
OnMouseButtonUp
(
Widget
w,
int
x
,
int
y
,
int
button)
197
{
198
if
(
m_ScenePC
)
199
m_ScenePC
.CharacterRotationStop();
200
return
false
;
201
}
202
203
override
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button)
204
{
205
if
(button ==
MouseState
.LEFT)
206
{
207
if
(w ==
m_Play
)
208
{
209
m_LastFocusedButton
=
m_Play
;
210
Play
();
211
return
true
;
212
}
213
else
if
(w ==
m_ChooseServer
)
214
{
215
m_LastFocusedButton
=
m_ChooseServer
;
216
OpenMenuServerBrowser
();
217
return
true
;
218
}
219
else
if
(w ==
m_CustomizeCharacter
)
220
{
221
OpenMenuCustomizeCharacter
();
222
return
true
;
223
}
224
else
if
(w ==
m_TutorialButton
)
225
{
226
OpenTutorials
();
227
return
true
;
228
}
229
else
if
(w ==
m_MessageButton
)
230
{
231
OpenCredits
();
232
return
true
;
233
}
234
else
if
(w ==
m_SettingsButton
)
235
{
236
OpenSettings
();
237
return
true
;
238
}
239
else
if
(w ==
m_Exit
)
240
{
241
Exit
();
242
return
true
;
243
}
244
else
if
(w ==
m_PrevCharacter
)
245
{
246
PreviousCharacter
();
247
return
true
;
248
}
249
else
if
(w ==
m_NextCharacter
)
250
{
251
NextCharacter
();
252
return
true
;
253
}
254
else
if
(w ==
m_PlayVideo
)
255
{
256
m_LastFocusedButton
=
m_PlayVideo
;
257
PlayVideo
();
258
return
true
;
259
}
260
else
if
(w ==
m_Tutorials
)
261
{
262
m_LastFocusedButton
=
m_Tutorials
;
263
OpenTutorials
();
264
return
true
;
265
}
266
else
if
(w ==
m_Feedback
)
267
{
268
m_LastFocusedButton
=
m_Feedback
;
269
OpenFeedback
();
270
}
271
}
272
return
false
;
273
}
274
275
override
bool
OnMouseEnter
(
Widget
w,
int
x
,
int
y
)
276
{
277
if
(w ==
m_Play
)
278
{
279
string
ip =
""
;
280
string
name
=
""
;
281
int
port = 0;
282
283
if
(
m_ScenePC
&& !
m_ScenePC
.GetIntroCharacter().IsDefaultCharacter())
284
{
285
int
charID =
m_ScenePC
.GetIntroCharacter().GetCharacterID();
286
m_ScenePC
.GetIntroCharacter().GetLastPlayedServer(charID, ip,
name
, port);
287
288
m_LastPlayedTooltipName
.SetText(
"#server_details_name "
+
name
);
289
m_LastPlayedTooltipIP
.SetText(
"#main_menu_IP "
+ ip);
290
m_LastPlayedTooltipPort
.SetText(
"#main_menu_port "
+ port);
291
292
m_LastPlayedTooltipTimer
.FadeIn(
m_LastPlayedTooltip
, 0.3,
true
);
293
}
294
}
295
296
if
(
IsFocusable
(w))
297
{
298
ColorHighlight
(w);
299
return
true
;
300
}
301
return
false
;
302
}
303
304
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x
,
int
y
)
305
{
306
if
(w ==
m_Play
)
307
{
308
m_LastPlayedTooltipTimer
.FadeOut(
m_LastPlayedTooltip
, 0.3,
true
);
309
}
310
311
if
(
IsFocusable
(w))
312
{
313
ColorNormal
(w);
314
return
true
;
315
}
316
return
false
;
317
}
318
319
override
bool
OnFocus
(
Widget
w,
int
x
,
int
y
)
320
{
321
if
(
IsFocusable
(w))
322
{
323
ColorHighlight
(w);
324
return
true
;
325
}
326
return
false
;
327
}
328
329
override
bool
OnFocusLost
(
Widget
w,
int
x
,
int
y
)
330
{
331
if
(
IsFocusable
(w))
332
{
333
ColorNormal
(w);
334
return
true
;
335
}
336
return
false
;
337
}
338
339
bool
IsFocusable
(
Widget
w)
340
{
341
if
(w)
342
{
343
if
(w ==
m_Play
|| w ==
m_ChooseServer
|| w ==
m_CustomizeCharacter
|| w ==
m_TutorialButton
|| w ==
m_MessageButton
|| w ==
m_SettingsButton
)
344
{
345
return
true
;
346
}
347
348
if
(w ==
m_Exit
|| w ==
m_PlayVideo
|| w ==
m_Feedback
)
349
{
350
return
true
;
351
}
352
353
if
(w ==
m_NewsMain
|| w ==
m_NewsSec1
|| w ==
m_NewsSec2
|| w ==
m_PrevCharacter
|| w ==
m_NextCharacter
)
354
{
355
return
true
;
356
}
357
}
358
return
false
;
359
}
360
361
override
void
Refresh
()
362
{
363
string
name
;
364
if
(
m_ScenePC
&&
g_Game
.GetGameState() == DayZGameState.MAIN_MENU)
365
OnChangeCharacter
();
366
367
string
version;
368
g_Game
.GetVersion(version);
369
m_Version
.SetText(
"#main_menu_version"
+
" "
+ version);
370
371
if
(
m_DisplayedDlcHandler
)
372
m_DisplayedDlcHandler
.UpdateAllPromotionInfo();
373
}
374
375
override
void
OnShow
()
376
{
377
if
(
m_DisplayedDlcHandler
)
378
m_DisplayedDlcHandler
.ShowInfoPanel(
true
);
379
380
SetFocus
(null);
381
OnChangeCharacter
(
false
);
382
m_Stats
.UpdateStats();
383
LoadMods
();
384
return
;
385
}
386
387
override
void
OnHide
()
388
{
389
if
(
m_DisplayedDlcHandler
)
390
m_DisplayedDlcHandler
.ShowInfoPanel(
false
);
391
392
GetDayZGame
().GetBacklit().MainMenu_OnHide();
393
}
394
395
override
void
Update
(
float
timeslice)
396
{
397
super.Update(timeslice);
398
399
CheckWidth
();
400
401
if
(
g_Game
&&
GetUApi
().GetInputByID(UAUIBack).LocalPress())
402
{
403
if
(!
g_Game
.GetUIManager().IsDialogHiding())
404
{
405
Exit
();
406
}
407
}
408
409
if
(
m_NewsCarousel
)
410
m_NewsCarousel
.Update(timeslice);
411
}
412
413
void
Play
()
414
{
415
if
(!
g_Game
.IsNewCharacter())
416
{
417
g_Game
.GetCallQueue(
CALL_CATEGORY_GUI
).CallByName(
this
,
"ConnectLastSession"
);
418
}
419
else
420
{
421
g_Game
.GetCallQueue(
CALL_CATEGORY_GUI
).CallByName(
this
,
"ConnectBestServer"
);
422
}
423
}
424
425
bool
CanSaveDefaultCharacter
()
426
{
427
if
(
m_ScenePC
&&
m_ScenePC
.GetIntroCharacter() &&
m_ScenePC
.GetIntroCharacter().GetCharacterID() == -1)
428
{
429
return
true
;
430
}
431
return
false
;
432
}
433
434
void
OpenMenuServerBrowser
()
435
{
436
EnterScriptedMenu(
MENU_SERVER_BROWSER
);
437
}
438
439
void
OpenMenuCustomizeCharacter
()
440
{
441
EnterScriptedMenu(
MENU_CHARACTER
);
442
}
443
444
void
NextCharacter
()
445
{
446
if
(
m_ScenePC
&&
m_ScenePC
.GetIntroCharacter())
447
{
448
int
charID =
m_ScenePC
.GetIntroCharacter().GetNextCharacterID();
449
if
(charID !=
m_ScenePC
.GetIntroCharacter().GetCharacterID())
450
{
451
m_ScenePC
.GetIntroCharacter().SetCharacterID(charID);
452
OnChangeCharacter
();
453
}
454
}
455
}
456
457
void
PreviousCharacter
()
458
{
459
if
(
m_ScenePC
&&
m_ScenePC
.GetIntroCharacter())
460
{
461
int
charID =
m_ScenePC
.GetIntroCharacter().GetPrevCharacterID();
462
if
(charID !=
m_ScenePC
.GetIntroCharacter().GetCharacterID())
463
{
464
m_ScenePC
.GetIntroCharacter().SetCharacterID(charID);
465
OnChangeCharacter
();
466
}
467
}
468
}
469
470
void
OnChangeCharacter
(
bool
create_character =
true
)
471
{
472
if
(
m_ScenePC
&&
m_ScenePC
.GetIntroCharacter())
473
{
474
int
charID =
m_ScenePC
.GetIntroCharacter().GetCharacterID();
475
if
(create_character)
476
{
477
m_ScenePC
.GetIntroCharacter().CreateNewCharacterById(charID);
478
}
479
m_PlayerName
.SetText(
m_ScenePC
.GetIntroCharacter().GetCharacterNameById(charID));
480
481
Widget
w =
m_CustomizeCharacter
.FindAnyWidget(
m_CustomizeCharacter
.GetName() +
"_label"
);
482
483
if
(w)
484
{
485
TextWidget
text =
TextWidget
.Cast(w);
486
487
if
(
m_ScenePC
.GetIntroCharacter().IsDefaultCharacter())
488
{
489
text.SetText(
"#layout_main_menu_customize_char"
);
490
}
491
else
492
{
493
text.SetText(
"#layout_main_menu_rename"
);
494
}
495
}
496
if
(
m_ScenePC
.GetIntroCharacter().GetCharacterObj())
497
{
498
if
(
m_ScenePC
.GetIntroCharacter().GetCharacterObj().IsMale())
499
m_ScenePC
.GetIntroCharacter().SetCharacterGender(
ECharGender
.Male);
500
else
501
m_ScenePC
.GetIntroCharacter().SetCharacterGender(
ECharGender
.Female);
502
}
503
504
//update character stats
505
m_Stats
.UpdateStats();
506
}
507
}
508
509
void
OpenStats
()
510
{
511
512
}
513
514
void
OpenMessages
()
515
{
516
517
}
518
519
void
OpenSettings
()
520
{
521
EnterScriptedMenu(
MENU_OPTIONS
);
522
}
523
524
void
PlayVideo
()
525
{
526
EnterScriptedMenu(
MENU_VIDEO
);
527
}
528
529
protected
void
OpenFeedback
()
530
{
531
g_Game
.OpenURL(
"https://feedback.bistudio.com/project/view/2/"
);
532
}
533
534
void
OpenTutorials
()
535
{
536
EnterScriptedMenu(
MENU_TUTORIAL
);
537
}
538
539
void
OpenCredits
()
540
{
541
EnterScriptedMenu(
MENU_CREDITS
);
542
m_Mission
.OnMenuEnter(
MENU_CREDITS
);
543
}
544
545
void
Exit
()
546
{
547
g_Game
.GetUIManager().ShowDialog(
"#main_menu_exit"
,
"#main_menu_exit_desc"
,
IDC_MAIN_QUIT
, DBT_YESNO, DBB_YES, DMT_QUESTION,
this
);
548
}
549
550
bool
TryConnectLastSession
(out
string
ip, out
int
port)
551
{
552
if
(
g_Game
.GetLastVisitedServer(ip, port))
553
{
554
return
true
;
555
}
556
return
false
;
557
}
558
559
void
AutoConnect
()
560
{
561
OnlineServices
.
AutoConnectToEmptyServer
();
562
}
563
564
void
ConnectLastSession
()
565
{
566
string
ip =
""
;
567
string
name
=
""
;
568
int
port = 0;
569
int
steamQueryPort = 0;
570
571
if
(!
m_ScenePC
.GetIntroCharacter().IsDefaultCharacter())
572
{
573
int
charID =
m_ScenePC
.GetIntroCharacter().GetCharacterID();
574
m_ScenePC
.GetIntroCharacter().GetLastPlayedServerEx(charID, ip,
name
, port, steamQueryPort);
575
}
576
577
if
(ip.
Length
() > 0)
578
{
579
g_Game
.ConnectFromServerBrowserEx(ip, port, steamQueryPort,
""
);
580
}
581
else
582
{
583
OpenMenuServerBrowser
();
584
}
585
}
586
587
void
ConnectBestServer
()
588
{
589
ConnectLastSession
();
590
}
591
592
override
bool
OnModalResult
(
Widget
w,
int
x
,
int
y
,
int
code,
int
result)
593
{
594
if
(code ==
IDC_MAIN_QUIT
)
595
{
596
if
(result == 2)
597
g_Game
.GetCallQueue(
CALL_CATEGORY_GUI
).Call(
g_Game
.RequestExit,
IDC_MAIN_QUIT
);
598
if
(result == 3)
599
ColorNormal
(
GetFocus
());
600
return
true
;
601
}
602
else
if
(code == 555)
603
{
604
if
(result == 2)
605
OpenTutorials
();
606
}
607
return
false
;
608
}
609
610
//Coloring functions (Until WidgetStyles are useful)
611
void
ColorHighlight
(
Widget
w)
612
{
613
if
(!w)
614
return
;
615
616
int
color_pnl =
ARGB
(255, 0, 0, 0);
617
int
color_lbl =
ARGB
(255, 255, 0, 0);
618
int
color_img =
ARGB
(255, 200, 0, 0);
619
620
ButtonSetColor
(w, color_pnl);
621
ButtonSetTextColor
(w, color_lbl);
622
ImagenSetColor
(w, color_img);
623
}
624
625
void
ColorNormal
(
Widget
w)
626
{
627
if
(!w)
628
return
;
629
630
int
color_pnl =
ARGB
(0, 0, 0, 0);
631
int
color_lbl =
ARGB
(255, 255, 255, 255);
632
int
color_img =
ARGB
(255, 255, 255, 255);
633
634
ButtonSetColor
(w, color_pnl);
635
ButtonSetTextColor
(w, color_lbl);
636
ImagenSetColor
(w, color_img);
637
}
638
639
void
ButtonSetText
(
Widget
w,
string
text)
640
{
641
if
(!w)
642
return
;
643
644
TextWidget
label =
TextWidget
.Cast(w.FindWidget(w.GetName() +
"_label"
));
645
646
if
(label)
647
{
648
label.SetText(text);
649
}
650
651
}
652
653
void
ButtonSetColor
(
Widget
w,
int
color)
654
{
655
if
(!w)
656
return
;
657
658
Widget
panel = w.FindWidget(w.GetName() +
"_panel"
);
659
660
if
(panel)
661
{
662
panel.SetColor(color);
663
}
664
}
665
666
void
ImagenSetColor
(
Widget
w,
int
color)
667
{
668
if
(!w)
669
return
;
670
671
Widget
panel = w.FindWidget(w.GetName() +
"_image"
);
672
673
if
(panel)
674
{
675
panel.SetColor(color);
676
}
677
}
678
679
void
ButtonSetTextColor
(
Widget
w,
int
color)
680
{
681
if
(!w)
682
return
;
683
684
TextWidget
label =
TextWidget
.Cast(w.FindAnyWidget(w.GetName() +
"_label"
));
685
TextWidget
text =
TextWidget
.Cast(w.FindAnyWidget(w.GetName() +
"_text"
));
686
TextWidget
text2 =
TextWidget
.Cast(w.FindAnyWidget(w.GetName() +
"_text_1"
));
687
688
if
(label)
689
{
690
label.SetColor(color);
691
}
692
693
if
(text)
694
{
695
text.SetColor(color);
696
}
697
698
if
(text2)
699
{
700
text2.SetColor(color);
701
}
702
}
703
704
void
CheckWidth
()
705
{
706
int
w, h;
707
ScreenWidthType
widthType;
708
GetScreenSize
(w, h);
709
710
if
(h > 0)
711
{
712
float
ratio = w / h;
713
if
(ratio > 1.75)
714
widthType =
ScreenWidthType
.WIDE;
715
else
if
(ratio > 1.5)
716
widthType =
ScreenWidthType
.MEDIUM;
717
else
718
widthType =
ScreenWidthType
.NARROW;
719
}
720
721
m_Width
= w;
722
m_Height
= h;
723
724
if
(
m_PrevWidth
!=
m_Width
||
m_PrevHeight
!=
m_Height
)
725
{
727
if
(
m_NewsCarousel
)
728
{
729
m_NewsCarousel
.Destroy();
730
m_NewsCarousel
= null;
731
m_NewsCarousel
=
new
NewsCarousel
(
m_NewsCarouselFrame
,
this
);
732
}
733
734
m_PrevWidth
= w;
735
m_PrevHeight
= h;
736
}
737
}
738
740
protected
ref
array<ref MainMenuDlcHandlerBase>
m_DlcHandlers
;
741
protected
ref MainMenuDlcHandlerBase
m_DisplayedDlcHandler
;
742
protected
ref
map<string, ref ModInfo>
m_AllDlcsMap
;
743
protected
ref
JsonDataDLCList
m_DlcData
;
744
745
[
Obsolete
(
"No replacement"
)]
746
void
PopulateDlcFrame
()
747
{
748
if
(!
m_DlcHandlers
)
749
m_DlcHandlers
=
new
array<ref MainMenuDlcHandlerBase>
();
750
751
m_DlcData
=
DlcDataLoader
.
GetData
();
752
int
count =
m_DlcData
.DLCs.Count();
753
JsonDataDLCInfo
data;
754
ModInfo
info;
755
756
for
(
int
i = 0; i < count; i++)
757
{
758
data =
m_DlcData
.DLCs[i];
759
info =
m_AllDlcsMap
.Get(data.
Name
);
760
MainMenuDlcHandlerBase handler =
new
MainMenuDlcHandlerBase(info,
m_DlcFrame
, data);
761
762
handler.ShowInfoPanel(
true
);
763
m_DisplayedDlcHandler
= handler;
//TODO: carousel will take care of this later
764
765
m_DlcHandlers
.Insert(handler);
766
}
767
}
768
769
[
Obsolete
(
"No replacement"
)]
770
void
ShowDlcFrame
(
bool
show)
771
{
772
m_DlcFrame
.Show(show);
773
if
(
m_DisplayedDlcHandler
)
774
m_DisplayedDlcHandler
.ShowInfoPanel(show);
775
}
776
777
[
Obsolete
(
"No replacement"
)]
778
void
FilterDlcs
(inout
array<ref ModInfo>
modArray)
779
{
780
if
(!
m_AllDlcsMap
)
781
m_AllDlcsMap
=
new
map<string,ref ModInfo>
();
782
m_AllDlcsMap
.Clear();
783
784
int
count = modArray.Count();
785
ModInfo
info;
786
for
(
int
i = count - 1; i > -1; i--)
787
{
788
info = modArray[i];
789
if
(info.
GetIsDLC
())
790
{
791
m_AllDlcsMap
.Set(info.
GetName
(),info);
792
modArray.Remove(i);
793
}
794
}
795
}
796
}
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZIntroScenePC
Definition
dayzintroscenepc.c:2
DlcDataLoader
Definition
dlcdataloader.c:2
DlcDataLoader::GetData
static JsonDataDLCList GetData()
Definition
dlcdataloader.c:5
JsonDataDLCInfo
Definition
jsondatadlcinfo.c:7
JsonDataDLCInfo::Name
string Name
Definition
jsondatadlcinfo.c:8
JsonDataDLCList
Definition
jsondatadlcinfo.c:2
MainMenuData
Definition
mainmenudata.c:2
MainMenuData::GetAllMods
static array< ref ModInfo > GetAllMods()
All mods including DLCs.
Definition
mainmenudata.c:138
MainMenuData::LoadMods
static void LoadMods()
Definition
mainmenudata.c:29
ModInfo
Definition
modinfo.c:2
ModInfo::GetName
proto owned string GetName()
ModInfo::GetIsDLC
proto bool GetIsDLC()
OnlineServices
Definition
onlineservices.c:2
OnlineServices::AutoConnectToEmptyServer
static void AutoConnectToEmptyServer()
Definition
onlineservices.c:626
TextWidget
Definition
enwidgets.c:220
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
UIScriptedMenu::m_PrevCharacter
Widget m_PrevCharacter
Definition
mainmenu.c:27
UIScriptedMenu::TryConnectLastSession
bool TryConnectLastSession(out string ip, out int port)
Definition
mainmenu.c:550
UIScriptedMenu::m_Stats
ref MainMenuStats m_Stats
Definition
mainmenu.c:3
UIScriptedMenu::FilterDlcsEx
void FilterDlcsEx(inout array< ref ModInfo > modArray)
Definition
mainmenu.c:171
UIScriptedMenu::Play
void Play()
Definition
cameratoolsmenu.c:448
UIScriptedMenu::ButtonSetText
void ButtonSetText(Widget w, string text)
Definition
mainmenu.c:639
UIScriptedMenu::FilterDlcs
void FilterDlcs(inout array< ref ModInfo > modArray)
Definition
mainmenu.c:778
UIScriptedMenu::Exit
void Exit()
Definition
logoutmenu.c:184
UIScriptedMenu::m_Exit
Widget m_Exit
Definition
mainmenu.c:23
UIScriptedMenu::m_ModsSimple
ref ModsMenuSimple m_ModsSimple
Definition
mainmenu.c:40
UIScriptedMenu::Update
override void Update(float timeslice)
Definition
mainmenu.c:395
UIScriptedMenu::m_LastFocusedButton
ref Widget m_LastFocusedButton
Definition
mainmenu.c:37
UIScriptedMenu::CanSaveDefaultCharacter
bool CanSaveDefaultCharacter()
Definition
mainmenu.c:425
UIScriptedMenu::m_ModsDetailed
ref ModsMenuDetailed m_ModsDetailed
Definition
mainmenu.c:41
UIScriptedMenu::OpenStats
void OpenStats()
Definition
mainmenu.c:509
UIScriptedMenu::OpenMenuServerBrowser
void OpenMenuServerBrowser()
Definition
mainmenu.c:434
UIScriptedMenu::m_Tutorials
Widget m_Tutorials
Definition
mainmenu.c:19
UIScriptedMenu::m_NewsSec1
Widget m_NewsSec1
Definition
mainmenu.c:25
UIScriptedMenu::Refresh
override void Refresh()
Definition
chatinputmenu.c:70
UIScriptedMenu::m_LastPlayedTooltip
Widget m_LastPlayedTooltip
Definition
mainmenu.c:30
UIScriptedMenu::m_MessageButton
Widget m_MessageButton
Definition
mainmenu.c:21
UIScriptedMenu::OnChangeCharacter
void OnChangeCharacter(bool create_character=true)
Definition
mainmenu.c:470
UIScriptedMenu::m_DlcData
ref JsonDataDLCList m_DlcData
DEPRICATED.
Definition
mainmenu.c:743
UIScriptedMenu::m_Video
ref MainMenuVideo m_Video
Definition
mainmenu.c:4
UIScriptedMenu::CheckWidth
void CheckWidth()
Definition
mainmenu.c:704
UIScriptedMenu::m_Play
ButtonWidget m_Play
Definition
cameratoolsmenu.c:41
UIScriptedMenu::m_PlayVideo
Widget m_PlayVideo
Definition
mainmenu.c:17
UIScriptedMenu::OnShow
override void OnShow()
Definition
mainmenu.c:375
UIScriptedMenu::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
mainmenu.c:304
UIScriptedMenu::m_Width
int m_Width
Definition
mainmenu.c:51
UIScriptedMenu::ConnectLastSession
void ConnectLastSession()
Definition
mainmenu.c:564
UIScriptedMenu::m_NewsCarouselFrame
Widget m_NewsCarouselFrame
Definition
mainmenu.c:46
UIScriptedMenu::ButtonSetColor
void ButtonSetColor(Widget w, int color)
Definition
controlsxboxnew.c:497
UIScriptedMenu::m_NextCharacter
Widget m_NextCharacter
Definition
mainmenu.c:28
UIScriptedMenu::m_LastPlayedTooltipIP
TextWidget m_LastPlayedTooltipIP
Definition
mainmenu.c:33
UIScriptedMenu::m_DisplayedDlcHandler
ref MainMenuDlcHandlerBase m_DisplayedDlcHandler
Definition
mainmenu.c:741
UIScriptedMenu::m_SettingsButton
Widget m_SettingsButton
Definition
mainmenu.c:22
UIScriptedMenu::m_LastPlayedTooltipTimer
ref WidgetFadeTimer m_LastPlayedTooltipTimer
Definition
mainmenu.c:36
UIScriptedMenu::m_DlcHandlers
ref array< ref MainMenuDlcHandlerBase > m_DlcHandlers
DEPRICATED.
Definition
mainmenu.c:740
UIScriptedMenu::OpenFeedback
void OpenFeedback()
Definition
ingamemenu.c:422
UIScriptedMenu::OpenSettings
void OpenSettings()
Definition
mainmenu.c:519
UIScriptedMenu::ShowDlcFrame
void ShowDlcFrame(bool show)
Definition
mainmenu.c:770
UIScriptedMenu::PreviousCharacter
void PreviousCharacter()
Definition
mainmenu.c:457
UIScriptedMenu::m_CharacterRotationFrame
Widget m_CharacterRotationFrame
Definition
charactercreationmenu.c:13
UIScriptedMenu::m_Version
TextWidget m_Version
Definition
ingamemenuxbox.c:36
UIScriptedMenu::m_PrevWidth
int m_PrevWidth
Definition
mainmenu.c:50
UIScriptedMenu::ButtonSetTextColor
void ButtonSetTextColor(Widget w, int color)
Definition
controlsxboxnew.c:510
UIScriptedMenu::m_Feedback
Widget m_Feedback
Definition
mainmenu.c:18
UIScriptedMenu::m_AllDlcsMap
ref map< string, ref ModInfo > m_AllDlcsMap
Definition
mainmenu.c:742
UIScriptedMenu::m_NewsSec2
Widget m_NewsSec2
Definition
mainmenu.c:26
UIScriptedMenu::m_DisplayCarousel
bool m_DisplayCarousel
Definition
mainmenu.c:48
UIScriptedMenu::LoadMods
void LoadMods()
Definition
mainmenu.c:148
UIScriptedMenu::OpenTutorials
void OpenTutorials()
Definition
mainmenu.c:534
UIScriptedMenu::ColorNormal
void ColorNormal(Widget w)
Definition
controlsxboxnew.c:471
UIScriptedMenu::OnHide
override void OnHide()
Definition
mainmenu.c:387
UIScriptedMenu::~MainMenu
void ~MainMenu()
Definition
mainmenu.c:133
UIScriptedMenu::m_NewsCarousel
ref NewsCarousel m_NewsCarousel
Definition
mainmenu.c:47
UIScriptedMenu::OpenMenuCustomizeCharacter
void OpenMenuCustomizeCharacter()
Definition
mainmenu.c:439
UIScriptedMenu::AutoConnect
void AutoConnect()
Definition
mainmenu.c:559
UIScriptedMenu::m_LastPlayedTooltipLabel
Widget m_LastPlayedTooltipLabel
Definition
mainmenu.c:31
UIScriptedMenu::ConnectBestServer
void ConnectBestServer()
Definition
mainmenu.c:587
UIScriptedMenu::m_ModdedWarning
ref TextWidget m_ModdedWarning
Definition
ingamemenu.c:20
UIScriptedMenu::OpenMessages
void OpenMessages()
Definition
mainmenu.c:514
UIScriptedMenu::m_NewsMain
Widget m_NewsMain
Definition
mainmenu.c:24
UIScriptedMenu::Init
override Widget Init()
Definition
mainmenu.c:53
UIScriptedMenu::OnModalResult
override bool OnModalResult(Widget w, int x, int y, int code, int result)
Definition
mainmenu.c:592
UIScriptedMenu::m_ModsTooltip
ref ModsMenuTooltip m_ModsTooltip
Definition
mainmenu.c:42
UIScriptedMenu::m_Height
int m_Height
Definition
mainmenu.c:51
UIScriptedMenu::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
mainmenu.c:329
UIScriptedMenu::m_LastPlayedTooltipPort
TextWidget m_LastPlayedTooltipPort
Definition
mainmenu.c:34
UIScriptedMenu::m_ChooseServer
Widget m_ChooseServer
Definition
mainmenu.c:15
UIScriptedMenu::IsFocusable
bool IsFocusable(Widget w)
Definition
cameratoolsmenu.c:960
UIScriptedMenu::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
mainmenu.c:275
UIScriptedMenu::OnMouseButtonDown
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
Definition
mainmenu.c:184
UIScriptedMenu::m_PrevHeight
int m_PrevHeight
Definition
mainmenu.c:50
UIScriptedMenu::ImagenSetColor
void ImagenSetColor(Widget w, int color)
Definition
mainmenu.c:666
UIScriptedMenu::m_PlayerName
TextWidget m_PlayerName
Definition
mainmenu.c:9
UIScriptedMenu::ColorHighlight
void ColorHighlight(Widget w)
Definition
controlsxboxnew.c:454
UIScriptedMenu::ShowNewsCarousel
void ShowNewsCarousel(bool show)
Definition
mainmenu.c:141
UIScriptedMenu::PlayVideo
void PlayVideo()
Definition
mainmenu.c:524
UIScriptedMenu::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
mainmenu.c:319
UIScriptedMenu::m_Mission
MissionMainMenu m_Mission
Definition
mainmenu.c:6
UIScriptedMenu::OpenCredits
void OpenCredits()
Definition
mainmenu.c:539
UIScriptedMenu::NextCharacter
void NextCharacter()
Definition
mainmenu.c:444
UIScriptedMenu::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
mainmenu.c:203
UIScriptedMenu::OnMouseButtonUp
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
Definition
mainmenu.c:196
UIScriptedMenu::m_TutorialButton
Widget m_TutorialButton
Definition
mainmenu.c:20
UIScriptedMenu::m_DlcFrame
Widget m_DlcFrame
Definition
mainmenu.c:44
UIScriptedMenu::m_ScenePC
DayZIntroScenePC m_ScenePC
Definition
mainmenu.c:7
UIScriptedMenu::m_CustomizeCharacter
Widget m_CustomizeCharacter
Definition
mainmenu.c:16
UIScriptedMenu::PopulateDlcFrame
void PopulateDlcFrame()
Definition
mainmenu.c:746
UIScriptedMenu::m_LastPlayedTooltipName
TextWidget m_LastPlayedTooltipName
Definition
mainmenu.c:32
Widget
Definition
enwidgets.c:190
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
map
Definition
cachedequipmentstorage.c:4
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
GetDayZGame
DayZGame GetDayZGame()
Definition
dayzgame.c:3944
ECharGender
ECharGender
Definition
echargender.c:2
Obsolete
void Obsolete(string msg="")
Definition
enscript.c:371
MENU_TUTORIAL
const int MENU_TUTORIAL
Definition
constants.c:204
MENU_SERVER_BROWSER
const int MENU_SERVER_BROWSER
Definition
constants.c:200
MENU_OPTIONS
const int MENU_OPTIONS
Definition
constants.c:183
MENU_CREDITS
const int MENU_CREDITS
Definition
constants.c:205
MENU_CHARACTER
const int MENU_CHARACTER
Definition
constants.c:174
MENU_VIDEO
const int MENU_VIDEO
Definition
constants.c:202
MouseState
MouseState
Definition
ensystem.c:311
GetScreenSize
proto void GetScreenSize(out int x, out int y)
string::Length
proto native int Length()
Returns length of string.
CALL_CATEGORY_GUI
const int CALL_CATEGORY_GUI
Definition
tools.c:9
IDC_MAIN_QUIT
const int IDC_MAIN_QUIT
Definition
constants.c:144
GetFocus
proto native Widget GetFocus()
SetFocus
proto native void SetFocus(Widget w)
x
Icon x
y
Icon y
ScreenWidthType
ScreenWidthType
Definition
inventorymenu.c:2
NewsCarousel
void NewsCarousel(Widget parent, UIScriptedMenu mainMenu)
Definition
newscarousel.c:47
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
newui
mainmenu
mainmenu.c
Generated by
1.17.0