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

◆ DropReceivedFromMain()

void Icon::DropReceivedFromMain ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected

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

888 {
889 ItemManager.GetInstance().HideDropzones();
890 ItemManager.GetInstance().SetIsDragging(false);
891 string name = w.GetName();
892 name.Replace("PanelWidget", "Render");
893 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
894
895 ItemPreviewWidget targetIpw = ItemPreviewWidget.Cast(receiver.FindAnyWidget( "Render" ));
896 if (m_HandsIcon)
897 {
898 targetIpw = ItemPreviewWidget.Cast(receiver.GetParent().FindAnyWidget( "Render" ));
899 }
900
901 ItemPreviewWidget selectedIpw = ItemPreviewWidget.Cast(w.FindAnyWidget( name ));
902 if (selectedIpw == null)
903 {
904 selectedIpw = ItemPreviewWidget.Cast(w.FindAnyWidget( "Render" ));
905 }
906 if (selectedIpw == null)
907 {
908 return;
909 }
910
911 InventoryItem targetEntity = InventoryItem.Cast(targetIpw.GetItem());
912 InventoryItem selectedEntity = InventoryItem.Cast(selectedIpw.GetItem());
913 if (!selectedEntity)
914 {
915 return;
916 }
917 int index;
918 InventoryLocation ilSrc;
919 InventoryLocation ilDst;
920 if (m_Lock && targetEntity == selectedEntity)
921 {
922 index = player.GetHumanInventory().FindUserReservedLocationIndex(m_Item);
923 ilSrc = new InventoryLocation();
924 ilDst = new InventoryLocation();
925
926 m_Item.GetInventory().GetCurrentInventoryLocation(ilSrc);
927 player.GetHumanInventory().GetUserReservedLocation(index, ilDst);
928
929 if (ilDst.GetParent().GetInventory().LocationCanAddEntity(ilDst))
930 {
931
932 player.GetHumanInventory().ClearUserReservedLocation(m_Item);
933 player.PredictiveTakeToDst(ilSrc, ilDst);
934 m_Item.GetOnReleaseLock().Invoke(m_Item);
935 }
936 }
937 else if (m_Lock)
938 {
939 CargoContainer parentCargo = CargoContainer.Cast(m_Parent);
940
941 float parentX;
942 float parentY;
943
944 parentCargo.GetRootWidget().GetScreenPos(parentX, parentY);
945
946 float iconSize = parentCargo.GetIconSize();
947 float spaceSize = parentCargo.GetSpaceSize();
948
949 int PosX = (x-parentX) / (iconSize + spaceSize);
950 int PosY = (y-parentY) / (iconSize + spaceSize);
951
952 EntityAI parent = m_Lock;
953 CargoBase targetCargo = parent.GetInventory().GetCargo();
954
955 ilDst = new InventoryLocation();
956 ilDst.SetCargoAuto(targetCargo, selectedEntity, PosY, PosX, selectedEntity.GetInventory().GetFlipCargo());
957
958 if (parent.GetInventory().LocationCanAddEntity(ilDst))
959 {
960 player.GetHumanInventory().ClearUserReservedLocation(m_Item);
961 m_Item.GetOnReleaseLock().Invoke(m_Item);
962
963 SplitItemUtils.TakeOrSplitToInventoryLocation(player, ilDst);
964 }
965 }
966 else
967 {
968 ilDst = new InventoryLocation();
969 static int testedFlags = InventoryCombinationFlags.COMBINE_QUANTITY2 | InventoryCombinationFlags.ADD_AS_CARGO | InventoryCombinationFlags.ADD_AS_ATTACHMENT | InventoryCombinationFlags.SWAP | InventoryCombinationFlags.FSWAP | InventoryCombinationFlags.SWAP_MAGAZINE;
970
971 int chosenInventoryAction = ItemManager.GetChosenCombinationFlag(selectedEntity, targetEntity, testedFlags, ilDst);
972 PerformCombination(selectedEntity, targetEntity, chosenInventoryAction, ilDst);
973 }
974 }
class LogManager EntityAI
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
Widget m_Parent
Определения SizeToChild.c:92
ItemBase m_Item
Определения Icon.c:16
bool m_HandsIcon
Определения Icon.c:17
EntityAI m_Lock
Определения Icon.c:8
bool PerformCombination(EntityAI selectedEntity, EntityAI targetEntity, int combinationFlag, InventoryLocation ilSwapDst=null)
Определения Icon.c:518
proto native EntityAI GetParent()
returns parent of current 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 EntityAI GetItem()
proto native CGame GetGame()

Перекрестные ссылки InventoryCombinationFlags::ADD_AS_ATTACHMENT, InventoryCombinationFlags::ADD_AS_CARGO, InventoryCombinationFlags::COMBINE_QUANTITY2, InventoryCombinationFlags::FSWAP, ItemManager::GetChosenCombinationFlag(), GetGame(), ItemManager::GetInstance(), ItemPreviewWidget::GetItem(), InventoryLocation::GetParent(), GetPlayer(), ItemManager::HideDropzones(), m_HandsIcon, m_Item, m_Lock, m_Parent, name, PerformCombination(), InventoryLocation::SetCargoAuto(), ItemManager::SetIsDragging(), InventoryCombinationFlags::SWAP, InventoryCombinationFlags::SWAP_MAGAZINE, SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.