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

Protected Member Functions

ItemBase m_Item void HandsPreview (LayoutHolder parent)
 
void ~HandsPreview ()
 
void RefreshQuantity (EntityAI m_Item_to_refresh)
 
override EntityAI GetFocusedItem ()
 
Icon GetIcon ()
 
override void SetDefaultFocus (bool while_micromanagment_mode=false)
 
override void SetLastFocus ()
 
override void Unfocus ()
 
float GetIconSize ()
 
override void SetLayoutName ()
 
void RemoveItem ()
 
override void UpdateInterval ()
 
void CreateNewIcon (ItemBase item)
 
void DeleteIcon ()
 
override bool SelectItem ()
 
override bool Select ()
 

Protected Attributes

ref Icon m_Icon
 
EntityAI m_AttachmentsInitialized
 
float m_IconSize
 

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 HandsPreview.c.

Constructor & Destructor Documentation

◆ HandsPreview()

ItemBase m_Item void HandsPreview::HandsPreview ( LayoutHolder parent)
inlineprotected

Definition at line 10 of file HandsPreview.c.

11 {
12 GetGame().GetPlayer().GetOnItemAddedToHands().Insert(CreateNewIcon);
13 GetGame().GetPlayer().GetOnItemRemovedFromHands().Insert(DeleteIcon);
14 }
void CreateNewIcon(ItemBase item)
void DeleteIcon()
proto native CGame GetGame()

References CreateNewIcon(), DeleteIcon(), and GetGame().

◆ ~HandsPreview()

void HandsPreview::~HandsPreview ( )
inlineprotected

Definition at line 16 of file HandsPreview.c.

17 {
18 GetGame().GetPlayer().GetOnItemAddedToHands().Remove(CreateNewIcon);
19 GetGame().GetPlayer().GetOnItemRemovedFromHands().Remove(DeleteIcon);
20 }

References CreateNewIcon(), DeleteIcon(), and GetGame().

Member Function Documentation

◆ CreateNewIcon()

void HandsPreview::CreateNewIcon ( ItemBase item)
inlineprotected

Definition at line 93 of file HandsPreview.c.

94 {
95 float y;
96 GetRootWidget().GetParent().GetParent().GetParent().GetParent().GetScreenSize(m_IconSize, y);
98
99 m_Icon = new Icon(this, true);
100 m_Icon.Refresh();
101 if (m_Icon)
102 {
103 m_Item = item;
104 m_Icon.Init(m_Item);
105 m_Icon.FullScreen();
106 (HandsContainer.Cast(m_Parent)).ShowAtt(m_Item);
107 m_Icon.Refresh();
108 }
109
110 m_RootWidget.SetColor(ARGB(180, 0, 0, 0));
111 m_Parent.GetParent().Refresh();
112 Inventory.GetInstance().UpdateConsoleToolbar();
113
115 HandsHeader header = HandsHeader.Cast(parent.GetHeader());
116
117 if (m_Item && !m_Item.GetInventory().GetCargo())
118 {
119 string display_name = m_Item.GetDisplayName();
120 display_name.ToUpper();
121 header.SetName(display_name);
122 }
123 }
void Inventory(LayoutHolder parent)
Definition Inventory.c:76
ItemBase m_Item
Definition ActionInput.c:16
Icon y
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Widget m_Parent
Definition SizeToChild.c:86
override Header GetHeader()
float m_IconSize
Definition HandsPreview.c:6
ref Icon m_Icon
Definition HandsPreview.c:3
Definition Icon.c:2
int ARGB(int a, int r, int g, int b)
Definition proto.c:322

References ARGB(), HandsContainer::GetHeader(), Inventory(), m_Icon, m_IconSize, m_Item, m_Parent, m_RootWidget, and y.

Referenced by HandsPreview(), and ~HandsPreview().

◆ DeleteIcon()

void HandsPreview::DeleteIcon ( )
inlineprotected

Definition at line 125 of file HandsPreview.c.

126 {
127 RemoveItem();
128 (HandsContainer.Cast(m_Parent)).DestroyAtt();
129 (HandsContainer.Cast(m_Parent)).DestroyCargo();
132 m_RootWidget.SetColor(ARGB(166, 80, 80, 80));
133 m_Parent.GetParent().Refresh();
134 Inventory.GetInstance().UpdateConsoleToolbar();
135 }
EntityAI m_AttachmentsInitialized
Definition HandsPreview.c:4
void RemoveItem()

References ARGB(), Inventory(), m_AttachmentsInitialized, m_Parent, m_RootWidget, and RemoveItem().

Referenced by HandsPreview(), and ~HandsPreview().

◆ GetFocusedItem()

override EntityAI HandsPreview::GetFocusedItem ( )
inlineprotected

Definition at line 28 of file HandsPreview.c.

29 {
30 return m_Item;
31 }

References m_Item.

◆ GetIcon()

Icon HandsPreview::GetIcon ( )
inlineprotected

Definition at line 33 of file HandsPreview.c.

34 {
35 return m_Icon;
36 }

References m_Icon.

◆ GetIconSize()

float HandsPreview::GetIconSize ( )
inlineprotected

Definition at line 59 of file HandsPreview.c.

60 {
61 return m_IconSize;
62 }

References m_IconSize.

◆ RefreshQuantity()

void HandsPreview::RefreshQuantity ( EntityAI m_Item_to_refresh)
inlineprotected

Definition at line 22 of file HandsPreview.c.

23 {
24 if (m_Icon)
25 m_Icon.SetQuantity();
26 }

References m_Icon.

◆ RemoveItem()

void HandsPreview::RemoveItem ( )
inlineprotected

Definition at line 69 of file HandsPreview.c.

70 {
71 delete m_Icon;
72 m_Item = null;
73 }

References m_Icon, and m_Item.

Referenced by DeleteIcon().

◆ Select()

override bool HandsPreview::Select ( )
inlineprotected

Definition at line 147 of file HandsPreview.c.

148 {
149 Man player = GetGame().GetPlayer();
151 if (ItemManager.GetInstance().IsMicromanagmentMode())
152 {
153 EntityAI selected_item = ItemManager.GetInstance().GetSelectedItem();
154 if (selected_item && selected_item.GetInventory().CanRemoveEntity())
155 {
156 if (item_in_hands && item_in_hands.GetInventory().CanRemoveEntity())
157 {
159 {
160 player.PredictiveSwapEntities(item_in_hands, selected_item);
161 return true;
162 }
163 }
164 else
165 {
166 if (player.GetHumanInventory().CanAddEntityInHands(selected_item) && selected_item.GetInventory().CanRemoveEntity())
167 {
169 float stackable = item_base.GetTargetQuantityMax();
170 if (stackable == 0 || item_base.GetQuantity() <= stackable)
171 {
172 GetGame().GetPlayer().PredictiveTakeEntityToHands(item_base);
173 return true;
174 }
175 else if (stackable != 0 && stackable <= item_base.GetQuantity())
176 {
177 item_base.SplitIntoStackMaxHandsClient(PlayerBase.Cast(GetGame().GetPlayer()));
178 return true;
179 }
180 }
181 }
182 }
183 }
184 return false;
185 }
PlayerBase GetPlayer()
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:610
static ItemManager GetInstance()

References GameInventory::CanSwapEntitiesEx(), GetGame(), ItemManager::GetInstance(), GetPlayer(), and m_Item.

◆ SelectItem()

override bool HandsPreview::SelectItem ( )
inlineprotected

Definition at line 137 of file HandsPreview.c.

138 {
139 if (m_Item)
140 {
141 ItemManager.GetInstance().SetSelectedItemEx(m_Item, null, null);
142 return true;
143 }
144 return false;
145 }

References ItemManager::GetInstance(), and m_Item.

◆ SetDefaultFocus()

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

Definition at line 38 of file HandsPreview.c.

39 {
40 super.SetDefaultFocus(while_micromanagment_mode);
41 if (m_Icon)
42 m_Icon.SetActive(true);
43 }

References m_Icon.

◆ SetLastFocus()

override void HandsPreview::SetLastFocus ( )
inlineprotected

Definition at line 45 of file HandsPreview.c.

46 {
47 super.SetLastFocus();
48 if (m_Icon)
49 m_Icon.SetActive(true);
50 }

References m_Icon.

◆ SetLayoutName()

override void HandsPreview::SetLayoutName ( )
inlineprotected

Definition at line 64 of file HandsPreview.c.

65 {
66 m_LayoutName = WidgetLayoutName.HandsPreview;
67 }
const string HandsPreview

References WidgetLayoutName::HandsPreview.

◆ Unfocus()

override void HandsPreview::Unfocus ( )
inlineprotected

Definition at line 52 of file HandsPreview.c.

53 {
54 super.Unfocus();
55 if (m_Icon)
56 m_Icon.SetActive(false);
57 }

References m_Icon.

◆ UpdateInterval()

override void HandsPreview::UpdateInterval ( )
inlineprotected

Definition at line 75 of file HandsPreview.c.

76 {
77 bool show_combine_swap = ItemManager.GetInstance().IsDragging();
78
79#ifdef PLATFORM_CONSOLE
80 if (m_Icon && !m_Icon.IsDragged() && GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
81#else
82 if (m_Icon && !m_Icon.IsDragged())
83#endif
84 {
85 m_Icon.GetMainWidget().FindAnyWidget("Combine").Show(show_combine_swap);
86 m_Icon.GetMainWidget().FindAnyWidget("Swap").Show(show_combine_swap);
87 }
88
89 if (m_Icon)
90 m_Icon.UpdateInterval();
91 }
ActionInput GetInput()
Definition ActionBase.c:989

References GetGame(), GetInput(), ItemManager::GetInstance(), and m_Icon.

Member Data Documentation

◆ m_AttachmentsInitialized

EntityAI HandsPreview::m_AttachmentsInitialized
protected

Definition at line 4 of file HandsPreview.c.

Referenced by DeleteIcon().

◆ m_Icon

ref Icon HandsPreview::m_Icon
protected

◆ m_IconSize

float HandsPreview::m_IconSize
protected

Definition at line 6 of file HandsPreview.c.

Referenced by CreateNewIcon(), and GetIconSize().


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