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

◆ DraggingOver()

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

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

366 {
367 ItemManager.GetInstance().HideDropzones();
368
369 if (w == null)
370 {
371 return;
372 }
373 string name = w.GetName();
374 name.Replace("PanelWidget", "Render");
375
376 ItemPreviewWidget targetIpw = ItemPreviewWidget.Cast(receiver.FindAnyWidget( "Render" ));
377 if (m_HandsIcon)
378 {
379 targetIpw = ItemPreviewWidget.Cast(receiver.GetParent().FindAnyWidget( "Render" ));
380 }
381
382 ItemPreviewWidget selectedIpw = ItemPreviewWidget.Cast(w.FindAnyWidget( name ));
383 if (selectedIpw == null)
384 {
385 selectedIpw = ItemPreviewWidget.Cast(w.FindAnyWidget( "Render" ));
386 }
387 if (selectedIpw == null)
388 {
389 return;
390 }
391
392 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
393 InventoryItem targetEntity = InventoryItem.Cast(targetIpw.GetItem());
394 InventoryItem selectedEntity = InventoryItem.Cast(selectedIpw.GetItem());
395 InventoryLocation ilDst;
396 if (!targetEntity || !selectedEntity)
397 {
398 return;
399 }
400
401 if (m_Lock)
402 {
403 if (targetEntity == selectedEntity)
404 {
405 ColorManager.GetInstance().SetColor( w, ColorManager.SWAP_COLOR );
406 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
407 }
408 else
409 {
410 CargoContainer parentContainer = CargoContainer.Cast(m_Parent);
411
412 float parentX;
413 float parentY;
414
415 parentContainer.GetRootWidget().GetScreenPos(parentX, parentY);
416
417 float iconSize = parentContainer.GetIconSize();
418 float spaceSize = parentContainer.GetSpaceSize();
419
420 int PosX = (x - parentX) / (iconSize + spaceSize);
421 int PosY = (y - parentY) / (iconSize + spaceSize);
422
423 EntityAI parent = m_Lock;
424 CargoBase targetCargo = parent.GetInventory().GetCargo();
425
426 ilDst = new InventoryLocation();
427 ilDst.SetCargoAuto(targetCargo, selectedEntity, PosY, PosX, selectedEntity.GetInventory().GetFlipCargo());
428
429 if (parent.GetInventory().LocationCanAddEntity(ilDst))
430 {
431 ColorManager.GetInstance().SetColor(w, ColorManager.GREEN_COLOR);
432 ItemManager.GetInstance().GetRightDropzone().SetAlpha(1);
433 }
434 else
435 {
436 ColorManager.GetInstance().SetColor(w, ColorManager.RED_COLOR);
437 ItemManager.GetInstance().ShowSourceDropzone(selectedEntity);
438 }
439 }
440 }
441 else
442 {
443 static int testedFlags = InventoryCombinationFlags.COMBINE_QUANTITY2 | InventoryCombinationFlags.ADD_AS_CARGO | InventoryCombinationFlags.ADD_AS_ATTACHMENT | InventoryCombinationFlags.SWAP | InventoryCombinationFlags.FSWAP | InventoryCombinationFlags.SWAP_MAGAZINE;
444
445 int chosenInventoryAction = ItemManager.GetChosenCombinationFlag(selectedEntity, targetEntity, testedFlags, ilDst);
446 UpdateFrameColor(selectedEntity, targetEntity, chosenInventoryAction, w, ilDst);
447 }
448 }
class LogManager EntityAI
Entity m_Parent
Определения CachedEquipmentStorageBase.c:17
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:4074
Icon x
Icon y
void UpdateFrameColor(EntityAI selectedEntity, EntityAI targetEntity, int combinationFlag, Widget w, InventoryLocation il=null)
Определения Icon.c:564
bool m_HandsIcon
Определения Icon.c:17
EntityAI m_Lock
Определения Icon.c:8
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()

Перекрестные ссылки InventoryCombinationFlags::ADD_AS_ATTACHMENT, InventoryCombinationFlags::ADD_AS_CARGO, InventoryCombinationFlags::COMBINE_QUANTITY2, InventoryCombinationFlags::FSWAP, g_Game, ItemManager::GetChosenCombinationFlag(), ColorManager::GetInstance(), ItemManager::GetInstance(), ItemPreviewWidget::GetItem(), ItemManager::GetRightDropzone(), ColorManager::GREEN_COLOR, ItemManager::HideDropzones(), m_HandsIcon, m_Lock, m_Parent, name, ColorManager::RED_COLOR, InventoryLocation::SetCargoAuto(), ColorManager::SetColor(), ItemManager::ShowSourceDropzone(), InventoryCombinationFlags::SWAP, ColorManager::SWAP_COLOR, InventoryCombinationFlags::SWAP_MAGAZINE, UpdateFrameColor(), x и y.