DayZ 1.24
Loading...
Searching...
No Matches
missionBase.c
Go to the documentation of this file.
2{
3 PluginDeveloper m_ModuleDeveloper;
4 PluginKeyBinding m_ModuleKeyBinding
6
10
12
13 autoptr ObjectSnapCallback m_InventoryDropCallback;
14
16 {
18
20
21 m_WidgetEventHandler = new WidgetEventHandler;
22
23 m_InventoryDropCallback = new EntityPlacementCallback;
24
25 //Debug.DestroyAllShapes();
26
27 //TODO clea up after Gamescom
28 m_ModuleServerInfo = PluginAdditionalInfo.Cast(GetPlugin(PluginAdditionalInfo));
29 //
31
32 if (GetGame().IsServer())
33 InitialiseWorldData();
34 else
35 {
36 GetDayZGame().GetAnalyticsClient().RegisterEvents();
37 m_WorldLighting = new WorldLighting;
38 }
39
40 GetOnInputDeviceConnected().Insert(UpdateInputDevicesAvailability);
41 GetOnInputDeviceDisconnected().Insert(UpdateInputDevicesAvailability);
42
43 // There is a possibility different maps/servers may be using different effects
45 GetUApi().UpdateControls();
46 }
47
49 {
51
52 if (GetGame().IsClient())
53 GetDayZGame().GetAnalyticsClient().UnregisterEvents();
55 }
56
57 override ObjectSnapCallback GetInventoryDropCallback()
58 {
59 return m_InventoryDropCallback;
60 }
61
63 {
64 string worldName = "empty";
65 GetGame().GetWorldName(worldName);
66 worldName.ToLower();
67
68 switch (worldName)
69 {
70 case "chernarusplus":
71 m_WorldData = new ChernarusPlusData();
72 break;
73
74 case "enoch":
75 m_WorldData = new EnochData();
76 break;
77
78#ifdef PLATFORM_CONSOLE
79 case "mainmenuscenexbox":
80 m_WorldData = new MainMenuWorldData();
81 break
82#endif
83
84 default:
85 m_WorldData = new ChernarusPlusData();
86 break;
87 }
88 }
89
91 {
92 return m_WorldLighting;
93 }
94
96 {
97 return m_WorldData;
98 }
99
101 {
103
104 switch (id)
105 {
106 case MENU_MAIN:
107#ifdef PLATFORM_CONSOLE
108 menu = new MainMenuConsole;
109#else
110 menu = new MainMenu;
111#endif
112 break;
113 case MENU_INGAME:
114#ifdef PLATFORM_CONSOLE
115 menu = new InGameMenuXbox;
116#else
117 menu = new InGameMenu;
118#endif
119 break;
120 case MENU_CHARACTER:
121 menu = new CharacterCreationMenu;
122 break;
123 case MENU_OPTIONS:
124 menu = new OptionsMenu;
125 break;
126 case MENU_STARTUP:
127 menu = new StartupMenu;
128 break;
129 case MENU_LOADING:
130 menu = new LoadingMenu;
131 break;
132 case MENU_INVENTORY:
133 menu = new InventoryMenu;
134 break;
135 case MENU_INSPECT:
136 menu = new InspectMenuNew;
137 break;
138 case MENU_EARLYACCESS:
139 menu = new EarlyAccessMenu;
140 break;
142 menu = new ScriptConsole;
143 break;
145 menu = new ScriptConsoleNewPresetDialog;
146 break;
148 menu = new ScriptConsoleRenamePresetDialog;
149 break;
151 menu = new ScriptConsoleUniversalInfoDialog;
152 break;
153 case MENU_CHAT_INPUT:
154 menu = new ChatInputMenu;
155 break;
157 menu = new PresetsMenu;
158 break;
159 case MENU_NOTE:
160 menu = new NoteMenu;
161 break;
162 case MENU_MAP:
163 menu = new MapMenu;
164 break;
165 case MENU_BOOK:
166 menu = new BookMenu;
167 break;
169 menu = new SceneEditorMenu;
170 break;
171 case MENU_HELP_SCREEN:
172 menu = new HelpScreen;
173 break;
174 case MENU_GESTURES:
175 menu = new GesturesMenu;
176 break;
177 case MENU_LOGOUT:
178 menu = new LogoutMenu;
179 break;
181 menu = new TitleScreenMenu;
182 break;
184 menu = new ControlsXboxNew;
185 break;
187 menu = new RadialQuickbarMenu;
188 break;
191 break;
192 case MENU_LOGIN_QUEUE:
193 menu = new LoginQueueBase;
194 break;
195 case MENU_LOGIN_TIME:
196 menu = new LoginTimeBase;
197 break;
199 menu = new CameraToolsMenu;
200 break;
201 case MENU_VIDEO:
202 menu = new MainMenuVideo;
203 break;
204 case MENU_KEYBINDINGS:
205 menu = new KeybindingsMenu;
206 break;
207 case MENU_TUTORIAL:
208 menu = new TutorialsMenu;
209 break;
210 case MENU_CREDITS:
211 menu = new CreditsMenu;
212 break;
214 menu = new InviteMenu;
215 break;
218 break;
220 menu = new InputDeviceDisconnectWarningMenu;
221 break;
224 break;
226 menu = new RespawnDialogue;
227 break;
230 break;
231 case MENU_LOC_ADD:
232 menu = new ScriptConsoleAddLocation;
233 break;
235 menu = new MissionLoader;
236 break;
237 }
238
239 if (menu)
240 menu.SetID(id);
241
242 return menu;
243 }
244
246
248 {
249 g_Game.RefreshMouseCursorVisibility();
250 }
251
252 override void OnKeyPress(int key)
253 {
254 super.OnKeyPress(key);
255
256#ifdef DIAG_DEVELOPER
257 if (PluginKeyBinding.instance)
258 PluginKeyBinding.instance.OnKeyPress(key);
259#endif
260 }
261
264
266 {
267 UIScriptedMenu current_menu = GetGame().GetUIManager().GetMenu();
268
269 if (current_menu)
270 {
271 Widget widget_root = current_menu.GetLayoutRoot();
272
273 if (widget_root)
274 {
275 m_WidgetsTotal = 0;
276 m_WidgetsInvisible = 0;
277
278 Print(widget_root.GetName() + " (" + widget_root.GetTypeName() + ")");
279
280 DumpWidget(widget_root.GetChildren(), 1);
281
282 Print("Widgets TOTAL: " + m_WidgetsTotal.ToString() + " INVISIBLE: " + m_WidgetsInvisible.ToString() + " VISIBLE: " + (m_WidgetsTotal - m_WidgetsInvisible).ToString());
283 }
284 }
285 }
286
288 {
289 if (!w)
290 return;
291
292 m_WidgetsTotal++;
293
294 string tmp;
295 for (int i = 0; i < tabs; i++)
296 tmp += " ";
297
298 string invisible = "";
299
300 if (!w.IsVisibleHierarchy())
301 {
302 invisible = "[invisible]";
303 m_WidgetsInvisible++;
304 }
305
306 Print(tmp + "- " + w.GetName() + " (" + w.GetTypeName() + ") " + invisible);
307
308 bool collapse = false;
309 if (w.GetChildren())
310 {
311 collapse = true;
312 Print(tmp + "{");
313 }
314
315 DumpWidget(w.GetChildren(), tabs + 1);
316
317 if (collapse)
318 Print(tmp + "}");
319
320 DumpWidget(w.GetSibling(), tabs);
321 }
322
323 override void OnKeyRelease(int key)
324 {
325 super.OnKeyRelease(key);
326
327 if (GetGame().IsDebug())
328 {
329 if (PluginKeyBinding.instance != NULL)
330 PluginKeyBinding.instance.OnKeyRelease(key);
331 }
332 }
333
334 override void OnMouseButtonPress(int button)
335 {
336 super.OnMouseButtonPress(button);
337
338 if (GetGame().IsDebug())
339 {
340 if (PluginKeyBinding.instance != NULL)
341 PluginKeyBinding.instance.OnMouseButtonPress(button);
342 }
343 }
344
345 override void OnMouseButtonRelease(int button)
346 {
347 super.OnMouseButtonRelease(button);
348
349 if (GetGame().IsDebug())
350 {
351 if (PluginKeyBinding.instance != NULL)
352 PluginKeyBinding.instance.OnMouseButtonRelease(button);
353 }
354 }
355
356 void OnLog(string msg_log)
357 {
358 if (PluginDeveloper.GetInstance())
359 {
360 if (GetGame().IsServer() && !GetGame().IsMultiplayer())
361 PluginDeveloper.GetInstance().PrintLogClient(msg_log);
362 else if (GetGame().IsMultiplayer() && GetGame().IsClient())
363 PluginDeveloper.GetInstance().PrintLogClient(msg_log);
364 }
365 }
366
368 {
369 for (int i = 0; i < m_DummyPlayers.Count(); i++)
370 {
371 if (m_DummyPlayers.Get(i))
372 m_DummyPlayers.Get(i).OnTick();
373 }
374 }
375
377 {
378 m_DummyPlayers.Insert(PlayerBase.Cast(player));
379 }
380
381#ifdef DIAG_DEVELOPER
383 {
384 DisplayInputDebug(DiagMenu.GetBool(DiagMenuIDs.MISC_INPUT_DEVICE_DISCONNECT_DBG));
385 }
386
387 void DisplayInputDebug(bool show)
388 {
390 DbgUI.Begin("InputDeviceDebug", 60, 60);
391
392 if (show)
393 {
394 DbgUI.Text("Gamepad: " + g_Game.GetInput().IsActiveGamepadSelected());
395 DbgUI.Text("Mouse: " + g_Game.GetInput().IsMouseConnected());
396 DbgUI.Text("Keyboard: " + g_Game.GetInput().IsKeyboardConnected());
397 }
398
399 DbgUI.End();
401 }
402#endif
403}
404
405class MissionDummy extends MissionBase
406{
407}
void LoginQueueBase()
Definition DayZGame.c:110
DayZGame g_Game
Definition DayZGame.c:3528
DayZGame GetDayZGame()
Definition DayZGame.c:3530
void SetDispatcher(Dispatcher dispatcher)
Definition Dispatcher.c:31
DiagMenuIDs
Definition EDiagMenuIDs.c:2
void InventoryMenu()
PluginBase GetPlugin(typename plugin_type)
void PluginManagerInit()
void PluginManagerDelete()
proto native UAInputAPI GetUApi()
Definition DbgUI.c:60
LoginTime when using -connect since mission is not created yet.
Definition DayZGame.c:320
override bool IsServer()
override void UpdateInputDevicesAvailability()
override void AddDummyPlayerToScheduler(Man player)
PluginDeveloper m_ModuleDeveloper
Definition missionBase.c:3
override void OnMouseButtonRelease(int button)
void DumpWidget(Widget w, int tabs)
override void OnKeyPress(int key)
ref WidgetEventHandler m_WidgetEventHandler
Definition missionBase.c:7
override ObjectSnapCallback GetInventoryDropCallback()
Definition missionBase.c:57
autoptr ObjectSnapCallback m_InventoryDropCallback
Definition missionBase.c:13
void UpdateInputDevicesAvailability()
void OnLog(string msg_log)
PluginKeyBinding m_ModuleKeyBinding PluginAdditionalInfo m_ModuleServerInfo
Definition missionBase.c:5
override void OnMouseButtonPress(int button)
override WorldLighting GetWorldLighting()
Definition missionBase.c:90
ref WorldData m_WorldData
Definition missionBase.c:8
override WorldData GetWorldData()
Definition missionBase.c:95
override void OnKeyRelease(int key)
override UIScriptedMenu CreateScriptedMenu(int id)
void InitialiseWorldData()
Definition missionBase.c:62
void DumpCurrentUILayout()
ref WorldLighting m_WorldLighting
Definition missionBase.c:9
void UpdateDummyScheduler()
Manager class for managing Effect (EffectParticle, EffectSound)
static void Cleanup()
Cleanup method to properly clean up the static data.
static void Init()
Definition SoundSetMap.c:6
Keeps information about currently loaded world, like temperature.
Definition WorldData.c:3
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto void BeginCleanupScope()
static proto native void EndCleanupScope()
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
const int MENU_CONNECT_ERROR
Definition constants.c:201
const int MENU_TUTORIAL
Definition constants.c:194
const int MENU_HELP_SCREEN
Definition constants.c:183
const int MENU_TITLE_SCREEN
Definition constants.c:186
const int MENU_KEYBINDINGS
Definition constants.c:193
const int MENU_XBOX_CONTROLS
Definition constants.c:187
const int MENU_SCRIPTCONSOLE
Definition constants.c:175
const int MENU_WARNING_TELEPORT
Definition constants.c:200
const int MENU_LOGOUT
Definition constants.c:185
const int MENU_INSPECT
Definition constants.c:169
const int MENU_LOGIN_TIME
Definition constants.c:197
const int MENU_MAP
Definition constants.c:181
const int MENU_MAIN
Definition constants.c:172
const int MENU_SERVER_BROWSER
Definition constants.c:190
const int MENU_WARNING_ITEMDROP
Definition constants.c:198
const int MENU_MISSION_LOADER
Definition constants.c:204
const int MENU_SCRIPTCONSOLE_UNIVERSAL_INFO_DIALOG
Definition constants.c:203
const int MENU_STARTUP
Definition constants.c:174
const int MENU_RESPAWN_DIALOGUE
Definition constants.c:199
const int MENU_OPTIONS
Definition constants.c:173
const int MENU_CREDITS
Definition constants.c:195
const int MENU_CAMERA_TOOLS
Definition constants.c:191
const int MENU_CHARACTER
Definition constants.c:164
const int MENU_INVITE_TIMER
Definition constants.c:196
const int MENU_GESTURES
Definition constants.c:184
const int MENU_LOGIN_QUEUE
Definition constants.c:189
const int MENU_SCENE_EDITOR
Definition constants.c:167
const int MENU_SCRIPTCONSOLE_DIALOG_PRESET_NAME
Definition constants.c:177
const int MENU_WARNING_INPUTDEVICE_DISCONNECT
Definition constants.c:202
const int MENU_CONTROLS_PRESET
Definition constants.c:179
const int MENU_EARLYACCESS
Definition constants.c:166
const int MENU_SCRIPTCONSOLE_DIALOG_PRESET_RENAME
Definition constants.c:178
const int MENU_INVENTORY
Definition constants.c:170
const int MENU_NOTE
Definition constants.c:180
const int MENU_LOADING
Definition constants.c:171
const int MENU_RADIAL_QUICKBAR
Definition constants.c:188
const int MENU_BOOK
Definition constants.c:182
const int MENU_LOC_ADD
Definition constants.c:162
const int MENU_INGAME
Definition constants.c:168
const int MENU_CHAT_INPUT
Definition constants.c:176
const int MENU_VIDEO
Definition constants.c:192