Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
modsmenusimple.c
Go to the documentation of this file.
1
class
ModsMenuSimple
extends
ScriptedWidgetEventHandler
2
{
3
protected
const
int
MOD_DISPLAY_COUNT_MAX
= 3;
4
5
protected
Widget
m_Root
;
6
protected
Widget
m_MoreButton
;
7
protected
Widget
m_MoreHighlight
;
8
protected
ref
map<ModInfo, ref ModsMenuSimpleEntry>
m_Data
;
9
protected
ModsMenuDetailed
m_DetailMenu
;
10
11
void
ModsMenuSimple
(
array<ref ModInfo>
data,
Widget
parent,
ModsMenuDetailed
detail_menu)
12
{
13
m_Root
=
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/mods_menu/mods_menu_simple.layout"
, parent);
14
m_MoreButton
=
m_Root
.FindAnyWidget(
"ModMore"
);
15
m_MoreHighlight
=
m_Root
.FindAnyWidget(
"ModMoreOverlay"
);
16
m_Data
=
new
map<ModInfo, ref ModsMenuSimpleEntry>
;
17
m_DetailMenu
= detail_menu;
18
19
m_Root
.SetHandler(
this
);
20
LoadEntries
(data);
21
}
22
23
void
~ModsMenuSimple
()
24
{
25
delete
m_Root
;
26
}
27
28
void
LoadEntries
(
array<ref ModInfo>
data)
29
{
30
m_MoreButton
.Show(data.Count() >
MOD_DISPLAY_COUNT_MAX
);
31
int
count =
Math
.
Clamp
(data.Count(),0,
MOD_DISPLAY_COUNT_MAX
);
32
33
for
(
int
i = 0; i < count; i++)
34
{
35
ref
ModsMenuSimpleEntry
entry =
new
ModsMenuSimpleEntry
(data[i], i,
m_Root
,
this
);
36
m_Data
.Insert(data[i], entry);
37
}
38
}
39
40
void
Select
(
ModInfo
mod)
41
{
42
m_DetailMenu
.Open();
43
m_DetailMenu
.Highlight(mod);
44
}
45
46
override
bool
OnMouseButtonUp
(
Widget
w,
int
x
,
int
y
,
int
button)
47
{
48
if
(w ==
m_MoreButton
)
49
{
50
if
(
m_DetailMenu
.IsOpen())
51
m_DetailMenu
.Close();
52
else
53
m_DetailMenu
.Open();
54
return
true
;
55
}
56
return
false
;
57
}
58
59
override
bool
OnMouseEnter
(
Widget
w,
int
x
,
int
y
)
60
{
61
if
(w ==
m_MoreButton
)
62
{
63
m_MoreHighlight
.Show(
true
);
64
return
true
;
65
}
66
return
false
;
67
}
68
69
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x
,
int
y
)
70
{
71
if
(enterW !=
m_MoreButton
)
72
{
73
m_MoreHighlight
.Show(
false
);
74
return
true
;
75
}
76
return
false
;
77
}
78
79
override
bool
OnFocus
(
Widget
w,
int
x
,
int
y
)
80
{
81
if
(w ==
m_MoreButton
)
82
{
83
m_MoreHighlight
.Show(
true
);
84
return
true
;
85
}
86
return
false
;
87
}
88
89
override
bool
OnFocusLost
(
Widget
w,
int
x
,
int
y
)
90
{
91
if
(w ==
m_MoreButton
)
92
{
93
m_MoreHighlight
.Show(
false
);
94
return
true
;
95
}
96
return
false
;
97
}
98
}
Math
Definition
enmath.c:7
ModInfo
Definition
modinfo.c:2
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition
enwidgets.c:657
ScriptedWidgetEventHandler::m_Root
Widget m_Root
Definition
sizetochild.c:9
ScriptedWidgetEventHandler::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
modsmenusimple.c:69
ScriptedWidgetEventHandler::m_DetailMenu
ModsMenuDetailed m_DetailMenu
Definition
modsmenusimple.c:9
ScriptedWidgetEventHandler::ModsMenuDetailed
void ModsMenuDetailed(array< ref ModInfo > data, Widget parent, ModsMenuTooltip tooltip, UIScriptedMenu menu_parent)
Definition
modsmenudetailed.c:17
ScriptedWidgetEventHandler::LoadEntries
void LoadEntries(array< ref ModInfo > data)
Definition
modsmenudetailed.c:168
ScriptedWidgetEventHandler::m_MoreHighlight
Widget m_MoreHighlight
Definition
modsmenusimple.c:7
ScriptedWidgetEventHandler::~ModsMenuSimple
void ~ModsMenuSimple()
Definition
modsmenusimple.c:23
ScriptedWidgetEventHandler::m_Data
ref map< ref ModInfo, ref ModsMenuDetailedEntry > m_Data
Definition
modsmenudetailed.c:7
ScriptedWidgetEventHandler::ModsMenuSimple
void ModsMenuSimple(array< ref ModInfo > data, Widget parent, ModsMenuDetailed detail_menu)
Definition
modsmenusimple.c:11
ScriptedWidgetEventHandler::Select
void Select(ModInfo mod)
Definition
modsmenusimple.c:40
ScriptedWidgetEventHandler::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
modsmenusimple.c:89
ScriptedWidgetEventHandler::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
modsmenusimple.c:59
ScriptedWidgetEventHandler::ModsMenuSimpleEntry
void ModsMenuSimpleEntry(ModInfo data, int index, Widget parent, ModsMenuSimple parent_menu)
Definition
modsmenusimpleentry.c:11
ScriptedWidgetEventHandler::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
modsmenusimple.c:79
ScriptedWidgetEventHandler::MOD_DISPLAY_COUNT_MAX
const int MOD_DISPLAY_COUNT_MAX
Definition
modsmenusimple.c:3
ScriptedWidgetEventHandler::m_MoreButton
Widget m_MoreButton
Definition
modsmenusimple.c:6
ScriptedWidgetEventHandler::OnMouseButtonUp
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
Definition
modsmenusimple.c:46
Widget
Definition
enwidgets.c:190
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
map
Definition
cachedequipmentstorage.c:4
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Math::Clamp
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
x
Icon x
y
Icon y
Games
Dayz
scripts
5_mission
gui
newui
modsmenu
modsmenusimple.c
Generated by
1.17.0