Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
itemdropwarningmenu.c
Go to the documentation of this file.
1
class
WarningMenuBase
:
UIScriptedMenu
2
{
3
protected
ButtonWidget
m_OkButton
;
4
protected
MultilineTextWidget
m_Description
;
5
6
void
WarningMenuBase
()
7
{
8
if
(
g_Game
.GetMission())
9
{
10
g_Game
.GetMission().AddActiveInputExcludes({
"menu"
});
11
12
g_Game
.GetMission().GetHud().ShowHudUI(
false
);
13
g_Game
.GetMission().GetHud().ShowQuickbarUI(
false
);
14
}
15
}
16
17
void
~WarningMenuBase
()
18
{
19
if
(
g_Game
&&
g_Game
.GetMission())
20
{
21
g_Game
.GetMission().RemoveActiveInputExcludes({
"menu"
},
true
);
22
23
g_Game
.GetMission().GetHud().ShowHudUI(
true
);
24
g_Game
.GetMission().GetHud().ShowQuickbarUI(
true
);
25
26
g_Game
.GetMission().GetOnInputPresetChanged().Remove(
OnInputPresetChanged
);
27
g_Game
.GetMission().GetOnInputDeviceChanged().Remove(
OnInputDeviceChanged
);
28
}
29
}
30
31
override
Widget
Init
()
32
{
33
layoutRoot =
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/day_z_dropped_items.layout"
);
34
m_OkButton
= ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"bOK"
));
35
m_Description
= MultilineTextWidget.Cast(layoutRoot.FindAnyWidget(
"txtDescription"
));
36
m_Description
.Show(
true
);
37
38
string
text =
Widget
.TranslateString(
GetText
());
39
m_Description
.SetText(text);
40
41
if
(
g_Game
.GetMission())
42
{
43
g_Game
.GetMission().GetOnInputPresetChanged().Insert(
OnInputPresetChanged
);
44
g_Game
.GetMission().GetOnInputDeviceChanged().Insert(
OnInputDeviceChanged
);
45
}
46
47
OnInputDeviceChanged
(
g_Game
.GetInput().GetCurrentInputDevice());
48
49
return
layoutRoot;
50
}
51
52
string
GetText
()
53
{
54
return
""
;
55
}
56
57
override
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button)
58
{
59
super.OnClick(w,
x
,
y
, button);
60
61
if
(w.GetUserID() ==
IDC_OK
)
62
{
63
Close
();
64
return
true
;
65
}
66
67
return
false
;
68
}
69
70
override
void
Update
(
float
timeslice)
71
{
72
super.Update(timeslice);
73
74
#ifdef PLATFORM_CONSOLE
75
if
(
GetUApi
().GetInputByID(UAUISelect).LocalPress())
76
Close
();
77
#endif
78
}
79
80
protected
void
OnInputPresetChanged
()
81
{
82
#ifdef PLATFORM_CONSOLE
83
UpdateControlsElements
();
84
#endif
85
}
86
87
protected
void
OnInputDeviceChanged
(
EInputDeviceType
pInputDeviceType)
88
{
89
UpdateControlsElements
();
90
UpdateControlsElementVisibility
();
91
}
92
93
protected
void
UpdateControlsElements
()
94
{
95
RichTextWidget
toolbarText =
RichTextWidget
.Cast(layoutRoot.FindAnyWidget(
"ContextToolbarText"
));
96
string
context =
string
.Format(
" %1"
,
InputUtils
.
GetRichtextButtonIconFromInputAction
(
"UAUISelect"
,
"#early_access_alpha_understand"
, EUAINPUT_DEVICE_CONTROLLER,
InputUtils
.
ICON_SCALE_TOOLBAR
));
97
98
toolbarText.SetText(context);
99
}
100
101
protected
void
UpdateControlsElementVisibility
()
102
{
103
bool
toolbarShow =
false
;
104
#ifdef PLATFORM_CONSOLE
105
toolbarShow = !
g_Game
.GetInput().IsEnabledMouseAndKeyboard() ||
g_Game
.GetInput().GetCurrentInputDevice() ==
EInputDeviceType
.CONTROLLER;
106
#endif
107
108
layoutRoot.FindAnyWidget(
"BottomConsoleToolbar"
).Show(toolbarShow);
109
m_OkButton
.Show(!toolbarShow);
110
}
111
}
112
113
class
ItemDropWarningMenu :
WarningMenuBase
114
{
115
override
string
GetText
()
116
{
117
return
"#str_item_drop_notification"
;
118
}
119
}
120
121
class
PlayerRepositionWarningMenu
:
WarningMenuBase
122
{
123
override
string
GetText
()
124
{
125
return
"#str_position_change_notification"
;
126
}
127
}
InputUtils
Definition
inpututils.c:2
InputUtils::ICON_SCALE_TOOLBAR
static const float ICON_SCALE_TOOLBAR
Definition
inpututils.c:15
InputUtils::GetRichtextButtonIconFromInputAction
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition
inpututils.c:167
PlayerRepositionWarningMenu
Definition
itemdropwarningmenu.c:122
PlayerRepositionWarningMenu::GetText
override string GetText()
Definition
itemdropwarningmenu.c:123
RichTextWidget
Definition
gameplay.c:317
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
WarningMenuBase
Definition
itemdropwarningmenu.c:2
WarningMenuBase::OnInputPresetChanged
void OnInputPresetChanged()
Definition
itemdropwarningmenu.c:80
WarningMenuBase::UpdateControlsElementVisibility
void UpdateControlsElementVisibility()
Definition
itemdropwarningmenu.c:101
WarningMenuBase::Update
override void Update(float timeslice)
Definition
itemdropwarningmenu.c:70
WarningMenuBase::WarningMenuBase
void WarningMenuBase()
Definition
itemdropwarningmenu.c:6
WarningMenuBase::~WarningMenuBase
void ~WarningMenuBase()
Definition
itemdropwarningmenu.c:17
WarningMenuBase::m_OkButton
ButtonWidget m_OkButton
Definition
itemdropwarningmenu.c:3
WarningMenuBase::OnInputDeviceChanged
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition
itemdropwarningmenu.c:87
WarningMenuBase::m_Description
MultilineTextWidget m_Description
Definition
itemdropwarningmenu.c:4
WarningMenuBase::Init
override Widget Init()
Definition
itemdropwarningmenu.c:31
WarningMenuBase::UpdateControlsElements
void UpdateControlsElements()
Definition
itemdropwarningmenu.c:93
WarningMenuBase::GetText
string GetText()
Definition
itemdropwarningmenu.c:52
WarningMenuBase::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
itemdropwarningmenu.c:57
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
IDC_OK
const int IDC_OK
Definition
constants.c:135
x
Icon x
y
Icon y
EInputDeviceType
EInputDeviceType
Definition
input.c:3
Close
void Close()
GetUApi
proto native UAInputAPI GetUApi()
Games
Dayz
scripts
5_mission
gui
itemdropwarningmenu.c
Generated by
1.17.0