Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TimePresetsEditorAttribute.c
Go to the documentation of this file.
1
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;
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
44 return;
45
46 //Recreate presets in case date changed
48
49 //Set new time
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);
97 float time;
98
99 foreach (SCR_DayTimeInfoBase dayTime: daytimeInfo)
100 {
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};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
void PreviewVariable(bool setPreview, SCR_AttributesManagerEditorComponent manager)
static SCR_BaseEditorAttributeVar CreateInt(int value)
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
int GetCurrentDayTimeUIInfo(out SCR_UIInfo uiInfo)
int GetDayTimeInfoArray(out notnull array< SCR_DayTimeInfoBase > dayTimeInfoArray, int year=-1, int month=-1, int day=-1)