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

◆ RefreshSlot()

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

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

657 {
658 SlotsIcon icon = m_AttachmentsContainer.GetSlotsIcon(row, column);
659 int slot_id_ = icon.GetSlotID();
660 EntityAI item = m_Entity.GetInventory().FindAttachment(slot_id_);
662
663 if (!m_Entity.CanDisplayAttachmentSlot(slot_id_))
664 {
665 icon.Clear();
666 icon.GetMainWidget().Show(false);
667 }
668 else if (!item)
669 {
670 icon.ClearRemainSelected();
671
672 cont = m_AttachmentCargos.Get(slot_id_);
673 if (cont)
674 {
675 m_AttachmentCargos.Remove(slot_id_);
676 this.Remove(cont);
677 (Container.Cast(cont.m_Parent)).Remove(cont);
678 }
679 icon.GetMainWidget().Show(true);
680 }
681 else
682 {
683 icon.GetMainWidget().Show(true);
684 if (icon.GetEntity() != item)
685 {
686 icon.Init(item);
687 }
688 else
689 {
690 icon.Refresh();
691 }
692
693 cont = m_AttachmentCargos.Get(slot_id_);
694 if (cont && cont.GetEntity() != item)
695 {
696 m_AttachmentCargos.Remove(slot_id_);
697 (Container.Cast(cont.m_Parent)).Remove(cont);
698 this.Remove(cont);
699 cont = null;
700 }
701
702 if (!cont)
703 {
704 if (item.GetInventory().GetCargo() && m_AttachmentCargos)
705 {
706 cont = new ContainerWithCargo(this, true);
707 cont.GetRootWidget().SetSort(m_AttachmentCargos.Count() + 10);
708 cont.SetEntity(item);
709 cont.SetSlotIcon(icon);
710
711 m_AttachmentCargos.Insert(slot_id_, cont);
712 icon.SetContainer(cont);
713
714 SetOpenForSlotIcon(cont.IsOpened(),icon);
715 }
716 }
717
718 if (cont)
719 {
720 icon.GetRadialIconPanel().Show(cont.IsDisplayable());
721 }
722
723 string slotName = InventorySlots.GetSlotName(slot_id_);
724 bool draggable = true;
725 bool can_be_removed = item.GetInventory().CanRemoveEntity();
726 bool in_hands_condition = m_Entity.GetHierarchyRoot() == g_Game.GetPlayer();
727 bool in_vicinity_condition = IsCategoryReachable(m_Entity,GetCategoryIdentifier()) || AttachmentsOutOfReach.IsAttachmentReachable(m_Entity, slotName, -1, UAMaxDistances.DEFAULT);
728 if (m_Entity.GetInventory().GetSlotLock(slot_id_) && ItemManager.GetInstance().GetDraggedItem() != item)
729 {
730 icon.GetMountedWidget().Show(true);
731 draggable = false;
732 }
733 else
734 {
735 icon.GetMountedWidget().Show(false);
736 }
737
739 {
740 draggable = false;
741 }
742
743 if ((in_hands_condition || in_vicinity_condition) && can_be_removed)
744 {
745 icon.GetOutOfReachWidget().Show(false);
746 }
747 else
748 {
749 icon.GetOutOfReachWidget().Show(true);
750 draggable = false;
751 }
752
753 if (draggable)
754 {
755 icon.GetRender().GetParent().SetFlags(WidgetFlags.DRAGGABLE);
756 }
757 else
758 {
759 icon.GetRender().GetParent().ClearFlags(WidgetFlags.DRAGGABLE);
760 }
761 }
762 }
class LogManager EntityAI
Entity m_Entity
Определения CachedEquipmentStorageBase.c:16
const string Container
Определения CentralEconomy.c:6
PlayerSpawnPreset slotName
DayZGame g_Game
Определения DayZGame.c:4074
bool IsCategoryReachable(EntityAI ent, string categoryName, float range=1.5)
Определения AttachmentCategoriesRow.c:764
ref AttachmentsGroupContainer m_AttachmentsContainer
Определения AttachmentCategoriesRow.c:7
ref map< int, ref ContainerWithCargo > m_AttachmentCargos
Определения AttachmentCategoriesRow.c:8
string GetCategoryIdentifier()
Определения AttachmentCategoriesRow.c:23
void ContainerWithCargo(LayoutHolder parent, int sort=-1)
Определения ContainerWithCargo.c:6
proto native GameInventory GetInventory()
bool CanDisplayAttachmentSlot(int slot_id)
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)
override void Clear()
Определения SlotsIcon.c:65
override void ClearRemainSelected()
Определения SlotsIcon.c:57
void SetContainer(Container container)
Определения SlotsIconBase.c:109
Widget GetRadialIconPanel()
Определения SlotsIconBase.c:270
override void Refresh()
Определения SlotsIconBase.c:315
Widget GetOutOfReachWidget()
Определения SlotsIconBase.c:235
int GetSlotID()
Определения SlotsIconBase.c:160
ItemPreviewWidget GetRender()
Определения SlotsIconBase.c:200
EntityAI GetEntity()
Определения SlotsIconBase.c:335
Widget GetMountedWidget()
Определения SlotsIconBase.c:195
void Init(EntityAI obj, bool reservation=false)
Определения SlotsIconBase.c:472
WidgetFlags
Определения EnWidgets.c:58

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

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