Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
closablecontainer.c
Go to the documentation of this file.
1
class
ClosableContainer
extends
Container
2
{
3
protected
ref
ClosableHeader
m_ClosableHeader
;
4
protected
bool
m_LockCargo
;
5
6
void
ClosableContainer
(
LayoutHolder
parent,
int
sort = -1 )
7
{
8
m_Body =
new
array<ref LayoutHolder>
;
9
m_ClosableHeader
=
new
ClosableHeader
(
this
,
"CloseButtonOnMouseButtonDown"
);
10
11
if
( sort > -1 )
12
m_RootWidget
.SetSort( sort + 2 );
13
14
m_MainWidget = m_MainWidget.FindWidget(
"body"
);
15
}
16
17
override
bool
IsDisplayable
()
18
{
19
for
(
int
i = 0; i < m_Body.Count(); i++)
20
{
21
LayoutHolder
c = m_Body[i];
22
if
( c && c.IsDisplayable())
23
return
true
;
24
}
25
return
false
;
26
}
27
28
override
void
UpdateRadialIcon
()
29
{
30
if
( m_SlotIcon )
31
{
32
bool
show_radial_icon;
33
show_radial_icon =
IsOpened
();
34
show_radial_icon = show_radial_icon && ( (
m_Entity
.GetInventory().
GetCargo
() &&
m_Entity
.CanDisplayCargo()) ||
m_Entity
.GetSlotsCountCorrect() > 0 );
35
show_radial_icon = show_radial_icon && !
m_Entity
.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT );
36
if
(
IsDisplayable
() )
37
{
38
m_SlotIcon.GetRadialIconPanel().Show(
true
);
39
SetOpenForSlotIcon(show_radial_icon);
40
}
41
else
42
{
43
m_SlotIcon.GetRadialIconPanel().Show(
false
);
44
}
45
}
46
}
47
48
void
SetOpenState
(
bool
state )
49
{
50
ItemManager
.
GetInstance
().
SetDefaultOpenState
(
m_Entity
.GetType(), state );
51
m_Closed = !state;
52
if
( !m_Closed )
53
{
54
OnShow
();
55
}
56
else
57
{
58
OnHide
();
59
}
60
}
61
62
override
Header
GetHeader
()
63
{
64
return
m_ClosableHeader
;
65
}
66
67
override
void
Open
()
68
{
69
if
(
IsDisplayable
() )
70
{
71
super.Open();
72
ItemManager
.
GetInstance
().
SetDefaultOpenState
(
m_Entity
.GetType(),
true
);
73
SetOpenForSlotIcon(
true
);
74
OnShow
();
75
m_Parent
.m_Parent.Refresh();
76
}
77
}
78
79
override
void
Close
()
80
{
81
ItemManager
.
GetInstance
().
SetDefaultOpenState
(
m_Entity
.GetType(),
false
);
82
super.Close();
83
SetOpenForSlotIcon(
false
);
84
OnHide
();
85
m_Parent
.m_Parent.Refresh();
//TODO: ???
86
}
87
88
override
void
SetLayoutName
()
89
{
90
m_LayoutName =
WidgetLayoutName
.
ClosableContainer
;
91
}
92
93
override
void
OnShow
()
94
{
95
if
(
IsOpened
() )
96
{
97
super.OnShow();
98
}
99
}
100
101
override
LayoutHolder
Get
(
int
x
)
102
{
103
if
( m_Body &&
x
< m_Body.Count() &&
x
>= 0 )
104
return
m_Body.
Get
(
x
);
105
return
null;
106
}
107
108
override
void
Refresh
()
109
{
110
if
( !m_Closed )
111
{
112
super.Refresh();
113
}
114
}
115
116
void
CloseButtonOnMouseButtonDown
()
117
{
118
Close
();
119
}
120
121
override
float
GetFocusedContainerHeight
(
bool
contents =
false
)
122
{
123
float
x
,
y
;
124
if
( contents && GetFocusedContainer() )
125
y
= GetFocusedContainer().GetFocusedContainerHeight( contents );
126
else
if
( GetRootWidget() )
127
GetRootWidget().GetScreenSize(
x
,
y
);
128
return
y
;
129
}
130
131
override
float
GetFocusedContainerYPos
(
bool
contents =
false
)
132
{
133
float
x
,
y
;
134
if
( contents && GetFocusedContainer() )
135
y
= GetFocusedContainer().GetFocusedContainerYPos( contents );
136
else
if
( GetRootWidget() )
137
GetRootWidget().GetPos(
x
,
y
);
138
return
y
;
139
}
140
141
override
float
GetFocusedContainerYScreenPos
(
bool
contents =
false
)
142
{
143
float
x
,
y
;
144
if
( contents && GetFocusedContainer() )
145
y
= GetFocusedContainer().GetFocusedContainerYScreenPos( contents );
146
else
if
( GetRootWidget() )
147
GetRootWidget().GetScreenPos(
x
,
y
);
148
return
y
;
149
}
150
151
void
MoveContainerUp
(
Widget
cont )
152
{
153
if
(
m_Entity
)
154
{
155
InventoryLocation
loc =
new
InventoryLocation
;
156
m_Entity
.GetInventory().GetCurrentInventoryLocation( loc );
157
if
( loc.
IsValid
() )
158
{
159
int
slot = loc.
GetSlot
();
160
Inventory
.MoveAttachmentUp( slot );
161
UpdateSelectionIcons();
162
}
163
}
164
}
165
166
void
MoveContainerDown
(
Widget
cont )
167
{
168
if
(
m_Entity
)
169
{
170
InventoryLocation
loc =
new
InventoryLocation
;
171
m_Entity
.GetInventory().GetCurrentInventoryLocation( loc );
172
if
( loc.
IsValid
() )
173
{
174
int
slot = loc.
GetSlot
();
175
Inventory
.MoveAttachmentDown( slot );
176
UpdateSelectionIcons();
177
}
178
}
179
}
180
181
override
void
CheckHeaderDragability
()
182
{
183
super.CheckHeaderDragability();
184
185
if
(
m_ClosableHeader
&&
m_Entity
)
//TODO: do the entity check here?
186
{
187
int
flag =
m_ClosableHeader
.GetMainWidget().GetFlags();
188
bool
old = flag &
WidgetFlags
.DRAGGABLE;
189
bool
current =
ItemBase
.Cast(
m_Entity
) &&
m_Entity
.IsTakeable();
190
//bool changed = false;
191
if
(old && !current)
192
{
193
m_ClosableHeader
.GetMainWidget().ClearFlags(
WidgetFlags
.DRAGGABLE );
194
Widget
drag =
GetDragWidget
();
195
if
(drag && drag ==
m_ClosableHeader
.GetMainWidget())
196
{
197
CancelWidgetDragging
();
198
m_ClosableHeader
.OnDropHeader(null);
199
}
200
201
//changed = true;
202
}
203
else
if
(!old && current)
204
{
205
m_ClosableHeader
.GetMainWidget().SetFlags(
WidgetFlags
.DRAGGABLE );
206
//changed = true;
207
}
208
/*if (old != current)
209
{
210
flag &= ~WidgetFlags.DRAGGABLE;
211
m_ClosableHeader.GetMainWidget().SetFlags( flag );
212
}*/
213
}
214
}
215
}
Inventory
void Inventory(LayoutHolder parent)
Definition
inventory.c:74
m_Entity
Entity m_Entity
Definition
cachedequipmentstoragebase.c:14
m_Parent
Entity m_Parent
Definition
cachedequipmentstoragebase.c:15
ClosableContainer
Definition
containerwithcargo.c:2
ClosableContainer::GetCargo
CargoContainer GetCargo()
Definition
containerwithcargo.c:490
ClosableContainer::IsOpened
override bool IsOpened()
Definition
containerwithcargo.c:102
ClosableContainer::Close
override void Close()
Definition
containerwithcargo.c:85
ClosableContainer::IsDisplayable
override bool IsDisplayable()
Definition
containerwithcargo.c:19
ClosableHeader
Definition
closableheader.c:2
Container
Definition
cargocontainer.c:3
Container::GetFocusedContainerYPos
override float GetFocusedContainerYPos(bool contents=false)
Definition
closablecontainer.c:131
Container::SetOpenState
void SetOpenState(bool state)
Definition
closablecontainer.c:48
Container::ClosableContainer
void ClosableContainer(LayoutHolder parent, int sort=-1)
Definition
closablecontainer.c:6
Container::MoveContainerDown
void MoveContainerDown(Widget cont)
Definition
closablecontainer.c:166
Container::Refresh
override void Refresh()
Definition
closablecontainer.c:108
Container::OnShow
override void OnShow()
Definition
closablecontainer.c:93
Container::GetFocusedContainerYScreenPos
override float GetFocusedContainerYScreenPos(bool contents=false)
Definition
closablecontainer.c:141
Container::UpdateRadialIcon
override void UpdateRadialIcon()
Definition
closablecontainer.c:28
Container::CloseButtonOnMouseButtonDown
void CloseButtonOnMouseButtonDown()
Definition
closablecontainer.c:116
Container::GetHeader
override Header GetHeader()
Definition
closablecontainer.c:62
Container::Get
override LayoutHolder Get(int x)
Definition
closablecontainer.c:101
Container::CheckHeaderDragability
override void CheckHeaderDragability()
Definition
closablecontainer.c:181
Container::m_ClosableHeader
ref ClosableHeader m_ClosableHeader
Definition
closablecontainer.c:3
Container::GetFocusedContainerHeight
override float GetFocusedContainerHeight(bool contents=false)
Definition
closablecontainer.c:121
Container::Close
override void Close()
Definition
closablecontainer.c:79
Container::MoveContainerUp
void MoveContainerUp(Widget cont)
Definition
closablecontainer.c:151
Container::SetLayoutName
override void SetLayoutName()
Definition
closablecontainer.c:88
Container::Open
override void Open()
Definition
closablecontainer.c:67
Container::IsDisplayable
override bool IsDisplayable()
Definition
closablecontainer.c:17
Container::m_LockCargo
bool m_LockCargo
Definition
closablecontainer.c:4
Header
Definition
header.c:2
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::GetSlot
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation::IsValid
proto native bool IsValid()
verify current set inventory location
ItemBase
Definition
inventoryitem.c:742
ItemManager
Definition
itemmanager.c:2
ItemManager::SetDefaultOpenState
void SetDefaultOpenState(string type, bool is_opened)
Definition
itemmanager.c:168
ItemManager::GetInstance
static ItemManager GetInstance()
Definition
itemmanager.c:282
LayoutHolder
Definition
container.c:2
LayoutHolder::Get
LayoutHolder Get(int x)
Definition
container.c:1246
Widget
Definition
enwidgets.c:190
WidgetLayoutName
Definition
widgetlayoutname.c:2
WidgetLayoutName::ClosableContainer
const string ClosableContainer
Definition
widgetlayoutname.c:49
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
OnShow
override void OnShow()
Definition
controlsxbox.c:362
WidgetFlags
WidgetFlags
Definition
enwidgets.c:58
CancelWidgetDragging
proto native Widget CancelWidgetDragging()
GetDragWidget
proto native Widget GetDragWidget()
x
Icon x
y
Icon y
OnHide
override void OnHide()
Definition
inventorymenu.c:141
m_RootWidget
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Definition
pluginremoteplayerdebugclient.c:14
Games
Dayz
scripts
5_mission
gui
inventorynew
containers
closablecontainer.c
Generated by
1.17.0