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_SpinningWidgetComponent.c
Go to the documentation of this file.
1
5
6
class
SCR_SpinningWidgetComponent
:
ScriptedWidgetComponent
7
{
8
[
Attribute
(
"1"
,
UIWidgets
.Auto,
"Speed, revolutions per second. Positive values mean clockwise rotation."
)]
9
float
m_fSpeedRps;
10
11
protected
Widget
m_wRoot
;
12
13
protected
ref
SCR_SpinningWidgetAnimationAbstract
m_Anim
;
14
15
16
//-----------------------------------------------------------------------------
17
override
void
HandlerAttached
(
Widget
w)
18
{
19
if
(!
GetGame
().InPlayMode())
20
return
;
21
22
m_wRoot
= w;
23
24
if
(
TextWidget
.Cast(w))
25
m_Anim
=
new
SCR_SpinningWidgetAnimation<TextWidget>(w);
26
else
if
(
ImageWidget
.Cast(w))
27
m_Anim
=
new
SCR_SpinningWidgetAnimation<ImageWidget>(w);
28
29
if
(!
m_Anim
)
30
return
;
31
32
ScriptCallQueue
queue =
GetGame
().GetCallqueue();
33
queue.CallLater(
OnEachFrame
, 0,
true
);
34
}
35
36
//-----------------------------------------------------------------------------
37
override
void
HandlerDeattached
(
Widget
w)
38
{
39
if
(!
GetGame
() || !
GetGame
().InPlayMode())
40
return
;
41
42
ScriptCallQueue
queue =
GetGame
().GetCallqueue();
43
queue.Remove(
OnEachFrame
);
44
}
45
46
//-----------------------------------------------------------------------------
47
protected
void
OnEachFrame
()
48
{
49
if
(!
m_wRoot
.IsEnabled() || !
m_wRoot
.IsVisible() || !
m_Anim
)
50
return
;
51
52
float
tDelta = ftime / 1000.0;
53
m_Anim
.Animate(tDelta, m_fSpeedRps);
54
}
55
};
56
57
//-----------------------------------------------------------------------------
59
class
SCR_SpinningWidgetAnimationAbstract
60
{
61
void
Animate(
float
tDelta,
float
speedRps);
62
};
63
64
//-----------------------------------------------------------------------------
66
class
SCR_SpinningWidgetAnimation<
Widget
TWidget> :
SCR_SpinningWidgetAnimationAbstract
67
{
68
TWidget m_wTarget;
69
70
71
//-----------------------------------------------------------------------------
72
void
SCR_SpinningWidgetAnimation(
Widget
w)
73
{
74
m_wTarget = TWidget.Cast(w);
75
}
76
77
//-----------------------------------------------------------------------------
78
override
void
Animate
(
float
tDelta,
float
speedRps)
79
{
80
float
angle = m_wTarget.GetRotation();
81
angle += tDelta*speedRps*360.0;
82
if
(angle > 360.0)
83
angle -= 360.0;
84
if
(angle < 0)
85
angle += 360.0;
86
m_wTarget.SetRotation(angle);
87
}
88
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
Animate
void Animate(bool finished)
Definition
WidgetAnimation.c:303
ImageWidget
Definition
ImageWidget.c:13
SCR_SpinningWidgetAnimationAbstract
Abstract class of a spinning animation.
Definition
SCR_SpinningWidgetComponent.c:60
SCR_SpinningWidgetComponent
Definition
SCR_SpinningWidgetComponent.c:7
SCR_SpinningWidgetComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_SpinningWidgetComponent.c:17
SCR_SpinningWidgetComponent::m_Anim
ref SCR_SpinningWidgetAnimationAbstract m_Anim
Definition
SCR_SpinningWidgetComponent.c:13
SCR_SpinningWidgetComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_SpinningWidgetComponent.c:37
SCR_SpinningWidgetComponent::m_wRoot
Widget m_wRoot
Definition
SCR_SpinningWidgetComponent.c:11
SCR_SpinningWidgetComponent::OnEachFrame
void OnEachFrame()
Definition
SCR_SpinningWidgetComponent.c:47
ScriptCallQueue
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Definition
tools.c:53
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
TextWidget
Definition
TextWidget.c:16
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
SCR_SpinningWidgetComponent.c
Generated by
1.17.0