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_SetBuildingProgressEditorAttribute.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
2
class
SetBuildingProgressEditorAttribute
:
SCR_BaseValueListEditorAttribute
3
{
4
//------------------------------------------------------------------------------------------------
5
override
SCR_BaseEditorAttributeVar
ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
6
{
7
SCR_EditableEntityComponent
editableEntity =
SCR_EditableEntityComponent
.Cast(item);
8
if
(!editableEntity)
9
return
null;
10
11
SCR_CampaignBuildingLayoutComponent layoutComponent =
GetLayoutComponent
(editableEntity);
12
if
(!layoutComponent)
13
return
null;
14
15
if
(layoutComponent.GetToBuildValue() <= 0)
16
return
null;
17
18
//~ Send over current and max value as max value is used in UI to set slider max.
19
return
SCR_BaseEditorAttributeVar
.
CreateFloat
((layoutComponent.GetCurrentBuildValue() / layoutComponent.GetToBuildValue()) * 100);
20
}
21
22
//------------------------------------------------------------------------------------------------
23
protected
SCR_CampaignBuildingLayoutComponent
GetLayoutComponent
(notnull
SCR_EditableEntityComponent
editableEntity)
24
{
25
IEntity
child = editableEntity.GetOwner().
GetChildren
();
26
SCR_CampaignBuildingLayoutComponent layoutComponent;
27
while
(child)
28
{
29
// The preview exist at this moment but will be deleted, skip it.
30
layoutComponent = SCR_CampaignBuildingLayoutComponent.Cast(child.
FindComponent
(SCR_CampaignBuildingLayoutComponent));
31
if
(layoutComponent)
32
break
;
33
34
child = child.
GetSibling
();
35
}
36
37
return
layoutComponent;
38
}
39
40
//------------------------------------------------------------------------------------------------
41
override
void
WriteVariable
(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
42
{
43
if
(!var)
44
return
;
45
46
SCR_EditableEntityComponent
editableEntity =
SCR_EditableEntityComponent
.Cast(item);
47
if
(!editableEntity)
48
return
;
49
50
SCR_CampaignBuildingLayoutComponent layoutComponent =
GetLayoutComponent
(editableEntity);
51
if
(!layoutComponent)
52
return
;
53
54
layoutComponent.SetBuildingValue(layoutComponent.GetToBuildValue() * (var.
GetFloat
() * 0.01));
55
}
56
};
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetChildren
proto external IEntity GetChildren()
IEntity::GetSibling
proto external IEntity GetSibling()
SCR_BaseEditorAttributeCustomTitle
Definition
SCR_BaseEditorAttribute.c:876
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::GetFloat
float GetFloat()
Definition
SCR_BaseEditorAttributeVar.c:38
SCR_BaseEditorAttributeVar::CreateFloat
static SCR_BaseEditorAttributeVar CreateFloat(float value)
Definition
SCR_BaseEditorAttributeVar.c:113
SCR_BaseValueListEditorAttribute
Definition
SCR_BaseValueListEditorAttribute.c:6
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SetBuildingProgressEditorAttribute
Definition
SCR_SetBuildingProgressEditorAttribute.c:3
SetBuildingProgressEditorAttribute::WriteVariable
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
Definition
SCR_SetBuildingProgressEditorAttribute.c:41
SetBuildingProgressEditorAttribute::GetLayoutComponent
SCR_CampaignBuildingLayoutComponent GetLayoutComponent(notnull SCR_EditableEntityComponent editableEntity)
Definition
SCR_SetBuildingProgressEditorAttribute.c:23
scripts
Game
Editor
Containers
Attributes
SCR_SetBuildingProgressEditorAttribute.c
Generated by
1.17.0