Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MapEditorComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Editor", description: "", icon: "WBData/ComponentEditorProps/componentEditor.png")]
5
10{
11 [Attribute(SCR_SoundEvent.SOUND_HUD_MAP_OPEN, UIWidgets.EditBox)]
12 protected string m_sOpeningEditorMapSfx;
13
14 [Attribute(SCR_SoundEvent.SOUND_HUD_MAP_CLOSE, UIWidgets.EditBox)]
15 protected string m_sClosingEditorMapSfx;
16
21 protected bool m_bWasMapOpened;
22 protected bool m_bIsInit;
23
25
26 protected ref Color m_CameraIconColor = Color.White;
27
29 {
30 return m_bIsInit;
31 }
32
34 {
35 m_MapHandler = mapHandler;
37 }
38
43
44 void ToggleMap()
45 {
47 }
48
49 void ShowMap(bool show)
50 {
51 if (!m_MapHandler)
52 {
53 return;
54 }
55
56 //--- In limited editor, map can be opened only if map gadget is in player's inventory
57 if (show && GetManager().IsLimited())
58 {
60 if (!playerEntity)
61 return; //--- Limited editor works only if player has an entity, so this should never happen.
62
64 if (gadgetManager && !gadgetManager.GetGadgetByType(EGadgetType.MAP))
65 return;
66 }
67
68 if (show)
70 else
72
74 m_bWasMapOpened = show;
75 }
76
78 {
79 if (IsEditorMapOpen())
80 {
81 ShowMap(false);
82 }
83 }
84
85 protected bool IsEditorMapOpen()
86 {
87 if (m_MapHandler)
88 {
89 return m_MapHandler.IsEditorMapOpen();
90 }
91 return false;
92 }
93
94 protected void OnLimitedChange(bool isLimited)
95 {
96 //--- Close the map when the editor became limited
97 if (isLimited && IsEditorMapOpen())
98 {
99 ShowMap(false);
100 }
101 }
103 {
105 if (!menuComponent || !menuComponent.GetMenu())
106 return null;
107
108 SCR_MapEditorUIComponent mapEditorComponent = SCR_MapEditorUIComponent.Cast(menuComponent.GetMenu().GetRootComponent().FindComponent(SCR_MapEditorUIComponent, true));
109 return mapEditorComponent;
110 }
111
112 override void OnPostInit(IEntity owner)
113 {
115 return;
116 super.OnPostInit(owner);
117
119 if (!m_MapEntity)
120 return;
121
122 BaseGameMode gameMode = GetGame().GetGameMode();
123 if (!gameMode)
124 return;
125
126 SCR_MapConfigComponent configComp = SCR_MapConfigComponent.Cast(gameMode.FindComponent(SCR_MapConfigComponent));
127 if (configComp)
128 m_sMapConfigEditorPrefab = configComp.GetEditorMapConfig();
129
131 if (!m_EditorManager)
132 return;
133
134 m_EditorManager.GetOnLimitedChange().Insert(OnLimitedChange);
135
137 if (previewEntityComponent)
138 {
139 previewEntityComponent.GetOnPreviewCreate().Insert(OnPlacingPreviewCreate);
140 }
141
142 m_bIsInit = true;
143 }
144
145 override void EOnDeactivate(IEntity owner)
146 {
148 return;
149
150 if (m_CameraIcon)
151 {
152 delete m_CameraIcon;
153 }
154 }
155};
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
bool IsLimited()
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
Definition Color.c:13
proto external Managed FindComponent(typename typeName)
void SCR_BaseEditorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_EditorManagerEntity GetManager()
IEntity GetGadgetByType(EGadgetType type)
static bool IsEditMode()
Definition Functions.c:1566
override void EOnDeactivate(IEntity owner)
void OnLimitedChange(bool isLimited)
void SetMapHandler(SCR_MapEditorUIComponent mapHandler)
override void OnPostInit(IEntity owner)
SCR_MapEditorUIComponent FindMapHandler()
SCR_MapEditorUIComponent m_MapHandler
SCR_EditorManagerEntity m_EditorManager
static SCR_MapEntity GetMapInstance()
Get map entity instance.
static IEntity GetLocalControlledEntity()
SCR_FieldOfViewSettings Attribute