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_HideEditorUIComponent.c
Go to the documentation of this file.
1
2
3
class
SCR_HideEditorUIComponent
:
SCR_BaseEditorUIComponent
4
{
5
[
Attribute
(
"10"
,
UIWidgets
.Auto,
"Speed of smooth transition between visible and hidden state."
)]
6
protected
float
m_fTransitionSpeed
;
7
8
[
Attribute
(
desc
:
"Show interface again when any of these actions is triggered"
)]
9
protected
ref array<string>
m_aShowActions
;
10
11
protected
SCR_MenuEditorComponent
m_EditorMenuManager
;
12
protected
float
m_fTargetOpacity
= 1;
13
protected
bool
m_bInTransition
;
14
protected
ref
ScriptInvoker
Event_OnOpacityChange
;
15
16
//------------------------------------------------------------------------------------------------
20
void
SetVisible
(
bool
visible,
bool
instant =
false
)
21
{
22
Widget
widget =
GetWidget
();
23
if
(!widget)
24
return
;
25
26
widget.SetEnabled(visible);
27
28
if
(visible)
29
m_fTargetOpacity
= 1;
30
else
31
m_fTargetOpacity
= 0;
32
33
if
(instant)
34
SetWidgetOpacity
(widget,
m_fTargetOpacity
);
35
else
36
m_bInTransition
=
true
;
37
}
38
39
//------------------------------------------------------------------------------------------------
41
ScriptInvoker
GetOnOpacityChange
()
42
{
43
if
(!
Event_OnOpacityChange
)
44
Event_OnOpacityChange
=
new
ScriptInvoker
();
45
46
return
Event_OnOpacityChange
;
47
}
48
49
//------------------------------------------------------------------------------------------------
50
protected
void
Show
()
51
{
52
//--- Use delay, so clicking on hidden button won't activate it instantly
53
GetGame
().GetCallqueue().CallLater(
SetMenuVisible
, 1,
false
,
true
);
54
}
55
56
//------------------------------------------------------------------------------------------------
57
protected
void
SetMenuVisible
(
bool
visible)
58
{
59
if
(
m_EditorMenuManager
)
60
m_EditorMenuManager
.SetVisible(visible);
61
}
62
63
//------------------------------------------------------------------------------------------------
64
protected
void
SetWidgetOpacity
(
Widget
widget,
float
opacity)
65
{
66
if
(widget)
67
widget.SetOpacity(opacity);
68
69
if
(
Event_OnOpacityChange
)
70
Event_OnOpacityChange
.Invoke(opacity);
71
}
72
73
//------------------------------------------------------------------------------------------------
74
protected
void
OnMenuUpdate
(
float
tDelta)
75
{
76
Widget
widget =
GetWidget
();
77
if
(!widget)
78
return
;
79
80
//--- Disabled, handled by SCR_ToggleInterfaceToolbarAction now
81
// if (m_InputManager.GetActionTriggered("EditorToggleUI"))
82
// {
83
// if (m_EditorMenuManager)
84
// m_EditorMenuManager.ToggleVisible();
85
// else
86
// SetVisible(!widget.IsEnabled());
87
// }
88
89
if
(
m_bInTransition
)
90
{
91
float
opacity = widget.GetOpacity();
92
if
(
Math
.AbsFloat(opacity -
m_fTargetOpacity
) < 0.01)
93
{
94
SetWidgetOpacity
(widget,
m_fTargetOpacity
);
95
m_bInTransition
=
false
;
96
return
;
97
}
98
SetWidgetOpacity
(widget,
Math
.Lerp(opacity,
m_fTargetOpacity
,
m_fTransitionSpeed
* tDelta));
99
}
100
}
101
102
//------------------------------------------------------------------------------------------------
103
protected
void
OnMenuInit
()
104
{
105
if
(
m_EditorMenuManager
)
106
SetVisible
(
m_EditorMenuManager
.IsVisible(),
true
);
107
}
108
109
//------------------------------------------------------------------------------------------------
110
override
void
HandlerAttachedScripted
(
Widget
w)
111
{
112
super.HandlerAttachedScripted(w);
113
if
(
SCR_Global
.
IsEditMode
())
114
return
;
//--- Run-time only
115
116
MenuRootBase
menu =
GetMenu
();
117
if
(!menu)
118
return
;
119
120
OnMenuInit
();
121
menu.
GetOnMenuInit
().Insert(
OnMenuInit
);
122
menu.
GetOnMenuUpdate
().Insert(
OnMenuUpdate
);
123
124
m_EditorMenuManager
=
SCR_MenuEditorComponent
.Cast(
SCR_MenuEditorComponent
.GetInstance(
SCR_MenuEditorComponent
));
125
126
InputManager
inputManager =
GetGame
().GetInputManager();
127
if
(inputManager)
128
{
129
foreach
(
string
showAction :
m_aShowActions
)
130
{
131
inputManager.AddActionListener(showAction,
EActionTrigger
.DOWN,
Show
);
132
}
133
}
134
}
135
136
//------------------------------------------------------------------------------------------------
137
override
void
HandlerDeattached
(
Widget
w)
138
{
139
super.HandlerDeattached(w);
140
141
InputManager
inputManager =
GetGame
().GetInputManager();
142
if
(inputManager)
143
{
144
foreach
(
string
showAction :
m_aShowActions
)
145
{
146
inputManager.RemoveActionListener(showAction,
EActionTrigger
.DOWN,
Show
);
147
}
148
}
149
}
150
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetMenu
SCR_RadialMenu GetMenu()
Definition
SCR_RadialMenuGameModeComponent.c:38
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
GetWidget
Widget GetWidget()
Definition
SCR_VonDisplay.c:162
InputManager
Input management system for user interactions.
Definition
InputManager.c:20
Math
Definition
Math.c:13
MenuRootBase
Definition
MenuRootBase.c:11
MenuRootBase::GetOnMenuInit
ScriptInvoker GetOnMenuInit()
Definition
MenuRootBase.c:84
MenuRootBase::GetOnMenuUpdate
ScriptInvoker GetOnMenuUpdate()
Definition
MenuRootBase.c:72
SCR_BaseEditorUIComponent
Definition
SCR_BaseEditorUIComponent.c:4
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_HideEditorUIComponent
Definition
SCR_HideEditorUIComponent.c:4
SCR_HideEditorUIComponent::OnMenuInit
void OnMenuInit()
Definition
SCR_HideEditorUIComponent.c:103
SCR_HideEditorUIComponent::Event_OnOpacityChange
ref ScriptInvoker Event_OnOpacityChange
Definition
SCR_HideEditorUIComponent.c:14
SCR_HideEditorUIComponent::HandlerAttachedScripted
override void HandlerAttachedScripted(Widget w)
Definition
SCR_HideEditorUIComponent.c:110
SCR_HideEditorUIComponent::m_fTargetOpacity
float m_fTargetOpacity
Definition
SCR_HideEditorUIComponent.c:12
SCR_HideEditorUIComponent::m_fTransitionSpeed
float m_fTransitionSpeed
Definition
SCR_HideEditorUIComponent.c:6
SCR_HideEditorUIComponent::GetOnOpacityChange
ScriptInvoker GetOnOpacityChange()
Definition
SCR_HideEditorUIComponent.c:41
SCR_HideEditorUIComponent::SetWidgetOpacity
void SetWidgetOpacity(Widget widget, float opacity)
Definition
SCR_HideEditorUIComponent.c:64
SCR_HideEditorUIComponent::m_bInTransition
bool m_bInTransition
Definition
SCR_HideEditorUIComponent.c:13
SCR_HideEditorUIComponent::m_EditorMenuManager
SCR_MenuEditorComponent m_EditorMenuManager
Definition
SCR_HideEditorUIComponent.c:11
SCR_HideEditorUIComponent::SetVisible
void SetVisible(bool visible, bool instant=false)
Definition
SCR_HideEditorUIComponent.c:20
SCR_HideEditorUIComponent::m_aShowActions
ref array< string > m_aShowActions
Definition
SCR_HideEditorUIComponent.c:9
SCR_HideEditorUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_HideEditorUIComponent.c:137
SCR_HideEditorUIComponent::SetMenuVisible
void SetMenuVisible(bool visible)
Definition
SCR_HideEditorUIComponent.c:57
SCR_HideEditorUIComponent::OnMenuUpdate
void OnMenuUpdate(float tDelta)
Definition
SCR_HideEditorUIComponent.c:74
SCR_HideEditorUIComponent::Show
void Show()
Definition
SCR_HideEditorUIComponent.c:50
SCR_MenuEditorComponent
Definition
SCR_MenuEditorComponent.c:9
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Editor
UI
Components
Common
SCR_HideEditorUIComponent.c
Generated by
1.17.0