Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
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"
)]
2
class
SCR_MapEditorComponentClass
:
SCR_BaseEditorComponentClass
3
{
4
};
5
9
class
SCR_MapEditorComponent
:
SCR_BaseEditorComponent
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
17
protected
ResourceName
m_sMapConfigEditorPrefab
;
18
protected
SCR_MapEntity
m_MapEntity
;
19
protected
SCR_EditorManagerEntity
m_EditorManager
;
20
protected
MapItem
m_CameraIcon
;
21
protected
bool
m_bWasMapOpened
;
22
protected
bool
m_bIsInit
;
23
24
protected
SCR_MapEditorUIComponent
m_MapHandler
;
25
26
protected
ref
Color
m_CameraIconColor
=
Color
.White;
27
28
bool
GetMapAvailable
()
29
{
30
return
m_bIsInit
;
31
}
32
33
void
SetMapHandler
(
SCR_MapEditorUIComponent
mapHandler)
34
{
35
m_MapHandler
= mapHandler;
36
ShowMap
(
m_bWasMapOpened
);
37
}
38
39
ResourceName
GetMapConfigPrefab
()
40
{
41
return
m_sMapConfigEditorPrefab
;
42
}
43
44
void
ToggleMap
()
45
{
46
ShowMap
(!
IsEditorMapOpen
());
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
{
59
IEntity
playerEntity =
SCR_PlayerController
.
GetLocalControlledEntity
();
60
if
(!playerEntity)
61
return
;
//--- Limited editor works only if player has an entity, so this should never happen.
62
63
SCR_GadgetManagerComponent
gadgetManager =
SCR_GadgetManagerComponent
.Cast(playerEntity.
FindComponent
(
SCR_GadgetManagerComponent
));
64
if
(gadgetManager && !gadgetManager.
GetGadgetByType
(EGadgetType.MAP))
65
return
;
66
}
67
68
if
(show)
69
SCR_UISoundEntity
.SoundEvent(
m_sOpeningEditorMapSfx
,
true
);
70
else
71
SCR_UISoundEntity
.SoundEvent(
m_sClosingEditorMapSfx
,
true
);
72
73
m_MapHandler
.ToggleMap(show,
m_sMapConfigEditorPrefab
);
74
m_bWasMapOpened
= show;
75
}
76
77
void
OnPlacingPreviewCreate
()
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
}
102
protected
SCR_MapEditorUIComponent
FindMapHandler
()
103
{
104
SCR_MenuEditorComponent
menuComponent =
SCR_MenuEditorComponent
.Cast(
SCR_MenuEditorComponent
.GetInstance(
SCR_MenuEditorComponent
));
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
{
114
if
(
SCR_Global
.
IsEditMode
())
115
return
;
116
super.OnPostInit(owner);
117
118
m_MapEntity
=
SCR_MapEntity
.
GetMapInstance
();
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
130
m_EditorManager
=
SCR_EditorManagerEntity
.Cast(owner);
131
if
(!
m_EditorManager
)
132
return
;
133
134
m_EditorManager
.GetOnLimitedChange().Insert(
OnLimitedChange
);
135
136
SCR_PreviewEntityEditorComponent
previewEntityComponent =
SCR_PreviewEntityEditorComponent
.Cast(
SCR_PreviewEntityEditorComponent
.GetInstance(
SCR_PreviewEntityEditorComponent
));
137
if
(previewEntityComponent)
138
{
139
previewEntityComponent.
GetOnPreviewCreate
().Insert(
OnPlacingPreviewCreate
);
140
}
141
142
m_bIsInit
=
true
;
143
}
144
145
override
void
EOnDeactivate
(
IEntity
owner)
146
{
147
if
(
SCR_Global
.
IsEditMode
())
148
return
;
149
150
if
(
m_CameraIcon
)
151
{
152
delete
m_CameraIcon
;
153
}
154
}
155
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
IsLimited
bool IsLimited()
Definition
SCR_EditorManagerEntity.c:529
SCR_EditorManagerEntity
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
Definition
SCR_EditorManagerEntity.c:2211
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
Color
Definition
Color.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
MapItem
Definition
MapItem.c:13
ResourceName
Definition
ResourceName.c:13
SCR_BaseEditorComponentClass
Definition
SCR_BaseEditorComponent.c:3
SCR_BaseEditorComponent::SCR_BaseEditorComponent
void SCR_BaseEditorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_BaseEditorComponent.c:683
SCR_BaseEditorComponent::GetManager
SCR_EditorManagerEntity GetManager()
Definition
SCR_BaseEditorComponent.c:459
SCR_GadgetManagerComponent
Definition
SCR_GadgetManagerComponent.c:140
SCR_GadgetManagerComponent::GetGadgetByType
IEntity GetGadgetByType(EGadgetType type)
Definition
SCR_GadgetManagerComponent.c:348
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_MapEditorComponentClass
Definition
SCR_MapEditorComponent.c:3
SCR_MapEditorComponent
Definition
SCR_MapEditorComponent.c:10
SCR_MapEditorComponent::GetMapConfigPrefab
ResourceName GetMapConfigPrefab()
Definition
SCR_MapEditorComponent.c:39
SCR_MapEditorComponent::m_CameraIconColor
ref Color m_CameraIconColor
Definition
SCR_MapEditorComponent.c:26
SCR_MapEditorComponent::m_sMapConfigEditorPrefab
ResourceName m_sMapConfigEditorPrefab
Definition
SCR_MapEditorComponent.c:17
SCR_MapEditorComponent::ShowMap
void ShowMap(bool show)
Definition
SCR_MapEditorComponent.c:49
SCR_MapEditorComponent::EOnDeactivate
override void EOnDeactivate(IEntity owner)
Definition
SCR_MapEditorComponent.c:145
SCR_MapEditorComponent::OnLimitedChange
void OnLimitedChange(bool isLimited)
Definition
SCR_MapEditorComponent.c:94
SCR_MapEditorComponent::m_CameraIcon
MapItem m_CameraIcon
Definition
SCR_MapEditorComponent.c:20
SCR_MapEditorComponent::SetMapHandler
void SetMapHandler(SCR_MapEditorUIComponent mapHandler)
Definition
SCR_MapEditorComponent.c:33
SCR_MapEditorComponent::OnPlacingPreviewCreate
void OnPlacingPreviewCreate()
Definition
SCR_MapEditorComponent.c:77
SCR_MapEditorComponent::OnPostInit
override void OnPostInit(IEntity owner)
Definition
SCR_MapEditorComponent.c:112
SCR_MapEditorComponent::m_sOpeningEditorMapSfx
string m_sOpeningEditorMapSfx
Definition
SCR_MapEditorComponent.c:12
SCR_MapEditorComponent::ToggleMap
void ToggleMap()
Definition
SCR_MapEditorComponent.c:44
SCR_MapEditorComponent::IsEditorMapOpen
bool IsEditorMapOpen()
Definition
SCR_MapEditorComponent.c:85
SCR_MapEditorComponent::m_bIsInit
bool m_bIsInit
Definition
SCR_MapEditorComponent.c:22
SCR_MapEditorComponent::FindMapHandler
SCR_MapEditorUIComponent FindMapHandler()
Definition
SCR_MapEditorComponent.c:102
SCR_MapEditorComponent::GetMapAvailable
bool GetMapAvailable()
Definition
SCR_MapEditorComponent.c:28
SCR_MapEditorComponent::m_MapEntity
SCR_MapEntity m_MapEntity
Definition
SCR_MapEditorComponent.c:18
SCR_MapEditorComponent::m_MapHandler
SCR_MapEditorUIComponent m_MapHandler
Definition
SCR_MapEditorComponent.c:24
SCR_MapEditorComponent::m_bWasMapOpened
bool m_bWasMapOpened
Definition
SCR_MapEditorComponent.c:21
SCR_MapEditorComponent::m_sClosingEditorMapSfx
string m_sClosingEditorMapSfx
Definition
SCR_MapEditorComponent.c:15
SCR_MapEditorComponent::m_EditorManager
SCR_EditorManagerEntity m_EditorManager
Definition
SCR_MapEditorComponent.c:19
SCR_MapEditorUIComponent
Definition
SCR_MapEditorUIComponent.c:2
SCR_MapEntity
Definition
SCR_MapEntity.c:18
SCR_MapEntity::GetMapInstance
static SCR_MapEntity GetMapInstance()
Get map entity instance.
Definition
SCR_MapEntity.c:112
SCR_MenuEditorComponent
Definition
SCR_MenuEditorComponent.c:9
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::GetLocalControlledEntity
static IEntity GetLocalControlledEntity()
Definition
SCR_PlayerController.c:495
SCR_PreviewEntityEditorComponent
Definition
SCR_PreviewEntityEditorComponent.c:13
SCR_PreviewEntityEditorComponent::GetOnPreviewCreate
ScriptInvoker GetOnPreviewCreate()
Definition
SCR_PreviewEntityEditorComponent.c:798
SCR_SoundEvent
Definition
SCR_SoundEvent.c:2
SCR_UISoundEntity
Definition
SCR_UISoundEntity.c:8
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
Components
Editor
SCR_MapEditorComponent.c
Generated by
1.17.0