Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_IngameDateUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute("Date_Date", desc: "Widget filled with date. At least Date or Day widget needs to be assigned for this UI to function")]
4 protected string m_sDateTextName;
5
6 [Attribute("Date_Day", desc: "Widget filled with current day (Monday to Sunday). At least Date or Day widget needs to be assigned for this UI to function")]
7 protected string m_sDayTextName;
8
9 [Attribute("1", desc: "If true month will be written in full text, else month will be a number")]
10 protected bool m_bMonthAsText;
11
12 [Attribute("2", desc: "Time until the UI will update in seconds")]
13 protected float m_fUpdateFreq;
14
15 protected int m_iDayLastCheckedYear = -1;
16 protected int m_iDayLastCheckedMonth = -1;
17 protected int m_iDayLastCheckedDay = -1;
18
19 //~ References
23
24
25 protected void UpdateIngameDate()
26 {
27 int day, month, year;
28 m_TimeAndWeatherManagerEntity.GetDate(year, month, day);
29
30 //~ Set date
31 if (m_DateText)
32 {
33 string date = SCR_DateTimeHelper.GetDateString(day, month, year, m_bMonthAsText);
34 m_DateText.SetText(date);
35 }
36
37 if (m_DayText)
38 {
40 {
44
45 m_DayText.SetText(m_TimeAndWeatherManagerEntity.GetWeekDayString());
46 }
47 }
48
49 }
50
51 override void HandlerAttached(Widget w)
52 {
54 return;
55
56 m_DateText = TextWidget.Cast(w.FindAnyWidget(m_sDateTextName));
57 m_DayText = TextWidget.Cast(w.FindAnyWidget(m_sDayTextName));
58
59 if (!m_DateText && !m_DayText)
60 {
61 Print("'SCR_IngameDateUIComponent' is missing both date and day widget and therefore won't function", LogLevel.ERROR);
62 return;
63 }
64
65 ChimeraWorld world = GetGame().GetWorld();
66 m_TimeAndWeatherManagerEntity = world.GetTimeAndWeatherManager();
68 {
69 Print("'SCR_IngameDateUIComponent' could not find the TimeAndWeatherManager", LogLevel.ERROR);
70 return;
71 }
72
74 GetGame().GetCallqueue().CallLater(UpdateIngameDate, m_fUpdateFreq * 1000, true);
75
76 }
77 override void HandlerDeattached(Widget w)
78 {
80 GetGame().GetCallqueue().Remove(UpdateIngameDate);
81 }
82};
ArmaReforgerScripted GetGame()
Definition game.c:1398
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static bool IsEditMode()
Definition Functions.c:1566
override void HandlerAttached(Widget w)
TimeAndWeatherManagerEntity m_TimeAndWeatherManagerEntity
override void HandlerDeattached(Widget w)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute