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_WidgetHighlightUIComponent.c
Go to the documentation of this file.
1
class
SCR_WidgetHighlightUIComponent
:
ScriptedWidgetComponent
2
{
3
protected
Widget
m_HighlightWidget
;
4
12
static
Widget
CreateHighlight
(
Widget
widget,
ResourceName
layout
,
Widget
parent = null)
13
{
14
if
(!widget)
15
{
16
Print
(
"Cannot create highlight, widget not found!"
,
LogLevel
.WARNING);
17
return
null;
18
}
19
20
/*
21
Create the highlight in Workspace, not where target widget is.
22
It's because we don't know which layout slot is used, and not all of them would be compatible (e.g., horizontal slot).
23
Furthermore, highlight widget can be an outline *outside* of the area, and modifying target's clipping could be dangerous.
24
*/
25
WorkspaceWidget
workspace =
GetGame
().GetWorkspace();
26
if
(!parent)
27
parent = workspace;
28
SCR_WidgetHighlightUIComponent
highlight =
new
SCR_WidgetHighlightUIComponent
();
29
highlight.
m_HighlightWidget
= workspace.CreateWidgets(
layout
, parent);
30
widget.AddHandler(highlight);
31
return
highlight.
m_HighlightWidget
;
32
}
33
40
static
Widget
CreateHighlight
(
string
widgetName,
ResourceName
layout
,
Widget
parent = null)
41
{
42
Widget
widget =
GetGame
().GetWorkspace().FindAnyWidget(widgetName);
43
if
(!widget)
44
{
45
Print
(
string
.Format(
"Cannot create highlight, widget '%1' not found!"
, widgetName),
LogLevel
.WARNING);
46
return
null;
47
}
48
return
CreateHighlight
(widget,
layout
, parent);
49
}
50
51
protected
void
Update
(
Widget
w)
52
{
53
//--- Exit if the parent was meanwhile deleted (e.g., when the menu is closed)
54
if
(!
m_HighlightWidget
|| !w.GetParent())
55
{
56
HandlerDeattached
(w);
57
return
;
58
}
59
60
WorkspaceWidget
workspace =
GetGame
().GetWorkspace();
61
62
//--- Set position
63
float
posX, posY, posW, posH;
64
w.GetScreenPos(posX, posY);
65
w.GetScreenSize(posW, posH);
66
FrameSlot
.SetPos(
m_HighlightWidget
, workspace.DPIUnscale(posX), workspace.DPIUnscale(posY));
67
FrameSlot
.SetSize(
m_HighlightWidget
, workspace.DPIUnscale(posW), workspace.DPIUnscale(posH));
68
69
//--- Set visibility
70
bool
isVisible =
true
;
71
while
(w)
72
{
73
if
(!w.IsVisible() || w.GetOpacity() == 0)
74
{
75
isVisible =
false
;
76
break
;
77
}
78
w = w.GetParent();
79
}
80
m_HighlightWidget
.SetVisible(isVisible);
81
}
82
override
void
HandlerAttached
(
Widget
w)
83
{
84
Update
(w);
85
if
(
GetGame
().
GetCallqueue
())
86
GetGame
().GetCallqueue().CallLater(
Update
, 1,
true
, w);
87
}
88
override
void
HandlerDeattached
(
Widget
w)
89
{
90
if
(
GetGame
())
91
{
92
if
(
GetGame
().
GetCallqueue
())
93
GetGame
().GetCallqueue().Remove(
Update
);
94
}
95
96
if
(
m_HighlightWidget
)
97
m_HighlightWidget
.RemoveFromHierarchy();
98
}
99
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetCallqueue
ScriptCallQueue GetCallqueue()
Returns CallQueue of this AI. It gets updated from EvaluateBehavior, so that it's synchronous with ot...
Definition
SCR_AIUtilityComponent.c:478
layout
UI layouts Menus CleanSweep CleanSweepAreaSelection layout
Definition
SCR_GameModeCleanSweep.c:19
FrameSlot
Definition
FrameSlot.c:13
ResourceName
Definition
ResourceName.c:13
SCR_WidgetHighlightUIComponent
Definition
SCR_WidgetHighlightUIComponent.c:2
SCR_WidgetHighlightUIComponent::Update
void Update(Widget w)
Definition
SCR_WidgetHighlightUIComponent.c:51
SCR_WidgetHighlightUIComponent::CreateHighlight
static Widget CreateHighlight(Widget widget, ResourceName layout, Widget parent=null)
Definition
SCR_WidgetHighlightUIComponent.c:12
SCR_WidgetHighlightUIComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_WidgetHighlightUIComponent.c:82
SCR_WidgetHighlightUIComponent::CreateHighlight
static Widget CreateHighlight(string widgetName, ResourceName layout, Widget parent=null)
Definition
SCR_WidgetHighlightUIComponent.c:40
SCR_WidgetHighlightUIComponent::m_HighlightWidget
Widget m_HighlightWidget
Definition
SCR_WidgetHighlightUIComponent.c:3
SCR_WidgetHighlightUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_WidgetHighlightUIComponent.c:88
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
Widget
Definition
Widget.c:13
WorkspaceWidget
Definition
WorkspaceWidget.c:16
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
Components
SCR_WidgetHighlightUIComponent.c
Generated by
1.17.0