Esempio n. 1
0
 protected override void OnMouseUp(EventArgsMouse e)
 {
     addEvent(new InputEventM(MouseEvent.Up, e));
     if (_mouseIsDragging)
     {
         addEvent(new InputEventM(MouseEvent.DragEnd, e));
         _mouseIsDragging = false;
     }
     else
     {
         if (!Utility.IsPointThisDistanceAway(_lastMouseDown.Position, e.Position, MouseClickMaxDelta))
         {
             if ((ClientVars.EngineVars.TheTime - _lastMouseClickTime <= ClientVars.EngineVars.SecondsForDoubleClick))
             {
                 _lastMouseClickTime = 0f;
                 addEvent(new InputEventM(MouseEvent.DoubleClick, e));
             }
             else
             {
                 _lastMouseClickTime = ClientVars.EngineVars.TheTime;
                 addEvent(new InputEventM(MouseEvent.Click, e));
             }
         }
     }
     _lastMouseDown = null;
 }
Esempio n. 2
0
        static void onMoveButton(InputEventM e)
        {
            if (e.EventType == MouseEvent.Down)
            {
                // keep moving as long as the move button is down.
                _ContinuousMoveCheck = true;
            }
            else if (e.EventType == MouseEvent.Up)
            {
                // If the movement mouse button has been released, stop moving.
                _ContinuousMoveCheck = false;
            }

            e.Handled = true;
        }
Esempio n. 3
0
 protected override void OnMouseDown(EventArgsMouse e)
 {
     _lastMouseDown = new InputEventM(MouseEvent.Down, e);
     _lastMouseDownTime = ClientVars.EngineVars.TheTime;
     addEvent(_lastMouseDown);
 }
Esempio n. 4
0
        static void onInteractButton(InputEventM e)
        {
            MapObject overObject = (e.EventType == MouseEvent.DragBegin) ? _dragObject : _world.MouseOverObject;
            Vector2 overObjectOffset = (e.EventType == MouseEvent.DragBegin) ? _dragOffset : _world.MouseOverObjectPoint;

            if (e.EventType == MouseEvent.Down)
            {
                _dragObject = overObject;
                _dragOffset = overObjectOffset;
            }

            if (overObject == null)
                return;

            if (isTargeting && e.EventType == MouseEvent.Click)
            {
                // Special case: targeting
                onTargetingButton(overObject);
            }
            else if (_ui.Cursor.IsHolding && e.EventType == MouseEvent.Up)
            {
                // Special case: if we're holding anything, drop it.
                checkDropItem();
            }
            else
            {
                // standard interaction actions ...
                if (overObject is MapObjectGround)
                {
                    // we can't interact with ground tiles.
                }
                else if (overObject is MapObjectStatic)
                {
                    // clicking a static should pop up the name of the static.
                    if (e.EventType == MouseEvent.Click)
                    {

                    }
                }
                else if (overObject is MapObjectItem)
                {
                    Item entity = (Item)overObject.OwnerEntity;
                    // single click = tool tip
                    // double click = use / open
                    // click and drag = pick up
                    switch (e.EventType)
                    {
                        case MouseEvent.Click:
                            // tool tip
                            Interaction.SingleClick(entity);
                            break;
                        case MouseEvent.DoubleClick:
                            Interaction.DoubleClick(entity);
                            break;
                        case MouseEvent.DragBegin:
                            Interaction.PickUpItem(entity, (int)overObjectOffset.X, (int)overObjectOffset.Y);
                            break;
                    }
                }
                else if (overObject is MapObjectMobile)
                {
                    Mobile entity = (Mobile)overObject.OwnerEntity;
                    // single click = tool tip; if npc = request context sensitive menu
                    // double click = set last target; if is human open paper doll; if ridable ride; if self and riding, dismount;
                    // click and drag = pull off status bar
                    switch (e.EventType)
                    {
                        case MouseEvent.Click:
                            // tool tip
                            Interaction.SingleClick(entity);
                            if (ClientVars.EngineVars.WarMode)
                                UltimaClient.Send(new AttackRequestPacket(entity.Serial));
                            else
                                UltimaClient.Send(new RequestContextMenuPacket(entity.Serial));
                            break;
                        case MouseEvent.DoubleClick:
                            Interaction.DoubleClick(entity);
                            ClientVars.EngineVars.LastTarget = entity.Serial;
                            break;
                        case MouseEvent.DragBegin:
                            // pull off status bar
                            break;
                    }
                }
                else if (overObject is MapObjectCorpse)
                {
                    Corpse entity = (Corpse)overObject.OwnerEntity;
                    // click and drag = nothing
                    // single click = tool tip
                    // double click = open loot window.
                }
                else if (overObject is MapObjectText)
                {
                    // clicking on text should somehow indicate the person speaking.
                }
                else
                {
                    throw new Exception("Unknown object type in onInteractButtonDown()");
                }
            }

            e.Handled = true;
        }