예제 #1
0
 private void ShipInfo_Dragged(PointerEventData eventData, ShipInfo shipInfo, FleetAccordion accordion)
 {
     if (_draggingShipInfo == null)
     {
         _draggingAccordion = accordion;
         _draggingShipInfo  = shipInfo;
     }
 }
예제 #2
0
 private void ShipInfo_DragEnd(PointerEventData eventData, IEnumerable <ShipInfo> selectedShips, FleetAccordion accordion)
 {
     // if we're currently hovering over a hex, the ship is being placed in that hex
     if (HexGrid.HoverHex != null && IsAllowedFleetShipPlacement(accordion.Fleet, HexGrid.HoverHex.GridPosition))
     {
         foreach (ShipInfo shipInfo in selectedShips)
         {
             // add the ship to the hex hovered on
             _mapData.GetMapNode(HexGrid.HoverHex.GridPosition.x, HexGrid.HoverHex.GridPosition.y).Ships.Add(shipInfo.Ship);
             // remove the ShipInfo from the ShipDisplay
             FleetDisplayArea.RemoveShipInfo(accordion, shipInfo);
             if (HexGrid.SelectedHex != null && HexGrid.HoverHex.GridPosition == HexGrid.SelectedHex.GridPosition)
             {
                 HexContentView.AddShip(shipInfo.Ship);
             }
         }
     }
     _draggingAccordion = null;
     _draggingShipInfo  = null;
 }