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

◆ DraggingOver()

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

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

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