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_IngameDateUIComponent.c
Go to the documentation of this file.
1
class
SCR_IngameDateUIComponent
:
ScriptedWidgetComponent
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
20
protected
TextWidget
m_DateText
;
21
protected
TextWidget
m_DayText
;
22
protected
TimeAndWeatherManagerEntity
m_TimeAndWeatherManagerEntity
;
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
{
39
if
(
m_iDayLastCheckedDay
!= day ||
m_iDayLastCheckedMonth
!= month ||
m_iDayLastCheckedYear
!= year)
40
{
41
m_iDayLastCheckedDay
= day;
42
m_iDayLastCheckedMonth
= month;
43
m_iDayLastCheckedYear
= year;
44
45
m_DayText
.SetText(
m_TimeAndWeatherManagerEntity
.GetWeekDayString());
46
}
47
}
48
49
}
50
51
override
void
HandlerAttached
(
Widget
w)
52
{
53
if
(
SCR_Global
.
IsEditMode
())
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();
67
if
(!
m_TimeAndWeatherManagerEntity
)
68
{
69
Print
(
"'SCR_IngameDateUIComponent' could not find the TimeAndWeatherManager"
,
LogLevel
.ERROR);
70
return
;
71
}
72
73
UpdateIngameDate
();
74
GetGame
().GetCallqueue().CallLater(
UpdateIngameDate
,
m_fUpdateFreq
* 1000,
true
);
75
76
}
77
override
void
HandlerDeattached
(
Widget
w)
78
{
79
if
(
m_TimeAndWeatherManagerEntity
)
80
GetGame
().GetCallqueue().Remove(
UpdateIngameDate
);
81
}
82
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
ChimeraWorld
Definition
ChimeraWorld.c:13
SCR_DateTimeHelper
Definition
SCR_DateTimeHelper.c:2
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_IngameDateUIComponent
Definition
SCR_IngameDateUIComponent.c:2
SCR_IngameDateUIComponent::m_iDayLastCheckedDay
int m_iDayLastCheckedDay
Definition
SCR_IngameDateUIComponent.c:17
SCR_IngameDateUIComponent::m_sDateTextName
string m_sDateTextName
Definition
SCR_IngameDateUIComponent.c:4
SCR_IngameDateUIComponent::m_DateText
TextWidget m_DateText
Definition
SCR_IngameDateUIComponent.c:20
SCR_IngameDateUIComponent::m_iDayLastCheckedMonth
int m_iDayLastCheckedMonth
Definition
SCR_IngameDateUIComponent.c:16
SCR_IngameDateUIComponent::m_iDayLastCheckedYear
int m_iDayLastCheckedYear
Definition
SCR_IngameDateUIComponent.c:15
SCR_IngameDateUIComponent::m_fUpdateFreq
float m_fUpdateFreq
Definition
SCR_IngameDateUIComponent.c:13
SCR_IngameDateUIComponent::m_DayText
TextWidget m_DayText
Definition
SCR_IngameDateUIComponent.c:21
SCR_IngameDateUIComponent::m_bMonthAsText
bool m_bMonthAsText
Definition
SCR_IngameDateUIComponent.c:10
SCR_IngameDateUIComponent::UpdateIngameDate
void UpdateIngameDate()
Definition
SCR_IngameDateUIComponent.c:25
SCR_IngameDateUIComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_IngameDateUIComponent.c:51
SCR_IngameDateUIComponent::m_TimeAndWeatherManagerEntity
TimeAndWeatherManagerEntity m_TimeAndWeatherManagerEntity
Definition
SCR_IngameDateUIComponent.c:22
SCR_IngameDateUIComponent::m_sDayTextName
string m_sDayTextName
Definition
SCR_IngameDateUIComponent.c:7
SCR_IngameDateUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_IngameDateUIComponent.c:77
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
TextWidget
Definition
TextWidget.c:16
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
Widget
Definition
Widget.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
SCR_IngameDateUIComponent.c
Generated by
1.17.0