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

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

void AttachmentCategoriesRow (LayoutHolder parent, int sort=-1)
 
string GetCategoryIdentifier ()
 
int GetFocusedSlot ()
 
override bool Select ()
 
override bool TransferItem ()
 
override bool TransferItemToVicinity ()
 
override bool Combine ()
 
override bool CanSplitEx (EntityAI focusedItem)
 
override bool SplitItem ()
 
override bool EquipItem ()
 
override bool CanCombine ()
 
override bool CanCombineAmmo ()
 
override bool IsItemActive ()
 
override bool IsItemWithQuantityActive ()
 
override void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
override void UnfocusAll ()
 
override void DraggingOverHeader (Widget w, int x, int y, Widget receiver)
 
bool DraggingOverGrid (Widget w, int x, int y, Widget reciever, CargoContainer cargo)
 
void DropReceived (Widget w, int x, int y, CargoContainer cargo)
 
EntityAI GetItemPreviewItem (Widget w)
 
override void Refresh ()
 
void RefreshAllSlots ()
 
void RefreshSlot (int row, int column, int slot_id, string slot_name)
 
void DoubleClick (Widget w, int x, int y, int button)
 
void MouseClick (Widget w, int x, int y, int button)
 
void Init (int attachments_categories_count, int i, string attachment_category, string config_path_attachment_categories, EntityAI entity, int parent_m_Body_count)
 
override void UpdateInterval ()
 

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

string m_CategoryIdentifier
 
string m_RowConfigPath
 
bool m_Refreshing
 
ref AttachmentsGroupContainer m_AttachmentsContainer
 
ref map< int, ref ContainerWithCargom_AttachmentCargos
 

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

- Закрытые члены унаследованные от ClosableContainer
void ContainerWithCargo (Container parent, int sort=-1)
 
override bool IsDisplayable ()
 
override bool IsEmpty ()
 
override bool IsItemActive ()
 
override bool CanCombine ()
 
override bool CanCombineAmmo ()
 
override bool IsItemWithQuantityActive ()
 
void LockCargo (bool value)
 
override void Open ()
 
override void Close ()
 
override bool IsOpened ()
 
override void UpdateInterval ()
 
override bool IsFirstContainerFocused ()
 
override bool IsLastContainerFocused ()
 
override void SetDefaultFocus (bool while_micromanagment_mode=false)
 
override void UnfocusAll ()
 
override bool SplitItem ()
 
override bool EquipItem ()
 
override bool TransferItem ()
 
override bool TransferItemToVicinity ()
 
override bool InspectItem ()
 
void SetEntity (EntityAI entity, int cargo_index=0, bool immedUpdate=true)
 
EntityAI GetEntity ()
 
override EntityAI GetFocusedContainerEntity ()
 
EntityAI GetItemPreviewItem (Widget w)
 
bool DraggingOverGrid (Widget w, int x, int y, Widget reciever)
 
void DropReceived (Widget w, int x, int y)
 
void TakeIntoHands (notnull PlayerBase player, notnull EntityAI item)
 
override void DraggingOverHeader (Widget w, int x, int y, Widget receiver)
 
override void DraggingOver (Widget w, int x, int y, Widget receiver)
 
override void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
void ContainerWithCargoAndAttachments (LayoutHolder parent, int sort=-1)
 
void ~ContainerWithCargoAndAttachments ()
 
void RecomputeContainers ()
 
void AttachmentAddedEx (EntityAI item, string slot, EntityAI parent, bool immedUpdate=true)
 
void AttachmentAdded (EntityAI item, string slot, EntityAI parent)
 
void AttachmentRemoved (EntityAI item, string slot, EntityAI parent)
 
override void UpdateInterval ()
 
override EntityAI GetFocusedContainerEntity ()
 
override void UnfocusAll ()
 
override bool IsLastIndex ()
 
override bool IsFirstContainerFocused ()
 
override bool IsLastContainerFocused ()
 
override void MoveGridCursor (int direction)
 
void SetEntity (EntityAI entity, bool immedUpdate=true)
 
void HideCargo ()
 
void ShowCargo ()
 
EntityAI GetEntity ()
 
ItemPreviewWidget GetItemPreviewWidgetDragOrDrop (Widget w)
 
EntityAI GetItemPreviewItem (Widget w)
 
Widget GetItemPreviewWidget (Widget w)
 
void MouseClick2 (Widget w, int x, int y, int button)
 
void DropReceived (Widget w, int x, int y, CargoContainer cargo)
 NOTE Used for mouse only.
 
void TakeAsAttachment (Widget w, Widget receiver)
 
override void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
void OnDropReceivedFromHeader2 (Widget w, int x, int y, Widget receiver)
 
void DoubleClick (Widget w, int x, int y, int button)
 
bool DraggingOverGrid (Widget w, int x, int y, Widget reciever, CargoContainer cargo)
 
override void DraggingOver (Widget w, int x, int y, Widget receiver)
 
override void DraggingOverHeader (Widget w, int x, int y, Widget receiver)
 
- Закрытые данные унаследованные от ClosableContainer
ref CargoContainer m_CargoGrid
 
int m_CargoIndex = -1
 
ref Attachments m_Atts
 
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
 
ref map< EntityAI, ref AttachmentsWrapperm_AttachmentAttachmentsContainers
 
ref map< EntityAI, ref Attachmentsm_AttachmentAttachments
 
ref array< intm_AttachmentSlotsSorted
 

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

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

◆ AttachmentCategoriesRow()

void AttachmentCategoriesRow ( LayoutHolder parent,
int sort = -1 )
inlineprotected
11 {
12 m_Refreshing = false;
15
16 m_Body.Insert(m_AttachmentsContainer);
17
18 m_ClosableHeader.GetMainWidget().ClearFlags( WidgetFlags.DRAGGABLE );
19
20 RecomputeOpenedContainers();
21 }
bool m_Refreshing
Definition AttachmentCategoriesRow.c:5
ref map< int, ref ContainerWithCargo > m_AttachmentCargos
Definition AttachmentCategoriesRow.c:8
ref AttachmentsGroupContainer m_AttachmentsContainer
Definition AttachmentCategoriesRow.c:7
Definition AttachmentsGroupContainer.c:2
Definition EntityAI.c:95
WidgetFlags
Definition EnWidgets.c:58

Перекрестные ссылки m_AttachmentCargos, m_AttachmentsContainer и m_Refreshing.

Методы

◆ CanCombine()

override bool CanCombine ( )
inlineprotected
247 {
248 Man player = GetGame().GetPlayer();
249 ItemBase prev_item = ItemBase.Cast( GetFocusedItem() );
250 ItemBase selected_item = ItemBase.Cast( player.GetHumanInventory().GetEntityInHands() );
251 SlotsIcon focused_icon = GetFocusedSlotsIcon();
252
253 if( selected_item )
254 {
256 int stack_max;
257 if( selected_item && selected_item.GetInventory().CanRemoveEntity() && (focused_icon && !focused_icon.IsOutOfReach()) )
258 {
259 if( m_Entity.GetInventory().CanAddAttachmentEx( selected_item, selected_slot ) )
260 {
262 float quantity = selected_item.GetQuantity();
263 if( stack_max == 0 || stack_max >= quantity || !selected_item.CanBeSplit() )
264 {
265 return true;
266 }
267 else
268 {
269 return true;
270 }
271 }
272 else if( selected_slot != -1 )
273 {
274 if( prev_item )
275 {
277 prev_item.GetInventory().GetCurrentInventoryLocation( inv_loc );
279 quantity = prev_item.GetQuantity();
280 if( prev_item.CanBeCombined( ItemBase.Cast( selected_item ) ) )
281 {
282 return true;
283 }
284 }
285 }
286 }
287 }
288 return false;
289 }
EntityAI m_Entity
Definition ActionDebug.c:11
int GetFocusedSlot()
Definition AttachmentCategoriesRow.c:28
InventoryLocation.
Definition InventoryLocation.c:28
provides access to slot configuration
Definition InventorySlots.c:6
static proto native int GetStackMaxForSlotId(int slot_Id)
Definition InventoryItem.c:731
Definition SlotsIcon.c:2
proto native CGame GetGame()

Перекрестные ссылки GetFocusedSlot(), GetGame(), InventorySlots::GetStackMaxForSlotId() и m_Entity.

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

◆ CanCombineAmmo()

override bool CanCombineAmmo ( )
inlineprotected
292 {
293 return false;
294 }

◆ CanSplitEx()

override bool CanSplitEx ( EntityAI focusedItem)
inlineprotected
232 {
233 return false;
234 }

◆ Combine()

override bool Combine ( )
inlineprotected
168 {
169 if (CanCombine())
170 {
171 Man player = GetGame().GetPlayer();
172 ItemBase prev_item = ItemBase.Cast( GetFocusedItem() );
173 ItemBase selected_item = ItemBase.Cast( player.GetHumanInventory().GetEntityInHands() );
174 SlotsIcon focused_icon = GetFocusedSlotsIcon();
175
176 if( selected_item )
177 {
179 int stack_max;
180 if( selected_item && selected_item.GetInventory().CanRemoveEntity() && (focused_icon && !focused_icon.IsOutOfReach()) )
181 {
182 if( !prev_item && m_Entity.GetInventory().CanAddAttachmentEx( selected_item, selected_slot ) )
183 {
185 float quantity = selected_item.GetQuantity();
186 if( stack_max == 0 || stack_max >= quantity || !selected_item.CanBeSplit() )
187 {
188 player.PredictiveTakeEntityToTargetAttachmentEx( m_Entity, selected_item, selected_slot );
189 return true;
190 }
191 else
192 {
193 selected_item.SplitIntoStackMaxClient( m_Entity, selected_slot );
194 return true;
195 }
196 }
197 else if( selected_slot != -1 )
198 {
199 if( prev_item )
200 {
202 prev_item.GetInventory().GetCurrentInventoryLocation( inv_loc );
204 quantity = prev_item.GetQuantity();
205 if( prev_item.CanBeCombined( ItemBase.Cast( selected_item ) ) )
206 {
207 prev_item.CombineItemsClient( selected_item, true );
208 return true;
209 }
211 {
212 player.PredictiveSwapEntities( selected_item, prev_item );
213 return true;
214 }
215 else if( m_AttachmentCargos.Contains( inv_loc.GetSlot() ) )
216 {
217 if( prev_item.GetInventory().CanAddEntityInCargo( selected_item, selected_item.GetInventory().GetFlipCargo() ) )
218 {
220 return true;
221 }
222 }
223 }
224 }
225 }
226 }
227 }
228 return false;
229 }
override bool CanCombine()
Definition AttachmentCategoriesRow.c:246
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:628
Definition PlayerBaseClient.c:2
Definition SplitItemUtils.c:2
static void TakeOrSplitToInventory(notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
Definition SplitItemUtils.c:3

Перекрестные ссылки CanCombine(), GameInventory::CanSwapEntitiesEx(), GetFocusedSlot(), GetGame(), InventorySlots::GetStackMaxForSlotId(), m_AttachmentCargos, m_Entity и SplitItemUtils::TakeOrSplitToInventory().

◆ DoubleClick()

void DoubleClick ( Widget w,
int x,
int y,
int button )
inlineprotected
777 {
778 if (button == MouseState.LEFT && !g_Game.IsLeftCtrlDown())
779 {
780 ItemPreviewWidget iw = ItemPreviewWidget.Cast(w.FindAnyWidget("Render"));
781 if (!iw)
782 {
783 string name = w.GetName();
784 name.Replace("PanelWidget", "Render");
785 iw = ItemPreviewWidget.Cast(w.FindAnyWidget(name));
786 }
787
788 if (!iw)
789 iw = ItemPreviewWidget.Cast(w);
790
792 w.GetUserData(icon);
793
794 if (icon && m_Entity.GetInventory().GetSlotLock(iw.GetUserID()))
795 return;
796
797 if (icon.IsOutOfReach())
798 return;
799
800 ItemBase item = ItemBase.Cast(iw.GetItem());
801 if (item)
802 {
803 if (!item.GetInventory().CanRemoveEntity())
804 return;
805
807 if (controlledPlayer.GetInventory().HasEntityInInventory(item) && controlledPlayer.GetHumanInventory().CanAddEntityInHands(item))
808 {
809 controlledPlayer.PredictiveTakeEntityToHands(item);
810 }
811 else
812 {
813 if (controlledPlayer.GetInventory().CanAddEntityToInventory(item) && item.GetInventory().CanRemoveEntity())
814 {
815 if (item.GetTargetQuantityMax() < item.GetQuantity())
816 item.SplitIntoStackMaxClient(controlledPlayer, -1);
817 else
818 controlledPlayer.PredictiveTakeEntityToInventory(FindInventoryLocationType.ANY, item);
819 }
820 else
821 {
822 if (controlledPlayer.GetHumanInventory().CanAddEntityInHands(item))
823 {
824 if (item.GetTargetQuantityMax() < item.GetQuantity())
825 item.SplitIntoStackMaxHandsClient(controlledPlayer);
826 else
827 controlledPlayer.PredictiveTakeEntityToHands(item);
828 }
829 }
830 }
831
832 HideOwnedTooltip();
833
834 name = w.GetName();
835 name.Replace("PanelWidget", "Temperature");
836 w.FindAnyWidget(name).Show(false);
837 }
838 }
839 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Definition DayZGame.c:3746
FindInventoryLocationType
flags for searching locations in inventory
Definition InventoryLocation.c:16
PlayerBase GetPlayer()
Definition ModifierBase.c:47
Definition gameplay.c:276
MouseState
Definition EnSystem.c:311

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

◆ DraggingOverGrid()

bool DraggingOverGrid ( Widget w,
int x,
int y,
Widget reciever,
CargoContainer cargo )
inlineprotected
502 {
503 if( w == null )
504 {
505 return false;
506 }
507
509
510 if( !item )
511 {
512 return false;
513 }
514
515 int color;
516 int idx = 0;
517 int c_x, c_y;
518
521
522 target_entity = cargo.GetEntity() ;
523 if( target_entity )
524 {
525 target_cargo = target_entity.GetInventory().GetCargo();
526 }
527 else
528 return false;
529
531 {
532 c_x = target_cargo.GetHeight();
533 c_y = target_cargo.GetWidth();
534 }
535 else
536 return false;
537
538 if( c_x > x && c_y > y && target_entity.GetInventory().CanAddEntityInCargoEx( item, idx, x, y, item.GetInventory().GetFlipCargo() ) )
539 {
541 }
542 else
543 {
545 }
546
547 if( w.FindAnyWidget("Cursor") )
548 {
549 w.FindAnyWidget("Cursor").SetColor( color );
550 }
551 else
552 {
553 string name = w.GetName();
554 name.Replace( "PanelWidget", "Cursor" );
555 if( w.FindAnyWidget( name ) )
556 {
557 w.FindAnyWidget( name ).SetColor( color );
558 }
559 }
560
561 return true;
562 }
Icon x
Icon y
EntityAI GetItemPreviewItem(Widget w)
Definition AttachmentCategoriesRow.c:615
represents base for cargo storage for entities
Definition Cargo.c:7
Definition ColorManager.c:2
static int GREEN_COLOR
Definition ColorManager.c:17
static int RED_COLOR
Definition ColorManager.c:16
Definition Building.c:6

Перекрестные ссылки GetItemPreviewItem(), ColorManager::GREEN_COLOR, name, ColorManager::RED_COLOR, x и y.

◆ DraggingOverHeader()

override void DraggingOverHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
422 {
423 if( w == null )
424 {
425 return;
426 }
427 ItemPreviewWidget iw = ItemPreviewWidget.Cast( w.FindAnyWidget("Render") );
428 if(!iw)
429 {
430 string name = w.GetName();
431 name.Replace("PanelWidget", "Render");
432 iw = ItemPreviewWidget.Cast( w.FindAnyWidget(name) );
433 }
434 if(!iw)
435 {
436 iw = ItemPreviewWidget.Cast( w );
437 }
438
439 if( !iw || !iw.GetItem() || (iw.GetItem() == m_Entity) )
440 {
441 return;
442 }
443
446 name = receiver.GetName();
447 name.Replace("PanelWidget", "Render");
449 if(receiver_iw)
450 receiver_item = ItemBase.Cast( receiver_iw.GetItem() );
451
453 receiver.GetUserData(slots_icon);
454
455 if( receiver_item )
456 {
457 int stack_max = InventorySlots.GetStackMaxForSlotId( receiver_item.GetInventory().GetSlotId(0) );
458 //int quantity = receiver_item.GetQuantity();
459 //bool combinable = ( quantity < stack_max ) && ( ItemBase.Cast( receiver_item ).CanBeCombined( ItemBase.Cast( iw.GetItem() ) ) );
460 if( receiver_item.CanBeCombined( ItemBase.Cast( iw.GetItem() ) ) )
461 {
462 ItemManager.GetInstance().HideDropzones();
463 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
465 }
466 else if( stack_max == 0 && GameInventory.CanSwapEntitiesEx( receiver_item, iw.GetItem() ) )
467 {
468 ItemManager.GetInstance().HideDropzones();
469 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
471 }
472 else
473 {
474 ItemManager.GetInstance().ShowSourceDropzone( iw.GetItem() );
476 }
477 }
478 else if( slots_icon && slots_icon.GetSlotID() != -1 )
479 {
480 item = ItemBase.Cast( iw.GetItem() );
481
482 if( item && m_Entity.GetInventory().CanAddAttachmentEx( item, slots_icon.GetSlotID() ) )
483 {
484 ItemManager.GetInstance().HideDropzones();
485 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
487 }
488 else
489 {
490 ItemManager.GetInstance().ShowSourceDropzone( iw.GetItem() );
492 }
493 }
494 else
495 {
496 ItemManager.GetInstance().ShowSourceDropzone( iw.GetItem() );
498 }
499 }
static ColorManager GetInstance()
Definition ColorManager.c:27
static int SWAP_COLOR
Definition ColorManager.c:18
static int COMBINE_COLOR
Definition ColorManager.c:20
Definition ItemManager.c:2
static ItemManager GetInstance()
Definition ItemManager.c:283

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), ColorManager::COMBINE_COLOR, ColorManager::GetInstance(), ItemManager::GetInstance(), InventorySlots::GetStackMaxForSlotId(), ColorManager::GREEN_COLOR, m_Entity, name, ColorManager::RED_COLOR и ColorManager::SWAP_COLOR.

◆ DropReceived()

void DropReceived ( Widget w,
int x,
int y,
CargoContainer cargo )
inlineprotected
565 {
567 if( !item )
568 {
569 return;
570 }
571
572 int idx = 0;
573 int c_x, c_y;
574
577
578 target_entity = cargo.GetEntity();
579 if( target_entity )
580 {
581 target_cargo = target_entity.GetInventory().GetCargo();
582 }
583 else
584 return;
585
587 {
588 c_x = target_cargo.GetHeight();
589 c_y = target_cargo.GetWidth();
590 }
591 else
592 return;
593
595 dst.SetCargoAuto(target_cargo, item, x, y, item.GetInventory().GetFlipCargo());
596
597 if( c_x > x && c_y > y && target_entity.GetInventory().LocationCanAddEntity(dst))
598 {
600
602
603 Icon icon = cargo.GetIcon( item );
604
605 if( icon )
606 {
607 icon.GetCursorWidget().SetColor( ColorManager.BASE_COLOR );
608 icon.RefreshPos( x, y );
609 icon.Refresh();
610 Refresh();
611 }
612 }
613 }
override void Refresh()
Definition AttachmentCategoriesRow.c:635
static int BASE_COLOR
Definition ColorManager.c:15
Definition Icon.c:2
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
Definition SplitItemUtils.c:34

Перекрестные ссылки ColorManager::BASE_COLOR, GetGame(), GetItemPreviewItem(), GetPlayer(), Refresh(), SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.

◆ EquipItem()

override bool EquipItem ( )
inlineprotected
242 {
243 return false;
244 }

◆ GetCategoryIdentifier()

string GetCategoryIdentifier ( )
inlineprotected
24 {
26 }
string m_CategoryIdentifier
Definition AttachmentCategoriesRow.c:3

Перекрестные ссылки m_CategoryIdentifier.

◆ GetFocusedSlot()

int GetFocusedSlot ( )
inlineprotected
29 {
30 SlotsIcon icon = GetFocusedSlotsIcon();
31 if (icon)
32 {
33 return icon.GetSlotID();
34 }
35 return -1;
36 }

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

◆ GetItemPreviewItem()

EntityAI GetItemPreviewItem ( Widget w)
inlineprotected
616 {
617 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
618 if( !ipw )
619 {
620 string name = w.GetName();
621 name.Replace( "PanelWidget", "Render" );
622 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
623 }
624 if( !ipw )
625 {
626 ipw = ItemPreviewWidget.Cast( w );
627 }
628 if( !ipw || !ipw.IsInherited( ItemPreviewWidget ) )
629 {
630 return null;
631 }
632 return ipw.GetItem();
633 }

Перекрестные ссылки name.

Используется в DraggingOverGrid(), DropReceived() и OnDropReceivedFromHeader().

◆ Init()

void Init ( int attachments_categories_count,
int i,
string attachment_category,
string config_path_attachment_categories,
EntityAI entity,
int parent_m_Body_count )
inlineprotected
898 {
901
903
905 string categoryName;
906
909 GetGame().ConfigGetTextArray(m_RowConfigPath, player_ghosts_slots2);
911 header.SetName(categoryName);
912
914 SetHeader(null);
915
916 int count = player_ghosts_slots2.Count();
917 int lastRow = count / ITEMS_IN_ROW;
919
920 for ( int j = 0; j < count; j++ )
921 {
922 string slotName = player_ghosts_slots2.Get(j);
923 string iconName; //must be in format "set:<setname> image:<imagename>"
924 string path = "CfgSlots" + " Slot_" + slotName;
925
927
928 GetGame().ConfigGetText(path + " ghostIcon", iconName);
929 GetGame().ConfigGetText(path + " name", slotName);
930
931 int row = j / ITEMS_IN_ROW;
932 int column = j % ITEMS_IN_ROW;
933 if (column == 0)
934 {
936 slotsContainer.GetRootWidget().SetAlpha(0.7);
937 if (row == lastRow)
938 slotsContainer.SetColumnCount(count % ITEMS_IN_ROW);
939 else
940 slotsContainer.SetColumnCount(ITEMS_IN_ROW);
941
943 slotsContainer.GetRootWidget().SetSort(row);
944 }
945
946 SlotsIcon icon = slotsContainer.GetSlotIcon(column);
947 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetMainWidget(), this, "OnDropReceivedFromHeader");
948 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetGhostSlot(), this, "OnDropReceivedFromHeader");
949 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetPanelWidget(), this, "OnDropReceivedFromHeader");
950
951 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetMainWidget(), this, "DraggingOverHeader");
952 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetGhostSlot(), this, "DraggingOverHeader");
953 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetPanelWidget(), this, "DraggingOverHeader");
954
955 WidgetEventHandler.GetInstance().RegisterOnDrop(icon.GetMainWidget(), this, "OnIconDrop");
956 WidgetEventHandler.GetInstance().RegisterOnDrop(icon.GetPanelWidget(), this, "OnIconDrop");
957
958 WidgetEventHandler.GetInstance().RegisterOnDoubleClick(icon.GetPanelWidget(), this, "DoubleClick");
959 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp(icon.GetPanelWidget(), this, "MouseClick");
960
962 icon.SetSlotID(slotId);
963 icon.SetSlotDisplayName(InventorySlots.GetSlotDisplayName(slotId));
964
965 icon.Clear();
966 }
968 }
const int ITEMS_IN_ROW
Definition Attachments.c:1
PlayerSpawnPreset slotName
string GetHeader()
Definition ErrorProperties.c:76
string path
Definition OptionSelectorMultistate.c:135
string m_RowConfigPath
Definition AttachmentCategoriesRow.c:4
void RefreshAllSlots()
Definition AttachmentCategoriesRow.c:647
Definition Header.c:2
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static proto native owned string GetSlotDisplayName(int id)
converts slot_id to string
Definition SlotsContainer.c:2
Definition StaticGUIUtils.c:2
static const int IMAGESETGROUP_INVENTORY
Definition StaticGUIUtils.c:3
static string VerifyIconImageString(int imageset_group=IMAGESETGROUP_INVENTORY, string icon_name="")
Checks for improperly formated, legacy image names and corrects them to default format.
Definition StaticGUIUtils.c:7
Definition WidgetEventHandler.c:2
static WidgetEventHandler GetInstance()
Definition WidgetEventHandler.c:22

Перекрестные ссылки GetGame(), GetHeader(), WidgetEventHandler::GetInstance(), InventorySlots::GetSlotDisplayName(), InventorySlots::GetSlotIdFromString(), StaticGUIUtils::IMAGESETGROUP_INVENTORY, ITEMS_IN_ROW, m_AttachmentsContainer, m_CategoryIdentifier, m_Entity, m_RowConfigPath, path, RefreshAllSlots(), slotName и StaticGUIUtils::VerifyIconImageString().

◆ IsItemActive()

override bool IsItemActive ( )
inlineprotected
297 {
298 SlotsIcon icon = GetFocusedSlotsIcon();
299 return GetFocusedItem() != null && (!icon || !icon.IsOutOfReach());
300 }

◆ IsItemWithQuantityActive()

override bool IsItemWithQuantityActive ( )
inlineprotected
303 {
304 ItemBase item = ItemBase.Cast(GetFocusedItem());
305 SlotsIcon icon = GetFocusedSlotsIcon();
306 return item && ( !icon || !icon.IsOutOfReach()) && item.CanBeSplit();
307 }

◆ MouseClick()

void MouseClick ( Widget w,
int x,
int y,
int button )
inlineprotected
842 {
845 w.GetUserData(icon);
846 if (icon)
847 selectedItem = ItemBase.Cast(icon.GetEntity());
848
849 if (selectedItem)
850 {
851 switch (button)
852 {
853 case MouseState.RIGHT:
854 #ifdef DIAG_DEVELOPER
855 if (g_Game.IsLeftCtrlDown())
856 ShowActionMenu(selectedItem);
857 #endif
858
859 break;
860
861 case MouseState.MIDDLE:
863 break;
864
865 case MouseState.LEFT:
867 if (g_Game.IsLeftCtrlDown())
868 {
869 if (icon.IsOutOfReach())
870 return;
871
872 if (controlledPlayer.CanDropEntity(selectedItem))
873 {
874 if (selectedItem.GetTargetQuantityMax() < selectedItem.GetQuantity())
875 selectedItem.SplitIntoStackMaxClient(null, -1);
876 else
877 controlledPlayer.PhysicalPredictiveDropItem(selectedItem);
878 }
879 else
880 {
881 bool draggable = !controlledPlayer.GetInventory().HasInventoryReservation(selectedItem, null ) && !controlledPlayer.GetInventory().IsInventoryLocked() && selectedItem.GetInventory().CanRemoveEntity() && !controlledPlayer.IsItemsToDelete();
882 ItemManager.GetInstance().SetWidgetDraggable(w, draggable);
883 }
884 }
885 else
886 {
887 ClosableContainer c = ClosableContainer.Cast(icon.GetContainer());
888 if (c)
889 c.Toggle();
890 }
891
892 break;
893 }
894 }
895 }
Definition ContainerWithCargo.c:2
override bool InspectItem()
Definition ContainerWithCargo.c:185

Перекрестные ссылки g_Game, GetGame(), ItemManager::GetInstance(), GetPlayer() и ClosableContainer::InspectItem().

◆ OnDropReceivedFromHeader()

override void OnDropReceivedFromHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
310 {
311 ItemManager.GetInstance().HideDropzones();
312 ItemManager.GetInstance().SetIsDragging( false );
315 int slot_id = -1;
316 bool is_reserved = false;
318 receiver.GetUserData(slots_icon);
319 float stackable = 0.0;
321
322 if( slots_icon )
323 {
324 receiver_item = slots_icon.GetEntity();
325 slot_id = slots_icon.GetSlotID();
326 attached_entity = slots_icon.GetSlotParent();
327 is_reserved = slots_icon.IsReserved();
328 }
329
331 if( !item )
332 {
333 return;
334 }
336
338 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
339 return;
340
344 if( Class.CastTo(wpn, m_Entity ) && Class.CastTo(mag, item ) )
345 {
346 if( player.GetWeaponManager().CanAttachMagazine( wpn, mag ) )
347 {
348 player.GetWeaponManager().AttachMagazine( mag );
349 }
350 }
351 else if( receiver_item && !is_reserved )
352 {
353 if( ( ItemBase.Cast( receiver_item ) ).CanBeCombined( ItemBase.Cast( item ) ) )
354 {
356 }
358 {
359 if( !receiver_item.GetInventory().CanRemoveEntity() )
360 return;
361 GetGame().GetPlayer().PredictiveSwapEntities( receiver_item, item );
362 }
363 else if( receiver_item.GetInventory().CanAddAttachment( item ) )
364 {
365 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
366 }
367 }
368 else if( attached_entity && slot_id != -1 && attached_entity.GetInventory().CanAddAttachmentEx( item, slot_id ) )
369 {
370 item_base = ItemBase.Cast( item );
371 stackable = item_base.GetTargetQuantityMax( slot_id );
372
373 if( stackable == 0 || stackable >= item_base.GetQuantity() )
374 {
375 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, slot_id);
376 }
377 else if( stackable != 0 && stackable < item_base.GetQuantity() )
378 {
379 item_base.SplitIntoStackMaxClient( m_Entity, slot_id );
380 }
381 }
382 else if(attached_entity && slot_id == -1 && attached_entity.GetInventory().FindFreeLocationFor(item,FindInventoryLocationType.ATTACHMENT,il))
383 {
384 item_base = ItemBase.Cast( item );
385 stackable = item_base.GetTargetQuantityMax( il.GetSlot() );
386
387 if( stackable == 0 || stackable >= item_base.GetQuantity() )
388 {
389 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, il.GetSlot());
390 }
391 else if( stackable != 0 && stackable < item_base.GetQuantity() )
392 {
393 item_base.SplitIntoStackMaxClient( m_Entity, il.GetSlot() );
394 }
395 }
396 /*else if( ( m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && ( !player.GetInventory().HasEntityInInventory( item ) || !m_Entity.GetInventory().HasEntityInCargo( item )) ) )
397 {
398 SplitItemUtils.TakeOrSplitToInventory( PlayerBase.Cast( GetGame().GetPlayer() ), m_Entity, item );
399 }*/
400 }
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Definition ItemBase.c:5561
Super root of all classes in Enforce script.
Definition EnScript.c:11
shorthand
Definition BoltActionRifle_Base.c:6
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), Class::CastTo(), CombineItemsClient(), GetGame(), ItemManager::GetInstance(), GetItemPreviewItem(), GetPlayer() и m_Entity.

◆ Refresh()

override void Refresh ( )
inlineprotected
636 {
637 if (!m_Refreshing)
638 {
639 if( !m_Closed )
640 {
641 super.Refresh();
643 }
644 }
645 }

Перекрестные ссылки m_Refreshing и RefreshAllSlots().

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

◆ RefreshAllSlots()

void RefreshAllSlots ( )
inlineprotected
648 {
649 m_Refreshing = true;
650 int row_count = m_AttachmentsContainer.GetRowCount();
651 int row;
652 for (row = 0; row < row_count; row++)
653 {
654 int col_count = m_AttachmentsContainer.GetColumnCountForRow(row);
655 int col;
656 for (col = 0; col < col_count; col++)
657 {
658 RefreshSlot(row, col, -1, "");
659 }
660 }
661 m_Refreshing = false;
662 }
void RefreshSlot(int row, int column, int slot_id, string slot_name)
Definition AttachmentCategoriesRow.c:665

Перекрестные ссылки m_AttachmentsContainer, m_Refreshing и RefreshSlot().

Используется в Init(), Refresh() и UpdateInterval().

◆ RefreshSlot()

void RefreshSlot ( int row,
int column,
int slot_id,
string slot_name )
inlineprotected
666 {
668 int slot_id_ = icon.GetSlotID();
669 EntityAI item = m_Entity.GetInventory().FindAttachment( slot_id_ );
671
672 if (!m_Entity.CanDisplayAttachmentSlot(slot_id_))
673 {
674 icon.Clear();
675 icon.GetMainWidget().Show( false );
676 }
677 else if (!item)
678 {
679 if (icon.GetEntity())
680 {
681 icon.ClearRemainSelected();
682
684 if (cont)
685 {
687 this.Remove(cont);
688 ( Container.Cast( cont.m_Parent ) ).Remove( cont );
689 }
690 }
691 icon.GetMainWidget().Show(true);
692 }
693 else
694 {
695 icon.GetMainWidget().Show( true );
696 if (icon.GetEntity() != item)
697 {
698 icon.Init( item );
699 }
700 else
701 {
702 icon.Refresh();
703 }
704
706 if( cont && cont.GetEntity() != item)
707 {
709 ( Container.Cast( cont.m_Parent ) ).Remove( cont );
710 this.Remove(cont);
711 cont = null;
712 }
713
714 if( !cont )
715 {
716 if( item.GetInventory().GetCargo() && m_AttachmentCargos )
717 {
718 cont = new ContainerWithCargo( this, true );
719 cont.GetRootWidget().SetSort( m_AttachmentCargos.Count() + 10 );
720 cont.SetEntity( item );
721 cont.SetSlotIcon( icon );
722
724 icon.SetContainer(cont);
725
726 SetOpenForSlotIcon(cont.IsOpened(),icon);
727 }
728 }
729
730 if (cont)
731 {
732 icon.GetRadialIconPanel().Show( cont.IsDisplayable() );
733 }
734
736 bool draggable = true;
737 bool can_be_removed = item.GetInventory().CanRemoveEntity();
738 bool in_hands_condition = m_Entity.GetHierarchyRoot() == GetGame().GetPlayer();
740 if( m_Entity.GetInventory().GetSlotLock( slot_id_ ) && ItemManager.GetInstance().GetDraggedItem() != item )
741 {
742 icon.GetMountedWidget().Show( true );
743 draggable = false;
744 }
745 else
746 {
747 icon.GetMountedWidget().Show( false );
748 }
749
750 if( !m_Entity.CanReleaseAttachment( item ) )
751 {
752 draggable = false;
753 }
754
756 {
757 icon.GetOutOfReachWidget().Show( false );
758 }
759 else
760 {
761 icon.GetOutOfReachWidget().Show( true );
762 draggable = false;
763 }
764
765 if( draggable )
766 {
767 icon.GetRender().GetParent().SetFlags( WidgetFlags.DRAGGABLE );
768 }
769 else
770 {
771 icon.GetRender().GetParent().ClearFlags( WidgetFlags.DRAGGABLE );
772 }
773 }
774 }
void Remove(Object object)
Definition ActionTargets.c:207
Definition AttachmentsOutOfReach.c:2
static bool IsAttachmentReachable(EntityAI e, string att_slot_name="", int slot_id=-1, float range=1.5)
Definition AttachmentsOutOfReach.c:5
void ContainerWithCargo(Container parent, int sort=-1)
Definition ContainerWithCargo.c:6
Definition CargoContainer.c:3
static proto native owned string GetSlotName(int id)
converts slot_id to string

Перекрестные ссылки ClosableContainer::ContainerWithCargo(), GetGame(), ItemManager::GetInstance(), InventorySlots::GetSlotName(), AttachmentsOutOfReach::IsAttachmentReachable(), m_AttachmentCargos, m_AttachmentsContainer, m_Entity и Remove().

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

◆ Select()

override bool Select ( )
inlineprotected
39 {
40 Man player = GetGame().GetPlayer();
41 SlotsIcon focused_icon = GetFocusedSlotsIcon();
42 EntityAI focused_item = GetFocusedItem();
43 Container focused_cont = GetFocusedContainer();
44 ItemBase selected_item = ItemBase.Cast( ItemManager.GetInstance().GetSelectedItem() ); // == dragged item
45
46 if( selected_item && focused_item != selected_item)//dropping from micromanagement
47 {
48 if( selected_item.GetInventory().CanRemoveEntity() )
49 {
50 int stack_max;
51
52 if (!focused_icon)
53 {
54 if (focused_cont)
55 {
56 focused_cont.Select();
57 }
58 }
59 else if( !focused_item && m_Entity && m_Entity.GetInventory().CanAddAttachmentEx( selected_item, focused_icon.GetSlotID() ) )
60 {
62 float quantity = selected_item.GetQuantity();
63 if( stack_max == 0 || stack_max >= quantity || !selected_item.CanBeSplit() )
64 {
65 player.PredictiveTakeEntityToTargetAttachmentEx( m_Entity, selected_item, focused_icon.GetSlotID() );
66 return true;
67 }
68 else
69 {
70 selected_item.SplitIntoStackMaxClient( m_Entity, focused_icon.GetSlotID() );
71 return true;
72 }
73 }
74 else if (focused_icon.GetSlotID() != -1)
75 {
76 if (focused_item && focused_item.GetHierarchyParent() && focused_item.GetHierarchyParent().GetInventory().CanAddAttachment(selected_item))
77 {
79 focused_item.GetInventory().GetCurrentInventoryLocation( inv_loc );
81 quantity = focused_item.GetQuantity();
82 if( focused_item.CanBeCombined( ItemBase.Cast( selected_item ) ) )
83 {
84 focused_item.CombineItemsClient( selected_item, true );
85 return true;
86 }
88 {
89 player.PredictiveSwapEntities( selected_item, focused_item );
90 return true;
91 }
92 else if( m_AttachmentCargos.Contains( inv_loc.GetSlot() ) )
93 {
94 if( focused_item.GetInventory().CanAddEntityInCargo( selected_item, selected_item.GetInventory().GetFlipCargo() ) )
95 {
97 return true;
98 }
99 }
100 }
101 }
102 }
103 }
104 else //clicking
105 {
106 if( focused_item && focused_item.GetInventory().CanRemoveEntity() && (!focused_icon || !focused_icon.IsOutOfReach()) )
107 {
108 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
109 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
110 {
112 {
113 player.PredictiveSwapEntities( item_in_hands, focused_item );
114 return true;
115 }
116 }
117 else
118 {
119 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
120 {
121 player.PredictiveTakeEntityToHands( focused_item );
122 return true;
123 }
124 }
125 }
126 }
127
128 return false;
129 }

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), GetGame(), ItemManager::GetInstance(), InventorySlots::GetStackMaxForSlotId(), m_AttachmentCargos, m_Entity и SplitItemUtils::TakeOrSplitToInventory().

◆ SplitItem()

override bool SplitItem ( )
inlineprotected
237 {
238 return false;
239 }

◆ TransferItem()

override bool TransferItem ( )
inlineprotected
132 {
133 if (CanTakeToInventory())
134 {
135 EntityAI entity = GetFocusedItem();
136 SlotsIcon focused_icon = GetFocusedSlotsIcon();
137 if( entity && !entity.IsLockedInSlot() && (!focused_icon || !focused_icon.IsOutOfReach()) )
138 {
140 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.CARGO, entity );
141 return true;
142 }
143 }
144 return false;
145 }

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

◆ TransferItemToVicinity()

override bool TransferItemToVicinity ( )
inlineprotected
148 {
149 if (CanDrop())
150 {
151 ItemBase item = ItemBase.Cast(GetFocusedItem());
153 SlotsIcon focused_icon = GetFocusedSlotsIcon();
154
155 if (item && !item.IsLockedInSlot() && (focused_icon && !focused_icon.IsOutOfReach()))
156 {
157 if (item.GetTargetQuantityMax() < item.GetQuantity())
158 item.SplitIntoStackMaxClient( null, -1 );
159 else
160 player.PhysicalPredictiveDropItem( item );
161 return true;
162 }
163 }
164 return false;
165 }

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

◆ UnfocusAll()

override void UnfocusAll ( )
inlineprotected
403 {
404 int i;
405 for ( i = 1; i < Count(); i++ )
406 {
407 for ( int j = 0; j < ITEMS_IN_ROW; j++ )
408 {
409 Widget w = Get( i ).GetMainWidget().FindAnyWidget( "Cursor" + j );
410 if( w )
411 w.Show( false );
412 }
413 }
414 for ( i = 0; i < m_AttachmentCargos.Count(); i++ )
415 {
416 m_AttachmentCargos.GetElement( i ).Unfocus();
417 m_AttachmentCargos.GetElement( i ).SetActive( false );
418 }
419 }
array< ref PlayerStatBase > Get()
Definition PlayerStatsPCO.c:103
@ Count
Definition RandomGeneratorSyncManager.c:7
Definition EnWidgets.c:190

Перекрестные ссылки Count, Get(), ITEMS_IN_ROW и m_AttachmentCargos.

◆ UpdateInterval()

override void UpdateInterval ( )
inlineprotected
971 {
972 super.UpdateInterval();
974 }

Перекрестные ссылки RefreshAllSlots().

Поля

◆ m_AttachmentCargos

ref map<int, ref ContainerWithCargo> m_AttachmentCargos
protected

◆ m_AttachmentsContainer

ref AttachmentsGroupContainer m_AttachmentsContainer
protected

◆ m_CategoryIdentifier

string m_CategoryIdentifier
protected

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

◆ m_Refreshing

bool m_Refreshing
protected

Используется в AttachmentCategoriesRow(), Refresh() и RefreshAllSlots().

◆ m_RowConfigPath

string m_RowConfigPath
protected

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


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