Beispiel #1
0
 protected internal override void MouseClick(InputEventMouse e)
 {
     if (getAreaFromMouse(e.Position) == BarArea.None && (Children == null || Children.Count <Widget>() == 0))
     {
         Parent.MouseClick(e);
     }
 }
Beispiel #2
0
 protected internal override void MouseMove(InputEventMouse e)
 {
     if (e.Button != MouseButton.None)
     {
         RenderRule.Select(e.Position);
     }
 }
Beispiel #3
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);
     }
 }
Beispiel #4
0
        private void Metatile_OnClick(Widget widget, InputEventMouse e)
        {
            Sprite sprite = State.Data.Sprites[State.SelectedSprite];

            if (sprite != null)
            {
                MetaTile             metatile = (MetaTile)widget;
                Sprite.FrameTypeEnum frametype;
                if (metatile.Index >= 0x200)
                {
                    frametype = Sprite.FrameTypeEnum.Extra;
                }
                else if (metatile.Index >= 0x100)
                {
                    frametype = Sprite.FrameTypeEnum.Extended;
                }
                else
                {
                    frametype = Sprite.FrameTypeEnum.Standard;
                }
                SpriteMetaTileFrame tile = sprite.GetMetaTileFrame(frametype, metatile.Index & 0xFF)[metatile.ClickedTile];
                if (e.Button == MouseButton.Left)
                {
                    tile.Tile     = (byte)State.SelectedTile;
                    tile.TilePage = (byte)(State.SelectedPage);
                    metatile.SetTile(metatile.ClickedTile, tile.Tile, State.GfxPage(tile.TilePage).Texture);
                }
                else if (e.Button == MouseButton.Right)
                {
                    tile.Flip();
                    metatile.SetTileFlip(metatile.ClickedTile, tile.FlipH, tile.FlipV);
                }
                refreshSpriteDataDisplay();
            }
        }
Beispiel #5
0
        /*####################################################################*/
        /*                                Events                              */
        /*####################################################################*/

        protected internal override void MouseClick(InputEventMouse e)
        {
            if (ClickEvent != null)
            {
                ClickEvent(this);
            }
        }
Beispiel #6
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);
     }
 }
Beispiel #7
0
    public void _onSelectionMarkerInputEvent(Viewport viewport, InputEventMouse inputEvent, int shapeIdx)
    {
        if (!inputEvent.IsPressed())
        {
            return;
        }
        if (inputEvent.GetType() != typeof(InputEventMouseButton))
        {
            return;
        }

        InputEventMouseButton inputEventMouseButton = inputEvent as InputEventMouseButton;

        Mob ownerMob = GetParentMob();

        switch (inputEventMouseButton.ButtonIndex)
        {
        case 1:
            EmitSignal(nameof(LeftClick), ownerMob);
            break;

        case 2:
            EmitSignal(nameof(RightClick), ownerMob);
            break;
        }
    }
Beispiel #8
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);
     }
 }
Beispiel #9
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);
     }
 }
 protected internal override void MouseDown(InputEventMouse e)
 {
     if (m_OnClick != null)
     {
         m_OnClick(this);
     }
 }
Beispiel #11
0
 private void tiles_OnMouseMove(Elements.TileGfxTile tile, InputEventMouse e, int pixel)
 {
     if (tile.TileX == 0 && tile.TileY == 0)
     {
         tiles_OnClick(tile, e, pixel);
     }
 }
Beispiel #12
0
 protected internal override void MouseMove(InputEventMouse e)
 {
     if (e.Button == MouseButton.Left)
     {
         MouseDown(e);
     }
 }
Beispiel #13
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))
         {
             if ((m_TheTime - m_LastMouseClickTime <= Settings.SecondsForDoubleClick))
             {
                 m_LastMouseClickTime = 0f;
                 addEvent(new InputEventMouse(MouseEvent.DoubleClick, e));
             }
             else
             {
                 m_LastMouseClickTime = m_TheTime;
                 addEvent(new InputEventMouse(MouseEvent.Click, e));
             }
         }
     }
     addEvent(new InputEventMouse(MouseEvent.Up, e));
     m_LastMouseDown = null;
 }
Beispiel #14
0
 void InternalQueueSingleClick(InputEventMouse e, AEntity overEntity, Vector2Int overEntityPoint)
 {
     _queuedEvent_InQueue   = true;
     _queuedEntity          = overEntity;
     _queuedEntityPosition  = overEntityPoint;
     _queuedEvent_DequeueAt = UltimaGameSettings.UserInterface.Mouse.DoubleClickMS;
     _queuedEvent           = e;
 }
Beispiel #15
0
 private void InternalQueueSingleClick(InputEventMouse e, AEntity overEntity, Vector2 overEntityPoint)
 {
     m_QueuedEvent_InQueue   = true;
     m_QueuedEntity          = overEntity;
     m_QueuedEntityPosition  = overEntityPoint;
     m_QueuedEvent_DequeueAt = EngineVars.DoubleClickMS;
     m_QueuedEvent           = e;
 }
Beispiel #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;
 }
Beispiel #17
0
        protected internal override void MouseDown(InputEventMouse e)
        {
            m_ClickedTile = getTileIndexFromPoint(e.Position);

            if (OnClick != null)
            {
                OnClick(this, e);
            }
        }
Beispiel #18
0
        protected internal override void MouseClick(InputEventMouse e)
        {
            MenuElement element = RenderRule.ElementFromMouseCoordinates();

            if (element != null && element.Action != null)
            {
                element.Action(this);
            }
        }
Beispiel #19
0
        protected internal override void MouseDown(InputEventMouse e)
        {
            int selected = ((e.Position.X - RenderRule.Area.X) / 16) + ((e.Position.Y - RenderRule.Area.Y) / 16) * 16;

            if (m_OnClickHandler != null)
            {
                m_OnClickHandler(m_PageIndex, selected);
            }
        }
Beispiel #20
0
        public void Input_PlaceTower(InputEvent @event)
        {
            if (@event is InputEventMouse)
            {
                InputEventMouse mouseEvent = (InputEventMouse)@event;
                var             ray        = new MouseRay(camera, mouseEvent.GlobalPosition);
                Vector3?        pos        = ray.PositionOnPlane(new Plane(new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)));
                if (mouseEvent.ButtonMask == 1 && lastButtonMask == 0)
                {
                    if (GUITools.IsPointOnGUI(world.GetNode(new NodePath("GUI")), mouseEvent.GlobalPosition))
                    {
                        return;
                    }
                    if (pos.HasValue && pos.Value.x > 0 && pos.Value.z > 0)
                    {
                        Vector2 gPos = new Vector2(pos.Value.x, pos.Value.z);
                        gPos.x = (int)(gPos.x);
                        gPos.y = (int)(gPos.y);
                        if (Grid[(int)gPos.x, (int)gPos.y].CanPlaceOn)
                        {
                            Tile tile = (Tile)sceneTower.Instance();
                            SetTile(tile, (int)gPos.x, (int)gPos.y);
                            pathUpdaterGround.Update(GetGrid(MovementLayer.Ground), endPoints);
                        }
                    }
                }

                if (pos.HasValue)
                {
                    Vector3 iPos = new Vector3(
                        ((int)pos.Value.x),
                        ((int)pos.Value.y),
                        ((int)pos.Value.z));
                    glowTile.Translation  = iPos;
                    placeTile.Translation = iPos;
                    if (iPos.x < 0 || iPos.z < 0 || iPos.x >= Width || iPos.z >= Height)
                    {
                        glowTile.Visible = false;
                    }
                    else
                    {
                        glowTile.Visible = true;
                        Tile t = Grid[(int)iPos.x, (int)iPos.z];
                        if (t.CanPlaceOn)
                        {
                            glowTile.Call("blue");
                        }
                        else
                        {
                            glowTile.Call("red");
                        }
                    }
                }

                lastButtonMask = mouseEvent.ButtonMask;
            }
        }
Beispiel #21
0
        /*####################################################################*/
        /*                                Events                              */
        /*####################################################################*/

        protected internal override void MouseDown(InputEventMouse e)
        {
            if (!RenderRule.GripArea.Contains(e.Position))
            {
                return;
            }

            _travelStart = RenderRule.Travel;
            Pin.Push();
        }
Beispiel #22
0
 protected internal override void MouseUp(InputEventMouse e)
 {
     _isPressed = false;
     lock (RenderRule) {
         RenderRule.SetTextCursor(
             new Point(
                 e.Position.X - RenderRule.Area.X,
                 e.Position.Y - RenderRule.Area.Y));
     }
 }
Beispiel #23
0
        // ================================================================================
        // Input
        // ================================================================================

        protected internal override void MouseClick(InputEventMouse e)
        {
            if (e.Button == MouseButton.Left)
            {
                int index = RenderRule.ItemAtPosition(new Point(e.Position.X, e.Position.Y));
                if (index >= 0 && index < m_Items.Count)
                {
                    SelectedIndex = index;
                }
            }
        }
Beispiel #24
0
        protected internal override void MouseDown(InputEventMouse e)
        {
            int pixel = ((e.Position.X - RenderRule.Area.X) / m_PixelScale) + ((e.Position.Y - RenderRule.Area.Y) / m_PixelScale) * 8;
            int x     = ((e.Position.X - RenderRule.Area.X) / m_PixelScale);
            int y     = ((e.Position.Y - RenderRule.Area.Y) / m_PixelScale);

            if (x < 0 || x >= 8 || y < 0 || y >= 8)
            {
                return;
            }
            m_OnClick(this, e, x + y * 8);
        }
Beispiel #25
0
        protected internal override void MouseMove(InputEventMouse e)
        {
            if (m_SelectType != SelectType.None)
            {
                m_HoverTile = getTileIndexFromPoint(e.Position);
            }

            if (e.Button == MouseButton.Left && getTileIndexFromPoint(e.Position) != m_ClickedTile)
            {
                MouseDown(e);
            }
        }
Beispiel #26
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;
         }
     }
 }
Beispiel #27
0
        /*####################################################################*/
        /*                                Events                              */
        /*####################################################################*/

        protected internal override void MouseClick(InputEventMouse e)
        {
            IsToggled = !IsToggled;
            if (!IsToggled)
            {
                RenderRule.Mode = IsHover
                    ? ButtonRenderRule.RenderMode.Hover
                    : ButtonRenderRule.RenderMode.Default;
            }
            else
            {
                RenderRule.Mode = ButtonRenderRule.RenderMode.Pressed;
            }
        }
Beispiel #28
0
 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;
 }
Beispiel #29
0
        protected internal override void MouseMove(InputEventMouse e)
        {
            if (!_isPressed)
            {
                return;
            }

            lock (RenderRule) {
                RenderRule.SetTextCursor(
                    new Point(
                        e.Position.X - RenderRule.Area.X,
                        e.Position.Y - RenderRule.Area.Y));
            }
        }
Beispiel #30
0
 private void ctlChunk_OnClick(Widget widget, InputEventMouse e)
 {
     if (e.Button == MouseButton.Left)
     {
         int tile = ((Elements.ChunkElement)widget).ClickedTile;
         loadChunkTile(tile, State.SelectedMetatile);
     }
     else if (e.Button == MouseButton.Right)
     {
         int index = ((Elements.ChunkElement)widget).ClickedTile;
         int tile  = State.Data.Chunks[State.SelectedChunk][index];
         State.SelectedMetatile = aioTileset.SelectedTile = tile;
     }
 }
Beispiel #31
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;
        }
Beispiel #32
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, "<outline>" + overEntity.Name, 0, 0);
                    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)
                {
                    // 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;
        }
Beispiel #33
0
 private void InternalQueueSingleClick(InputEventMouse e, AEntity overEntity, Vector2 overEntityPoint)
 {
     m_QueuedEvent_InQueue = true;
     m_QueuedEntity = overEntity;
     m_QueuedEntityPosition = overEntityPoint;
     m_QueuedEvent_DequeueAt = Settings.World.Mouse.DoubleClickMS;
     m_QueuedEvent = e;
 }
Beispiel #34
0
 private void ClearQueuedClick()
 {
     m_QueuedEvent_InQueue = false;
     m_QueuedEvent = null;
     m_QueuedEntity = null;
 }
Beispiel #35
0
 private void onMouseWheel(InputEventMouse e)
 {
     addEvent(e);
 }
Beispiel #36
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;
        }
Beispiel #37
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;
         }
     }
 }
Beispiel #38
0
 private void onMouseDown(InputEventMouse e)
 {
     m_LastMouseDown = e;
     m_LastMouseDownTime = m_TheTime;
     addEvent(m_LastMouseDown);
 }