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;
8 [
Attribute(uiwidget: UIWidgets.LocaleEditBox, defvalue:
"#AR-Date_Day")]
11 [
Attribute(uiwidget: UIWidgets.LocaleEditBox, defvalue:
"#AR-Date_Month")]
14 [
Attribute(uiwidget: UIWidgets.LocaleEditBox, defvalue:
"#AR-Date_Year")]
17 [
Attribute(uiwidget: UIWidgets.LocaleEditBox)]
18 protected ref array<ref LocalizedString> m_aMonthList;
21 protected int m_iYearStartDate;
23 protected int m_iYearEndDate;
25 ref array<ref int> m_aYearArray =
new array<ref int>();
31 if (!IsGameMode(item))
36 TimeAndWeatherManagerEntity timeManager = world.GetTimeAndWeatherManager();
41 vector date = Vector(timeManager.GetDay() -1, timeManager.GetMonth() -1, GetYearIndex(timeManager.GetYear()));
45 override void WriteVariable(Managed item,
SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager,
int playerID)
51 TimeAndWeatherManagerEntity timeManager = world.GetTimeAndWeatherManager();
52 if (!timeManager)
return;
55 vector date = var.GetVector();
57 int month = date[1] +1;
58 int year = m_aYearArray[date[2]];
62 SCR_NotificationsComponent.SendToUnlimitedEditorPlayers(
ENotification.EDITOR_ATTRIBUTES_DATE_CHANGED, playerID, day, month, year);
65 timeManager.SetDate(year, month, day);
68 override void UpdateInterlinkedVariables(
SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager,
bool isInit =
false)
81 void GetYearArray(notnull out array<int> yearArray)
85 foreach(
int year : m_aYearArray)
87 yearArray.Insert(year);
91 protected void CreateYearArray()
93 if (m_aYearArray.Count() != 0)
97 TimeAndWeatherManagerEntity timeManager = world.GetTimeAndWeatherManager();
101 int currentYear = timeManager.GetYear();
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;
112 for (
int y = m_iYearStartDate; y <= m_iYearEndDate; y++)
114 m_aYearArray.Insert(y);
118 protected int GetYearIndex(
int year)
122 if (m_aYearArray.Contains(year))
124 return m_aYearArray.Find(year);
136 int GetYearByIndex(
int index)
140 if (index < 0 || index >= m_aYearArray.Count())
143 return m_aYearArray[
index];
146 override int GetEntries(notnull array<ref SCR_BaseEditorAttributeEntry> outEntries)
157 return outEntries.Count();
160 override void PreviewVariable(
bool setPreview, SCR_AttributesManagerEditorComponent manager)
167 timeAttribute.PreviewVariable(setPreview, manager);