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_QuickPlacingEditorUIComponent.c
Go to the documentation of this file.
1
2
3
class
SCR_QuickPlacingEditorUIComponent
:
SCR_BaseEditorUIComponent
4
{
5
protected
static
const
float
ANIMATION_THRESHOLD
= 0.01;
6
7
[
Attribute
()]
8
private
string
m_sActiveWidgetName;
9
10
[
Attribute
()]
11
private
string
m_sExpandWidgetName;
12
13
[
Attribute
(defvalue:
"0.2"
, uiwidget:
UIWidgets
.Slider,
params
:
"0 1 0.01"
)]
14
private
float
m_fHideCoef;
15
16
[
Attribute
(defvalue:
"0.1"
)]
17
private
float
m_fAnimationStrength;
18
19
private
Widget
m_wExpandWidget;
20
private
float
m_fDefaultOffset;
21
private
float
m_fCurrentCoef;
22
private
bool
m_bShown;
23
24
//------------------------------------------------------------------------------------------------
25
protected
void
Show
(
bool
show)
26
{
27
if
(show == m_bShown)
28
return
;
29
30
m_bShown = show;
31
if
(show)
32
SetCoef
(1);
33
else
34
SetCoef
(m_fHideCoef);
35
}
36
37
//------------------------------------------------------------------------------------------------
38
protected
void
SetCoef
(
float
coef,
bool
instant =
false
)
39
{
40
m_fCurrentCoef = coef;
41
if
(instant)
42
{
43
SetOffsets
(1);
44
}
45
else
46
{
47
MenuRootBase
menu =
GetMenu
();
48
if
(menu)
49
menu.
GetOnMenuUpdate
().Insert(
OnMenuUpdate
);
50
}
51
}
52
53
//------------------------------------------------------------------------------------------------
54
protected
bool
SetOffsets
(
float
progress)
55
{
56
float
offsetLeft, offsetTop, offsetRight, offsetBottom;
57
FrameSlot
.GetOffsets(m_wExpandWidget, offsetLeft, offsetTop, offsetRight, offsetBottom);
58
59
offsetTop =
Math
.Lerp(offsetTop, m_fDefaultOffset * m_fCurrentCoef, progress);
60
offsetBottom =
Math
.Lerp(offsetBottom, m_fDefaultOffset * (1 - m_fCurrentCoef), progress);
61
62
FrameSlot
.SetOffsets(m_wExpandWidget, offsetLeft, offsetTop, offsetRight, offsetBottom);
63
64
return
Math
.AbsFloat(offsetTop - m_fDefaultOffset * m_fCurrentCoef) <
ANIMATION_THRESHOLD
;
65
}
66
67
//------------------------------------------------------------------------------------------------
68
protected
void
OnMenuUpdate
(
float
tDelta)
69
{
70
if
(
SetOffsets
(tDelta / m_fAnimationStrength))
71
{
72
MenuRootBase
menu =
GetMenu
();
73
if
(menu)
74
menu.
GetOnMenuUpdate
().Remove(
OnMenuUpdate
);
75
}
76
}
77
78
//------------------------------------------------------------------------------------------------
79
protected
void
OnShortcut
(
Widget
w)
80
{
81
Show
(!m_bShown);
82
}
83
84
//------------------------------------------------------------------------------------------------
85
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
86
{
87
if
(w.GetName() == m_sActiveWidgetName && m_wExpandWidget)
88
Show
(
true
);
89
90
return
false
;
91
}
92
93
//------------------------------------------------------------------------------------------------
94
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
95
{
96
if
(w.GetName() == m_sActiveWidgetName && m_wExpandWidget)
97
Show
(
false
);
98
99
return
false
;
100
}
101
102
//------------------------------------------------------------------------------------------------
103
override
void
HandlerAttachedScripted
(
Widget
w)
104
{
105
m_wExpandWidget = w.FindAnyWidget(m_sExpandWidgetName);
106
if
(!m_wExpandWidget)
107
return
;
108
109
float
offsetLeft,
/* offsetTop, */
offsetRight, offsetBottom;
110
FrameSlot
.GetOffsets(m_wExpandWidget, offsetLeft, m_fDefaultOffset, offsetRight, offsetBottom);
111
112
SetCoef
(m_fHideCoef,
true
);
113
114
ScriptInvoker
onToggle =
ButtonActionComponent
.GetOnAction(w);
115
if
(onToggle)
116
onToggle.Insert(
OnShortcut
);
117
}
118
119
//------------------------------------------------------------------------------------------------
120
override
void
HandlerDeattached
(
Widget
w)
121
{
122
// do nothing
123
}
124
}
GetMenu
SCR_RadialMenu GetMenu()
Definition
SCR_RadialMenuGameModeComponent.c:38
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
ButtonActionComponent
Component to execute action when the button or its shortcut is pressed.
Definition
ButtonActionComponent.c:3
FrameSlot
Definition
FrameSlot.c:13
Math
Definition
Math.c:13
MenuRootBase
Definition
MenuRootBase.c:11
MenuRootBase::GetOnMenuUpdate
ScriptInvoker GetOnMenuUpdate()
Definition
MenuRootBase.c:72
SCR_BaseEditorUIComponent
Definition
SCR_BaseEditorUIComponent.c:4
SCR_QuickPlacingEditorUIComponent
Definition
SCR_QuickPlacingEditorUIComponent.c:4
SCR_QuickPlacingEditorUIComponent::ANIMATION_THRESHOLD
static const float ANIMATION_THRESHOLD
Definition
SCR_QuickPlacingEditorUIComponent.c:5
SCR_QuickPlacingEditorUIComponent::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_QuickPlacingEditorUIComponent.c:85
SCR_QuickPlacingEditorUIComponent::HandlerAttachedScripted
override void HandlerAttachedScripted(Widget w)
Definition
SCR_QuickPlacingEditorUIComponent.c:103
SCR_QuickPlacingEditorUIComponent::OnMenuUpdate
void OnMenuUpdate(float tDelta)
Definition
SCR_QuickPlacingEditorUIComponent.c:68
SCR_QuickPlacingEditorUIComponent::SetCoef
void SetCoef(float coef, bool instant=false)
Definition
SCR_QuickPlacingEditorUIComponent.c:38
SCR_QuickPlacingEditorUIComponent::Show
void Show(bool show)
Definition
SCR_QuickPlacingEditorUIComponent.c:25
SCR_QuickPlacingEditorUIComponent::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_QuickPlacingEditorUIComponent.c:94
SCR_QuickPlacingEditorUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_QuickPlacingEditorUIComponent.c:120
SCR_QuickPlacingEditorUIComponent::OnShortcut
void OnShortcut(Widget w)
Definition
SCR_QuickPlacingEditorUIComponent.c:79
SCR_QuickPlacingEditorUIComponent::SetOffsets
bool SetOffsets(float progress)
Definition
SCR_QuickPlacingEditorUIComponent.c:54
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Show
override void Show()
Definition
gameLib.c:262
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Editor
UI
Components
Common
SCR_QuickPlacingEditorUIComponent.c
Generated by
1.17.0