Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CommandPostMapMenuUI.c
Go to the documentation of this file.
1
4{
6
7 protected bool m_bWasMapClosedByEditor;
9
10 //------------------------------------------------------------------------------------------------
15
16 //------------------------------------------------------------------------------------------------
17 protected void OpenMap()
18 {
19 if (m_MapEntity)
20 {
21 BaseGameMode gameMode = GetGame().GetGameMode();
22 if (!gameMode)
23 return;
24
25 SCR_MapConfigComponent configComp = SCR_MapConfigComponent.Cast(gameMode.FindComponent(SCR_MapConfigComponent));
26 if (!configComp)
27 return;
28
29 EMapEntityMode currentMapEntityMode = configComp.GetCommandPostMapEntityMode();
30 ResourceName configResourceName = "";
31
32 switch (currentMapEntityMode)
33 {
34 case EMapEntityMode.COMBAT_SUPPORT_STATION :
35 configResourceName = configComp.GetCombatSupportStationMapConfig();
36 break;
37
38 case EMapEntityMode.OPERATIONS_STATION :
39 configResourceName = configComp.GetOperationsStationMapConfig();
40 break;
41
42 case EMapEntityMode.LOGISTICS_STATION :
43 configResourceName = configComp.GetLogisticsStationMapConfig();
44 break;
45
46 default:
47 Print("SCR_CommandPostMapMenuUI EMapEntityMode is not set", LogLevel.ERROR);
48 break;
49 }
50
51 MapConfiguration mapConfigFullscreen = m_MapEntity.SetupMapConfig(currentMapEntityMode, configResourceName, GetRootWidget());
52 m_MapEntity.OpenMap(mapConfigFullscreen);
53 }
54 }
55
56 //------------------------------------------------------------------------------------------------
57 override void OnMenuOpen()
58 {
59 OpenMap();
60
61 Widget wChatPanel = GetRootWidget().FindAnyWidget("ChatPanel");
62 if (wChatPanel)
63 m_ChatPanel = SCR_ChatPanel.Cast(wChatPanel.FindHandler(SCR_ChatPanel));
64
65 GetGame().GetInputManager().AddActionListener("ChatToggle", EActionTrigger.DOWN, Callback_OnChatToggleAction);
66
67 SCR_EditorManagerEntity editorManagerEntity = SCR_EditorManagerEntity.GetInstance();
68 if (!editorManagerEntity)
69 return;
70
71 editorManagerEntity.GetOnOpened().Insert(OnEditorOpened);
72 editorManagerEntity.GetOnClosed().Insert(OnEditorClosed);
73
75 if (!character)
76 return;
77
78 SCR_CharacterControllerComponent characterController = SCR_CharacterControllerComponent.Cast(character.GetCharacterController());
79 if (!characterController)
80 return;
81
82 m_CharacterController = characterController;
83 m_CharacterController.m_OnLifeStateChanged.Insert(OnLifeStateChanged);
84 }
85
86 //------------------------------------------------------------------------------------------------
87 override void OnMenuClose()
88 {
89 super.OnMenuClose();
90
91 SCR_EditorManagerEntity editorManagerEntity = SCR_EditorManagerEntity.GetInstance();
92 if (!editorManagerEntity)
93 return;
94
95 editorManagerEntity.GetOnOpened().Remove(OnEditorOpened);
96 editorManagerEntity.GetOnClosed().Remove(OnEditorClosed);
97
99 m_CharacterController.m_OnLifeStateChanged.Remove(OnLifeStateChanged);
100 }
101
102 //------------------------------------------------------------------------------------------------
103 protected void OnEditorOpened()
104 {
105 if (m_MapEntity.IsOpen())
106 {
107 // close map, the map will be closed by the editor anyway
108 m_MapEntity.CloseMap();
110 }
111 }
112
113 //------------------------------------------------------------------------------------------------
114 protected void OnEditorClosed()
115 {
117 {
118 m_OnClosedByEditor.Invoke();
119 Close();
120 }
121
123 }
124
125 //------------------------------------------------------------------------------------------------
126 protected void OnLifeStateChanged(ECharacterLifeState previousLifeState, ECharacterLifeState newLifeState, bool isJIP)
127 {
128 if (newLifeState == ECharacterLifeState.ALIVE)
129 return;
130
132
133 Close();
134 }
135}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
EMapEntityMode
Mode of the map.
Widget GetRootWidget()
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
proto native void Close()
Command post map menu.
void OnEditorClosed()
ScriptInvokerVoid GetOnClosedByEditor()
void OnEditorOpened()
ref ScriptInvokerVoid m_OnClosedByEditor
SCR_CharacterControllerComponent m_CharacterController
void OnLifeStateChanged(ECharacterLifeState previousLifeState, ECharacterLifeState newLifeState, bool isJIP)
override void OnMenuOpen()
void OpenMap()
bool m_bWasMapClosedByEditor
override void OnMenuClose()
Fullscreen map menu.
SCR_MapEntity m_MapEntity
void Callback_OnChatToggleAction()
SCR_ChatPanel m_ChatPanel
static IEntity GetLocalControlledEntity()
ECharacterLifeState
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
EActionTrigger