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

◆ RefreshSlot()

void AttachmentCategoriesRow::RefreshSlot ( int row,
int column,
int slot_id,
string slot_name )
inlineprotected

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

656 {
657 SlotsIcon icon = m_AttachmentsContainer.GetSlotsIcon(row, column);
658 int slot_id_ = icon.GetSlotID();
659 EntityAI item = m_Entity.GetInventory().FindAttachment( slot_id_ );
661
662 if (!m_Entity.CanDisplayAttachmentSlot(slot_id_))
663 {
664 icon.Clear();
665 icon.GetMainWidget().Show( false );
666 }
667 else if (!item)
668 {
669 icon.ClearRemainSelected();
670
671 cont = m_AttachmentCargos.Get(slot_id_);
672 if (cont)
673 {
674 m_AttachmentCargos.Remove(slot_id_);
675 this.Remove(cont);
676 ( Container.Cast( cont.m_Parent ) ).Remove( cont );
677 }
678 icon.GetMainWidget().Show(true);
679 }
680 else
681 {
682 icon.GetMainWidget().Show( true );
683 if (icon.GetEntity() != item)
684 {
685 icon.Init( item );
686 }
687 else
688 {
689 icon.Refresh();
690 }
691
692 cont = m_AttachmentCargos.Get(slot_id_);
693 if( cont && cont.GetEntity() != item)
694 {
695 m_AttachmentCargos.Remove(slot_id_);
696 ( Container.Cast( cont.m_Parent ) ).Remove( cont );
697 this.Remove(cont);
698 cont = null;
699 }
700
701 if( !cont )
702 {
703 if( item.GetInventory().GetCargo() && m_AttachmentCargos )
704 {
705 cont = new ContainerWithCargo( this, true );
706 cont.GetRootWidget().SetSort( m_AttachmentCargos.Count() + 10 );
707 cont.SetEntity( item );
708 cont.SetSlotIcon( icon );
709
710 m_AttachmentCargos.Insert( slot_id_, cont );
711 icon.SetContainer(cont);
712
713 SetOpenForSlotIcon(cont.IsOpened(),icon);
714 }
715 }
716
717 if (cont)
718 {
719 icon.GetRadialIconPanel().Show( cont.IsDisplayable() );
720 }
721
722 string slot_name_ = InventorySlots.GetSlotName(slot_id_);
723 bool draggable = true;
724 bool can_be_removed = item.GetInventory().CanRemoveEntity();
725 bool in_hands_condition = m_Entity.GetHierarchyRoot() == g_Game.GetPlayer();
726 bool in_vicinity_condition = AttachmentsOutOfReach.IsAttachmentReachable( m_Entity, slot_name_ );
727 if( m_Entity.GetInventory().GetSlotLock( slot_id_ ) && ItemManager.GetInstance().GetDraggedItem() != item )
728 {
729 icon.GetMountedWidget().Show( true );
730 draggable = false;
731 }
732 else
733 {
734 icon.GetMountedWidget().Show( false );
735 }
736
737 if( !m_Entity.CanReleaseAttachment( item ) )
738 {
739 draggable = false;
740 }
741
742 if ((in_hands_condition || in_vicinity_condition) && can_be_removed)
743 {
744 icon.GetOutOfReachWidget().Show( false );
745 }
746 else
747 {
748 icon.GetOutOfReachWidget().Show( true );
749 draggable = false;
750 }
751
752 if( draggable )
753 {
754 icon.GetRender().GetParent().SetFlags( WidgetFlags.DRAGGABLE );
755 }
756 else
757 {
758 icon.GetRender().GetParent().ClearFlags( WidgetFlags.DRAGGABLE );
759 }
760 }
761 }
class LogManager EntityAI
void Remove(Object object)
Определения ActionTargets.c:207
Entity m_Entity
Определения CachedEquipmentStorageBase.c:14
const string Container
Определения CentralEconomy.c:6
DayZGame g_Game
Определения DayZGame.c:3942
ref AttachmentsGroupContainer m_AttachmentsContainer
Определения AttachmentCategoriesRow.c:7
ref map< int, ref ContainerWithCargo > m_AttachmentCargos
Определения AttachmentCategoriesRow.c:8
void ContainerWithCargo(LayoutHolder parent, int sort=-1)
Определения ContainerWithCargo.c:6
bool CanDisplayAttachmentSlot(string slot_name)
proto native GameInventory GetInventory()
bool CanReleaseAttachment(EntityAI attachment)
calls this->CanReleaseAttachment(attachment)
proto native EntityAI GetHierarchyRoot()
Returns root of current hierarchy (for example: if this entity is in Backpack on gnd,...
proto native bool GetSlotLock(int slot)
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
void ClearRemainSelected()
Определения SlotsIcon.c:549
override void Refresh()
Определения SlotsIcon.c:345
ItemPreviewWidget GetRender()
Определения SlotsIcon.c:230
EntityAI GetEntity()
Определения SlotsIcon.c:365
void Init(EntityAI obj, bool reservation=false)
Определения SlotsIcon.c:501
void SetContainer(Container container)
Определения SlotsIcon.c:139
int GetSlotID()
Определения SlotsIcon.c:190
void Clear()
Определения SlotsIcon.c:612
Widget GetMountedWidget()
Определения SlotsIcon.c:225
Widget GetOutOfReachWidget()
Определения SlotsIcon.c:265
Widget GetRadialIconPanel()
Определения SlotsIcon.c:300
WidgetFlags
Определения EnWidgets.c:58

Перекрестные ссылки SlotsIcon::Clear(), SlotsIcon::ClearRemainSelected(), ClosableContainer::ContainerWithCargo(), g_Game, ItemManager::GetDraggedItem(), SlotsIcon::GetEntity(), ItemManager::GetInstance(), SlotsIcon::GetMountedWidget(), SlotsIcon::GetOutOfReachWidget(), SlotsIcon::GetRadialIconPanel(), SlotsIcon::GetRender(), SlotsIcon::GetSlotID(), InventorySlots::GetSlotName(), SlotsIcon::Init(), AttachmentsOutOfReach::IsAttachmentReachable(), m_AttachmentCargos, m_AttachmentsContainer, m_Entity, SlotsIcon::Refresh(), Remove() и SlotsIcon::SetContainer().

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