DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
missionMainMenu.c
См. документацию.
1class MissionMainMenu extends MissionBase
2{
4 private CreditsMenu m_CreditsMenu;
7
9
10 override void OnInit()
11 {
12 if (!m_NoCutscene)
13 {
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 {
43 }
44 }
45
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
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
67 {
68#ifdef PLATFORM_CONSOLE
70#else
72#endif
73 }
74
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);
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
197
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
213 {
214 if ( m_MenuMusic )
215 m_MenuMusic.Stop();
216 }
217
219 {
220 return m_MenuMusic;
221 }
222}
DayZGame g_Game
Определения DayZGame.c:3942
EDynamicMusicPlayerCategory
Определения EDynamicMusicPlayerCategory.c:2
WaveKind
Определения Sound.c:2
Определения EnMath.c:7
int SortedInsert(array< int > list, int number)
Определения missionMainMenu.c:146
void OnMenuEnter(int menu_id)
Определения missionMainMenu.c:127
void CreateIntroScene()
Определения missionMainMenu.c:66
void StopMusic()
Определения missionMainMenu.c:212
override void OnUpdate(float timeslice)
Определения missionMainMenu.c:108
override void OnInit()
Определения missionMainMenu.c:10
AbstractWave GetMenuMusic()
Определения missionMainMenu.c:218
void OnInputDeviceChanged(int device)
Определения missionMainMenu.c:138
override void Reset()
Определения missionMainMenu.c:32
ref DayZIntroSceneXbox m_IntroSceneXbox
Определения missionMainMenu.c:6
CreditsMenu m_CreditsMenu
Определения missionMainMenu.c:4
ref DayZIntroScenePC m_IntroScenePC
Определения missionMainMenu.c:5
void PlayMusic()
Определения missionMainMenu.c:198
AbstractWave m_MenuMusic
Определения missionMainMenu.c:196
UIScriptedMenu m_mainmenu
Определения missionMainMenu.c:3
DayZIntroScenePC GetIntroScenePC()
Определения missionMainMenu.c:46
DayZIntroSceneXbox GetIntroSceneXbox()
Определения missionMainMenu.c:56
override void OnMissionFinish()
Определения missionMainMenu.c:93
override void OnMissionStart()
Определения missionMainMenu.c:83
override void UpdateInputDevicesAvailability()
Определения missionMainMenu.c:75
bool m_NoCutscene
Определения missionMainMenu.c:8
Определения missionGameplay.c:2
static proto native void DestroyAllPendingProgresses()
Определения ProgressAsync.c:2
Определения Sound.c:112
Определения DayZGame.c:64
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
static proto float Floor(float f)
Returns floor of value.
const int MENU_TITLE_SCREEN
Определения 3_Game/DayZ/constants.c:196
const int MENU_MAIN
Определения 3_Game/DayZ/constants.c:182
const int MENU_CREDITS
Определения 3_Game/DayZ/constants.c:205
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
void AbstractWave()
Определения Sound.c:167
class SoundObject SoundParams(string name)
proto native void SetKind(WaveKind kind)