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

◆ DropReceived() [2/2]

void ClosableContainer::DropReceived ( Widget w,
int x,
int y,
CargoContainer cargo )
inlineprotected

NOTE Used for mouse only.

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

526 {
528 if (!item)
529 return;
530
531 #ifndef PLATFORM_CONSOLE
532 int c_x, c_y;
533 #endif
534
535 EntityAI targetEntity = m_Entity;
536 CargoBase targetCargo;
537
538 if (cargo != m_CargoGrid)
539 {
540 targetEntity = m_AttachmentCargos.GetKeyByValue(cargo);
541 }
542
543 if (targetEntity)
544 {
545 targetCargo = targetEntity.GetInventory().GetCargo();
546 #ifdef PLATFORM_CONSOLE
547 if (m_CargoGrid && m_CargoGrid.HasItem(item))
548 return;
549 #endif
550 }
551
552 if (!targetCargo || !targetEntity)
553 return;
554
555 InventoryLocation dst = new InventoryLocation();
556 #ifdef PLATFORM_CONSOLE
557 x = 0;
558 y = targetCargo.GetItemCount();
559 targetEntity.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.CARGO, dst);
560 #else
561 c_x = targetCargo.GetHeight();
562 c_y = targetCargo.GetWidth();
563
564 dst.SetCargoAuto(targetCargo, item, x, y, item.GetInventory().GetFlipCargo());
565 #endif
566
567 InventoryLocation src = new InventoryLocation();
568 item.GetInventory().GetCurrentInventoryLocation(src);
569 if (src.CompareLocationOnly(dst) && src.GetFlip() == dst.GetFlip())
570 return;
571
572 #ifdef PLATFORM_CONSOLE
573 if (dst.IsValid() && targetEntity.GetInventory().LocationCanAddEntity(dst))
574 #else
575 if (c_x > x && c_y > y && targetEntity.GetInventory().LocationCanAddEntity(dst))
576 #endif
577 {
578 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
579
580 SplitItemUtils.TakeOrSplitToInventoryLocation(player, dst);
581
582 Icon icon = cargo.GetIcon(item);
583 if (icon)
584 {
585 if (w && w.FindAnyWidget("Cursor"))
586 w.FindAnyWidget("Cursor").SetColor(ColorManager.BASE_COLOR);
587
588 icon.Refresh();
589 Refresh();
590 }
591 }
592
593 ItemManager.GetInstance().HideDropzones();
594 ItemManager.GetInstance().SetIsDragging(false);
595 }
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
void Refresh()
Определения SizeToChild.c:108
proto native int GetItemCount()
proto native int GetWidth()
proto native int GetHeight()
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
ref CargoContainer m_CargoGrid
Определения ContainerWithCargo.c:3
EntityAI GetItemPreviewItem(Widget w)
Определения ContainerWithCargo.c:224
override void Refresh()
Определения Icon.c:1216
proto native bool IsValid()
verify current set inventory location
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
proto native bool CompareLocationOnly(notnull InventoryLocation other)
proto native bool GetFlip()
returns flip status of cargo
proto native CGame GetGame()

Перекрестные ссылки ColorManager::BASE_COLOR, InventoryLocation::CompareLocationOnly(), InventoryLocation::GetFlip(), GetGame(), CargoBase::GetHeight(), ItemManager::GetInstance(), CargoBase::GetItemCount(), GetItemPreviewItem(), GetPlayer(), CargoBase::GetWidth(), ItemManager::HideDropzones(), InventoryLocation::IsValid(), m_AttachmentCargos, m_CargoGrid, m_Entity, Icon::Refresh(), Refresh(), InventoryLocation::SetCargoAuto(), ItemManager::SetIsDragging(), SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.