Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PauseMenuUI.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 InputManager m_InputManager;
5
7 protected Widget m_wRoot;
8 protected Widget m_wFade;
11 protected bool m_bFocused = true;
12
13 protected const float DURATION_IN_BLUR = 0.75;
14 protected const float DURATION_OUT_BLUR = 0.5;
15
16 protected const float VALUE_BLUR = 0.8;
17 protected const float VALUE_DISABLED = 0.0;
18
19 //Editor and Photo mode Specific
24
26
29
30 protected const string EXIT_SAVE = "#AR-PauseMenu_ReturnSaveTitle";
31 protected const string EXIT_NO_SAVE = "#AR-PauseMenu_ReturnTitle";
32
33 protected const string EXIT_MESSAGE = "#AR-PauseMenu_ReturnText";
34 protected const string EXIT_TITLE = "#AR-PauseMenu_ReturnTitle";
35 protected const string EXIT_IMAGE = "exit";
36
37 protected const string RESTART_MESSAGE = "#AR-PauseMenu_RestartText";
38 protected const string RESTART_TITLE = "#AR-PauseMenu_Restart";
39 protected const string RESTART_IMAGE = "restart";
40
41 protected const string LOAD_MESSAGE = "#AR-PauseMenu_LoadText";
42 protected const string LOAD_TITLE = "#AR-PauseMenu_Load";
43 protected const string LOAD_IMAGE = "up";
44
45 protected const string DIALOG_SCENARIO_EXIT = "scenario_exit";
46 protected const string DIALOG_SAVE_FAILED = "pause_menu_save_failed";
47 protected const string DIALOG_CONFIRM_RESPAWN = "respawn_confirmation";
48
51
52 protected static PauseMenuUI s_Instance;
53
54 //------------------------------------------------------------------------------------------------
55 // If the pause menu was open, reinitialize it so it sits on top
56 static void MoveToTop()
57 {
58 if (!s_Instance)
59 return;
60
61 s_Instance.Close();
62
63 // Must be called the next frame for the menu to be reopened immediately after closing
64 GetGame().GetCallqueue().CallLater(OpenMenuOnTop);
65
66 // TODO: tried setting the ZOrder but it does not work: ask for Enfusion API
67 }
68
69 //------------------------------------------------------------------------------------------------
70 // Opens the pause menu with settings for it to be on top of other menus
71 static void OpenMenuOnTop()
72 {
73 GetGame().OpenPauseMenu(false, true);
74 }
75
76 //------------------------------------------------------------------------------------------------
77 override void OnMenuOpen()
78 {
79 bool isReplicationRunning = Replication.IsRunning();
80
81 s_Instance = this;
82
84 m_wFade = m_wRoot.FindAnyWidget("BackgroundFade");
85 m_wSystemTime = m_wRoot.FindAnyWidget("SystemTime");
86 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
88
89 // Pause game
91 if (gameMode)
92 gameMode.PauseGame(true, SCR_EPauseReason.MENU | SCR_EPauseReason.MUSIC);
93
94 // Continue
96 if (comp)
97 {
98 GetGame().GetWorkspace().SetFocusedWidget(comp.GetRootWidget());
99 comp.m_OnClicked.Insert(Close);
100 }
101
102 // Restart
104 if (comp)
105 {
106 bool enabledRestart = !isReplicationRunning;
107 comp.GetRootWidget().SetVisible(enabledRestart);
108 comp.m_OnClicked.Insert(OnRestart);
109 }
110
111
113 if (comp)
114 { // Respawn
115 SCR_RespawnSystemComponent respawnComponent = SCR_RespawnSystemComponent.GetInstance();
116 if (respawnComponent && !respawnComponent.IsPauseMenuRespawnEnabled())
117 comp.SetVisible(false);
118 else
119 comp.m_OnClicked.Insert(ConfirmRespawn);
120 }
121
122 // Leave faction
123 comp = SCR_ButtonTextComponent.GetButtonText("LeaveFaction", m_wRoot);
124 if (comp)
125 {
126 bool factionLeaveAllowed;
128 if (gm)
129 factionLeaveAllowed = gm.IsFactionChangeAllowed();
130
131 SCR_FactionManager fm = SCR_FactionManager.Cast(GetGame().GetFactionManager());
132 if (fm)
133 {
134 array<Faction> factions = {};
135 fm.GetFactionsList(factions);
136 int playableFactionCount = 0;
137 foreach (Faction f : factions)
138 {
139 SCR_Faction scriptedFaction = SCR_Faction.Cast(f);
140 if (scriptedFaction && scriptedFaction.IsPlayable())
141 playableFactionCount++;
142 }
143
144 factionLeaveAllowed = factionLeaveAllowed && (playableFactionCount > 1);
145 }
146
147 comp.GetRootWidget().SetVisible(factionLeaveAllowed);
148 if (factionLeaveAllowed)
149 {
150 PlayerController pc = GetGame().GetPlayerController();
152
153 if (factionComp)
154 comp.SetEnabled(factionComp.GetAffiliatedFaction() != null);
155
156 comp.m_OnClicked.Insert(OnLeaveFaction)
157 }
158 }
159
160 // Exit
162 if (comp)
163 {
164 comp.m_OnClicked.Insert(OnExit);
165 if (IsSavingOnExit())
166 comp.SetText(EXIT_SAVE);
167 else
168 comp.SetText(EXIT_NO_SAVE);
169 }
170
171 // Rewind
173 if (comp)
174 {
175 SCR_RewindComponent rewindManager = SCR_RewindComponent.GetInstance();
176 comp.GetRootWidget().SetVisible(rewindManager != null); //--- Hide the button when rewinding is not configured for the mission
177 comp.SetEnabled(rewindManager && rewindManager.HasRewindPoint()); //--- Disable the button when the rewind point does not exist
178 comp.m_OnClicked.Insert(OnRewind);
179 }
180
181 // Tutorial HUB
182 //TODO> Rename
183 comp = SCR_ButtonTextComponent.GetButtonText("ReturnHUB", m_wRoot);
184 if (comp)
185 {
186 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
187
188 if (tutorial && tutorial.CanBreakCourse())
189 {
190 comp.SetVisible(true);
191 comp.m_OnClicked.Insert(OnCourseBreak);
192 }
193 else
194 {
195 comp.SetVisible(false);
196 }
197 }
198
199 // Camera
201 if (comp)
202 {
203 comp.m_OnClicked.Insert(OnCamera);
204 comp.SetEnabled(editorManager && !editorManager.IsOpened());
205 comp.GetRootWidget().SetVisible(Game.IsDev());
206 }
207
208 // Settings
211 m_SettingsButton.m_OnClicked.Insert(OnSettings);
212
213 // Field Manual
214 comp = SCR_ButtonTextComponent.GetButtonText("FieldManual", m_wRoot);
215 if (comp)
216 comp.m_OnClicked.Insert(OnFieldManual);
217
218 // Group menu
219 comp = SCR_ButtonTextComponent.GetButtonText("GroupMenu", m_wRoot);
220 if (comp)
221 {
222 SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
223 if (!groupManager || !groupManager.IsGroupMenuAllowed())
224 comp.GetRootWidget().SetVisible(false);
225
226 comp.m_OnClicked.Insert(OnGroupMenu);
227
228 }
229
230 // Block list
231 comp = SCR_ButtonTextComponent.GetButtonText("BlockList", m_wRoot);
232 if (comp)
233 {
234 comp.GetRootWidget().SetVisible(isReplicationRunning);
235 comp.m_OnClicked.Insert(OnBlockList);
236 }
237
238 // Players
240 if (comp)
241 {
242 comp.GetRootWidget().SetVisible(isReplicationRunning);
243 comp.m_OnClicked.Insert(OnPlayers);
244 }
245
246 // Invite friends
247 comp = SCR_ButtonTextComponent.GetButtonText("InviteFriend", m_wRoot);
248 if (comp)
249 {
250 bool canInvite = isReplicationRunning && GetGame().GetPlayerManager().IsMultiplayerActivityInviteAvailable();
251 comp.GetRootWidget().SetVisible(canInvite);
252
253 if (canInvite)
254 comp.m_OnClicked.Insert(OnInviteFriends);
255 }
256
257 // Version
258 m_wVersion = TextWidget.Cast(m_wRoot.FindAnyWidget("Version"));
259 if (m_wVersion)
260 m_wVersion.SetText(GetGame().GetBuildVersion());
261
262 // Unlimited editor (Game Master)
265 m_EditorUnlimitedOpenButton.m_OnClicked.Insert(OnEditorUnlimited);
266
269 m_EditorUnlimitedCloseButton.m_OnClicked.Insert(OnEditorUnlimited);
270
271 //--- Photo mode
274 m_EditorPhotoOpenButton.m_OnClicked.Insert(OnEditorPhoto);
277 m_EditorPhotoCloseButton.m_OnClicked.Insert(OnEditorPhoto);
278
279 SetEditorUnlimitedButton(editorManager);
280 SetEditorPhotoButton(editorManager);
281
282 if (editorManager)
283 {
284 editorManager.GetOnModeAdd().Insert(OnEditorModeChanged);
285 editorManager.GetOnModeRemove().Insert(OnEditorModeChanged);
286 }
287
289 if (comp)
290 {
291 comp.m_OnClicked.Insert(OnFeedback);
292 }
293
294 //Hide second separator when second menu group is empty
295 if (!m_EditorPhotoCloseButton.IsVisible() && !m_EditorPhotoOpenButton.IsVisible() && !m_EditorUnlimitedOpenButton.IsVisible() && !m_EditorUnlimitedCloseButton.IsVisible())
296 {
297 ImageWidget separatorSecondGroup = ImageWidget.Cast(m_wRoot.FindAnyWidget("Separator0"));
298 if (separatorSecondGroup)
299 separatorSecondGroup.SetVisible(false);
300 }
301
302 m_InputManager = GetGame().GetInputManager();
303
304 m_OnPauseMenuOpened.Invoke();
305
306 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_FE_HUD_PAUSE_MENU_OPEN);
307
308 SCR_CampaignBuildingEditorComponent CampaignBuildingEditorComponent = SCR_CampaignBuildingEditorComponent.Cast(SCR_CampaignBuildingEditorComponent.GetInstance(SCR_CampaignBuildingEditorComponent));
309 if (!CampaignBuildingEditorComponent)
310 return;
311
312 m_wBlurEffect = BlurWidget.Cast(m_wRoot.FindAnyWidget("ScreenEffectBlur"));
313 CampaignBuildingEditorComponent.GetOnObstructionEventTriggered().Insert(AreaTriggerChange);
314
315 if (CampaignBuildingEditorComponent.IsViewObstructed())
317 }
318
319 //------------------------------------------------------------------------------------------------
321 protected void AreaTriggerChange(bool activated)
322 {
323 if (activated)
325 else
327 }
328
329 //------------------------------------------------------------------------------------------------
339
340 //------------------------------------------------------------------------------------------------
350
351 //------------------------------------------------------------------------------------------------
352 private void OnCourseBreak()
353 {
354 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
355 if (!tutorial)
356 return;
357
358 tutorial.RequestBreakCourse(SCR_ETutorialBreakType.FORCED);
359 }
360
361 //------------------------------------------------------------------------------------------------
362 override void OnMenuShow()
363 {
364 //--- Close pause menu when editor is opened or closed
365 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
366 if (editorManager)
367 {
368 editorManager.GetOnOpened().Insert(Close);
369 editorManager.GetOnClosed().Insert(Close);
370 }
371 }
372
373 //------------------------------------------------------------------------------------------------
374 override void OnMenuHide()
375 {
376 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
377 if (editorManager)
378 {
379 editorManager.GetOnOpened().Insert(Close);
380 editorManager.GetOnClosed().Insert(Close);
381 }
382
383 if (m_wFade)
384 m_wFade.SetVisible(false);
385 }
386
387 //------------------------------------------------------------------------------------------------
388 override void OnMenuClose()
389 {
390 s_Instance = null;
391
392 // Unpause
393 SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
394 if (gameMode)
395 gameMode.PauseGame(false, SCR_EPauseReason.MENU | SCR_EPauseReason.MUSIC);
396
397 SCR_HUDManagerComponent hud = GetGame().GetHUDManager();
398 if (hud)
399 hud.SetVisible(true);
400
401 m_OnPauseMenuClosed.Invoke();
402
403 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_FE_HUD_PAUSE_MENU_CLOSE);
404 }
405
406 //------------------------------------------------------------------------------------------------
407 override void OnMenuFocusLost()
408 {
409 m_bFocused = false;
410 m_InputManager.RemoveActionListener(UIConstants.MENU_ACTION_OPEN, EActionTrigger.DOWN, Close);
411 m_InputManager.RemoveActionListener(UIConstants.MENU_ACTION_BACK, EActionTrigger.DOWN, Close);
412 #ifdef WORKBENCH
413 m_InputManager.RemoveActionListener(UIConstants.MENU_ACTION_OPEN_WB, EActionTrigger.DOWN, Close);
414 m_InputManager.RemoveActionListener(UIConstants.MENU_ACTION_BACK_WB, EActionTrigger.DOWN, Close);
415 #endif
416 }
417
418 //------------------------------------------------------------------------------------------------
419 override void OnMenuFocusGained()
420 {
421 m_bFocused = true;
422 m_InputManager.AddActionListener(UIConstants.MENU_ACTION_OPEN, EActionTrigger.DOWN, Close);
423 m_InputManager.AddActionListener(UIConstants.MENU_ACTION_BACK, EActionTrigger.DOWN, Close);
424 #ifdef WORKBENCH
425 m_InputManager.AddActionListener(UIConstants.MENU_ACTION_OPEN_WB, EActionTrigger.DOWN, Close);
426 m_InputManager.AddActionListener(UIConstants.MENU_ACTION_BACK_WB, EActionTrigger.DOWN, Close);
427 #endif
428 }
429
430 //------------------------------------------------------------------------------------------------
431 void FadeBackground(bool fade, bool animate = true)
432 {
433 if (!m_wFade)
434 return;
435
436 m_wFade.SetVisible(fade);
437 m_wFade.SetOpacity(0);
438 if (fade && animate)
439 AnimateWidget.Opacity(m_wFade, 1, UIConstants.FADE_RATE_FAST, true);
440 }
441
442 //------------------------------------------------------------------------------------------------
443 private void OnSettings()
444 {
445 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.SettingsSuperMenu);
446 }
447
448 //------------------------------------------------------------------------------------------------
449 private void OnFieldManual()
450 {
451 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.FieldManualDialog);
452 }
453
454 //------------------------------------------------------------------------------------------------
455 private void OnGroupMenu()
456 {
457 SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
458 if (!groupManager || !groupManager.IsGroupMenuAllowed())
459 return;
460
461 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.GroupMenu);
462 }
463
464 //------------------------------------------------------------------------------------------------
465 private void OnBlockList()
466 {
467 SCR_BlockedUsersDialogUI dialog = new SCR_BlockedUsersDialogUI();
468 SCR_ConfigurableDialogUi.CreateFromPreset(SCR_AccountWidgetComponent.BLOCKED_USER_DIALOG_CONFIG, "blocked_list", dialog);
469 }
470
471 //------------------------------------------------------------------------------------------------
472 private void OnExit()
473 {
474 // Create exit dialog
475 m_ExitDialog = SCR_CommonDialogs.CreateDialog(DIALOG_SCENARIO_EXIT);
476 if (!m_ExitDialog)
477 return;
478
479 m_ExitDialog.m_OnConfirm.Insert(OnExitConfirm);
480 }
481
482 //------------------------------------------------------------------------------------------------
483 private void ConfirmRespawn()
484 {
485 // Create respawn confirmation dialog
486 m_RespawnDialog = SCR_CommonDialogs.CreateDialog(DIALOG_CONFIRM_RESPAWN);
487 if (!m_RespawnDialog)
488 return;
489
490 bool canRespawn;
491 SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
492 if (gameMode)
493 {
494 RespawnSystemComponent respawn = RespawnSystemComponent.Cast(gameMode.FindComponent(RespawnSystemComponent));
495 canRespawn = (respawn != null && CanRespawn());
496 }
497
498 m_RespawnDialog.GetRootWidget().SetVisible(canRespawn);
499 if (canRespawn)
500 m_RespawnDialog.m_OnConfirm.Insert(OnRespawn);
501 else
502 m_RespawnDialog.Close();
503 }
504
505 //------------------------------------------------------------------------------------------------
506 private void OnRewind()
507 {
508 new SCR_RewindDialog();
509 }
510
511 //------------------------------------------------------------------------------------------------
512 private void OnExitConfirm()
513 {
514 m_ExitDialog.m_OnConfirm.Remove(OnExitConfirm);
515
516 SaveGameManager manager = GetGame().GetSaveGameManager();
517 if (IsSavingOnExit() && !manager.IsBusy())
518 {
519 //--- Close only after the save file was created, unless a save was already ongoing.
520 manager.RequestSavePoint(ESaveGameType.SHUTDOWN, flags: ESaveGameRequestFlags.BLOCKING, callback: new SaveGameOperationCallback(OnExitSaveResult))
521 }
522 else
523 {
524 //--- Close instantly
526 }
527 }
528
529 //------------------------------------------------------------------------------------------------
530 protected void OnExitSaveResult(bool success)
531 {
532 if (success)
533 {
534 // Do not trigger another shutdown save on exit transition
535 GetGame().GetSaveGameManager().SetSavingAllowed(false);
537 return;
538 }
539
540 m_ExitDialog.Close();
541
543 if (!dialog)
544 return;
545
546 dialog.m_OnConfirm.Insert(CloseToMainMenu);
547 }
548
549 //------------------------------------------------------------------------------------------------
550 protected void CloseToMainMenu()
551 {
552 ChimeraWorld world = GetGame().GetWorld();
553 world.PauseGameTime(false);
554
555 Close();
556 GameStateTransitions.RequestGameplayEndTransition();
557 }
558
559 //------------------------------------------------------------------------------------------------
560 private void OnEditorUnlimited()
561 {
562 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
563 if (editorManager)
564 {
565 if (!editorManager.IsOpened() || editorManager.GetCurrentModeEntity().IsLimited())
566 {
567 editorManager.SetCurrentMode(false);
568 editorManager.Open();
569 }
570 else
571 {
572 editorManager.Close();
573 }
574 }
575 Close();
576 }
577
578 //Update Editor Mode Button text and if Enabled
579 //------------------------------------------------------------------------------------------------
580 private void SetEditorUnlimitedButton(SCR_EditorManagerEntity editorManager)
581 {
583
584 if (!editorManager || editorManager.IsLimited())
585 {
586 //--- LIMITED EDITOR
587
588 //--- Show disabled "Open Unlimited Editor" button when editor is *legal* in the mission
589 bool isUnlimitedEditorLegal;
590 SCR_EditorSettingsEntity settingsEntity = SCR_EditorSettingsEntity.GetInstance();
591 if (settingsEntity)
592 isUnlimitedEditorLegal = settingsEntity.IsUnlimitedEditorLegal();
593
594 m_EditorUnlimitedOpenButton.GetRootWidget().SetVisible(isUnlimitedEditorLegal);
595 m_EditorUnlimitedOpenButton.SetEnabled(false);
596
597 //--- Don't show the "Close Unlimited Editor" button
598 m_EditorUnlimitedCloseButton.GetRootWidget().SetVisible(false);
599
600 //--- Don't show the real-time clock
601 m_wSystemTime.SetVisible(false);
602 }
603 else
604 {
605 //--- UNLIMITED EDITOR
606 if (!editorManager.IsOpened() || editorManager.GetCurrentModeEntity().IsLimited())
607 {
608 //--- Current mode is limited, show the "Open Unlimited Editor" button
609 m_EditorUnlimitedOpenButton.GetRootWidget().SetVisible(true);
610 m_EditorUnlimitedCloseButton.GetRootWidget().SetVisible(false);
611 }
612 else
613 {
614 //--- Current mode is unlimited, show the "Close Unlimited Editor" button
615 m_EditorUnlimitedOpenButton.GetRootWidget().SetVisible(false);
616 m_EditorUnlimitedCloseButton.GetRootWidget().SetVisible(true);
617 m_EditorUnlimitedCloseButton.SetEnabled(editorManager.CanClose());
618 }
619
620 //--- Show the real-time clock
621 m_wSystemTime.SetVisible(true);
622 }
623 }
624
625 //Updates Editor and Photomode button if Rights changed
626 //------------------------------------------------------------------------------------------------
627 protected void OnEditorModeChanged(SCR_EditorModeEntity modeEntity)
628 {
629 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
630 SetEditorUnlimitedButton(editorManager);
631 SetEditorPhotoButton(editorManager);
632 }
633
634 //------------------------------------------------------------------------------------------------
635 private void OnEditorPhoto()
636 {
637 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
638 if (editorManager)
639 {
640 if (!editorManager.IsOpened() || editorManager.GetCurrentMode() != EEditorMode.PHOTO)
641 {
642 editorManager.SetCurrentMode(EEditorMode.PHOTO);
643 editorManager.Open();
644 }
645 else
646 {
647 editorManager.Close();
648 }
649 }
650 Close();
651 }
652
653 //Update Photo Mode Button text and if Enabled
654 //------------------------------------------------------------------------------------------------
655 private void SetEditorPhotoButton(SCR_EditorManagerEntity editorManager)
656 {
658 if (Replication.IsRunning())
659 {
660 m_EditorPhotoOpenButton.GetRootWidget().SetVisible(false);
661 m_EditorPhotoCloseButton.GetRootWidget().SetVisible(false);
662
663 }
664 else
665 {
666 if (!editorManager || !editorManager.HasMode(EEditorMode.PHOTO))
667 {
668 m_EditorPhotoOpenButton.GetRootWidget().SetVisible(true);
669 m_EditorPhotoOpenButton.SetEnabled(false);
670 m_EditorPhotoCloseButton.GetRootWidget().SetVisible(false);
671 }
672 else
673 {
674 if (!editorManager.IsOpened() || editorManager.GetCurrentMode() != EEditorMode.PHOTO)
675 {
676 m_EditorPhotoOpenButton.GetRootWidget().SetVisible(true);
677 m_EditorPhotoCloseButton.GetRootWidget().SetVisible(false);
678
679 //Set enabled
680 m_EditorPhotoOpenButton.SetEnabled(!editorManager.IsLimited() || GetGame().GetPlayerController().GetControlledEntity());
681 }
682 else
683 {
684 m_EditorPhotoOpenButton.GetRootWidget().SetVisible(false);
685 m_EditorPhotoCloseButton.GetRootWidget().SetVisible(true);
686 m_EditorPhotoCloseButton.SetEnabled(editorManager.CanClose());
687 }
688 }
689 }
690
691 }
692
693 //------------------------------------------------------------------------------------------------
694 void DisableSettings()
695 {
697 m_SettingsButton.SetEnabled(false);
698 }
699
700 //------------------------------------------------------------------------------------------------
701 void DisableGameMaster()
702 {
704 m_EditorUnlimitedOpenButton.SetEnabled(false);
705 }
706
707 //------------------------------------------------------------------------------------------------
708 void DisableArmaVision()
709 {
711 m_EditorPhotoOpenButton.SetEnabled(false);
712 }
713
714 //------------------------------------------------------------------------------------------------
715 private void OnFeedback()
716 {
717 SCR_FeedbackDialogUI.OpenFeedbackDialog();
718 }
719
720 //------------------------------------------------------------------------------------------------
721 private void OnRestart()
722 {
723 // Create dialog
724 SCR_ConfigurableDialogUi dialog = SCR_CommonDialogs.CreateDialog(SCR_ScenarioUICommon.DIALOG_RESTART);
725 if (!dialog)
726 return;
727
728 dialog.m_OnConfirm.Insert(OnRestartConfirm);
729 }
730
731 //------------------------------------------------------------------------------------------------
732 private void OnRestartConfirm()
733 {
734 GetGame().GetMenuManager().CloseAllMenus();
735 GameStateTransitions.RequestScenarioRestart();
736 }
737
738 //------------------------------------------------------------------------------------------------
739 private void OnPlayers()
740 {
741 ArmaReforgerScripted.OpenPlayerList();
742 }
743
744 //------------------------------------------------------------------------------------------------
745 protected void OnInviteFriends()
746 {
747 GetGame().GetPlayerManager().ShowMultiplayerActivityInvite();
748 }
749
750 //------------------------------------------------------------------------------------------------
753 protected bool CanRespawn()
754 {
755 PlayerController pc = GetGame().GetPlayerController();
756 if (!pc)
757 return false;
758
759 IEntity player = pc.GetControlledEntity();
760 if (!player)
761 return false;
762
763 SCR_ChimeraCharacter char = SCR_ChimeraCharacter.Cast(player);
764 if (!char)
765 return false;
766
767 CharacterControllerComponent charController = char.GetCharacterController();
768 if (!charController)
769 return false;
770
771 if (charController.GetLifeState() == ECharacterLifeState.DEAD)
772 return false;
773
774 return true;
775 }
776
777 //------------------------------------------------------------------------------------------------
778 private void OnRespawn()
779 {
782 PlayerController playerController = GetGame().GetPlayerController();
783 if (!playerController)
784 return;
785
786 SCR_RespawnComponent respawn = SCR_RespawnComponent.Cast(playerController.FindComponent(SCR_RespawnComponent));
787 if (!respawn)
788 return;
789
790 respawn.RequestPlayerSuicide();
791 Close();
792 }
793
794 //------------------------------------------------------------------------------------------------
795 private void OnLeaveFaction()
796 {
797 PlayerController pc = GetGame().GetPlayerController();
798 if (!pc)
799 return;
800
801 SCR_PlayerFactionAffiliationComponent factionComp = SCR_PlayerFactionAffiliationComponent.Cast(pc.FindComponent(SCR_PlayerFactionAffiliationComponent));
802 if (!factionComp)
803 return;
804
806 if (!rc)
807 return;
808
809 factionComp.RequestFaction(null);
810 rc.RequestPlayerSuicide();
811
812 Close();
813 }
814
815 //------------------------------------------------------------------------------------------------
816 private void OnCamera()
817 {
818 SCR_DebugCameraCore cameraCore = SCR_DebugCameraCore.Cast(SCR_DebugCameraCore.GetInstance(SCR_DebugCameraCore));
819 if (cameraCore)
820 cameraCore.ToggleCamera();
821 Close();
822 }
823
824 //------------------------------------------------------------------------------------------------
825 override void HandlerDeattached(Widget w)
826 {
827 super.HandlerDeattached(w);
828
829 //Remove Editor modes listener
830 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
831
832 if (editorManager)
833 {
834 editorManager.GetOnModeAdd().Remove(OnEditorModeChanged);
835 editorManager.GetOnModeRemove().Remove(OnEditorModeChanged);
836 }
837 }
838
839 //------------------------------------------------------------------------------------------------
840 protected bool IsSavingOnExit()
841 {
842 if (Replication.IsClient())
843 return false; // No saving as proxy in MP
844
845 if (!GetGame().GetSaveGameManager().IsSavingAllowed())
846 return false;
847
848 // Check if exit saves are enabled for current mission
849 return GetGame().GetSaveGameManager().GetEnabledSaveTypes() & ESaveGameType.SHUTDOWN;
850 }
851}
SCR_EAIThreatSectorFlags flags
ChimeraMenuPreset
Menu presets.
SCR_EPauseReason
Definition EPauseReason.c:2
ArmaReforgerScripted GetGame()
Definition game.c:1398
void OnFeedback()
Definition MainMenuUI.c:582
SCR_BaseGameMode GetGameMode()
void OnRespawn()
Hints are displayed with a delay after respawn so player has time to find their bearings.
SCR_ETutorialBreakType
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Widget GetRootWidget()
void SCR_RespawnComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
proto native void Close()
static bool StopAnimation(Widget w, typename typeName)
static WidgetAnimationBlurIntensity BlurIntensity(Widget widget, float targetValue, float speed)
Constant variables used in various menus.
override void OnMenuShow()
override void OnMenuHide()
override void OnMenuFocusGained()
override void OnMenuClose()
override void OnMenuFocusLost()
Definition Game.c:8
static proto bool IsDev()
Return true if executable is developer build.
Input management system for user interactions.
const string LOAD_IMAGE
const string LOAD_MESSAGE
const float DURATION_IN_BLUR
ref SCR_ConfigurableDialogUi m_ExitDialog
SCR_ButtonTextComponent m_EditorUnlimitedCloseButton
const float VALUE_BLUR
void AreaTriggerChange(bool activated)
static void MoveToTop()
void FinishObstructionAnimation(bool force=false)
Ends screen obstruction effect.
SCR_ButtonTextComponent m_EditorPhotoOpenButton
static PauseMenuUI s_Instance
static void OpenMenuOnTop()
void OnEditorModeChanged(SCR_EditorModeEntity modeEntity)
const string RESTART_TITLE
SCR_ButtonTextComponent m_EditorPhotoCloseButton
static ref ScriptInvoker m_OnPauseMenuClosed
BlurWidget m_wBlurEffect
const string EXIT_NO_SAVE
const string RESTART_IMAGE
const string EXIT_MESSAGE
Widget m_wSystemTime
SCR_ButtonTextComponent m_EditorUnlimitedOpenButton
const string RESTART_MESSAGE
const string DIALOG_CONFIRM_RESPAWN
override void OnMenuOpen()
void OnInviteFriends()
const string EXIT_IMAGE
bool IsSavingOnExit()
const string LOAD_TITLE
const string EXIT_SAVE
const string EXIT_TITLE
const float DURATION_OUT_BLUR
const string DIALOG_SCENARIO_EXIT
ref SCR_ConfigurableDialogUi m_RespawnDialog
void CloseToMainMenu()
void OnExitSaveResult(bool success)
const string DIALOG_SAVE_FAILED
const float VALUE_DISABLED
static ref ScriptInvoker m_OnPauseMenuOpened
TextWidget m_wVersion
SCR_ButtonTextComponent m_SettingsButton
void StartObstructionAnimation(bool force=false)
Start screen obstruction effect.
Main replication API.
Definition Replication.c:14
bool PauseGame(bool pause, SCR_EPauseReason reason=SCR_EPauseReason.SYSTEM)
static SCR_ButtonTextComponent GetButtonText(string name, Widget parent, bool searchAllChildren=true)
bool IsPlayable()
SCR_EditableEntityComponent GetControlledEntity()
ECharacterLifeState
EEditorMode
Editor mode that defines overall functionality.
Definition EEditorMode.c:6
proto external PlayerController GetPlayerController()
EActionTrigger
ESaveGameRequestFlags
ESaveGameType
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134