Example #1
0
        private void onMouseUp(InputEventMouse e)
        {
            if (m_MouseIsDragging)
            {
                addEvent(new InputEventMouse(MouseEvent.DragEnd, e));
                m_MouseIsDragging = false;
            }
            else
            {
                if (!DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, MouseClickMaxDelta))
                {
                    addEvent(new InputEventMouse(MouseEvent.Click, e));

                    if ((m_TheTime - m_LastMouseClickTime <= Settings.UserInterface.Mouse.DoubleClickMS) &&
                        !DistanceBetweenPoints(m_LastMouseClick.Position, e.Position, MouseClickMaxDelta))
                    {
                        m_LastMouseClickTime = 0f;
                        addEvent(new InputEventMouse(MouseEvent.DoubleClick, e));
                    }
                    else
                    {
                        m_LastMouseClickTime = m_TheTime;
                        m_LastMouseClick     = e;
                    }
                }
            }
            addEvent(new InputEventMouse(MouseEvent.Up, e));
            m_LastMouseDown = null;
        }
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     EventType   = eventType;
     m_Buttons   = parent.m_Buttons;
     m_Clicks    = parent.m_Clicks;
     X           = parent.X;
     Y           = parent.Y;
     m_MouseData = parent.m_MouseData;
 }
Example #3
0
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     m_eventType = eventType;
     m_button    = parent.m_button;
     m_clicks    = parent.m_clicks;
     m_x         = parent.m_x;
     m_y         = parent.m_y;
     m_mouseData = parent.m_mouseData;
 }
Example #4
0
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     EventType = eventType;
     m_Buttons = parent.m_Buttons;
     m_Clicks = parent.m_Clicks;
     X = parent.X;
     Y = parent.Y;
     m_MouseData = parent.m_MouseData;
 }
Example #5
0
 private void onMouseMove(InputEventMouse e)
 {
     addEvent(new InputEventMouse(MouseEvent.Move, e));
     if (!m_MouseIsDragging && m_LastMouseDown != null)
     {
         if (DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, MouseDragBeginDistance))
         {
             addEvent(new InputEventMouse(MouseEvent.DragBegin, e));
             m_MouseIsDragging = true;
         }
     }
 }
Example #6
0
 public bool HandleMouseEvent(MouseEvent type, MouseButton mb)
 {
     foreach (InputEvent e in m_EventsThisFrame)
     {
         if (!e.Handled && e is InputEventMouse)
         {
             InputEventMouse em = (InputEventMouse)e;
             if (em.EventType == type && em.Button == mb)
             {
                 e.Handled = true;
                 return(true);
             }
         }
     }
     return(false);
 }
Example #7
0
 /// <summary>
 /// Raises the MouseWheel event. Override this method to add code to handle when a mouse wheel is turned
 /// </summary>
 /// <param name="e">InputEventCM for the MouseWheel event</param>
 private void invokeMouseWheel(InputEventMouse e)
 {
     if (MouseWheel != null)
         MouseWheel(e);
 }
Example #8
0
 private void ClearQueuedClick()
 {
     m_QueuedEvent_InQueue = false;
     m_QueuedEvent = null;
     m_QueuedEntity = null;
 }
Example #9
0
 private void onMouseDown(InputEventMouse e)
 {
     m_LastMouseDown     = e;
     m_LastMouseDownTime = m_TheTime;
     addEvent(m_LastMouseDown);
 }
Example #10
0
 private void onMouseWheel(InputEventMouse e)
 {
     addEvent(e);
 }
Example #11
0
        private void onMouseUp(InputEventMouse e)
        {
            if(m_MouseIsDragging)
            {
                addEvent(new InputEventMouse(MouseEvent.DragEnd, e));
                m_MouseIsDragging = false;
            }
            else
            {
                if(!DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, MouseClickMaxDelta))
                {
                    addEvent(new InputEventMouse(MouseEvent.Click, e));

                    if((m_TheTime - m_LastMouseClickTime <= Settings.World.Mouse.DoubleClickMS) &&
                       !DistanceBetweenPoints(m_LastMouseClick.Position, e.Position, MouseClickMaxDelta))
                    {
                        m_LastMouseClickTime = 0f;
                        addEvent(new InputEventMouse(MouseEvent.DoubleClick, e));
                    }
                    else
                    {
                        m_LastMouseClickTime = m_TheTime;
                        m_LastMouseClick = e;
                    }
                }
            }
            addEvent(new InputEventMouse(MouseEvent.Up, e));
            m_LastMouseDown = null;
        }
Example #12
0
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     m_eventType = eventType;
     m_button = parent.m_button;
     m_clicks = parent.m_clicks;
     m_x = parent.m_x;
     m_y = parent.m_y;
     m_mouseData = parent.m_mouseData;
 }
Example #13
0
 /// <summary>
 /// Raises the MouseUp event. Override this method to add code to handle when a mouse button is released
 /// </summary>
 /// <param name="e">InputEventCM for the MouseUp event</param>
 private void invokeMouseUp(InputEventMouse e)
 {
     MouseUp?.Invoke(e);
 }
Example #14
0
 private void onMouseDown(InputEventMouse e)
 {
     m_LastMouseDown = e;
     m_LastMouseDownTime = m_TheTime;
     addEvent(m_LastMouseDown);
 }
Example #15
0
 /// <summary>
 /// Raises the MouseDown event. Override this method to add code to handle when a mouse button is pressed
 /// </summary>
 /// <param name="e">InputEventCM for the MouseDown event</param>
 private void invokeMouseDown(InputEventMouse e)
 {
     MouseDown?.Invoke(e);
 }
Example #16
0
 private void InternalQueueSingleClick(InputEventMouse e, AEntity overEntity, Vector2 overEntityPoint)
 {
     m_QueuedEvent_InQueue = true;
     m_QueuedEntity = overEntity;
     m_QueuedEntityPosition = overEntityPoint;
     m_QueuedEvent_DequeueAt = Settings.UserInterface.Mouse.DoubleClickMS;
     m_QueuedEvent = e;
 }
Example #17
0
 void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }
Example #18
0
        private void onMoveButton(InputEventMouse e)
        {
            if(e.EventType == MouseEvent.Down)
            {
                // keep moving as long as the move button is down.
                ContinuousMouseMovementCheck = true;
            }
            else if(e.EventType == MouseEvent.Up)
            {
                // If the movement mouse button has been released, stop moving.
                ContinuousMouseMovementCheck = false;
            }

            e.Handled = true;
        }
Example #19
0
        private void onInteractButton(InputEventMouse e, AEntity overEntity, Vector2 overEntityPoint)
        {
            if(e.EventType == MouseEvent.Down)
            {
                // prepare to pick this item up.
                m_DraggingEntity = overEntity;
                m_dragOffset = overEntityPoint;
            }
            else if(e.EventType == MouseEvent.Click)
            {
                if(overEntity is Ground)
                {
                    // no action.
                }
                else if(overEntity is StaticItem)
                {
                    // pop up name of item.
                    overEntity.AddOverhead(MessageTypes.Label, overEntity.Name, 3, 0, false);
                    WorldModel.Statics.AddStaticThatNeedsUpdating(overEntity as StaticItem);
                }
                else if(overEntity is Item)
                {
                    // request context menu
                    World.Interaction.SingleClick(overEntity);
                }
                else if(overEntity is Mobile)
                {
                    // request context menu
                    World.Interaction.SingleClick(overEntity);
                }
            }
            else if(e.EventType == MouseEvent.DoubleClick)
            {
                if(overEntity is Ground)
                {
                    // no action.
                }
                else if(overEntity is StaticItem)
                {
                    // no action.
                }
                else if(overEntity is Item)
                {
                    // request context menu
                    World.Interaction.DoubleClick(overEntity);
                }
                else if(overEntity is Mobile)
                {
                    // Send double click packet.
                    // Set LastTarget == targeted Mobile.
                    // If in WarMode, set Attacking == true.
                    World.Interaction.DoubleClick(overEntity);
                    World.Interaction.LastTarget = overEntity.Serial;

                    if (WorldModel.Entities.GetPlayerEntity().Flags.IsWarMode)
                    {
                        m_Network.Send(new AttackRequestPacket(overEntity.Serial));
                    }
                }
            }
            else if(e.EventType == MouseEvent.DragBegin)
            {
                if(overEntity is Ground)
                {
                    // no action.
                }
                else if(overEntity is StaticItem)
                {
                    // no action.
                }
                else if(overEntity is Item)
                {
                    // attempt to pick up item.
                    World.Interaction.PickupItem((Item)overEntity, new Point((int)m_dragOffset.X, (int)m_dragOffset.Y));
                }
                else if(overEntity is Mobile)
                {
                    // request basic stats - gives us the name rename flag
                    m_Network.Send(new MobileQueryPacket(MobileQueryPacket.StatusType.BasicStatus, overEntity.Serial));
                    // drag off a status gump for this mobile.
                    MobileHealthTrackerGump gump = new MobileHealthTrackerGump(overEntity as Mobile);
                    m_UserInterface.AddControl(gump, e.X - 77, e.Y - 30);
                    m_UserInterface.AttemptDragControl(gump, new Point(e.X, e.Y), true);
                }
            }

            e.Handled = true;
        }
Example #20
0
 /// <summary>
 /// Raises the MouseMove event. Override this method to add code to handle when the mouse is moved
 /// </summary>
 /// <param name="e">InputEventCM for the MouseMove event</param>
 private void invokeMouseMove(InputEventMouse e)
 {
     MouseMove?.Invoke(e);
 }
Example #21
0
 /// <summary>
 /// Raises the MouseMove event. Override this method to add code to handle when the mouse is moved
 /// </summary>
 /// <param name="e">InputEventCM for the MouseMove event</param>
 private void invokeMouseMove(InputEventMouse e)
 {
     if (MouseMove != null)
         MouseMove(e);
 }
Example #22
0
 /// <summary>
 /// Raises the MouseWheel event. Override this method to add code to handle when a mouse wheel is turned
 /// </summary>
 /// <param name="e">InputEventCM for the MouseWheel event</param>
 private void invokeMouseWheel(InputEventMouse e)
 {
     MouseWheel?.Invoke(e);
 }
Example #23
0
 /// <summary>
 /// Raises the MouseDown event. Override this method to add code to handle when a mouse button is pressed
 /// </summary>
 /// <param name="e">InputEventCM for the MouseDown event</param>
 private void invokeMouseDown(InputEventMouse e)
 {
     if (MouseDown != null)
         MouseDown(e);
 }
Example #24
0
 private void onMouseMove(InputEventMouse e)
 {
     addEvent(new InputEventMouse(MouseEvent.Move, e));
     if(!m_MouseIsDragging && m_LastMouseDown != null)
     {
         if(DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, MouseDragBeginDistance))
         {
             addEvent(new InputEventMouse(MouseEvent.DragBegin, e));
             m_MouseIsDragging = true;
         }
     }
 }
Example #25
0
 /// <summary>
 /// Raises the MouseUp event. Override this method to add code to handle when a mouse button is released
 /// </summary>
 /// <param name="e">InputEventCM for the MouseUp event</param>
 private void invokeMouseUp(InputEventMouse e)
 {
     if (MouseUp != null)
         MouseUp(e);
 }
Example #26
0
 private void onMouseWheel(InputEventMouse e)
 {
     addEvent(e);
 }
Example #27
0
 void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown     = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }