Esempio n. 1
0
 public override bool MouseUp(MouseButtonEventArgs e)
 {
     //If dropped on container add to inventory.
     if (_inventoryContainer.MouseUp(e))
     {
         return(true);
     }
     if (_inventoryContainer.ClientArea.Contains(new Point((int)e.X, (int)e.Y)) &&
         _userInterfaceManager.DragInfo.IsEntity && _userInterfaceManager.DragInfo.IsActive)
     {
         if (!_inventoryComponent.ContainsEntity(_userInterfaceManager.DragInfo.DragEntity))
         {
             _inventoryComponent.SendInventoryAdd(_userInterfaceManager.DragInfo.DragEntity);
             _userInterfaceManager.DragInfo.Reset();
         }
         else
         {
             _userInterfaceManager.DragInfo.Reset();
         }
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        public override bool MouseUp(MouseInputEventArgs e)
        {
            var mouseAABB = new PointF(e.Position.X, e.Position.Y);

            switch (_currentTab)
            {
            case (1):     //Equip tab
            {
                #region Equip

                //Left Side - head, eyes, outer, hands, feet
                if (_slotHead.MouseUp(e))
                {
                    return(true);
                }
                if (_slotEyes.MouseUp(e))
                {
                    return(true);
                }
                if (_slotOuter.MouseUp(e))
                {
                    return(true);
                }
                if (_slotHands.MouseUp(e))
                {
                    return(true);
                }
                if (_slotFeet.MouseUp(e))
                {
                    return(true);
                }

                //Right Side - mask, ears, inner, belt, back
                if (_slotMask.MouseUp(e))
                {
                    return(true);
                }
                if (_slotEars.MouseUp(e))
                {
                    return(true);
                }
                if (_slotInner.MouseUp(e))
                {
                    return(true);
                }
                if (_slotBelt.MouseUp(e))
                {
                    return(true);
                }
                if (_slotBack.MouseUp(e))
                {
                    return(true);
                }

                if (_inventory != null)
                {
                    if (_inventory.MouseUp(e))
                    {
                        return(true);
                    }
                }

                if (_comboBg.AABB.Contains(mouseAABB) && _userInterfaceManager.DragInfo.IsEntity &&
                    _userInterfaceManager.DragInfo.IsActive)
                {
                    //Should be refined to only trigger in the equip area. Equip it if they drop it anywhere on the thing. This might make the slots obsolete if we keep it.
                    if (_playerManager.ControlledEntity == null)
                    {
                        return(false);
                    }

                    Entity entity = _playerManager.ControlledEntity;

                    var equipment = (EquipmentComponent)entity.GetComponent(ComponentFamily.Equipment);
                    equipment.DispatchEquip(_userInterfaceManager.DragInfo.DragEntity.Uid);
                    _userInterfaceManager.DragInfo.Reset();
                    return(true);
                }

                break;

                #endregion
            }

            case (2):     //Health tab
            {
                #region Status

                break;

                #endregion
            }

            case (3):     //Craft tab
            {
                #region Crafting

                if (_craftTimer != null)
                {
                    if (_craftTimer.MouseUp(e))
                    {
                        return(true);
                    }
                }
                if (_craftSlot1.MouseUp(e))
                {
                    if (_craftSlot2.ContainingEntity == _craftSlot1.ContainingEntity)
                    {
                        _craftSlot2.ResetEntity();
                    }
                    return(true);
                }
                if (_craftSlot2.MouseUp(e))
                {
                    if (_craftSlot1.ContainingEntity == _craftSlot2.ContainingEntity)
                    {
                        _craftSlot1.ResetEntity();
                    }
                    return(true);
                }
                if (_craftButton.MouseUp(e))
                {
                    return(true);
                }
                if (_blueprints.MouseUp(e))
                {
                    return(true);
                }
                if (_inventory != null)
                {
                    if (_inventory.MouseUp(e))
                    {
                        return(true);
                    }
                }
                break;

                #endregion
            }
            }

            return(false);
        }