Ejemplo n.º 1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject(-1))
        {
            if (LeftClick != null)
            {
                LeftClick.Invoke(this, EventArgs.Empty);
            }
            else
            {
            }
        }

        if (Input.GetMouseButtonDown(1) && !EventSystem.current.IsPointerOverGameObject(-1))
        {
            if (RightClick != null)
            {
                RightClick.Invoke(this, EventArgs.Empty);
            }
            else
            {
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            CancelClick?.Invoke(this, EventArgs.Empty);
        }
    }
Ejemplo n.º 2
0
 public static void OnLeftClick()
 {
     if (LeftClick != null)
     {
         LeftClick.Invoke();
     }
 }
 private void Mouse0Input()
 {
     if (Input.GetKeyDown(KeyCode.Mouse0))
     {
         LeftClick?.Invoke();
     }
 }
Ejemplo n.º 4
0
        private void CheckLeftClick()
        {
            if (LeftClick != null)
            {
                double  down    = 0;
                double  up      = 0;
                Point3D highest = list[0];
                Point3D lowest  = list[0];

                bool clicked = false;
                foreach (Point3D point in list)
                {
                    double isLowest = CheckPoint(point, highest);
                    double backHigh = CheckPoint(point, lowest);

                    if (isLowest == 0)
                    {
                        highest = point;
                        lowest  = point;
                        up      = 0;
                        down    = 0;
                        continue;
                    }

                    if (down <= MinDepth && (isLowest == 0 && backHigh == 0))
                    {
                        highest = point;
                        lowest  = point;
                        up      = 0;
                        down    = 0;
                        continue;
                    }

                    if (isLowest < 0 && isLowest < down)
                    {
                        down   = isLowest;
                        lowest = point;
                    }

                    if (down <= MinDepth && backHigh > 0 && backHigh > up)
                    {
                        up = backHigh;
                    }

                    if (up >= MaxDepth)
                    {
                        clicked = true;
                        break;
                    }
                }

                if (clicked)
                {
                    clickWait = SingleClickWaitCount;
                    LeftClick.Invoke();
                }
            }
        }
Ejemplo n.º 5
0
 private void MessageSink_MouseEventReceived(MouseEvent obj)
 {
     if (obj == MouseEvent.IconLeftMouseUp)
     {
         LeftClick?.Invoke();
     }
     else if (obj == MouseEvent.IconRightMouseUp)
     {
         RightClick?.Invoke();
     }
 }
Ejemplo n.º 6
0
        public override void Update(double dt)
        {
            PrevKeyboard    = CurrentKeyboard;
            CurrentKeyboard = Keyboard.GetState();

            PrevMouse    = CurrentMouse;
            CurrentMouse = Mouse.GetState();

            bool isOverUI = IsOverUI();

            if (CurrentMouse.LeftButton == ButtonState.Pressed)
            {
                if (LeftButtonDown != null && !isOverUI)
                {
                    LeftButtonDown.Invoke(new InputEventArgs(this));
                }
            }

            if (CurrentMouse.RightButton == ButtonState.Pressed)
            {
                if (RightButtonDown != null && !isOverUI)
                {
                    RightButtonDown.Invoke(new InputEventArgs(this));
                }
            }

            if (CurrentMouse.LeftButton == ButtonState.Pressed && PrevMouse.LeftButton == ButtonState.Released)
            {
                if (LeftClick != null && !isOverUI)
                {
                    LeftClick.Invoke(new InputEventArgs(this));
                }
            }

            if (CurrentMouse.RightButton == ButtonState.Pressed && PrevMouse.RightButton == ButtonState.Released)
            {
                if (RightClick != null && !isOverUI)
                {
                    RightClick.Invoke(new InputEventArgs(this));
                }
            }

            foreach (KeyListener listener in _listeners)
            {
                if (CurrentKeyboard.IsKeyDown(listener.Primary) && (listener.Continuous || !PrevKeyboard.IsKeyDown(listener.Primary)))
                {
                    listener.Trigger(listener.Primary, this);
                }
                else if (CurrentKeyboard.IsKeyDown(listener.Alternate) && (listener.Continuous || !PrevKeyboard.IsKeyDown(listener.Alternate)))
                {
                    listener.Trigger(listener.Alternate, this);
                }
            }
        }
Ejemplo n.º 7
0
    public void OnPointerDown(PointerEventData eventData)
    {
        firstMousePos = eventData.position.y;
        if (Input.GetMouseButtonDown(0))
        {
            LeftClick?.Invoke(eventData);
        }

        if (Input.GetMouseButtonDown(1))
        {
            RightClick?.Invoke(eventData);
        }
    }
Ejemplo n.º 8
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            clickFinished = DateTime.Now;
            IsDown        = false;

            ClickEventArgs args = new ClickEventArgs(
                new System.Windows.Point(e.Location.X, e.Location.Y),
                new System.Windows.Duration(clickFinished - clickStarted)
                );

            if (isHover)
            {
                LeftClick?.Invoke(this, args);
            }

            Refresh();
        }
Ejemplo n.º 9
0
        public void OnPointerClick(PointerEventData eventData)
        {
            Debug.Log(eventData.button);
            switch (eventData.button)
            {
            case PointerEventData.InputButton.Left:
                LeftClick?.Invoke();
                break;

            case PointerEventData.InputButton.Middle:
                MiddleClick?.Invoke();
                break;

            case PointerEventData.InputButton.Right:
                RightClick?.Invoke();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 private void LeftButton_Click(object sender, RoutedEventArgs e)
 {
     DismissWindow();
     LeftClick?.Invoke(this, e);
 }
Ejemplo n.º 11
0
 public static void Postfix(int x, int y, CoopMenu __instance)
 {
     LeftClick?.Invoke(__instance, x, y);
 }
Ejemplo n.º 12
0
 private void btn_Update_Click(object sender, RoutedEventArgs e)
 {
     LeftClick.Invoke(this, e);
 }
Ejemplo n.º 13
0
 private void btnLeft_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
 {
     DismissWindow();
     LeftClick?.Invoke(this, e);
 }