Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
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."
)]
6
class
SCR_MainMenuEntityClass
: GenericEntityClass
7
{
8
};
9
10
//------------------------------------------------------------------------------------------------
11
class
SCR_MainMenuEntity
:
GenericEntity
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
19
protected
static
SCR_MainMenuEntity
m_Instamce
;
20
21
//------------------------------------------------------------------------------------------------
22
void
SCR_MainMenuEntity
(
IEntitySource
src,
IEntity
parent)
23
{
24
m_Instamce
=
this
;
25
26
// Enable
27
SetEventMask
(
EntityEvent
.FRAME);
28
SetFlags
(
EntityFlags
.NO_TREE |
EntityFlags
.NO_LINK);
29
}
30
31
//------------------------------------------------------------------------------------------------
32
void
~SCR_MainMenuEntity
()
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
55
SCR_BaseLoadingScreenComponent
.
ResetLoadingTime
();
56
57
// Disable all events
58
ClearEventMask
(
EntityEvent
.ALL);
59
}
60
61
//------------------------------------------------------------------------------------------------
62
private
void
ShowWarningScreen()
63
{
64
Widget
w =
GetGame
().GetWorkspace().CreateWidgets(m_sSplashScreenLayout,
GetGame
().GetWorkspace());
65
66
SCR_IntroSplashScreen2Component
comp =
new
SCR_IntroSplashScreen2Component
();
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
ChimeraMenuPreset
Menu presets.
Definition
ChimeraMenuBase.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
Game
Definition
Game.c:8
Game::IsDev
static proto bool IsDev()
Return true if executable is developer build.
GenericEntity
Definition
GenericEntity.c:16
IEntity::IEntity
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
IEntity::SetEventMask
proto external EntityEvent SetEventMask(EntityEvent e)
IEntity::ClearEventMask
proto external EntityEvent ClearEventMask(EntityEvent e)
IEntity::SetFlags
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
IEntitySource
Definition
IEntitySource.c:13
ResourceName
Definition
ResourceName.c:13
SCR_BaseLoadingScreenComponent
Definition
SCR_BaseLoadingScreenComponent.c:4
SCR_BaseLoadingScreenComponent::ResetLoadingTime
static void ResetLoadingTime()
Definition
SCR_BaseLoadingScreenComponent.c:76
SCR_IntroSplashScreen2Component
Definition
SCR_IntroSplashScreen2Component.c:4
SCR_MainMenuEntityClass
Main menu entity.
Definition
ScriptedMainMenuEntity.c:7
SCR_MainMenuEntity::SCR_MainMenuEntity
void SCR_MainMenuEntity(IEntitySource src, IEntity parent)
Definition
ScriptedMainMenuEntity.c:22
SCR_MainMenuEntity::~SCR_MainMenuEntity
void ~SCR_MainMenuEntity()
Definition
ScriptedMainMenuEntity.c:32
SCR_MainMenuEntity::m_Instamce
static SCR_MainMenuEntity m_Instamce
Definition
ScriptedMainMenuEntity.c:19
SCR_MainMenuEntity::EOnFrame
override void EOnFrame(IEntity owner, float timeSlice)
Definition
ScriptedMainMenuEntity.c:40
SplashScreen
Definition
SplashScreen.c:5
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
EntityFlags
EntityFlags
Various entity flags.
Definition
EntityFlags.c:14
scripts
Game
UI
Menu
ScriptedMainMenuEntity.c
Generated by
1.17.0