DayZ 1.27
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
41 }
42
44 {
45 #ifdef PLATFORM_CONSOLE
46 Error("missionMainMenu->GetIntroScenePC on PLATFORM_CONSOLE is not implemented!");
47 return null;
48 #else
49 return m_IntroScenePC;
50 #endif
51 }
52
54 {
55 #ifdef PLATFORM_CONSOLE
56 return m_IntroSceneXbox;
57 #else
58 Error("missionMainMenu->GetIntroScenePC on PLATFORM_PC is not implemented!");
59 return null;
60 #endif
61 }
62
64 {
65#ifdef PLATFORM_CONSOLE
67#else
69#endif
70 }
71
73 {
74 super.UpdateInputDevicesAvailability();
75
76 g_Game.GetInput().UpdateConnectedInputDeviceList();
77 g_Game.UpdateInputDeviceDisconnectWarning();
78 }
79
80 override void OnMissionStart()
81 {
82 g_Game.GetUIManager().ShowUICursor(true);
83 g_Game.SetMissionState(DayZGame.MISSION_STATE_MAINMENU);
84 m_DynamicMusicPlayer.SetCategory(EDynamicMusicPlayerCategory.MENU, true);
85
86 g_Game.LoadingHide(true);
88 }
89
90 override void OnMissionFinish()
91 {
92 if ( m_mainmenu )
93 m_mainmenu.Cleanup();
95 m_mainmenu = NULL;
96
97 m_IntroScenePC = null;
98 m_IntroSceneXbox = null;
99 m_CreditsMenu = null;
100#ifndef FEATURE_CURSOR
101 g_Game.GetUIManager().ShowUICursor(false);
102#endif
103 }
104
105 override void OnUpdate(float timeslice)
106 {
107 super.OnUpdate(timeslice);
108
109#ifdef DIAG_DEVELOPER
110 UpdateInputDeviceDiag();
111#endif
112
113 if ( g_Game.IsLoading() )
114 {
115 return;
116 }
117
118 if (m_IntroScenePC)
119 {
120 m_IntroScenePC.Update();
121 }
122 }
123
124 void OnMenuEnter(int menu_id)
125 {
126 switch (menu_id)
127 {
128 case MENU_CREDITS:
129 {
130 m_CreditsMenu = CreditsMenu.Cast(GetGame().GetUIManager().GetMenu());
131 }
132 }
133 }
134
135 void OnInputDeviceChanged(int device)
136 {
137 if (m_CreditsMenu)
138 {
139 m_CreditsMenu.UpdateInfoPanelText(device);
140 }
141 }
142
143 int SortedInsert( array<int> list, int number )
144 {
145 int find_number = number;
146 int index_min = 0;
147 int index_max = list.Count() - 1;
148 int target_index = Math.Floor( index_max / 2 );
149
150 if ( index_max == -1 )
151 {
152 list.Insert( number );
153 return 0;
154 }
155
156 while ( true )
157 {
158 int target_value = list[target_index];
159
160 if ( find_number == target_value || ((index_max - index_min) <= 1) )
161 {
162 for ( int i = index_min; i <= index_max; i++ )
163 {
164 if ( find_number <= list[i] )
165 {
166 list.InsertAt( find_number, i );
167 return i;
168 }
169 }
170
171 index_max++;
172 list.InsertAt( find_number, index_max );
173 return target_index;
174 }
175 else if ( find_number < target_value )
176 {
177 index_max = target_index;
178 target_index = Math.Floor( target_index / 2 );
179 }
180 else if ( find_number > target_value )
181 {
182 index_min = target_index;
183 target_index += Math.Floor( (index_max - index_min) / 2 );
184 }
185 }
186
187 return target_index;
188 }
189
194
196 {
197 if ( !m_MenuMusic )
198 {
199 SoundParams soundParams = new SoundParams( "Music_Menu_SoundSet" );
200 SoundObjectBuilder soundBuilder = new SoundObjectBuilder( soundParams );
201 SoundObject soundObject = soundBuilder.BuildSoundObject();
202 soundObject.SetKind( WaveKind.WAVEMUSIC );
203 m_MenuMusic = GetGame().GetSoundScene().Play2D(soundObject, soundBuilder);
204 m_MenuMusic.Loop( true );
205 m_MenuMusic.Play();
206 }
207 }
208
210 {
211 if ( m_MenuMusic )
212 m_MenuMusic.Stop();
213 }
214
216 {
217 return m_MenuMusic;
218 }
219}
DayZGame g_Game
Определения DayZGame.c:3868
EDynamicMusicPlayerCategory
Определения EDynamicMusicPlayerCategory.c:2
WaveKind
Определения Sound.c:2
proto native UIManager GetUIManager()
proto native AbstractSoundScene GetSoundScene()
Определения EnMath.c:7
int SortedInsert(array< int > list, int number)
Определения missionMainMenu.c:143
UIManager GetUIManager()
Определения missionGameplay.c:179
void OnMenuEnter(int menu_id)
Определения missionMainMenu.c:124
void CreateIntroScene()
Определения missionMainMenu.c:63
void StopMusic()
Определения missionMainMenu.c:209
override void OnUpdate(float timeslice)
Определения missionMainMenu.c:105
override void OnInit()
Определения missionMainMenu.c:10
AbstractWave GetMenuMusic()
Определения missionMainMenu.c:215
void OnInputDeviceChanged(int device)
Определения missionMainMenu.c:135
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:195
AbstractWave m_MenuMusic
Определения missionMainMenu.c:193
UIScriptedMenu m_mainmenu
Определения missionMainMenu.c:3
DayZIntroScenePC GetIntroScenePC()
Определения missionMainMenu.c:43
DayZIntroSceneXbox GetIntroSceneXbox()
Определения missionMainMenu.c:53
override void OnMissionFinish()
Определения missionMainMenu.c:90
override void OnMissionStart()
Определения missionMainMenu.c:80
override void UpdateInputDevicesAvailability()
Определения missionMainMenu.c:72
bool m_NoCutscene
Определения missionMainMenu.c:8
Определения missionGameplay.c:2
static proto native void DestroyAllPendingProgresses()
Определения ProgressAsync.c:2
Определения Sound.c:112
bool CloseAll()
Close all opened menus.
Определения UIManager.c:78
Определения DayZGame.c:64
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
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
Определения constants.c:196
const int MENU_MAIN
Определения constants.c:182
const int MENU_CREDITS
Определения constants.c:205
proto native AbstractWave Play2D(SoundObject soundObject, SoundObjectBuilder soundBuilder)
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
void AbstractWave()
Определения Sound.c:167
class SoundObject SoundParams(string name)
proto native void SetKind(WaveKind kind)