Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
ScriptedMainMenuEntity.c
Go to the documentation of this file.
1//#define DEBUG_WARNING_SCREEN
2
3//------------------------------------------------------------------------------------------------
5[EntityEditorProps(category: "GameScripted/Menu", description:"When put into a level will make sure that the main menu is open.")]
6class SCR_MainMenuEntityClass: GenericEntityClass
7{
8};
9
10//------------------------------------------------------------------------------------------------
12{
13 [Attribute("ChimeraMenuPreset.MainMenu", UIWidgets.SearchComboBox, "Menu to launch at start of the world", "", ParamEnumArray.FromEnum(ChimeraMenuPreset) )]
14 ChimeraMenuPreset m_eMenu;
15
16 [Attribute("{1C71B463B3B66BAB}UI/layouts/Menus/MainMenu/IntroSplashScreen.layout")]
17 private ResourceName m_sSplashScreenLayout;
18
20
21 //------------------------------------------------------------------------------------------------
23 {
24 m_Instamce = this;
25
26 // Enable
28 SetFlags(EntityFlags.NO_TREE | EntityFlags.NO_LINK);
29 }
30
31 //------------------------------------------------------------------------------------------------
33 {
34 if (m_eMenu == ChimeraMenuPreset.MainMenu)
35 GetGame().m_bIsMainMenuOpen = false;
36 }
37
38 // Wait until first update - all systems, like MenuManager should be initialized
39 //------------------------------------------------------------------------------------------------
40 override void EOnFrame(IEntity owner, float timeSlice)
41 {
42 bool isDevVersion = Game.IsDev();
43 bool showWarningScreen = SplashScreen.GetGameReloads() == 0 && SplashScreen.s_iSplashShown == 1;
44
45 #ifdef DEBUG_WARNING_SCREEN
46 isDevVersion = false;
47 #endif
48
49 if (showWarningScreen && !isDevVersion)
50 ShowWarningScreen();
51 else if (!SplashScreen.IsOpen())
52 ShowMainMenu();
53
54 // Reset scenario loading time
56
57 // Disable all events
59 }
60
61 //------------------------------------------------------------------------------------------------
62 private void ShowWarningScreen()
63 {
64 Widget w = GetGame().GetWorkspace().CreateWidgets(m_sSplashScreenLayout, GetGame().GetWorkspace());
65
67 w.AddHandler(comp);
68
69 if (!comp)
70 return;
71
72 // If splash screen was skipped (due to CLI for example) make sure, we have it flagged and do not run ShowWarningScreen again
73 if (SplashScreen.s_iSplashShown == 0)
74 SplashScreen.s_iSplashShown++;
75
76 comp.m_OnFinished.Insert(ShowMainMenu);
77 }
78
79 //------------------------------------------------------------------------------------------------
80 private void ShowMainMenu()
81 {
82 if (m_eMenu == ChimeraMenuPreset.MainMenu)
83 GetGame().m_bIsMainMenuOpen = true;
84
85 GetGame().GetMenuManager().OpenMenu(m_eMenu);
86
87 // Check hosting fail
88 SCR_KickDialogs.CheckLastServerHost();
89 }
90
91 //------------------------------------------------------------------------------------------------
92 static SCR_MainMenuEntity GetInstance()
93 {
94 return m_Instamce;
95 }
96};
ChimeraMenuPreset
Menu presets.
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition Game.c:8
static proto bool IsDev()
Return true if executable is developer build.
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external EntityEvent ClearEventMask(EntityEvent e)
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
void SCR_MainMenuEntity(IEntitySource src, IEntity parent)
static SCR_MainMenuEntity m_Instamce
override void EOnFrame(IEntity owner, float timeSlice)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14
EntityFlags
Various entity flags.
Definition EntityFlags.c:14