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_IngameClockUIComponent.c
Go to the documentation of this file.
1
2
class
SCR_IngameClockUIComponent
:
MenuRootSubComponent
3
{
4
[
Attribute
(
"Time"
,
desc
:
"Clock needs at least the Time icon, time multiplier, time pause Icon or Time Text to function"
)]
5
protected
string
m_sTimeTextName
;
6
7
[
Attribute
(
"DayTime_Icon"
,
desc
:
"Clock needs at least the Time icon, time multiplier, time pause Icon or Time Text to function"
)]
8
protected
string
m_sTimeIconName
;
9
10
[
Attribute
(
"Time_Multiplier"
,
desc
:
"Clock needs at least the Time icon, time multiplier, time pause Icon or Time Text to function"
)]
11
protected
string
m_sTimeMultiplierName
;
12
13
[
Attribute
(
"Time_Paused_Icon"
,
desc
:
"Clock needs at least the Time icon, time multiplier, time pause Icon or Time Text to function"
)]
14
protected
string
m_sTimeStoppedIconName
;
15
16
[
Attribute
(
"#AR-ValueUnit_Short_Multiplier"
, uiwidget:
UIWidgets
.LocaleEditBox)]
17
protected
string
m_sTimeMultiplierFormat
;
18
19
[
Attribute
(
"#AR-Weather_Forecast_NoTimeProgression"
, uiwidget:
UIWidgets
.LocaleEditBox)]
20
protected
string
m_sNoTimeProgressionHint
;
21
22
[
Attribute
(
"#AR-Editor_Clock_IngameTime_Name"
, uiwidget:
UIWidgets
.LocaleEditBox)]
23
protected
string
m_sInGameTimeHint
;
24
25
[
Attribute
(
"1"
,
desc
:
"Time until the UI will update in seconds"
)]
26
protected
float
m_fUpdateFreq
;
27
28
[
Attribute
(
"1"
,
desc
:
"If true will hide the time multiplier if one (and assigned)"
)]
29
protected
bool
m_bHideTimeMultiplierIfOne
;
30
31
[
Attribute
(
desc
:
"If the current time of day is in this Phase show moonphase instead of daytimeIcon"
, uiwidget:
UIWidgets
.ComboBox, enums: ParamEnumArray.FromEnum(EDayTimeEnums))]
32
protected
ref array<EDayTimeEnums>
m_aShowMoonphaseAtDayTimes
;
33
34
//~ References
35
protected
TextWidget
m_TimeText
;
36
protected
ImageWidget
m_TimeIcon
;
37
protected
TextWidget
m_TimeMultiplier
;
38
protected
ImageWidget
m_TimeStoppedIcon
;
//~ Icon when simulation is paused
39
protected
TimeAndWeatherManagerEntity
m_TimeAndWeatherManagerEntity
;
40
protected
SCR_CustomTooltipTargetEditorUIComponent
m_CustomTooltipUIComponent
;
41
42
//======================== CLOCK UPDATE ========================\\
43
44
//------------------------------------------------------------------------------------------------
45
protected
void
UpdateIngameClock
()
46
{
47
//Get time
48
if
(
m_TimeText
)
49
{
50
int
hour, minute, sec;
51
m_TimeAndWeatherManagerEntity
.GetHoursMinutesSeconds(hour, minute, sec);
52
m_TimeText
.SetTextFormat(
SCR_FormatHelper
.
GetTimeFormattingHoursMinutes
(hour, minute));
53
}
54
55
if
(
m_TimeIcon
)
56
{
57
SCR_UIInfo
dayTimeUIInfo;
58
EDayTimeEnums dayTimePhase =
m_TimeAndWeatherManagerEntity
.GetCurrentDayTimeUIInfoAndPhase(dayTimeUIInfo);
59
60
if
(
m_aShowMoonphaseAtDayTimes
.Contains(dayTimePhase))
61
{
62
SCR_MoonPhaseUIInfo
moonPhase =
m_TimeAndWeatherManagerEntity
.GetCurrentMoonPhaseInfoForDate();
63
m_TimeIcon
.SetRotation(moonPhase.
GetMoonphaseImageRotation
());
64
moonPhase.SetIconTo(
m_TimeIcon
);
65
}
66
else
67
{
68
m_TimeIcon
.SetRotation(0);
69
dayTimeUIInfo.
SetIconTo
(
m_TimeIcon
);
70
}
71
}
72
73
if
(
m_TimeMultiplier
)
74
{
75
if
(
m_TimeAndWeatherManagerEntity
.GetIsDayAutoAdvanced())
76
{
77
float
timeMultiplier = 86400 /
m_TimeAndWeatherManagerEntity
.GetDayDuration();
78
int
TimeMultiplierInt = timeMultiplier;
79
80
bool
visible = !(
m_bHideTimeMultiplierIfOne
&& (TimeMultiplierInt == 1 && (timeMultiplier - TimeMultiplierInt) < 0.1));
81
m_TimeMultiplier
.SetVisible(visible);
82
m_TimeStoppedIcon
.SetVisible(
false
);
83
m_CustomTooltipUIComponent
.GetInfo().SetDescription(
m_sInGameTimeHint
);
84
85
if
(visible)
86
{
87
if
((timeMultiplier - TimeMultiplierInt) != 0)
88
m_TimeMultiplier
.SetTextFormat(
m_sTimeMultiplierFormat
, timeMultiplier.ToString(-1, 1));
89
else
90
m_TimeMultiplier
.SetTextFormat(
m_sTimeMultiplierFormat
, TimeMultiplierInt);
91
}
92
}
93
else
94
{
95
// When Time progression is paused/No Time Progression Show Pause Icon hide multiplier text
96
m_CustomTooltipUIComponent
.GetInfo().SetDescription(
m_sNoTimeProgressionHint
);
97
m_TimeStoppedIcon
.SetVisible(
true
);
98
m_TimeMultiplier
.SetVisible(
false
);
99
}
100
}
101
102
}
103
104
//======================== ATTACH/DEATTACH HANDLER ========================\\
105
106
//------------------------------------------------------------------------------------------------
107
//On Init
108
override
void
HandlerAttachedScripted
(
Widget
w)
109
{
110
if
(
SCR_Global
.
IsEditMode
())
111
return
;
112
113
m_TimeText
=
TextWidget
.Cast(w.FindAnyWidget(
m_sTimeTextName
));
114
m_TimeIcon
=
ImageWidget
.Cast(w.FindAnyWidget(
m_sTimeIconName
));
115
m_TimeMultiplier
=
TextWidget
.Cast(w.FindAnyWidget(
m_sTimeMultiplierName
));
116
m_TimeStoppedIcon
=
ImageWidget
.Cast(w.FindAnyWidget(
m_sTimeStoppedIconName
));
117
118
if
(!
m_TimeText
&& !
m_TimeIcon
&& !
m_TimeMultiplier
&& !
m_TimeStoppedIcon
)
119
{
120
Print
(
"'SCR_IngameClockUIComponent' is has no time time widgets and therefore won't function"
,
LogLevel
.ERROR);
121
return
;
122
}
123
124
m_CustomTooltipUIComponent
=
SCR_CustomTooltipTargetEditorUIComponent
.Cast(w.FindHandler(
SCR_CustomTooltipTargetEditorUIComponent
));
125
if
(!
m_CustomTooltipUIComponent
)
126
{
127
Print
(
"'SCR_IngameClockUIComponent' is missing custom editor tooltip component"
,
LogLevel
.ERROR);
128
return
;
129
}
130
131
ChimeraWorld
world =
GetGame
().GetWorld();
132
m_TimeAndWeatherManagerEntity
= world.GetTimeAndWeatherManager();
133
if
(!
m_TimeAndWeatherManagerEntity
)
134
{
135
Print
(
"'SCR_IngameClockUIComponent' could not find the TimeAndWeatherManager"
,
LogLevel
.ERROR);
136
return
;
137
}
138
139
UpdateIngameClock
();
140
GetGame
().GetCallqueue().CallLater(
UpdateIngameClock
,
m_fUpdateFreq
* 1000,
true
);
141
}
142
143
//------------------------------------------------------------------------------------------------
144
//On Destroy
145
override
void
HandlerDeattached
(
Widget
w)
146
{
147
if
(
m_TimeAndWeatherManagerEntity
)
148
GetGame
().GetCallqueue().Remove(
UpdateIngameClock
);
149
150
}
151
}
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
ImageWidget
Definition
ImageWidget.c:13
MenuRootSubComponent
Definition
MenuRootSubComponent.c:6
SCR_CustomTooltipTargetEditorUIComponent
Definition
SCR_CustomTooltipTargetEditorUIComponent.c:4
SCR_FormatHelper
Definition
SCR_FormatHelper.c:2
SCR_FormatHelper::GetTimeFormattingHoursMinutes
static string GetTimeFormattingHoursMinutes(int hours, int minutes, ETimeFormatParam hideEmpty=0, ETimeFormatParam hideLeadingZeroes=0)
Definition
SCR_FormatHelper.c:220
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_IngameClockUIComponent
Gets the Ingame time and displays it on a UI text element.
Definition
SCR_IngameClockUIComponent.c:3
SCR_IngameClockUIComponent::m_sTimeIconName
string m_sTimeIconName
Definition
SCR_IngameClockUIComponent.c:8
SCR_IngameClockUIComponent::m_fUpdateFreq
float m_fUpdateFreq
Definition
SCR_IngameClockUIComponent.c:26
SCR_IngameClockUIComponent::m_sTimeStoppedIconName
string m_sTimeStoppedIconName
Definition
SCR_IngameClockUIComponent.c:14
SCR_IngameClockUIComponent::m_aShowMoonphaseAtDayTimes
ref array< EDayTimeEnums > m_aShowMoonphaseAtDayTimes
Definition
SCR_IngameClockUIComponent.c:32
SCR_IngameClockUIComponent::m_TimeStoppedIcon
ImageWidget m_TimeStoppedIcon
Definition
SCR_IngameClockUIComponent.c:38
SCR_IngameClockUIComponent::m_sTimeTextName
string m_sTimeTextName
Definition
SCR_IngameClockUIComponent.c:5
SCR_IngameClockUIComponent::m_CustomTooltipUIComponent
SCR_CustomTooltipTargetEditorUIComponent m_CustomTooltipUIComponent
Definition
SCR_IngameClockUIComponent.c:40
SCR_IngameClockUIComponent::HandlerAttachedScripted
override void HandlerAttachedScripted(Widget w)
Definition
SCR_IngameClockUIComponent.c:108
SCR_IngameClockUIComponent::m_sTimeMultiplierName
string m_sTimeMultiplierName
Definition
SCR_IngameClockUIComponent.c:11
SCR_IngameClockUIComponent::UpdateIngameClock
void UpdateIngameClock()
Definition
SCR_IngameClockUIComponent.c:45
SCR_IngameClockUIComponent::m_TimeAndWeatherManagerEntity
TimeAndWeatherManagerEntity m_TimeAndWeatherManagerEntity
Definition
SCR_IngameClockUIComponent.c:39
SCR_IngameClockUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_IngameClockUIComponent.c:145
SCR_IngameClockUIComponent::m_sNoTimeProgressionHint
string m_sNoTimeProgressionHint
Definition
SCR_IngameClockUIComponent.c:20
SCR_IngameClockUIComponent::m_sInGameTimeHint
string m_sInGameTimeHint
Definition
SCR_IngameClockUIComponent.c:23
SCR_IngameClockUIComponent::m_sTimeMultiplierFormat
string m_sTimeMultiplierFormat
Definition
SCR_IngameClockUIComponent.c:17
SCR_IngameClockUIComponent::m_TimeMultiplier
TextWidget m_TimeMultiplier
Definition
SCR_IngameClockUIComponent.c:37
SCR_IngameClockUIComponent::m_TimeText
TextWidget m_TimeText
Definition
SCR_IngameClockUIComponent.c:35
SCR_IngameClockUIComponent::m_TimeIcon
ImageWidget m_TimeIcon
Definition
SCR_IngameClockUIComponent.c:36
SCR_IngameClockUIComponent::m_bHideTimeMultiplierIfOne
bool m_bHideTimeMultiplierIfOne
Definition
SCR_IngameClockUIComponent.c:29
SCR_MoonPhaseUIInfo
Definition
SCR_MoonPhaseUIInfo.c:3
SCR_MoonPhaseUIInfo::GetMoonphaseImageRotation
float GetMoonphaseImageRotation()
Definition
SCR_MoonPhaseUIInfo.c:32
SCR_UIInfo
Definition
SCR_UIInfo.c:8
SCR_UIInfo::SetIconTo
bool SetIconTo(ImageWidget imageWidget)
Definition
SCR_UIInfo.c:102
TextWidget
Definition
TextWidget.c:16
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
UIWidgets
Definition
attributes.c:40
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_IngameClockUIComponent.c
Generated by
1.17.0