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_TimePresetsEditorAttribute.c
Go to the documentation of this file.
1
4
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
5
class
SCR_TimePresetsEditorAttribute
:
SCR_BasePresetsEditorAttribute
6
{
7
override
SCR_BaseEditorAttributeVar
ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
8
{
9
//If opened in global attributes
10
if
(!
IsGameMode
(item))
11
return
null;
12
13
BaseGameMode gameMode =
GetGame
().GetGameMode();
14
if
(!gameMode)
15
return
null;
16
17
ChimeraWorld
world =
ChimeraWorld
.CastFrom(gameMode.GetWorld());
18
if
(!world)
19
return
null;
20
21
TimeAndWeatherManagerEntity
timeManager = world.GetTimeAndWeatherManager();
22
if
(!timeManager)
23
return
null;
24
25
26
SCR_UIInfo
uiInfo;
27
return
SCR_BaseEditorAttributeVar
.
CreateInt
(timeManager.
GetCurrentDayTimeUIInfo
(uiInfo));
28
}
29
30
override
void
UpdateInterlinkedVariables(
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
bool
isInit =
false
)
31
{
32
if
(!var)
33
return
;
34
35
if
(isInit)
36
{
37
manager.SetAttributeAsSubAttribute(
SCR_DaytimeEditorAttribute
);
38
return
;
39
}
40
41
int
index
= var.
GetInt
();
42
43
if
(
index < 0 || index >
=
m_aValues
.Count())
44
return
;
45
46
//Recreate presets in case date changed
47
CreatePresets
();
48
49
//Set new time
50
SCR_BaseEditorAttributeVar
newTime =
new
SCR_BaseEditorAttributeVar
();
51
newTime.
SetFloat
(
m_aValues
[
index
].GetFloatValue());
52
manager.SetAttributeVariable(
SCR_DaytimeEditorAttribute
, newTime);
53
}
54
55
//The Time preset doesn't actually set anything other then the slider
56
override
void
WriteVariable(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
57
{
58
return
;
59
}
60
61
override
void
CreatePresets
()
62
{
63
int
year = -1;
64
int
month = 5;
65
int
day = 23;
66
67
ChimeraWorld
world =
GetGame
().GetWorld();
68
TimeAndWeatherManagerEntity
timeManager = world.GetTimeAndWeatherManager();
69
if
(!timeManager)
70
return
;
71
72
SCR_AttributesManagerEditorComponent manager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
73
if
(manager)
74
{
75
SCR_DateEditorAttribute
dateAttribute =
SCR_DateEditorAttribute
.Cast(manager.GetAttributeRef(
SCR_DateEditorAttribute
));
76
if
(dateAttribute)
77
{
78
SCR_BaseEditorAttributeVar
dateVar = dateAttribute.GetVariable();
79
if
(dateVar)
80
{
81
vector
date = dateVar.
GetVector
();
82
year = dateAttribute.
GetYearByIndex
(date[2]);
83
month = date[1] +1;
84
day = date[0] +1;
85
}
86
}
87
}
88
89
if
(year < 0)
90
timeManager.GetDate(year, month, day);
91
92
m_aValues
.Clear();
93
94
array<SCR_DayTimeInfoBase> daytimeInfo =
new
array<SCR_DayTimeInfoBase>;
95
timeManager.
GetDayTimeInfoArray
(daytimeInfo, year, month, day);
96
SCR_EditorAttributeFloatStringValueHolder
value
97
float
time;
98
99
foreach
(
SCR_DayTimeInfoBase
dayTime: daytimeInfo)
100
{
101
value =
new
SCR_EditorAttributeFloatStringValueHolder
();
102
103
time = dayTime.GetDayTime();
104
if
(time >= 24)
105
time = 0;
106
107
value.SetWithUIInfo(dayTime.GetDayTimeUIInfo(), time * 3600);
108
m_aValues
.Insert(value);
109
}
110
}
111
112
override
void
PreviewVariable(
bool
setPreview, SCR_AttributesManagerEditorComponent manager)
113
{
114
if
(!manager)
115
return
;
116
117
SCR_BaseEditorAttribute
timeAttribute = manager.GetAttributeRef(
SCR_DaytimeEditorAttribute
);
118
if
(timeAttribute)
119
timeAttribute.
PreviewVariable
(setPreview, manager);
120
}
121
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
ChimeraWorld
Definition
ChimeraWorld.c:13
SCR_BaseEditorAttributeCustomTitle
Definition
SCR_BaseEditorAttribute.c:876
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition
SCR_BaseEditorAttribute.c:4
SCR_BaseEditorAttribute::PreviewVariable
void PreviewVariable(bool setPreview, SCR_AttributesManagerEditorComponent manager)
SCR_BaseEditorAttribute::IsGameMode
bool IsGameMode(Managed item)
Definition
SCR_BaseEditorAttribute.c:466
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::CreateInt
static SCR_BaseEditorAttributeVar CreateInt(int value)
Definition
SCR_BaseEditorAttributeVar.c:107
SCR_BaseEditorAttributeVar::GetInt
int GetInt()
Definition
SCR_BaseEditorAttributeVar.c:20
SCR_BaseEditorAttributeVar::GetVector
vector GetVector()
Definition
SCR_BaseEditorAttributeVar.c:74
SCR_BaseEditorAttributeVar::SetFloat
void SetFloat(float value)
Definition
SCR_BaseEditorAttributeVar.c:30
SCR_BaseFloatValueHolderEditorAttribute::m_aValues
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:6
SCR_BasePresetsEditorAttribute
Definition
SCR_BasePresetsEditorAttribute.c:6
SCR_BasePresetsEditorAttribute::CreatePresets
void CreatePresets()
Definition
SCR_BasePresetsEditorAttribute.c:28
SCR_DateEditorAttribute
Definition
SCR_DateEditorAttribute.c:3
SCR_DateEditorAttribute::GetYearByIndex
int GetYearByIndex(int index)
Definition
SCR_DateEditorAttribute.c:136
SCR_DayTimeInfoBase
Definition
TimeAndWeatherManagerEntity.c:999
SCR_DaytimeEditorAttribute
Definition
SCR_DaytimeEditorAttribute.c:6
SCR_EditorAttributeFloatStringValueHolder
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:61
SCR_TimePresetsEditorAttribute
Definition
SCR_TimePresetsEditorAttribute.c:6
SCR_UIInfo
Definition
SCR_UIInfo.c:8
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
TimeAndWeatherManagerEntity::GetCurrentDayTimeUIInfo
int GetCurrentDayTimeUIInfo(out SCR_UIInfo uiInfo)
Definition
TimeAndWeatherManagerEntity.c:490
TimeAndWeatherManagerEntity::GetDayTimeInfoArray
int GetDayTimeInfoArray(out notnull array< SCR_DayTimeInfoBase > dayTimeInfoArray, int year=-1, int month=-1, int day=-1)
Definition
TimeAndWeatherManagerEntity.c:553
vector
Definition
vector.c:13
scripts
Game
Editor
Containers
Attributes
SCR_TimePresetsEditorAttribute.c
Generated by
1.17.0