DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ InitGhostSlots()

void ZombieContainer::InitGhostSlots ( )
inlineprotected

См. определение в файле ZombieContainer.c строка 414

415 {
416 int row, column;
417 SlotsIcon icon;
418 bool has_cargo = m_ZombieEntity.GetInventory().GetCargo() != null;
419
420 string config_path_ghosts_slots = "CfgVehicles ZombieBase InventoryEquipment playerSlots";
421 array<string> player_ghosts_slots = new array<string>();
422 GetGame().ConfigGetTextArray( config_path_ghosts_slots, player_ghosts_slots );
423
424 for ( int i = 0; i < player_ghosts_slots.Count(); i++ )
425 {
426 string slot_name = player_ghosts_slots.Get ( i );
427 string path = "CfgSlots" + " " + slot_name;
428
429 if ( GetGame().ConfigIsExisting( path ) )
430 {
431 string icon_name; //icon_name must be in format "set:<setname> image:<imagename>"
432 GetGame().ConfigGetText( path + " ghostIcon", icon_name );
433 column = i % ITEMS_IN_ROW;
434
435 //START - GetWidgetSlot
436 row = i / ITEMS_IN_ROW;
437 if( row >= m_Container.Count() )
438 {
439 if ( has_cargo )
440 {
441 if( row < ( (player_ghosts_slots.Count() + 1 )/ ITEMS_IN_ROW ) )
443 else
444 AddSlotsContainer( ( player_ghosts_slots.Count() + 1 ) % ITEMS_IN_ROW );
445
446 }
447 else
448 {
449 if ( row < ( player_ghosts_slots.Count() / ITEMS_IN_ROW ) )
451 else
452 AddSlotsContainer( player_ghosts_slots.Count() % ITEMS_IN_ROW );
453 }
454
455 }
456
457 icon = GetSlotsIcon( row, column );
458
459 icon.GetMainWidget().Show( true );
460 icon.Clear();
461
462 WidgetEventHandler.GetInstance().RegisterOnDoubleClick( icon.GetPanelWidget(), this, "DoubleClick" );
463
464 //END - GetWidgetSlot
465 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetPanelWidget(), this, "OnDropReceivedFromGhostArea" );
466 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetGhostSlot(), this, "OnDropReceivedFromGhostArea" );
467 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetPanelWidget(), this, "DraggingOver" );
468 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetGhostSlot(), this, "DraggingOver" );
469 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetPanelWidget(), this, "DraggingOver" );
470 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown( icon.GetPanelWidget(), this, "MouseClick" );
471
472 icon.GetGhostSlot().LoadImageFile( 0, StaticGUIUtils.VerifyIconImageString(StaticGUIUtils.IMAGESETGROUP_INVENTORY,icon_name) );
473 //END - LoadIconIntoWidgetSlot
474
475 GetGame().ConfigGetText( path + " name", slot_name );
476 int slot_id = InventorySlots.GetSlotIdFromString( slot_name );
477 icon.SetSlotID( slot_id );
478 icon.SetSlotDisplayName(InventorySlots.GetSlotDisplayName(slot_id));
479 m_InventorySlots.Set( slot_id, icon );
480
481 int slot = InventorySlots.GetSlotIdFromString( slot_name );
482 ItemBase item = ItemBase.Cast( m_ZombieEntity.GetInventory().FindAttachment( slot ) );
483
484 if( item )
485 ItemAttached( item, slot_name );
486 }
487 }
488
489 if( m_ZombieEntity.GetInventory().GetCargo() )
490 {
491 row = player_ghosts_slots.Count() / ITEMS_IN_ROW;
492 column = player_ghosts_slots.Count() % ITEMS_IN_ROW;
493 if( row >= m_Container.Count() )
494 {
495 if( row < ( player_ghosts_slots.Count() + 1 / ITEMS_IN_ROW ) )
497 else
498 AddSlotsContainer( ( player_ghosts_slots.Count() + 1 ) % ITEMS_IN_ROW );
499 }
500
501 icon = GetSlotsIcon( row, column );
502 icon.GetMainWidget().Show( true );
503 icon.Clear();
504 icon.GetGhostSlot().LoadImageFile( 0, StaticGUIUtils.VerifyIconImageString(StaticGUIUtils.IMAGESETGROUP_INVENTORY,m_ZombieEntity.ConfigGetString("GUIInventoryCargoIcon")) );
505 icon.SetSlotDisplayName( m_ZombieEntity.ConfigGetString("GUIInventoryCargoName") );
506 icon.GetRadialIconPanel().Show( true );
507 icon.GetRadialIcon().Show( true );
508
509 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetGhostSlot(), this, "ToggleContainer" );
510 m_CargoGrid = new ContainerWithCargo( this, false );
511 m_CargoGrid.SetEntity( m_ZombieEntity );
512 m_CargoGrid.GetHeader().GetMainWidget().ClearFlags( WidgetFlags.DRAGGABLE );
515 }
516
517 RecomputeOpenedContainers();
518 }
const int ITEMS_IN_ROW
Определения Attachments.c:1
class GP5GasMask extends MaskBase ItemBase
string path
Определения OptionSelectorMultistate.c:142
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
Widget GetPanelWidget()
Определения SlotsIcon.c:205
void SetSlotID(int slot_ID)
Определения SlotsIcon.c:195
void SetSlotDisplayName(string text)
Определения SlotsIcon.c:144
Widget GetRadialIcon()
Определения SlotsIcon.c:310
void SetContainer(Container container)
Определения SlotsIcon.c:139
void Clear()
Определения SlotsIcon.c:612
Widget GetRadialIconPanel()
Определения SlotsIcon.c:300
ImageWidget GetGhostSlot()
Определения SlotsIcon.c:235
ref map< EntityAI, ref Container > m_ShowedItems
Определения ZombieContainer.c:6
ref AttachmentsGroupContainer m_Container
Определения ZombieContainer.c:3
EntityAI m_ZombieEntity
Определения ZombieContainer.c:7
void ItemAttached(EntityAI item, string slot_name)
Определения ZombieContainer.c:245
ref ContainerWithCargo m_CargoGrid
Определения ZombieContainer.c:4
void AddSlotsContainer(int row_count)
Определения ZombieContainer.c:520
SlotsIcon GetSlotsIcon(int row, int column)
Определения ZombieContainer.c:409
ref map< int, SlotsIcon > m_InventorySlots
Определения ZombieContainer.c:5
proto native CGame GetGame()
WidgetFlags
Определения EnWidgets.c:58

Перекрестные ссылки AddSlotsContainer(), SlotsIcon::Clear(), CGame::ConfigGetText(), CGame::ConfigGetTextArray(), GetGame(), SlotsIcon::GetGhostSlot(), WidgetEventHandler::GetInstance(), SlotsIcon::GetPanelWidget(), SlotsIcon::GetRadialIcon(), SlotsIcon::GetRadialIconPanel(), InventorySlots::GetSlotDisplayName(), InventorySlots::GetSlotIdFromString(), GetSlotsIcon(), StaticGUIUtils::IMAGESETGROUP_INVENTORY, ItemAttached(), ITEMS_IN_ROW, m_CargoGrid, m_Container, m_InventorySlots, m_ShowedItems, m_ZombieEntity, path, WidgetEventHandler::RegisterOnDoubleClick(), WidgetEventHandler::RegisterOnDraggingOver(), WidgetEventHandler::RegisterOnDropReceived(), WidgetEventHandler::RegisterOnMouseButtonDown(), WidgetEventHandler::RegisterOnMouseButtonUp(), SlotsIcon::SetContainer(), SlotsIcon::SetSlotDisplayName(), SlotsIcon::SetSlotID() и StaticGUIUtils::VerifyIconImageString().

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