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_DateEditorAttribute.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
2
class
SCR_DateEditorAttribute
:
SCR_BaseEditorAttribute
3
{
4
//TODO: Needs proper system to know the order of dmy
5
[
Attribute
(defvalue:
"dmy"
,
desc
:
"The order in which days, months and years appear. this could be dmy ymd mdy etc. This is a temporary system until a more permanent solution is added"
)]
6
protected
string
m_sDateFormatOrder
;
7
8
[
Attribute
(uiwidget:
UIWidgets
.LocaleEditBox, defvalue:
"#AR-Date_Day"
)]
9
protected
LocalizedString
m_sDayLabel
;
10
11
[
Attribute
(uiwidget:
UIWidgets
.LocaleEditBox, defvalue:
"#AR-Date_Month"
)]
12
protected
LocalizedString
m_sMonthLabel
;
13
14
[
Attribute
(uiwidget:
UIWidgets
.LocaleEditBox, defvalue:
"#AR-Date_Year"
)]
15
protected
LocalizedString
m_sYearLabel
;
16
17
[
Attribute
(uiwidget:
UIWidgets
.LocaleEditBox)]
18
protected
ref array<ref LocalizedString>
m_aMonthList
;
19
20
[
Attribute
(defvalue:
"1940"
)]
21
protected
int
m_iYearStartDate
;
22
23
[
Attribute
(defvalue:
"1995"
)]
24
protected
int
m_iYearEndDate
;
25
26
protected
ref array<int>
m_aYearArray
= {};
27
28
override
SCR_BaseEditorAttributeVar
ReadVariable
(Managed item, SCR_AttributesManagerEditorComponent manager)
29
{
30
//If opened in global attributes
31
if
(!
IsGameMode
(item))
32
return
null;
33
34
GenericEntity
ent =
GenericEntity
.Cast(item);
35
ChimeraWorld
world = ent.
GetWorld
();
36
TimeAndWeatherManagerEntity
timeManager = world.GetTimeAndWeatherManager();
37
if
(!timeManager)
38
return
null;
39
40
//Get date
41
vector
date =
Vector
(timeManager.GetDay() -1, timeManager.GetMonth() -1,
GetYearIndex
(timeManager.GetYear()));
42
return
SCR_BaseEditorAttributeVar
.
CreateVector
(date);
43
}
44
45
override
void
WriteVariable
(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
46
{
47
if
(!var)
return
;
48
49
GenericEntity
ent =
GenericEntity
.Cast(item);
50
ChimeraWorld
world = ent.
GetWorld
();
51
TimeAndWeatherManagerEntity
timeManager = world.GetTimeAndWeatherManager();
52
if
(!timeManager)
return
;
53
54
CreateYearArray
();
55
vector
date = var.
GetVector
();
56
int
day = date[0] +1;
57
int
month = date[1] +1;
58
int
year =
m_aYearArray
[date[2]];
59
60
if
(item)
61
{
62
SCR_NotificationsComponent.SendToUnlimitedEditorPlayers(
ENotification
.EDITOR_ATTRIBUTES_DATE_CHANGED, playerID, day, month, year);
63
}
64
65
timeManager.SetDate(year, month, day);
66
}
67
68
override
void
UpdateInterlinkedVariables
(
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
bool
isInit =
false
)
69
{
70
if
(!var || isInit)
71
return
;
72
73
//If date changed set time preset selected false
74
manager.SetAttributeSelected(
SCR_TimePresetsEditorAttribute
,
false
, -1);
75
}
76
81
void
GetYearArray
(notnull out array<int> yearArray)
82
{
83
CreateYearArray
();
84
85
foreach
(
int
year :
m_aYearArray
)
86
{
87
yearArray.Insert(year);
88
}
89
}
90
91
protected
void
CreateYearArray
()
92
{
93
if
(
m_aYearArray
.Count() != 0)
94
return
;
95
96
ChimeraWorld
world =
GetGame
().GetWorld();
97
TimeAndWeatherManagerEntity
timeManager = world.GetTimeAndWeatherManager();
98
if
(!timeManager)
99
return
;
100
101
int
currentYear = timeManager.GetYear();
102
103
//Safty
104
if
(currentYear <
m_iYearStartDate
)
105
m_iYearStartDate
= currentYear;
106
if
(currentYear >
m_iYearEndDate
)
107
m_iYearEndDate
= currentYear;
108
if
(
m_iYearEndDate
<=
m_iYearStartDate
)
109
m_iYearEndDate
=
m_iYearStartDate
+1;
110
111
//Create year list
112
for
(
int
y =
m_iYearStartDate
; y <=
m_iYearEndDate
; y++)
113
{
114
m_aYearArray
.Insert(y);
115
}
116
}
117
118
protected
int
GetYearIndex
(
int
year)
119
{
120
CreateYearArray
();
121
122
if
(
m_aYearArray
.Contains(year))
123
{
124
return
m_aYearArray
.Find(year);
125
}
126
else
127
{
128
return
0;
129
}
130
}
131
132
/* Returns year by given index, called by SCR_DaytimeEditorAttribute preview
133
\param index given index
134
\return int year
135
*/
136
int
GetYearByIndex
(
int
index
)
137
{
138
CreateYearArray
();
139
140
if
(
index < 0 || index >
=
m_aYearArray
.Count())
141
return
1990;
142
143
return
m_aYearArray
[
index
];
144
}
145
146
override
int
GetEntries
(notnull array<ref SCR_BaseEditorAttributeEntry> outEntries)
147
{
148
outEntries.Insert(
new
SCR_BaseEditorAttributeEntryText
(
GetUIInfo
().
GetName
()));
149
outEntries.Insert(
new
SCR_BaseEditorAttributeEntryText
(
m_sDateFormatOrder
));
150
outEntries.Insert(
new
SCR_BaseEditorAttributeEntryText
(
m_sDayLabel
));
151
outEntries.Insert(
new
SCR_BaseEditorAttributeEntryText
(
m_sMonthLabel
));
152
outEntries.Insert(
new
SCR_BaseEditorAttributeEntryText
(
m_sYearLabel
));
153
outEntries.Insert(
new
SCR_EditorAttributeEntryStringArray
(
m_aMonthList
));
154
155
CreateYearArray
();
156
outEntries.Insert(
new
SCR_EditorAttributeEntryIntArray
(
m_aYearArray
));
157
return
outEntries.Count();
158
}
159
160
override
void
PreviewVariable
(
bool
setPreview, SCR_AttributesManagerEditorComponent manager)
161
{
162
if
(!manager)
163
return
;
164
165
SCR_BaseEditorAttribute
timeAttribute = manager.GetAttributeRef(
SCR_DaytimeEditorAttribute
);
166
if
(timeAttribute)
167
timeAttribute.
PreviewVariable
(setPreview, manager);
168
}
169
};
ENotification
ENotification
Definition
ENotification.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_EditorAttributeEntryStringArray
void SCR_EditorAttributeEntryStringArray(array< ref LocalizedString > values)
Definition
SCR_BaseEditorAttribute.c:698
SCR_BaseEditorAttributeEntryText
void SCR_BaseEditorAttributeEntryText(string text)
Definition
SCR_BaseEditorAttribute.c:494
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
GetName
string GetName()
Definition
SCR_NotificationSenderComponent.c:15
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
ChimeraWorld
Definition
ChimeraWorld.c:13
GenericEntity
Definition
GenericEntity.c:16
IEntity::GetWorld
proto external BaseWorld GetWorld()
LocalizedString
Definition
LocalizedString.c:22
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_BaseEditorAttribute::GetUIInfo
SCR_EditorAttributeUIInfo GetUIInfo()
Definition
SCR_BaseEditorAttribute.c:57
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::CreateVector
static SCR_BaseEditorAttributeVar CreateVector(vector value)
Definition
SCR_BaseEditorAttributeVar.c:125
SCR_BaseEditorAttributeVar::GetVector
vector GetVector()
Definition
SCR_BaseEditorAttributeVar.c:74
SCR_DateEditorAttribute
Definition
SCR_DateEditorAttribute.c:3
SCR_DateEditorAttribute::GetYearIndex
int GetYearIndex(int year)
Definition
SCR_DateEditorAttribute.c:118
SCR_DateEditorAttribute::CreateYearArray
void CreateYearArray()
Definition
SCR_DateEditorAttribute.c:91
SCR_DateEditorAttribute::m_sDateFormatOrder
string m_sDateFormatOrder
Definition
SCR_DateEditorAttribute.c:6
SCR_DateEditorAttribute::m_sYearLabel
LocalizedString m_sYearLabel
Definition
SCR_DateEditorAttribute.c:15
SCR_DateEditorAttribute::WriteVariable
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
Definition
SCR_DateEditorAttribute.c:45
SCR_DateEditorAttribute::GetYearArray
void GetYearArray(notnull out array< int > yearArray)
Definition
SCR_DateEditorAttribute.c:81
SCR_DateEditorAttribute::m_aMonthList
ref array< ref LocalizedString > m_aMonthList
Definition
SCR_DateEditorAttribute.c:18
SCR_DateEditorAttribute::m_iYearStartDate
int m_iYearStartDate
Definition
SCR_DateEditorAttribute.c:21
SCR_DateEditorAttribute::m_sMonthLabel
LocalizedString m_sMonthLabel
Definition
SCR_DateEditorAttribute.c:12
SCR_DateEditorAttribute::GetEntries
override int GetEntries(notnull array< ref SCR_BaseEditorAttributeEntry > outEntries)
Definition
SCR_DateEditorAttribute.c:146
SCR_DateEditorAttribute::m_aYearArray
ref array< int > m_aYearArray
Definition
SCR_DateEditorAttribute.c:26
SCR_DateEditorAttribute::GetYearByIndex
int GetYearByIndex(int index)
Definition
SCR_DateEditorAttribute.c:136
SCR_DateEditorAttribute::m_sDayLabel
LocalizedString m_sDayLabel
Definition
SCR_DateEditorAttribute.c:9
SCR_DateEditorAttribute::m_iYearEndDate
int m_iYearEndDate
Definition
SCR_DateEditorAttribute.c:24
SCR_DateEditorAttribute::UpdateInterlinkedVariables
override void UpdateInterlinkedVariables(SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, bool isInit=false)
Definition
SCR_DateEditorAttribute.c:68
SCR_DateEditorAttribute::ReadVariable
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
Definition
SCR_DateEditorAttribute.c:28
SCR_DateEditorAttribute::PreviewVariable
override void PreviewVariable(bool setPreview, SCR_AttributesManagerEditorComponent manager)
Definition
SCR_DateEditorAttribute.c:160
SCR_DaytimeEditorAttribute
Definition
SCR_DaytimeEditorAttribute.c:6
SCR_EditorAttributeEntryIntArray
Definition
SCR_BaseEditorAttribute.c:719
SCR_TimePresetsEditorAttribute
Definition
SCR_TimePresetsEditorAttribute.c:6
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
Vector
proto native vector Vector(float x, float y, float z)
scripts
Game
Editor
Containers
Attributes
SCR_DateEditorAttribute.c
Generated by
1.17.0