Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
missionmainmenu.c
Go to the documentation of this file.
1
class
MissionMainMenu
extends
MissionBase
2
{
3
private
UIScriptedMenu
m_mainmenu
;
4
private
CreditsMenu
m_CreditsMenu
;
5
private
ref
DayZIntroScenePC
m_IntroScenePC
;
6
private
ref
DayZIntroSceneXbox
m_IntroSceneXbox
;
7
8
bool
m_NoCutscene
;
9
10
override
void
OnInit
()
11
{
12
if
(!
m_NoCutscene
)
13
{
14
CreateIntroScene
();
15
}
16
17
if
(!
m_mainmenu
)
18
{
19
#ifdef PLATFORM_CONSOLE
20
if
(
g_Game
.GetGameState() != DayZGameState.PARTY )
21
{
22
m_mainmenu
=
UIScriptedMenu
.Cast(
g_Game
.GetUIManager().EnterScriptedMenu(
MENU_TITLE_SCREEN
, null ) );
23
}
24
#else
25
m_mainmenu
=
UIScriptedMenu
.Cast(
g_Game
.GetUIManager().EnterScriptedMenu(
MENU_MAIN
, null ) );
26
#endif
27
}
28
29
GetOnInputDeviceChanged().Insert(
OnInputDeviceChanged
);
30
}
31
32
override
void
Reset
()
33
{
34
#ifdef PLATFORM_CONSOLE
35
delete
m_IntroSceneXbox
;
36
#else
37
delete
m_IntroScenePC
;
38
#endif
39
40
if
(!
m_NoCutscene
)
41
{
42
CreateIntroScene
();
43
}
44
}
45
46
DayZIntroScenePC
GetIntroScenePC
()
47
{
48
#ifdef PLATFORM_CONSOLE
49
Error
(
"missionMainMenu->GetIntroScenePC on PLATFORM_CONSOLE is not implemented!"
);
50
return
null;
51
#else
52
return
m_IntroScenePC
;
53
#endif
54
}
55
56
DayZIntroSceneXbox
GetIntroSceneXbox
()
57
{
58
#ifdef PLATFORM_CONSOLE
59
return
m_IntroSceneXbox
;
60
#else
61
Error
(
"missionMainMenu->GetIntroScenePC on PLATFORM_PC is not implemented!"
);
62
return
null;
63
#endif
64
}
65
66
void
CreateIntroScene
()
67
{
68
#ifdef PLATFORM_CONSOLE
69
m_IntroSceneXbox
=
new
DayZIntroSceneXbox
;
70
#else
71
m_IntroScenePC
=
new
DayZIntroScenePC
;
72
#endif
73
}
74
75
override
void
UpdateInputDevicesAvailability
()
76
{
77
super.UpdateInputDevicesAvailability();
78
79
g_Game
.GetInput().UpdateConnectedInputDeviceList();
80
g_Game
.UpdateInputDeviceDisconnectWarning();
81
}
82
83
override
void
OnMissionStart
()
84
{
85
g_Game
.GetUIManager().ShowUICursor(
true
);
86
g_Game
.SetMissionState(DayZGame.MISSION_STATE_MAINMENU);
87
m_DynamicMusicPlayer.SetCategory(
EDynamicMusicPlayerCategory
.MENU,
true
);
88
89
g_Game
.LoadingHide(
true
);
90
ProgressAsync
.
DestroyAllPendingProgresses
();
91
}
92
93
override
void
OnMissionFinish
()
94
{
95
if
(
m_mainmenu
)
96
m_mainmenu
.Cleanup();
97
g_Game
.GetUIManager().CloseAll();
98
m_mainmenu
= NULL;
99
100
m_IntroScenePC
= null;
101
m_IntroSceneXbox
= null;
102
m_CreditsMenu
= null;
103
#ifndef FEATURE_CURSOR
104
g_Game
.GetUIManager().ShowUICursor(
false
);
105
#endif
106
}
107
108
override
void
OnUpdate
(
float
timeslice)
109
{
110
super.OnUpdate(timeslice);
111
112
#ifdef DIAG_DEVELOPER
113
UpdateInputDeviceDiag();
114
#endif
115
116
if
(
g_Game
.IsLoading() )
117
{
118
return
;
119
}
120
121
if
(
m_IntroScenePC
)
122
{
123
m_IntroScenePC
.Update();
124
}
125
}
126
127
void
OnMenuEnter
(
int
menu_id)
128
{
129
switch
(menu_id)
130
{
131
case
MENU_CREDITS
:
132
{
133
m_CreditsMenu
= CreditsMenu.Cast(
g_Game
.GetUIManager().GetMenu());
134
}
135
}
136
}
137
138
void
OnInputDeviceChanged
(
int
device)
139
{
140
if
(
m_CreditsMenu
)
141
{
142
m_CreditsMenu
.UpdateInfoPanelText(device);
143
}
144
}
145
146
int
SortedInsert
(
array<int>
list,
int
number )
147
{
148
int
find_number = number;
149
int
index_min = 0;
150
int
index_max = list.Count() - 1;
151
int
target_index =
Math
.
Floor
( index_max / 2 );
152
153
if
( index_max == -1 )
154
{
155
list.Insert( number );
156
return
0;
157
}
158
159
while
(
true
)
160
{
161
int
target_value = list[target_index];
162
163
if
( find_number == target_value || ((index_max - index_min) <= 1) )
164
{
165
for
(
int
i = index_min; i <= index_max; i++ )
166
{
167
if
( find_number <= list[i] )
168
{
169
list.InsertAt( find_number, i );
170
return
i;
171
}
172
}
173
174
index_max++;
175
list.InsertAt( find_number, index_max );
176
return
target_index;
177
}
178
else
if
( find_number < target_value )
179
{
180
index_max = target_index;
181
target_index =
Math
.
Floor
( target_index / 2 );
182
}
183
else
if
( find_number > target_value )
184
{
185
index_min = target_index;
186
target_index +=
Math
.
Floor
( (index_max - index_min) / 2 );
187
}
188
}
189
190
return
target_index;
191
}
192
196
private
AbstractWave
m_MenuMusic
;
197
198
void
PlayMusic
()
199
{
200
if
( !
m_MenuMusic
)
201
{
202
SoundParams
soundParams =
new
SoundParams
(
"Music_Menu_SoundSet"
);
203
SoundObjectBuilder
soundBuilder =
new
SoundObjectBuilder
( soundParams );
204
SoundObject
soundObject = soundBuilder.BuildSoundObject();
205
soundObject.
SetKind
(
WaveKind
.WAVEMUSIC );
206
m_MenuMusic
=
g_Game
.GetSoundScene().Play2D(soundObject, soundBuilder);
207
m_MenuMusic
.Loop(
true
);
208
m_MenuMusic
.Play();
209
}
210
}
211
212
void
StopMusic
()
213
{
214
if
(
m_MenuMusic
)
215
m_MenuMusic
.Stop();
216
}
217
218
AbstractWave
GetMenuMusic
()
219
{
220
return
m_MenuMusic
;
221
}
222
}
DayZIntroScenePC
Definition
dayzintroscenepc.c:2
DayZIntroSceneXbox
Definition
dayzintroscenexbox.c:2
Math
Definition
enmath.c:7
MissionBase
Definition
missiongameplay.c:2
MissionBase::OnInit
override void OnInit()
Definition
missionmainmenu.c:10
MissionBase::UpdateInputDevicesAvailability
override void UpdateInputDevicesAvailability()
Definition
missionmainmenu.c:75
MissionBase::OnMissionStart
override void OnMissionStart()
Definition
missionmainmenu.c:83
MissionBase::Reset
override void Reset()
Definition
missionmainmenu.c:32
MissionBase::PlayMusic
void PlayMusic()
Definition
missionmainmenu.c:198
MissionBase::SortedInsert
int SortedInsert(array< int > list, int number)
Definition
missionmainmenu.c:146
MissionBase::GetIntroSceneXbox
DayZIntroSceneXbox GetIntroSceneXbox()
Definition
missionmainmenu.c:56
MissionBase::m_MenuMusic
AbstractWave m_MenuMusic
DEPRECATED.
Definition
missionmainmenu.c:196
MissionBase::m_CreditsMenu
CreditsMenu m_CreditsMenu
Definition
missionmainmenu.c:4
MissionBase::OnInputDeviceChanged
void OnInputDeviceChanged(int device)
Definition
missionmainmenu.c:138
MissionBase::m_mainmenu
UIScriptedMenu m_mainmenu
Definition
missionmainmenu.c:3
MissionBase::OnUpdate
override void OnUpdate(float timeslice)
Definition
missionmainmenu.c:108
MissionBase::OnMenuEnter
void OnMenuEnter(int menu_id)
Definition
missionmainmenu.c:127
MissionBase::m_IntroScenePC
ref DayZIntroScenePC m_IntroScenePC
Definition
missionmainmenu.c:5
MissionBase::GetMenuMusic
AbstractWave GetMenuMusic()
Definition
missionmainmenu.c:218
MissionBase::OnMissionFinish
override void OnMissionFinish()
Definition
missionmainmenu.c:93
MissionBase::m_IntroSceneXbox
ref DayZIntroSceneXbox m_IntroSceneXbox
Definition
missionmainmenu.c:6
MissionBase::GetIntroScenePC
DayZIntroScenePC GetIntroScenePC()
Definition
missionmainmenu.c:46
MissionBase::CreateIntroScene
void CreateIntroScene()
Definition
missionmainmenu.c:66
MissionBase::StopMusic
void StopMusic()
Definition
missionmainmenu.c:212
MissionBase::m_NoCutscene
bool m_NoCutscene
Definition
missionmainmenu.c:8
ProgressAsync
Definition
progressasync.c:2
ProgressAsync::DestroyAllPendingProgresses
static proto native void DestroyAllPendingProgresses()
SoundObject
Definition
sound.c:112
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
EDynamicMusicPlayerCategory
EDynamicMusicPlayerCategory
Definition
edynamicmusicplayercategory.c:2
Error
void Error(string err)
Messagebox with error message.
Definition
endebug.c:90
Math::Floor
static proto float Floor(float f)
Returns floor of value.
MENU_TITLE_SCREEN
const int MENU_TITLE_SCREEN
Definition
constants.c:196
MENU_MAIN
const int MENU_MAIN
Definition
constants.c:182
MENU_CREDITS
const int MENU_CREDITS
Definition
constants.c:205
SoundObject::SetKind
proto native void SetKind(WaveKind kind)
SoundObjectBuilder
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
AbstractWave
void AbstractWave()
Definition
sound.c:167
SoundParams
class SoundObject SoundParams(string name)
WaveKind
WaveKind
Definition
sound.c:2
Games
Dayz
scripts
5_mission
mission
missionmainmenu.c
Generated by
1.17.0