Exemple #1
0
        public void Tick()
        {
            if (Input.GetMouseButtonDown(MouseButtonIndex))
            {
                ButtonDown?.Invoke(ScreenToWorld(Input.mousePosition));
            }

            if (Input.GetMouseButton(MouseButtonIndex))
            {
                ButtonHold?.Invoke(ScreenToWorld(Input.mousePosition));
            }

            if (Input.GetMouseButtonUp(MouseButtonIndex))
            {
                ButtonUp?.Invoke(ScreenToWorld(Input.mousePosition));
            }
        }
Exemple #2
0
 public void Initialize()
 {
     buttons.Add(new MouseButton(
                     () => mouseCore.LeftButton,
                     () => ButtonPress?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Left)),
                     () => ButtonHold?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Left)),
                     () => ButtonLift?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Left))));
     buttons.Add(new MouseButton(
                     () => mouseCore.MiddleButton,
                     () => ButtonPress?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Middle)),
                     () => ButtonHold?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Middle)),
                     () => ButtonLift?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Middle))));
     buttons.Add(new MouseButton(
                     () => mouseCore.RightButton,
                     () => ButtonPress?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Right)),
                     () => ButtonHold?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Right)),
                     () => ButtonLift?.Invoke(this, new MouseButtonInteraction(X, Y, Input.MouseButton.Right))));
 }
Exemple #3
0
        public void Tick()
        {
            var touch = Input.GetTouch(TouchIndex);

            if (touch.phase == TouchPhase.Began)
            {
                ButtonDown?.Invoke(ScreenToWorld(touch.position));
            }

            if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary)
            {
                ButtonHold?.Invoke(ScreenToWorld(touch.position));
            }

            if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
            {
                ButtonUp?.Invoke(ScreenToWorld(Input.mousePosition));
            }
        }
Exemple #4
0
 protected override void OnHold(InputState istate, float holdTime)
 {
     ButtonHold?.Invoke(this, new HUDButtonEventArgs(HUDButtonEventType.Hold));
 }