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

◆ InitAttachmentGrid()

void Attachments::InitAttachmentGrid ( int att_row_index)
inlineprotected

См. определение в файле 5_Mission/DayZ/GUI/InventoryNew/Attachments.c строка 459

460 {
461 SlotsIcon icon;
462 int i;
463 m_RowIndex = att_row_index;
464
465 int number_of_rows = Math.Ceil( m_AttachmentSlotNames.Count() / ITEMS_IN_ROW );
466 string name = m_Entity.GetDisplayName();
467 name.ToUpper();
468
469 m_AttachmentsContainer = new AttachmentsWrapper( m_Parent );
470 m_AttachmentsContainer.SetParent( this );
471 m_AttachmentsContainer.SetFalseAttachmentsHeaderText(name);
472 m_AttachmentsContainer.GetRootWidget().SetSort( att_row_index );
473 m_Parent.Insert( m_AttachmentsContainer, att_row_index );
474
475 for ( i = 0; i < number_of_rows; i++ )
476 {
477 SlotsContainer ic = new SlotsContainer( m_AttachmentsContainer, m_Entity );
478 m_AttachmentsContainer.Insert( ic );
479
480 if( i == ( number_of_rows - 1 ) && m_AttachmentSlotNames.Count() % ITEMS_IN_ROW != 0 )
481 {
482 ic.SetColumnCount( m_AttachmentSlotNames.Count() % ITEMS_IN_ROW );
483 }
484 else
485 {
486 ic.SetColumnCount( ITEMS_IN_ROW );
487 }
488
489 for( int j = 0; j < ITEMS_IN_ROW; j++ )
490 {
491 icon = ic.GetSlotIcon( j );
492 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetMainWidget(), m_Parent, "OnDropReceivedFromHeader2" );
493 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetGhostSlot(), m_Parent, "OnDropReceivedFromHeader2" );
494 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetPanelWidget(), m_Parent, "OnDropReceivedFromHeader2" );
495
496 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetMainWidget(), m_Parent, "DraggingOverHeader" );
497 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetGhostSlot(), m_Parent, "DraggingOverHeader" );
498 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetPanelWidget(), m_Parent, "DraggingOverHeader" );
499
500 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown( icon.GetMainWidget(), m_Parent, "MouseClick2" );
501 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown( icon.GetGhostSlot(), m_Parent, "MouseClick2" );
502 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown( icon.GetPanelWidget(), m_Parent, "MouseClick2" );
503 }
504 }
505
506 for ( i = 0; i < m_AttachmentSlotNames.Count(); i++ )
507 {
508 icon = SlotsContainer.Cast( m_AttachmentsContainer.Get( ( i / ITEMS_IN_ROW ) ) ).GetSlotIcon( i % ITEMS_IN_ROW );
509 WidgetEventHandler.GetInstance().RegisterOnDoubleClick( icon.GetPanelWidget(), m_Parent, "DoubleClick" );
510
511 string path = "CfgSlots" + " Slot_" + m_AttachmentSlotNames[i];
512
513 //Show different magazine icon for firearms and pistols
514 if ( m_AttachmentSlotNames[i] == "magazine" )
515 {
516 if ( !m_Entity.IsInherited( Pistol_Base ) )
517 path = "CfgSlots" + " Slot_" + "magazine2";
518 }
519
520 string icon_name = ""; //icon_name must be in format "set:<setname> image:<imagename>"
521 if( g_Game.ConfigGetText( path + " ghostIcon", icon_name ) && icon_name != "" )
522 icon.GetGhostSlot().LoadImageFile( 0, StaticGUIUtils.VerifyIconImageString(StaticGUIUtils.IMAGESETGROUP_INVENTORY,icon_name) );
523 int slot_id = InventorySlots.GetSlotIdFromString( m_AttachmentSlotNames[i] );
524 m_AttachmentSlots.Insert( slot_id, icon );
525 m_AttachmentIDOrdered.Insert(slot_id);
526
527 icon.SetSlotID(slot_id);
528 icon.SetSlotDisplayName(InventorySlots.GetSlotDisplayName(slot_id));
529
530 EntityAI item = m_Entity.GetInventory().FindAttachment( slot_id );
531 if( item )
533 else
534 icon.Clear();
535
536 if (m_Entity.CanDisplayAttachmentSlot(slot_id))
537 {
538 icon.GetMainWidget().Show( true );
539 }
540 else
541 {
542 icon.GetMainWidget().Show( false );
543 }
544 }
545
546 if( m_AttachmentSlotNames.Count() > 0 )
547 {
548 int row_index = number_of_rows - 1;
549 SlotsContainer row_last = SlotsContainer.Cast( m_AttachmentsContainer.Get( row_index ) );
550 if( row_last )
551 {
552 for( int k = ((m_AttachmentSlotNames.Count() - 1) % ITEMS_IN_ROW) + 1; k < ITEMS_IN_ROW; k++ )
553 {
554 row_last.GetSlotIcon( k ).GetMainWidget().Show( false );
555 }
556 row_last.GetRootWidget().Update();
557 row_last.GetRootWidget().GetParent().Update();
558 }
559 }
560
561 m_AttachmentsContainer.RecomputeOpenedContainers();
562 }
class LogManager EntityAI
const int ITEMS_IN_ROW
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:4074
string path
Определения OptionSelectorMultistate.c:142
ref array< string > m_AttachmentSlotNames
ref AttachmentsWrapper m_AttachmentsContainer
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
ref array< int > m_AttachmentIDOrdered
ref map< int, SlotsIcon > m_AttachmentSlots
SlotsIcon GetSlotIcon(int index)
Определения SlotsContainer.c:207
override void Clear()
Определения SlotsIcon.c:65
void SetSlotID(int slot_ID)
Определения SlotsIconBase.c:165
ImageWidget GetGhostSlot()
Определения SlotsIconBase.c:205
Widget GetPanelWidget()
Определения SlotsIconBase.c:175
void SetSlotDisplayName(string text)
Определения SlotsIconBase.c:114

Перекрестные ссылки AttachmentAdded(), Math::Ceil(), SlotsIcon::Clear(), g_Game, SlotsIconBase::GetGhostSlot(), WidgetEventHandler::GetInstance(), SlotsIconBase::GetPanelWidget(), InventorySlots::GetSlotDisplayName(), SlotsContainer::GetSlotIcon(), InventorySlots::GetSlotIdFromString(), StaticGUIUtils::IMAGESETGROUP_INVENTORY, ITEMS_IN_ROW, m_AttachmentIDOrdered, m_AttachmentsContainer, m_AttachmentSlotNames, m_AttachmentSlots, m_Entity, m_Parent, m_RowIndex, name, path, WidgetEventHandler::RegisterOnDoubleClick(), WidgetEventHandler::RegisterOnDraggingOver(), WidgetEventHandler::RegisterOnDropReceived(), WidgetEventHandler::RegisterOnMouseButtonDown(), SlotsIconBase::SetSlotDisplayName(), SlotsIconBase::SetSlotID() и StaticGUIUtils::VerifyIconImageString().

Используется в HandsContainer::AttachmentAdded().