Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SimplePreload.c
Go to the documentation of this file.
1
class
SimplePreload
2
{
3
static
const
int
PRELOAD_FRAME_TIME_MS = 100;
4
static
const
int
MIN_DURATION_MS = 1000;
5
ref
LoadingAnim
m_LoadingAnim;
6
vector
m_Position;
7
float
m_fDuration;
8
int
m_iMaxDuration;
9
10
void
SimplePreload()
11
{
12
Print
(
"SimplePreload: preload started."
,
LogLevel
.VERBOSE);
13
}
14
15
void
~SimplePreload()
16
{
17
if
(m_LoadingAnim)
18
m_LoadingAnim.Hide();
19
Print
(
"SimplePreload: preload finished (took: "
+
Math
.Round(m_fDuration) +
"s)."
,
LogLevel
.VERBOSE);
20
}
21
22
bool
Update
(
float
timeSlice)
23
{
24
m_fDuration += timeSlice;
25
26
if
(
g_Game
.IsPreloadFinished() && (m_fDuration >= (MIN_DURATION_MS * 0.001)))
27
{
28
return
true
;
29
}
30
31
if
(m_LoadingAnim)
32
{
33
float
progress =
Math
.Min(m_fDuration / MIN_DURATION_MS * 0.001, 1.0);
34
m_LoadingAnim.Update(timeSlice, progress, progress);
35
}
36
return
false
;
37
}
38
39
static
SimplePreload Preload(
vector
position
,
float
radius = 500,
int
max_duration_ms = 20000)
40
{
41
if
(
g_Game
.BeginPreload(
g_Game
.GetWorld(),
position
, radius, max_duration_ms / 1000))
42
{
43
// there is a lot of resoruces to be loaded, show loading anim
44
SimplePreload preload =
new
SimplePreload();
45
preload.m_LoadingAnim =
g_Game
.CreateLoadingAnim(
g_Game
.GetWorkspace());
46
preload.m_LoadingAnim.Show();
47
preload.m_iMaxDuration = max_duration_ms;
48
preload.m_Position =
position
;
49
return
preload;
50
}
51
52
return
null;
53
}
54
};
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
LoadingAnim
Definition
gameLib.c:154
Math
Definition
Math.c:13
vector
Definition
vector.c:13
g_Game
Game g_Game
Game singleton instance.
Definition
gameLib.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
Update
@ Update
Definition
SndComponentCallbacks.c:14
scripts
Game
UI
SimplePreload.c
Generated by
1.17.0