DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс VicinitySlotsContainer
+ Граф наследования:VicinitySlotsContainer:

Защищенные члены

void VicinitySlotsContainer (LayoutHolder parent)
 
bool IsItemWithContainerActive ()
 
override bool IsItemWithQuantityActive ()
 
override bool IsItemActive ()
 
bool IsEmptyItemActive ()
 
override bool IsDisplayable ()
 
bool IsTakeable ()
 
override bool CanCombineAmmo ()
 
override bool EquipItem ()
 
override bool InspectItem ()
 
override bool TransferItem ()
 
override bool Combine ()
 
override bool Select ()
 
void ~VicinitySlotsContainer ()
 
override void SetLayoutName ()
 
override void OnShow ()
 
int GetRowSlotCount ()
 
bool ExcludeFromContainer (EntityAI item)
 Decides on the icon visibility.
 
void ShowItemsInContainers (array< EntityAI > items)
 
void DoubleClick (Widget w, int x, int y, int button)
 
string GetItemQuantityText (EntityAI item)
 
int HasItemQuantity (EntityAI item)
 
float GetItemQuantity (InventoryItem item)
 
void MouseButtonDown (Widget w, int x, int y, int button)
 
void MouseClick (Widget w, int x, int y, int button)
 
override void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
void RecomputeNumberOfContainers (array< EntityAI > items)
 

Защищенные данные

ref AttachmentsGroupContainer m_Container
 
int m_ItemsCount
 
int m_SlotsCount
 
ref array< EntityAIm_ShowedItems
 

Дополнительные унаследованные члены

- Закрытые члены унаследованные от 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 SetAttachmentSlotID (int slotID)
 
int GetAttachmentSlotID ()
 
int GetIconsCount ()
 
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 ()
 
- Закрытые данные унаследованные от 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
 
int m_AttachmentSlotID = -1
 
ref ClosableHeader m_ClosableHeader
 
bool m_LockCargo
 

Подробное описание

Конструктор(ы)

◆ VicinitySlotsContainer()

void VicinitySlotsContainer ( LayoutHolder parent)
inlineprotected
9 {
12 m_Container.Insert( con );
13 m_Body.Insert( m_Container );
14 for( int j = 0; j < ITEMS_IN_ROW; j++ )
15 {
16 SlotsIcon icon = con.GetSlotIcon( j );
17 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetPanelWidget(), m_Parent, "OnDropReceivedFromIcon" );
18 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetGhostSlot(), m_Parent, "OnDropReceivedFromHeader" );
19 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetMainWidget(), m_Parent, "OnDropReceivedFromHeader" );
20
21 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetPanelWidget(), m_Parent, "DraggingOverIcon" );
22 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetGhostSlot(), m_Parent, "DraggingOverHeader" );
23 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetMainWidget(), m_Parent, "DraggingOverHeader" );
24
25 WidgetEventHandler.GetInstance().RegisterOnDoubleClick( icon.GetPanelWidget(), this, "DoubleClick" );
26 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "MouseClick" );
27 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown( icon.GetPanelWidget(), this, "MouseButtonDown" );
28 }
29
30 con.SetColumnCount(0);
31 con.SetForceShow(true);
32
33 WidgetEventHandler.GetInstance().RegisterOnDropReceived( m_Container.GetMainWidget(), m_Parent, "OnDropReceivedFromHeader" );
34 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( m_Container.GetMainWidget(), m_Parent, "DraggingOverHeader" );
35
37 }
const int ITEMS_IN_ROW
Definition Attachments.c:1
Widget m_Parent
Definition SizeToChild.c:92
Definition AttachmentsGroupContainer.c:2
Definition EntityAI.c:95
Definition SlotsContainer.c:2
Definition SlotsIcon.c:2
ref AttachmentsGroupContainer m_Container
Definition VicinitySlotsContainer.c:3
ref array< EntityAI > m_ShowedItems
Definition VicinitySlotsContainer.c:6
Definition WidgetEventHandler.c:2
static WidgetEventHandler GetInstance()
Definition WidgetEventHandler.c:22

Перекрестные ссылки WidgetEventHandler::GetInstance(), ITEMS_IN_ROW, m_Container, m_Parent и m_ShowedItems.

◆ ~VicinitySlotsContainer()

void ~VicinitySlotsContainer ( )
inlineprotected
217 {
218 for ( int i = 0; i < m_Container.Count(); i++ )
219 {
221 if( c && c.GetMainWidget() )
222 {
223 delete m_Container.Get( i / ITEMS_IN_ROW ).GetMainWidget();
224 }
225 }
226 }
Definition ContainerWithCargo.c:2
Definition CargoContainer.c:3

Перекрестные ссылки ITEMS_IN_ROW и m_Container.

Методы

◆ CanCombineAmmo()

override bool CanCombineAmmo ( )
inlineprotected
77 {
80 ItemBase item_in_hands = ItemBase.Cast( GetGame().GetPlayer().GetHumanInventory().GetEntityInHands() );
82 Class.CastTo(amc, m_player.GetActionManager());
83
84 return ( amc.CanPerformActionFromInventory( item_in_hands, ent ) || amc.CanSetActionFromInventory( item_in_hands, ent ) );
85 }
PlayerBase GetPlayer()
Definition ModifierBase.c:51
DayZPlayer m_player
Definition RandomGeneratorSyncManager.c:16
Definition ActionManagerClient.c:5
Super root of all classes in Enforce script.
Definition EnScript.c:11
override EntityAI GetFocusedItem()
Definition CargoContainer.c:722
Definition InventoryItem.c:731
Definition PlayerBaseClient.c:2
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo(), Container::GetFocusedItem(), GetGame(), GetPlayer() и m_player.

◆ Combine()

override bool Combine ( )
inlineprotected
142 {
144
145 ItemBase item_in_hands = ItemBase.Cast( GetGame().GetPlayer().GetHumanInventory().GetEntityInHands() );
146
147 Icon hands_icon = ItemManager.GetInstance().GetHandsPreview().GetIcon();
148
149 if( item_in_hands && ent && hands_icon )
150 {
151 return hands_icon.CombineItems( item_in_hands, ent );
152 }
153 return false;
154 }
Definition Icon.c:2
Definition ItemManager.c:2
static ItemManager GetInstance()
Definition ItemManager.c:283

Перекрестные ссылки Container::GetFocusedItem(), GetGame(), ItemManager::GetInstance() и GetPlayer().

◆ DoubleClick()

void DoubleClick ( Widget w,
int x,
int y,
int button )
inlineprotected
346 {
347 if( button == MouseState.LEFT && !g_Game.IsLeftCtrlDown())
348 {
349 if( w == null )
350 {
351 return;
352 }
353 ItemPreviewWidget iw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
354 if( !iw )
355 {
356 string name = w.GetName();
357 name.Replace( "PanelWidget", "Render" );
358 iw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
359 }
360
361 if( !iw )
362 {
363 iw = ItemPreviewWidget.Cast( w );
364 }
365
366 ItemBase item = ItemBase.Cast( iw.GetItem() );
367 if( !item )
368 {
369 return;
370 }
371
372 if( !item.IsTakeable() )
373 {
374 return;
375 }
376
377 if( GetGame().GetPlayer().GetInventory().HasInventoryReservation( item, null ) )
378 {
379 return;
380 }
381
382 if( !item.GetInventory().CanRemoveEntity() )
383 return;
384
386
387 if ( player.GetInventory().HasEntityInInventory( item ) && GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
388 {
389 player.PredictiveTakeEntityToHands( item );
390 }
391 else
392 {
394 player.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.ANY, dst );
395 if( dst.IsValid() && player.GetInventory().LocationCanAddEntity( dst ) )
396 {
398 }
399 }
400
401 HideOwnedTooltip();
402 InventoryMenu menu = InventoryMenu.Cast( GetGame().GetUIManager().FindMenu( MENU_INVENTORY ) );
403 if( menu )
404 {
405 menu.RefreshQuickbar();
406 }
407 }
408 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Definition DayZGame.c:3815
FindInventoryLocationType
flags for searching locations in inventory
Definition InventoryLocation.c:17
void InventoryMenu()
Definition InventoryMenu.c:20
InventoryLocation.
Definition InventoryLocation.c:29
Definition gameplay.c:276
Definition SplitItemUtils.c:2
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
Definition SplitItemUtils.c:34
const int MENU_INVENTORY
Definition constants.c:178
MouseState
Definition EnSystem.c:311

Перекрестные ссылки g_Game, GetGame(), GetPlayer(), InventoryMenu(), MENU_INVENTORY, name и SplitItemUtils::TakeOrSplitToInventoryLocation().

◆ EquipItem()

override bool EquipItem ( )
inlineprotected
88 {
89 if (CanEquip())
90 {
92 bool res = false;
93
94 if( ent && !ent.IsInherited( Magazine ))
95 {
96 res = GetGame().GetPlayer().PredictiveTakeOrSwapAttachment( ent );
97 if(!res)
98 {
99 res = GetGame().GetPlayer().GetInventory().TakeEntityToInventory(InventoryMode.JUNCTURE,FindInventoryLocationType.ATTACHMENT,ent);
100 }
101 }
102 return res;
103 }
104 return false;
105 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
Definition Building.c:6

Перекрестные ссылки Container::GetFocusedItem() и GetGame().

◆ ExcludeFromContainer()

bool ExcludeFromContainer ( EntityAI item)
inlineprotected

Decides on the icon visibility.

245 {
246 int mask = item.GetHideIconMask();
247 return mask & EInventoryIconVisibility.HIDE_VICINITY;
248 }

Используется в ShowItemsInContainers().

◆ GetItemQuantity()

float GetItemQuantity ( InventoryItem item)
inlineprotected
479 {
480 float quantity = 0;
481 if ( item.IsInherited( InventoryItem ) )
482 {
484 if ( item.IsInherited( Magazine ) )
485 {
487 quantity = magazine_item.GetAmmoCount();
488 }
489 else
490 {
491 quantity = item_base.GetQuantity();
492 }
493 }
494 return quantity;
495 }
Definition ItemBase.c:15

◆ GetItemQuantityText()

string GetItemQuantityText ( EntityAI item)
inlineprotected
411 {
412 string quantity_text = "";
413 if ( item.IsInherited( InventoryItem ) )
414 {
416 float quantity = item_base.GetQuantity();
417 int ammo;
418 if ( item.IsInherited( Magazine ) )
419 {
421 ammo = magazine_item.GetAmmoCount();
422 quantity_text = ammo.ToString();
423 return quantity_text;
424 }
425 else if ( item.IsInherited( ItemBook ) )
426 {
427 return "";
428 }
429 int max = item.GetQuantityMax();
430 //string unit = item.ConfigGetString( "stackedUnit" );
431
432 if ( max > 0 )
433 {
434 if ( max == 1 )
435 {
436 float tmp = Math.Round( ( quantity / max ) * 100 );
437 quantity_text = tmp.ToString() + "%";
438 }
439 else
440 {
441 quantity_text = quantity.ToString();
442 }
443 }
444 }
445 return quantity_text;
446 }
Definition EnMath.c:7
static proto float Round(float f)
Returns mathematical round of value.

Перекрестные ссылки Math::Round().

◆ GetRowSlotCount()

int GetRowSlotCount ( )
inlineprotected
239 {
240 return GetFocusedContainer().GetColumnCount();
241 }

◆ HasItemQuantity()

int HasItemQuantity ( EntityAI item)
inlineprotected
449 {
450 if ( item.IsInherited( InventoryItem ) )
451 {
453 if ( item.IsInherited( Magazine ) )
454 {
455 return QUANTITY_COUNT;
456 }
457 else if ( item.IsInherited( ItemBook ) )
458 {
459 return QUANTITY_HIDDEN;
460 }
461 int max = item.GetQuantityMax();
462 bool bar = item.ConfigGetBool( "quantityBar" );
463 if ( max > 0 )
464 {
465 if ( max == 1 || bar )
466 {
467 return QUANTITY_PROGRESS;
468 }
469 else
470 {
471 return QUANTITY_COUNT;
472 }
473 }
474 }
475 return QUANTITY_HIDDEN;
476 }
const int QUANTITY_PROGRESS
Definition constants.c:495
const int QUANTITY_COUNT
Definition constants.c:494
const int QUANTITY_HIDDEN
Definition constants.c:493

Перекрестные ссылки QUANTITY_COUNT, QUANTITY_HIDDEN и QUANTITY_PROGRESS.

◆ InspectItem()

override bool InspectItem ( )
inlineprotected
108 {
110
111 if( ent )
112 {
113 InspectItem( ent );
114 return true;
115 }
116 return false;
117 }
override bool InspectItem()
Definition VicinitySlotsContainer.c:107

Перекрестные ссылки Container::GetFocusedItem() и InspectItem().

Используется в InspectItem() и MouseClick().

◆ IsDisplayable()

override bool IsDisplayable ( )
inlineprotected
66 {
67 return true;
68 }

◆ IsEmptyItemActive()

bool IsEmptyItemActive ( )
inlineprotected
59 {
61 return ent == null;
62 }

Перекрестные ссылки Container::GetFocusedItem().

◆ IsItemActive()

override bool IsItemActive ( )
inlineprotected
53 {
56 }
override bool IsItemWithQuantityActive()
Definition VicinitySlotsContainer.c:46
bool IsItemWithContainerActive()
Definition VicinitySlotsContainer.c:39

Перекрестные ссылки Container::GetFocusedItem(), IsItemWithContainerActive() и IsItemWithQuantityActive().

◆ IsItemWithContainerActive()

bool IsItemWithContainerActive ( )
inlineprotected
40 {
42 return ent && ( ent.GetInventory().GetCargo() || (ent.GetSlotsCountCorrect() > 0 && ent.CanDisplayAnyAttachmentSlot()) );
43 //TODO: also check for cargo visibility maybe?
44 }

Перекрестные ссылки Container::GetFocusedItem().

Используется в IsItemActive().

◆ IsItemWithQuantityActive()

override bool IsItemWithQuantityActive ( )
inlineprotected
47 {
49 return ent && QuantityConversions.HasItemQuantity( ent ) && ent.CanBeSplit();
50 }
Definition QuantityConversions.c:2
static int HasItemQuantity(notnull EntityAI item)
Definition QuantityConversions.c:143

Перекрестные ссылки Container::GetFocusedItem() и QuantityConversions::HasItemQuantity().

Используется в IsItemActive().

◆ IsTakeable()

bool IsTakeable ( )
inlineprotected
71 {
73 return ent.IsTakeable();
74 }

Перекрестные ссылки Container::GetFocusedItem().

◆ MouseButtonDown()

void MouseButtonDown ( Widget w,
int x,
int y,
int button )
inlineprotected
499 {
500 string name = w.GetName();
501 name.Replace( "PanelWidget", "Render" );
502 ItemPreviewWidget item_preview = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
503 ItemBase item = ItemBase.Cast( item_preview.GetItem() );
504 bool draggable = ItemManager.GetInstance().EvaluateContainerDragabilityDefault(item);
505 ItemManager.GetInstance().SetWidgetDraggable( w, draggable );
506 }

Перекрестные ссылки ItemManager::GetInstance() и name.

◆ MouseClick()

void MouseClick ( Widget w,
int x,
int y,
int button )
inlineprotected
510 {
511 string name = w.GetName();
512 name.Replace( "PanelWidget", "Render" );
513 ItemPreviewWidget item_preview = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
514 EntityAI item = item_preview.GetItem();
516
517 #ifdef DIAG_DEVELOPER
518 if (itemAtPos && GetDayZGame().IsLeftCtrlDown() && button == MouseState.RIGHT)
519 {
520 ShowActionMenu(itemAtPos);
521 }
522 else if (m_Parent)
523 #else
524 if (m_Parent)
525 #endif
526 {
528
529 if ( item && showed_items )
530 {
531 if (button == MouseState.LEFT)
532 {
534 }
535 if (button == MouseState.RIGHT)
536 {
537 if (itemAtPos)
538 {
539 itemAtPos.OnRightClick();
540 }
541 }
542 else if (button == MouseState.MIDDLE)
543 {
545 return;
546 }
547 }
548 }
549 }
DayZGame GetDayZGame()
Definition DayZGame.c:3817
Definition VicinityContainer.c:2
void ToggleContainer(Widget w, EntityAI item)
Definition VicinityContainer.c:591

Перекрестные ссылки GetDayZGame(), InspectItem(), m_Parent, name и VicinityContainer::ToggleContainer().

◆ OnDropReceivedFromHeader()

override void OnDropReceivedFromHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
552 {
553 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget("Render") );
554 if( !ipw )
555 {
556 string name = w.GetName();
557 name.Replace( "PanelWidget", "Render" );
558 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
559 }
560 if( !ipw )
561 {
562 ipw = ItemPreviewWidget.Cast( w );
563 }
564
565 if( !ipw.IsInherited( ItemPreviewWidget ) )
566 {
567 return;
568 }
569
571 ItemBase item = ItemBase.Cast(ipw.GetItem());
572
573 if( item )
574 {
575 if( !item.GetInventory().CanRemoveEntity() )
576 return;
577
578 if( player.CanDropEntity( item ) )
579 {
580 if( item.GetTargetQuantityMax() < item.GetQuantity() )
581 item.SplitIntoStackMaxClient( null, -1 );
582 else
583 player.PhysicalPredictiveDropItem( item );
584 }
585 }
586 }

Перекрестные ссылки GetGame(), GetPlayer() и name.

◆ OnShow()

override void OnShow ( )
inlineprotected
234 {
235 super.OnShow();
236 }

◆ RecomputeNumberOfContainers()

void RecomputeNumberOfContainers ( array< EntityAI > items)
inlineprotected
589 {
590 int number_of_containers = m_Container.m_Body.Count();
591 int number_of_containers_needed = ( items.Count() / ITEMS_IN_ROW ) + 1;
593 int g;
594
596 {
598 m_Container.Insert(con, -1, false);
599 for (int j = 0; j < ITEMS_IN_ROW; j++)
600 {
601 SlotsIcon icon = con.GetSlotIcon(j);
602 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetPanelWidget(), m_Parent, "OnDropReceivedFromIcon");
603 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetGhostSlot(), m_Parent, "OnDropReceivedFromHeader");
604 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetMainWidget(), m_Parent, "OnDropReceivedFromHeader");
605
606 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetPanelWidget(), m_Parent, "DraggingOverIcon");
607 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetGhostSlot(), m_Parent, "DraggingOverHeader");
608 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetMainWidget(), m_Parent, "DraggingOverHeader");
609
610 WidgetEventHandler.GetInstance().RegisterOnDoubleClick(icon.GetPanelWidget(), this, "DoubleClick");
611 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp(icon.GetPanelWidget(), this, "MouseClick");
612 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown(icon.GetPanelWidget(), this, "MouseButtonDown");
613 }
614
615 con.SetColumnCount(items.Count() % ITEMS_IN_ROW);
616 }
617
618 for (g = number_of_containers - 1 ; g >= number_of_containers_needed ; g--)
619 {
620 Widget w = m_Container.m_Body.Get(g).GetMainWidget();
621 delete w;
622 m_Container.m_Body.Remove(g);
623 }
624
625 if ( (items.Count() % ITEMS_IN_ROW) == 0 )
626 {
627 SlotsContainer.Cast( m_Container.Get( number_of_containers_needed - 1 ) ).SetColumnCount( ITEMS_IN_ROW );
628 }
629 else
630 {
631 SlotsContainer.Cast( m_Container.Get( number_of_containers_needed - 1 ) ).SetColumnCount( items.Count() % ITEMS_IN_ROW );
632 }
633
634 for ( int i = 0; i < number_of_containers_needed - 1; i++ )
635 {
636 SlotsContainer.Cast( m_Container.Get( i ) ).SetColumnCount( ITEMS_IN_ROW );
637 }
638
639 RecomputeOpenedContainers();
640 m_Container.RecomputeOpenedContainers();
641 }
Definition EnWidgets.c:190

Перекрестные ссылки WidgetEventHandler::GetInstance(), ITEMS_IN_ROW, m_Container и m_Parent.

Используется в ShowItemsInContainers().

◆ Select()

override bool Select ( )
inlineprotected
157 {
158 SlotsIcon selected_slot = ItemManager.GetInstance().GetSelectedIcon();
160 ItemBase selected_item = ItemBase.Cast(ItemManager.GetInstance().GetSelectedItem());
161
162 if( !(selected_slot && selected_slot.IsOutOfReach() ) )
163 {
164 if( selected_item )
165 {
166 if( ent != selected_item)
167 {
168 if( selected_item && GetGame().GetPlayer().CanDropEntity( selected_item ) )
169 {
170 bool draggable = false;
171
173 draggable = !player.GetInventory().HasInventoryReservation( selected_item, null ) && !player.IsItemsToDelete();
174 draggable = draggable && selected_item.GetInventory().CanRemoveEntity();
175
176 if( draggable && m_ShowedItems.Find( selected_item ) == -1 )
177 {
178 if( selected_item.GetTargetQuantityMax() < selected_item.GetQuantity() )
179 selected_item.SplitIntoStackMaxClient( null, -1 );
180 else
181 player.PhysicalPredictiveDropItem( selected_item );
182 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
183 return true;
184 }
185 }
186 }
187 }
188 else
189 {
190 if( ent && ent.GetInventory().CanRemoveEntity())
191 {
192 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
193 if( item_in_hands )
194 {
196 {
197 GetGame().GetPlayer().PredictiveSwapEntities( item_in_hands, ent );
198 return true;
199 }
200 }
201 else
202 {
203 if( GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( ent ) )
204 {
205 GetGame().GetPlayer().PredictiveTakeEntityToHands( ent );
206 return true;
207 }
208 }
209 }
210 }
211 }
212
213 return false;
214 }
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:628

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), Container::GetFocusedItem(), GetGame(), ItemManager::GetInstance(), GetPlayer() и m_ShowedItems.

◆ SetLayoutName()

override void SetLayoutName ( )
inlineprotected
229 {
230 m_LayoutName = WidgetLayoutName.Container;
231 }
Definition WidgetLayoutName.c:2
const string Container
Definition WidgetLayoutName.c:47

Перекрестные ссылки WidgetLayoutName::Container.

◆ ShowItemsInContainers()

void ShowItemsInContainers ( array< EntityAI > items)
inlineprotected
251 {
253 EntityAI selectedItem = ItemManager.GetInstance().GetSelectedItem();
255 int x;
256 int visible_items_count = 0;
257 int visible_rows = 0;
259
260 for ( x = 0; x < items.Count(); ++x )
261 {
262 item = items.Get( x );
263
264 if ( item == null || ExcludeFromContainer(item) )
265 continue;
266
267 visible_items.Insert( item );
269 }
270
272
273 for ( x = 0; x < visible_items_count; ++x )
274 {
275 item = visible_items.Get( x );
276 int row = (int)Math.Floor( x / ITEMS_IN_ROW );
277 int column = x % ITEMS_IN_ROW;
278 icon = SlotsContainer.Cast( m_Container.Get( row ) ).GetSlotIcon( column );
279
280 icon.GetMainWidget().Show( true );
281 icon.GetPanelWidget().SetUserID( item.GetID() );
282
283 #ifdef PLATFORM_CONSOLE
284 if (selectedItem == item)
285 {
286 icon.GetMicromanagedPanel().Show(true);
287 }
288 else
289 {
290 icon.GetMicromanagedPanel().Show(false);
291 }
292 #endif
293
294 if ( m_ShowedItems.Find( item ) != x )
295 icon.Init( item );
296 icon.UpdateInterval();
297
298 bool draggable = ItemManager.GetInstance().EvaluateContainerDragabilityDefault(item);
299 if ( !draggable && GetDragWidget() == icon.GetPanelWidget() )
301 ItemManager.GetInstance().SetWidgetDraggable( icon.GetPanelWidget(), draggable );
302
304
305 Container conta = Container.Cast( showed_items.Get( item.GetID() ) );
306 if ( conta )
307 {
308 conta.SetSlotIcon(icon);
309 }
310
311 if ( conta && conta.IsDisplayable() )
312 {
313 conta.UpdateRadialIcon();
314 }
315 else
316 {
317 icon.GetRadialIconPanel().Show( false );
318 if ( conta )
319 conta.OnHide();
320 }
321 }
322
324
325 for ( int c = visible_items_count % ITEMS_IN_ROW; c < ITEMS_IN_ROW; ++c )
326 {
327 icon = slots_last.GetSlotIcon( c );
328 icon.GetMainWidget().Show( false );
329 icon.Clear();
330 }
331
332 //#ifndef PLATFORM_CONSOLE
334 {
335 slots_last = SlotsContainer.Cast( m_Container.Get( m_Container.Count() - 1 ) );
336 slots_last.GetSlotIcon( 0 ).GetMainWidget().Show( true );
337 slots_last.GetSlotIcon( 0 ).GetGhostSlot().Show( false );
338 slots_last.GetMainWidget().Update();
339 }
340 //#endif
341
343 }
Param3 int
Icon x
bool ExcludeFromContainer(EntityAI item)
Decides on the icon visibility.
Definition VicinitySlotsContainer.c:244
void RecomputeNumberOfContainers(array< EntityAI > items)
Definition VicinitySlotsContainer.c:588
static proto float Floor(float f)
Returns floor of value.
proto native Widget CancelWidgetDragging()
proto native Widget GetDragWidget()

Перекрестные ссылки CancelWidgetDragging(), ExcludeFromContainer(), Math::Floor(), GetDragWidget(), ItemManager::GetInstance(), ITEMS_IN_ROW, m_Container, m_Parent, m_ShowedItems, RecomputeNumberOfContainers() и x.

◆ TransferItem()

override bool TransferItem ( )
inlineprotected
120 {
121 if (CanTakeToInventory())
122 {
124 if (ent)
125 {
126 if (ent.IsTakeable())
127 {
129 GetGame().GetPlayer().GetInventory().FindFreeLocationFor( ent, FindInventoryLocationType.CARGO, il );
130 if (il.IsValid() && GetGame().GetPlayer().GetInventory().LocationCanAddEntity( il ))
131 {
133 return true;
134 }
135 }
136 }
137 }
138 return false;
139 }

Перекрестные ссылки Container::GetFocusedItem(), GetGame(), GetPlayer() и SplitItemUtils::TakeOrSplitToInventoryLocation().

Поля

◆ m_Container

◆ m_ItemsCount

int m_ItemsCount
protected

◆ m_ShowedItems

ref array<EntityAI> m_ShowedItems
protected

Используется в Select(), ShowItemsInContainers() и VicinitySlotsContainer().

◆ m_SlotsCount

int m_SlotsCount
protected

Объявления и описания членов класса находятся в файле: