Exemplo n.º 1
0
 protected override bool OnMouseClick(InputEventMouse e)
 {
     MenuElement element = ((Views.MenuBarView)Model.GetView()).GetMenuElementUnderMouse();
     if (element != null && element.Action != null)
         element.Action();
     return true;
 }
Exemplo n.º 2
0
 protected override bool OnMouseClick(InputEventMouse e)
 {
     Model.IsChecked = !Model.IsChecked;
     if (Model.OnClickEvent != null)
         Model.OnClickEvent();
     return true;
 }
Exemplo n.º 3
0
 protected override bool OnMouseMove(InputEventMouse e)
 {
     m_MouseLocation = e.Position;
     m_MouseLocation.X -= Model.ScreenArea.X;
     m_MouseLocation.Y -= Model.ScreenArea.Y;
     return true;
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
0
        protected override bool OnMouseDown(InputEventMouse e)
        {
            if (Model.HoverTab != -1)
            {
                Model.SelectedTab = Model.HoverTab;
                return true;
            }

            return false;
        }
Exemplo n.º 6
0
        protected override bool OnMouseMove(InputEventMouse e)
        {
            int index = 0;

            if (View.TabAreas == null)
                return false; // must initialize tabs before we can receive mouse input.

            foreach (Rectangle area in View.TabAreas)
            {
                if (area.Contains(e.Position))
                {
                    Model.HoverTab = index;
                    return true;
                }
                index++;
            }

            Model.HoverTab = -1;
            return false;
        }
Exemplo n.º 7
0
        void onInteractButton(InputEventMouse e)
        {
            AMapObject overObject = (e.EventType == MouseEvent.DragBegin) ? m_dragObject : IsometricRenderer.MouseOverObject;
            Vector2 overObjectOffset = (e.EventType == MouseEvent.DragBegin) ? m_dragOffset : IsometricRenderer.MouseOverObjectPoint;

            if (e.EventType == MouseEvent.Down)
            {
                m_dragObject = overObject;
                m_dragOffset = overObjectOffset;
            }

            if (overObject == null)
                return;

            if (m_Model.Cursor.IsTargeting && e.EventType == MouseEvent.Click)
            {
                // Special case: targeting
                // handled by cursor class.
            }
            else
            {
                // standard interaction actions ...
                if (overObject is MapObjectGround)
                {
                    // we can't interact with ground tiles.
                }
                else if (overObject is MapObjectStatic)
                {
                    // clicking a should pop up the name of the static.
                    if (e.EventType == MouseEvent.Click)
                    {

                    }
                }
                else if (overObject is MapObjectItem)
                {
                    Item item = (Item)overObject.OwnerEntity;
                    // single click = tool tip
                    // double click = use / open
                    // click and drag = pick up
                    switch (e.EventType)
                    {
                        case MouseEvent.Click:
                            // tool tip
                            UltimaInteraction.SingleClick(item);
                            break;
                        case MouseEvent.DoubleClick:
                            UltimaInteraction.DoubleClick(item);
                            break;
                        case MouseEvent.DragBegin:
                            UltimaInteraction.PickupItem(item, new Point((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
                            UltimaInteraction.SingleClick(entity);
                            if (UltimaVars.EngineVars.WarMode)
                                m_Model.Client.Send(new AttackRequestPacket(entity.Serial));
                            else
                                m_Model.Client.Send(new RequestContextMenuPacket(entity.Serial));
                            break;
                        case MouseEvent.DoubleClick:
                            UltimaInteraction.DoubleClick(entity);
                            UltimaVars.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;
        }
Exemplo n.º 8
0
 protected override bool OnMouseUp(InputEventMouse e)
 {
     Model.SetTextCursor(new Point(
         e.X - Model.ScreenArea.X,
         e.Y - Model.ScreenArea.Y));
     return true;
 }
Exemplo n.º 9
0
 protected override bool OnMouseMove(InputEventMouse e)
 {
     if (Model.IsMouseDown)
     {
         Model.SetTextCursor(new Point(
             e.X - Model.ScreenArea.X,
             e.Y - Model.ScreenArea.Y));
     }
     return true;
 }
Exemplo n.º 10
0
 protected override bool OnMouseClick(InputEventMouse e)
 {
     // if (Model.OnClickEvent != null)
     //     Model.OnClickEvent();
     return true;
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
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);
 }
Exemplo n.º 13
0
 protected virtual bool OnMouseDoubleClick(InputEventMouse e)
 {
     return false;
 }
Exemplo n.º 14
0
 private void onMouseWheel(InputEventMouse e)
 {
     addEvent(e);
 }
Exemplo n.º 15
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;
         }
     }
 }
Exemplo n.º 16
0
        void onMoveButton(InputEventMouse e)
        {
            if (e.EventType == MouseEvent.Down)
            {
                // keep moving as long as the move button is down.
                m_ContinuousMoveCheck = true;
            }
            else if (e.EventType == MouseEvent.Up)
            {
                // If the movement mouse button has been released, stop moving.
                m_ContinuousMoveCheck = false;
            }

            e.Handled = true;
        }
Exemplo n.º 17
0
 protected virtual bool OnMouseDragBegin(InputEventMouse e)
 {
     return false;
 }
Exemplo n.º 18
0
 protected override bool OnMouseClick(InputEventMouse e)
 {
     if (Model.Group != null)
         Model.Group.ButtonClicked(Model);
     return base.OnMouseClick(e);
 }
Exemplo n.º 19
0
 protected virtual bool OnWheelScroll(InputEventMouse e)
 {
     return false;
 }
Exemplo n.º 20
0
 protected virtual bool OnMouseUp(InputEventMouse e)
 {
     return false;
 }
Exemplo n.º 21
0
 private void onMouseDown(InputEventMouse e)
 {
     m_LastMouseDown = e;
     m_LastMouseDownTime = m_TheTime;
     addEvent(m_LastMouseDown);
 }
Exemplo n.º 22
0
 protected override bool OnMouseUp(InputEventMouse e)
 {
     m_MouseDown = false;
     return true;
 }
Exemplo n.º 23
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))
         {
             m_LastMouseClickTime = m_TheTime;
             addEvent(new InputEventMouse(MouseEvent.Click, e));
             if ((m_TheTime - m_LastMouseClickTime <= Settings.SecondsForDoubleClick))
             {
                 m_LastMouseClickTime = 0f;
                 addEvent(new InputEventMouse(MouseEvent.DoubleClick, e));
             }
         }
     }
     addEvent(new InputEventMouse(MouseEvent.Up, e));
     m_LastMouseDown = null;
 }
Exemplo n.º 24
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);
 }
Exemplo n.º 25
0
        protected void InformMouseDownElementsThatMouseIsUp(InputEventMouse e)
        {
            if (m_MouseDownElements == null || m_MouseDownElements.Count == 0)
                return;

            List<InputEventMouse> list = new List<InputEventMouse>(1) {e};

            for (int i = 0; i < m_MouseDownElements.Count; i++)
            {
                Tuple<AElement, MouseButton> md = m_MouseDownElements[i];
                if (md.Item2 == e.Button)
                {
                    m_MouseDownElements.RemoveAt(i);
                    i--;
                    ((AElementController)md.Item1.GetController()).ReceiveMouseInput(e.Position, list);
                }
            }
        }
Exemplo n.º 26
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);
 }