DayZ 1.24
Loading...
Searching...
No Matches
SlotsContainer Class Reference
Inheritance diagram for SlotsContainer:
[legend]
Collaboration diagram for SlotsContainer:
[legend]

Protected Member Functions

void SlotsContainer (LayoutHolder parent, EntityAI slot_parent)
 
override void SetDefaultFocus (bool while_micromanagment_mode=false)
 
override void SetLastFocus ()
 
void SetFocus (int index)
 
void SetVisibleFocus (int index)
 
int GetVisibleFocus ()
 
override void SetNextRightActive ()
 
override void SetNextLeftActive ()
 
void UpdateIcon ()
 
override void UnfocusAll ()
 
override void Unfocus ()
 
override bool SelectItem ()
 
override bool IsEmpty ()
 
override bool IsDisplayable ()
 
SlotsIcon GetSlotIcon (int index)
 
override SlotsIcon GetFocusedSlotsIcon ()
 
override EntityAI GetFocusedItem ()
 
override void SetLayoutName ()
 
bool VerifySlotsIconVisibility (int idx=-1)
 Returns 'true' if radial icon is VISIBLE and also OPEN (individual icon or any icon, use parameter..)
 

Protected Attributes

ref array< ref SlotsIconm_Icons
 
int m_VisibleColumnCount
 

Additional Inherited Members

- Private Member Functions inherited from Container
void CargoContainer (LayoutHolder parent, bool is_attachment=false)
 
void ~CargoContainer ()
 
int GetCargoIndex ()
 
void AddedToCargoEx (EntityAI item, bool refresh=true)
 
void AddedToCargo (EntityAI item)
 
void RemovedFromCargo (EntityAI item)
 
void MovedInCargo (EntityAI item)
 
void SetLock (EntityAI item)
 
void ReleaseLock (EntityAI item)
 
override void SetLayoutName ()
 
void SetEntity (EntityAI item, int cargo_index=0, bool immedUpdate=true)
 
EntityAI GetEntity ()
 
void UpdateHeaderText ()
 
void InitGridHeight ()
 
void UpdateSize ()
 
float GetIconSize ()
 
float GetSpaceSize ()
 
int GetCargoCapacity ()
 
int GetMaxCargoCapacity ()
 
Icon GetIcon (EntityAI item)
 
Icon GetIcon (int index)
 
Icon GetFocusedIcon ()
 
override float GetFocusedContainerHeight (bool contents=false)
 
override float GetFocusedContainerYPos (bool contents=false)
 
override float GetFocusedContainerYScreenPos (bool contents=false)
 
void UpdateSelection ()
 
void UpdateRowVisibility (int count)
 
override void Refresh ()
 
void RefreshImpl ()
 
override void UpdateInterval ()
 
Icon InitIconEx (Icon icon, EntityAI item, int pos_x, int pos_y, bool refresh=true)
 
Icon InitIcon (Icon icon, EntityAI item, int pos_x, int pos_y)
 
bool HasItem (EntityAI item)
 
override bool TransferItemToVicinity ()
 
override void SetDefaultFocus (bool while_micromanagment_mode=false)
 
override void SetLastFocus ()
 
override void Unfocus ()
 
override void UnfocusAll ()
 
override void SetNextActive ()
 
override void SetPreviousActive (bool force=false)
 
override void SetNextRightActive ()
 
override void SetNextLeftActive ()
 
override EntityAI GetFocusedItem ()
 
override void SetLastActive ()
 
override void SetActive (bool active)
 
override bool IsItemActive ()
 
override bool IsItemWithQuantityActive ()
 
override bool IsEmpty ()
 
int GetRecipeCount (bool recipe_anywhere, ItemBase entity1, ItemBase entity2, PlayerBase player)
 
override bool CanCombineAmmo ()
 
override bool TransferItem ()
 
override bool SplitItem ()
 
override bool EquipItem ()
 
override bool SelectItem ()
 
override bool Select ()
 
override bool Combine ()
 
void ShowFalseCargoHeader (bool show)
 
void SetAlternateFalseTextHeaderWidget (TextWidget w)
 
void ClosableContainer (LayoutHolder parent, int sort=-1)
 
override bool IsDisplayable ()
 
override void UpdateRadialIcon ()
 
void SetOpenState (bool state)
 
override Header GetHeader ()
 
override void Open ()
 
override void Close ()
 
override void SetLayoutName ()
 
override void OnShow ()
 
override LayoutHolder Get (int x)
 
override void Refresh ()
 
void CloseButtonOnMouseButtonDown ()
 
override float GetFocusedContainerHeight (bool contents=false)
 
override float GetFocusedContainerYPos (bool contents=false)
 
override float GetFocusedContainerYScreenPos (bool contents=false)
 
void MoveContainerUp (Widget cont)
 
void MoveContainerDown (Widget cont)
 
override void CheckHeaderDragability ()
 
- Private Attributes inherited from Container
const int ROWS_NUMBER_XBOX = 5
 
CargoBase m_Cargo
 
int m_CargoIndex = -1
 
int m_FocusedItemPosition = -1
 
ref array< ref CargoContainerRowm_Rows
 
ref array< ref Iconm_Icons
 
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedItemPositions
 
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedLockPositions
 
float m_IconSize
 
float m_SpaceSize
 
bool m_IsAttachment
 
TextWidget m_FalseHeaderTextWidget
 
TextWidget m_AlternateFalseHeaderTextWidget
 
Widget m_CargoHeader
 
Widget m_CargoContainer
 
Widget m_ItemsContainer
 
ref SizeToChild m_Resizer1
 
ref SizeToChild m_Resizer2
 
ref Timer m_ResizeTimer
 
ref ClosableHeader m_ClosableHeader
 
bool m_LockCargo
 

Detailed Description

Definition at line 1 of file SlotsContainer.c.

Constructor & Destructor Documentation

◆ SlotsContainer()

void SlotsContainer::SlotsContainer ( LayoutHolder parent,
EntityAI slot_parent )
inlineprotected

Definition at line 6 of file SlotsContainer.c.

7 {
9 for (int i = 0; i < ITEMS_IN_ROW; i++)
10 {
11 if (GetRootWidget().FindAnyWidget("Icon" + i))
12 m_Icons.Insert(new SlotsIcon(this, GetRootWidget().FindAnyWidget("Icon" + i), i, slot_parent));
13 else
14 {
15 Widget child = GetRootWidget().GetChildren();
16 while (child)
17 child = child.GetSibling();
18 }
19 }
20 }
const int ITEMS_IN_ROW
Definition Attachments.c:1
ref array< ref SlotsIcon > m_Icons
proto native Widget FindAnyWidget(string pathname)

References FindAnyWidget(), ITEMS_IN_ROW, and m_Icons.

Member Function Documentation

◆ GetFocusedItem()

override EntityAI SlotsContainer::GetFocusedItem ( )
inlineprotected

Definition at line 202 of file SlotsContainer.c.

203 {
205
206 if (focus_icon && !focus_icon.IsReserved())
207 return EntityAI.Cast(focus_icon.GetObject());
208
209 return null;
210 }
override SlotsIcon GetFocusedSlotsIcon()

References GetFocusedSlotsIcon().

Referenced by SelectItem(), and UpdateIcon().

◆ GetFocusedSlotsIcon()

override SlotsIcon SlotsContainer::GetFocusedSlotsIcon ( )
inlineprotected

Definition at line 195 of file SlotsContainer.c.

196 {
197 if (m_Icons.Count())
198 return m_Icons.Get(m_FocusedColumn);
199 return null;
200 }

References m_Icons.

Referenced by GetFocusedItem(), and SelectItem().

◆ GetSlotIcon()

SlotsIcon SlotsContainer::GetSlotIcon ( int index)
inlineprotected

Definition at line 187 of file SlotsContainer.c.

188 {
189 if (m_Icons.IsValidIndex(index))
190 return m_Icons.Get(index);
191
192 return null;
193 }

References m_Icons.

Referenced by ZombieContainer::GetSlotsIcon(), Attachments::InitAttachmentGrid(), IsDisplayable(), and UpdateIcon().

◆ GetVisibleFocus()

int SlotsContainer::GetVisibleFocus ( )
inlineprotected

Definition at line 71 of file SlotsContainer.c.

72 {
73 int visible_icons_count = 0;
74 for (int i = 0; i < GetColumnCount(); i++)
75 {
76 if (m_FocusedColumn == i)
79 if (icon.IsVisible())
81 }
82 return visible_icons_count - 1;
83 }

References m_Icons.

◆ IsDisplayable()

override bool SlotsContainer::IsDisplayable ( )
inlineprotected

Definition at line 175 of file SlotsContainer.c.

176 {
177 if (m_ForcedShow)
178 return true;
179 for (int i = 0; i < m_ColumnCount; i++)
180 {
181 if (GetSlotIcon(i).IsVisible())
182 return true;
183 }
184 return false;
185 }
SlotsIcon GetSlotIcon(int index)
proto native bool IsVisible()

References GetSlotIcon(), and IsVisible().

◆ IsEmpty()

override bool SlotsContainer::IsEmpty ( )
inlineprotected

Definition at line 170 of file SlotsContainer.c.

171 {
172 return false;
173 }

◆ SelectItem()

override bool SlotsContainer::SelectItem ( )
inlineprotected

Definition at line 157 of file SlotsContainer.c.

158 {
161
162 if (item && !item.IsLockedInSlot() && !icon.IsOutOfReach() && !icon.IsReserved() && item.IsTakeable() && item.CanPutIntoHands(null))
163 {
164 ItemManager.GetInstance().SetSelectedItemEx(item, null, icon);
165 return true;
166 }
167 return false;
168 }
static ItemManager GetInstance()
override EntityAI GetFocusedItem()

References GetFocusedItem(), GetFocusedSlotsIcon(), and ItemManager::GetInstance().

◆ SetDefaultFocus()

override void SlotsContainer::SetDefaultFocus ( bool while_micromanagment_mode = false)
inlineprotected

Definition at line 22 of file SlotsContainer.c.

23 {
24 m_FocusedColumn = 0;
25 for (int i = 0; i < GetColumnCount(); i++)
26 {
28 if (icon.IsVisible())
29 {
30 m_FocusedColumn = i;
31 break;
32 }
33 }
34
35 SetFocus(m_FocusedColumn);
36 }
void SetFocus(int index)

References m_Icons, and SetFocus().

Referenced by SetLastFocus().

◆ SetFocus()

void SlotsContainer::SetFocus ( int index)
inlineprotected

Definition at line 43 of file SlotsContainer.c.

44 {
45 if (index >= 0 && index < m_Icons.Count())
46 m_Icons.Get(index).GetSelectedPanel().Show(true);
47 UpdateIcon();
48 }

References m_Icons, and UpdateIcon().

Referenced by SetDefaultFocus(), and SetVisibleFocus().

◆ SetLastFocus()

override void SlotsContainer::SetLastFocus ( )
inlineprotected

Definition at line 38 of file SlotsContainer.c.

39 {
41 }
override void SetDefaultFocus(bool while_micromanagment_mode=false)

References SetDefaultFocus().

◆ SetLayoutName()

override void SlotsContainer::SetLayoutName ( )
inlineprotected

Definition at line 212 of file SlotsContainer.c.

213 {
214#ifdef PLATFORM_CONSOLE
216#else
217 switch (InventoryMenu.GetWidthType())
218 {
219 case ScreenWidthType.NARROW:
220 {
222 break;
223 }
224 case ScreenWidthType.MEDIUM:
225 {
227 break;
228 }
229 case ScreenWidthType.WIDE:
230 {
232 break;
233 }
234 }
235#endif
236
237 }
ScreenWidthType
void InventoryMenu()
const string InventorySlotsContainerWide
const string InventorySlotsContainerMedium
const string InventorySlotsContainerXbox
const string InventorySlotsContainerNarrow

References InventoryMenu(), WidgetLayoutName::InventorySlotsContainerMedium, WidgetLayoutName::InventorySlotsContainerNarrow, WidgetLayoutName::InventorySlotsContainerWide, and WidgetLayoutName::InventorySlotsContainerXbox.

◆ SetNextLeftActive()

override void SlotsContainer::SetNextLeftActive ( )
inlineprotected

Definition at line 106 of file SlotsContainer.c.

107 {
108 Unfocus();
109
110 int index = m_FocusedColumn - 1;
111 for (int i = 0; i < GetColumnCount(); i++)
112 {
113 if (index < 0)
114 index = GetColumnCount() - 1;
116 if (icon.IsVisible())
117 {
118 m_FocusedColumn = index;
119 break;
120 }
121 index--;
122 }
123
124 UpdateIcon();
125 }
override void Unfocus()

References m_Icons, Unfocus(), and UpdateIcon().

◆ SetNextRightActive()

override void SlotsContainer::SetNextRightActive ( )
inlineprotected

Definition at line 85 of file SlotsContainer.c.

86 {
87 Unfocus();
88
89 int index = m_FocusedColumn + 1;
90 for (int i = 0; i < GetColumnCount(); i++)
91 {
92 if (index >= GetColumnCount())
93 index = 0;
95 if (icon.IsVisible())
96 {
97 m_FocusedColumn = index;
98 break;
99 }
100 index++;
101 }
102
103 UpdateIcon();
104 }

References m_Icons, Unfocus(), and UpdateIcon().

◆ SetVisibleFocus()

void SlotsContainer::SetVisibleFocus ( int index)
inlineprotected

Definition at line 50 of file SlotsContainer.c.

51 {
52 Unfocus();
53 int visible_icons_count = 0;
54
55 m_FocusedColumn = 0;
56 for (int i = 0; i < GetColumnCount(); i++)
57 {
59 if (icon.IsVisible())
60 {
61 m_FocusedColumn = i;
63 break;
65 }
66 }
67
68 SetFocus(m_FocusedColumn);
69 }

References m_Icons, SetFocus(), and Unfocus().

◆ Unfocus()

override void SlotsContainer::Unfocus ( )
inlineprotected

Definition at line 150 of file SlotsContainer.c.

151 {
152 Widget w = m_Icons.Get(m_FocusedColumn).GetSelectedPanel();
153 if (w)
154 w.Show(false);
155 }

References m_Icons.

Referenced by SetNextLeftActive(), SetNextRightActive(), and SetVisibleFocus().

◆ UnfocusAll()

override void SlotsContainer::UnfocusAll ( )
inlineprotected

Definition at line 144 of file SlotsContainer.c.

145 {
146 for (int i = 0; i < m_Icons.Count(); i++)
147 m_Icons.Get(i).GetSelectedPanel().Show(false);
148 }

References m_Icons.

◆ UpdateIcon()

void SlotsContainer::UpdateIcon ( )
inlineprotected

Definition at line 127 of file SlotsContainer.c.

128 {
129 float x, y;
130 SlotsIcon icon = GetSlotIcon(m_FocusedColumn);
131
132 icon.GetSelectedPanel().Show(true);
133 icon.GetSelectedPanel().GetScreenPos(x, y);
134
136 if (focused_item)
137 {
138 PrepareOwnedTooltip(focused_item, -1, y); //custom positioning for the controller
139 }
140 else
141 PrepareOwnedSlotsTooltip(icon.GetSelectedPanel(), icon.GetSlotDisplayName(), icon.GetSlotDesc(), x, y);
142 }
Icon x
Icon y

References GetFocusedItem(), GetSlotIcon(), x, and y.

Referenced by SetFocus(), SetNextLeftActive(), and SetNextRightActive().

◆ VerifySlotsIconVisibility()

bool SlotsContainer::VerifySlotsIconVisibility ( int idx = -1)
inlineprotected

Returns 'true' if radial icon is VISIBLE and also OPEN (individual icon or any icon, use parameter..)

Definition at line 240 of file SlotsContainer.c.

241 {
242 if (idx != -1)
243 return m_Icons[idx].IsVisible() && m_Icons[idx].GetRadialIconPanel().IsVisible() && m_Icons[idx].GetRadialIcon().IsVisible();
244 else
245 {
246 int count = m_Icons.Count();
247 for (int i = 0; i < count; i++)
248 {
249 if (m_Icons[i].IsVisible() && m_Icons[i].GetRadialIconPanel().IsVisible() && m_Icons[i].GetRadialIcon().IsVisible())
250 return true;
251 }
252 }
253 return false;
254 }

References IsVisible(), and m_Icons.

Member Data Documentation

◆ m_Icons

◆ m_VisibleColumnCount

int SlotsContainer::m_VisibleColumnCount
protected

Definition at line 4 of file SlotsContainer.c.


The documentation for this class was generated from the following file: