DayZ 1.24
Loading...
Searching...
No Matches
missionMainMenu.c
Go to the documentation of this file.
2{
9
10 override void OnInit()
11 {
12 if (!m_NoCutscene)
13 CreateIntroScene();
14
15 if (!m_mainmenu)
16 {
17#ifdef PLATFORM_CONSOLE
18 if (g_Game.GetGameState() != DayZGameState.PARTY)
19 m_mainmenu = UIScriptedMenu.Cast(g_Game.GetUIManager().EnterScriptedMenu(MENU_TITLE_SCREEN, null));
20#else
21 m_mainmenu = UIScriptedMenu.Cast(g_Game.GetUIManager().EnterScriptedMenu(MENU_MAIN, null));
22#endif
23 }
24
25 GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
26 }
27
28 override void Reset()
29 {
30#ifdef PLATFORM_CONSOLE
31 delete m_IntroSceneXbox;
32#else
33 delete m_IntroScenePC;
34#endif
35
36 CreateIntroScene();
37 }
38
40 {
41#ifdef PLATFORM_CONSOLE
42 Error("missionMainMenu->GetIntroScenePC on PLATFORM_CONSOLE is not implemented!");
43 return null;
44#else
45 return m_IntroScenePC;
46#endif
47 }
48
50 {
51#ifdef PLATFORM_CONSOLE
52 return m_IntroSceneXbox;
53#else
54 Error("missionMainMenu->GetIntroScenePC on PLATFORM_PC is not implemented!");
55 return null;
56#endif
57 }
58
60 {
61#ifdef PLATFORM_CONSOLE
62 m_IntroSceneXbox = new DayZIntroSceneXbox;
63#else
64 m_IntroScenePC = new DayZIntroScenePC;
65#endif
66 }
67
69 {
70 super.UpdateInputDevicesAvailability();
71
72 g_Game.GetInput().UpdateConnectedInputDeviceList();
73 g_Game.UpdateInputDeviceDisconnectWarning();
74 }
75
76 override void OnMissionStart()
77 {
78 if (m_mainmenu)
79 {
80 //m_mainmenu.FadeIn(2.0); //Fade in method is currently commented in MainMenu class
81 }
82 g_Game.GetUIManager().ShowUICursor(true);
83 g_Game.SetMissionState(DayZGame.MISSION_STATE_MAINMENU);
84
85 //Print("*** MissionMainMenu.OnMissionStart()");
86 g_Game.LoadingHide(true);
88 PlayMusic();
89 }
90
91 override void OnMissionFinish()
92 {
93 if (m_mainmenu)
94 m_mainmenu.Cleanup();
95 GetGame().GetUIManager().CloseAll();
96 m_mainmenu = NULL;
97
98 m_IntroScenePC = null;
99 m_IntroSceneXbox = null;
100 m_CreditsMenu = null;
101#ifndef FEATURE_CURSOR
102 g_Game.GetUIManager().ShowUICursor(false);
103#endif
104 }
105
106 override void OnUpdate(float timeslice)
107 {
108 super.OnUpdate(timeslice);
109
110#ifdef DIAG_DEVELOPER
112#endif
113
114 if (g_Game.IsLoading())
115 return;
116
117 if (m_IntroScenePC)
118 m_IntroScenePC.Update();
119 }
120
122 {
123 switch (menu_id)
124 {
125 case MENU_CREDITS:
126 {
127 m_CreditsMenu = CreditsMenu.Cast(GetGame().GetUIManager().GetMenu());
128 }
129 }
130 }
131
133 {
134 if (m_CreditsMenu)
135 m_CreditsMenu.UpdateInfoPanelText(device);
136 }
137
139 {
140 if (!m_MenuMusic)
141 {
142 SoundParams soundParams = new SoundParams("Music_Menu_SoundSet");
144 SoundObject soundObject = soundBuilder.BuildSoundObject();
145 soundObject.SetKind(WaveKind.WAVEMUSIC);
146 m_MenuMusic = GetGame().GetSoundScene().Play2D(soundObject, soundBuilder);
147 m_MenuMusic.Loop(true);
148 m_MenuMusic.Play();
149 }
150 }
151
153 {
154 if (m_MenuMusic)
155 m_MenuMusic.Stop();
156 }
157
159 {
160 return m_MenuMusic;
161 }
162
164 {
165 int find_number = number;
166 int index_min = 0;
167 int index_max = list.Count() - 1;
168 int target_index = Math.Floor(index_max / 2);
169
170 if (index_max == -1)
171 {
172 list.Insert(number);
173 return 0;
174 }
175
176 while (true)
177 {
179
180 if (find_number == target_value || ((index_max - index_min) <= 1))
181 {
182 for (int i = index_min; i <= index_max; i++)
183 {
184 if (find_number <= list[i])
185 {
186 list.InsertAt(find_number, i);
187 return i;
188 }
189 }
190
191 index_max++;
192 list.InsertAt(find_number, index_max);
193 return target_index;
194 }
195 else if (find_number < target_value)
196 {
199 }
200 else if (find_number > target_value)
201 {
204 }
205 }
206
207 return target_index;
208 }
209}
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition Inventory.c:167
DayZGame g_Game
Definition DayZGame.c:3528
WaveKind
Definition Sound.c:2
class SoundObjectBuilder SoundObject(SoundParams soundParams)
void SoundObjectBuilder(SoundParams soundParams)
proto void Play()
proto void Loop(bool setLoop)
proto void Stop()
Definition EnMath.c:7
int SortedInsert(array< int > list, int number)
void OnMenuEnter(int menu_id)
void CreateIntroScene()
override void OnUpdate(float timeslice)
override void OnInit()
AbstractWave GetMenuMusic()
void OnInputDeviceChanged(int device)
override void Reset()
ref DayZIntroSceneXbox m_IntroSceneXbox
CreditsMenu m_CreditsMenu
ref DayZIntroScenePC m_IntroScenePC
AbstractWave m_MenuMusic
UIScriptedMenu m_mainmenu
DayZIntroScenePC GetIntroScenePC()
DayZIntroSceneXbox GetIntroSceneXbox()
override void OnMissionFinish()
override void OnMissionStart()
override void UpdateInputDevicesAvailability()
static proto native void DestroyAllPendingProgresses()
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto float Floor(float f)
Returns floor of value.
const int MENU_TITLE_SCREEN
Definition constants.c:186
const int MENU_MAIN
Definition constants.c:172
const int MENU_CREDITS
Definition constants.c:195