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_CompassUIComponent.c
Go to the documentation of this file.
1
5
class
SCR_CompassUIComponent
:
MenuRootSubComponent
6
{
7
[
Attribute
(defvalue:
"0.8"
, uiwidget:
UIWidgets
.Slider,
params
:
"0 1 0.01"
)]
8
protected
float
m_fLabelsDistance
;
9
10
[
Attribute
()]
11
protected
string
m_sTextureWidgetName
;
12
13
[
Attribute
()]
14
protected
string
m_sEastWidgetName
;
15
16
[
Attribute
()]
17
protected
string
m_sSouthWidgetName
;
18
19
[
Attribute
()]
20
protected
string
m_sWestWidgetName
;
21
22
[
Attribute
()]
23
protected
string
m_sNorthWidgetName
;
24
25
protected
BaseWorld
m_World
;
26
protected
ImageWidget
m_TextureWidget
;
27
protected
ref
map<Widget, float>
m_Labels
=
new
map<Widget, float>
;
28
33
void
UpdateRotation
(
float
timeSlice)
34
{
35
vector
transform[4];
36
m_World
.GetCurrentCamera(transform);
37
float
yaw = -
Math3D
.MatrixToAngles(transform)[0];
38
m_TextureWidget
.SetRotation(yaw);
39
40
float
yawRad = yaw *
Math
.DEG2RAD;
41
foreach
(
Widget
label,
float
angle:
m_Labels
)
42
{
43
FrameSlot
.SetPos(
44
label,
45
m_fLabelsDistance
*
Math
.Cos(yawRad + angle),
46
m_fLabelsDistance
*
Math
.Sin(yawRad + angle)
47
);
48
}
49
}
50
51
override
void
HandlerAttachedScripted
(
Widget
w)
52
{
53
MenuRootBase
menu =
GetMenu
();
54
if
(!menu)
55
return
;
56
57
m_World
=
GetGame
().GetWorld();
58
if
(!
m_World
)
59
return
;
60
61
m_TextureWidget
=
ImageWidget
.Cast(w.FindAnyWidget(
m_sTextureWidgetName
));
62
if
(!
m_TextureWidget
)
63
return
;
64
65
m_Labels
.Insert(w.FindAnyWidget(
m_sEastWidgetName
), 0);
66
m_Labels
.Insert(w.FindAnyWidget(
m_sSouthWidgetName
),
Math
.PI * 0.5);
67
m_Labels
.Insert(w.FindAnyWidget(
m_sWestWidgetName
),
Math
.PI);
68
m_Labels
.Insert(w.FindAnyWidget(
m_sNorthWidgetName
),
Math
.PI * 1.5);
69
70
m_fLabelsDistance
*= 0.5 *
FrameSlot
.GetSizeY(w);
71
72
menu.
GetOnMenuUpdate
().Insert(
UpdateRotation
);
73
}
74
override
void
HandlerDeattached
(
Widget
w)
75
{
76
MenuRootBase
menu =
GetMenu
();
77
if
(menu)
78
{
79
menu.
GetOnMenuUpdate
().Remove(
UpdateRotation
);
80
}
81
}
82
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetMenu
SCR_RadialMenu GetMenu()
Definition
SCR_RadialMenuGameModeComponent.c:38
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
BaseWorld
Definition
BaseWorld.c:13
FrameSlot
Definition
FrameSlot.c:13
ImageWidget
Definition
ImageWidget.c:13
Math3D
Definition
Math3D.c:13
Math
Definition
Math.c:13
MenuRootBase
Definition
MenuRootBase.c:11
MenuRootBase::GetOnMenuUpdate
ScriptInvoker GetOnMenuUpdate()
Definition
MenuRootBase.c:72
MenuRootSubComponent
Definition
MenuRootSubComponent.c:6
SCR_CompassUIComponent
Definition
SCR_CompassUIComponent.c:6
SCR_CompassUIComponent::m_World
BaseWorld m_World
Definition
SCR_CompassUIComponent.c:25
SCR_CompassUIComponent::m_sNorthWidgetName
string m_sNorthWidgetName
Definition
SCR_CompassUIComponent.c:23
SCR_CompassUIComponent::m_sTextureWidgetName
string m_sTextureWidgetName
Definition
SCR_CompassUIComponent.c:11
SCR_CompassUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_CompassUIComponent.c:74
SCR_CompassUIComponent::HandlerAttachedScripted
override void HandlerAttachedScripted(Widget w)
Definition
SCR_CompassUIComponent.c:51
SCR_CompassUIComponent::m_Labels
ref map< Widget, float > m_Labels
Definition
SCR_CompassUIComponent.c:27
SCR_CompassUIComponent::m_sEastWidgetName
string m_sEastWidgetName
Definition
SCR_CompassUIComponent.c:14
SCR_CompassUIComponent::m_TextureWidget
ImageWidget m_TextureWidget
Definition
SCR_CompassUIComponent.c:26
SCR_CompassUIComponent::m_fLabelsDistance
float m_fLabelsDistance
Definition
SCR_CompassUIComponent.c:8
SCR_CompassUIComponent::m_sSouthWidgetName
string m_sSouthWidgetName
Definition
SCR_CompassUIComponent.c:17
SCR_CompassUIComponent::UpdateRotation
void UpdateRotation(float timeSlice)
Definition
SCR_CompassUIComponent.c:33
SCR_CompassUIComponent::m_sWestWidgetName
string m_sWestWidgetName
Definition
SCR_CompassUIComponent.c:20
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
map
Definition
Types.c:486
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
SCR_CompassUIComponent.c
Generated by
1.17.0