Ejemplo n.º 1
0
        public static _View HitTestOutsideFrame(
            this _View thisView
            , CGPoint point
#if __IOS__
            , _Event uievent
#endif
            )
        {
            // All touches that are on this view (and not its subviews) are ignored
            if (!thisView.Hidden && thisView.GetNativeAlpha() > 0)
            {
                foreach (var subview in thisView.Subviews.Safe().Reverse())
                {
                    var subPoint = subview.ConvertPointFromView(point, thisView);
#if __IOS__
                    var result = subview.HitTest(subPoint, uievent);
#elif __MACOS__
                    var result = subview.HitTest(subPoint);
#endif
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static bool IsTouchInView(this _Event evt, _View view)
        {
#if __MACOS__
            var screenLocation = _Application.SharedApplication.KeyWindow.ContentView.ConvertPointFromView(evt.LocationInWindow, null);

            var window = _Application.SharedApplication.KeyWindow;
            var bounds = GetBounds(window, view);

            return(screenLocation.X >= bounds.X &&
                   screenLocation.Y >= bounds.Y &&
                   screenLocation.X < bounds.Right &&
                   screenLocation.Y < bounds.Bottom);
#else
            var touch = evt?.AllTouches?.AnyObject as _Touch;

            if (touch == null)
            {
                return(false);
            }
            else
            {
                var window         = _Application.SharedApplication.KeyWindow;
                var screenLocation = touch.LocationInView(window);

                var bounds = GetBounds(window, view);

                return(screenLocation.X >= bounds.X &&
                       screenLocation.Y >= bounds.Y &&
                       screenLocation.X < bounds.Right &&
                       screenLocation.Y < bounds.Bottom);
            }
#endif
        }
Ejemplo n.º 3
0
        public override void TouchesBegan(Foundation.NSSet touches, UIKit.UIEvent evt)
        {
            swiped = false;
            UITouch touch = touches.AnyObject as UITouch;

            lastPoint = touch.LocationInView(this);
        }
Ejemplo n.º 4
0
 public override void TouchesMoved(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     if (this.Element is FrameApp)
     {
         (this.Self as UIKit.UIView).BackgroundColor = (this.Element as FrameApp).TouchBackgroundColor.ToUIColor();
     }
     base.TouchesMoved(touches, evt);
 }
Ejemplo n.º 5
0
 public override void TouchesCancelled(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     base.TouchesCancelled(touches, evt);
     if (ImageTouch != null)
     {
         ImageTouch.RaiseOnTouch(false);
     }
 }
Ejemplo n.º 6
0
 public override void TouchesBegan(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     base.TouchesBegan(touches, evt);
     if (ImageTouch != null)
     {
         ImageTouch.RaiseOnTouch(true);
     }
 }
Ejemplo n.º 7
0
        public override void TouchesEnded(Foundation.NSSet touches, UIKit.UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            if (base.Element != null)
            {
                ((PressedView)base.Element).SetPressed(false);
            }
        }
Ejemplo n.º 8
0
        public override void TouchesEnded(NSSet touches, UIKit.UIEvent evt)
        {
            base.TouchesEnded(touches, evt);
            UITouch touch = (UITouch)touches.AnyObject;

            if (touch != null)
            {
                window.TouchEnded((float)touch.LocationInView(view).X, (float)touch.LocationInView(view).Y);
            }
        }
Ejemplo n.º 9
0
 public override void MotionEnded(UIKit.UIEventSubtype motion, UIKit.UIEvent evt)
 {
     if (motion == UIEventSubtype.MotionShake)
     {
         BITHockeyManager.SharedHockeyManager.FeedbackManager.RequireUserEmail = BITFeedbackUserDataElement.DontShow;
         BITHockeyManager.SharedHockeyManager.FeedbackManager.RequireUserName  = BITFeedbackUserDataElement.DontShow;
         BITHockeyManager.SharedHockeyManager.FeedbackManager.ShowFeedbackComposeViewWithGeneratedScreenshot();
     }
     base.MotionEnded(motion, evt);
 }
Ejemplo n.º 10
0
 public override void TouchesBegan(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     if (this.Element is FrameApp)
     {
         UITouch touch    = touches.AnyObject as UITouch;
         var     location = touch.LocationInView(this.Self as UIKit.UIView);
         (this.Self as UIKit.UIView).BackgroundColor = (this.Element as FrameApp).TouchBackgroundColor.ToUIColor();
     }
     base.TouchesBegan(touches, evt);
 }
Ejemplo n.º 11
0
        public override void TouchesMoved(NSSet touches, UIKit.UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            UITouch touch = touches.AnyObject as UITouch;

            if (touch != null)
            {
                CGPoint p = touch.LocationInView(touch.View);

                m_Canvas.Input_MouseMoved((int)p.X, (int)p.Y, 0, 0);
            }
        }
Ejemplo n.º 12
0
        public override void TouchesEnded(NSSet touches, UIKit.UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            UITouch touch = touches.AnyObject as UITouch;

            if (touch != null)
            {
                m_Canvas.Input_MouseButton(0, false);

                // Cause mouse leave event
                m_Canvas.Input_MouseMoved(int.MaxValue, int.MaxValue, 0, 0);
            }

            ProcessKeyboard();
        }
Ejemplo n.º 13
0
        internal void TouchesBegan(Foundation.NSSet touches, UIKit.UIEvent e, GameWindow window)
        {
            // Reset State
            //Reset();

            // Check where is the touch
            UITouch [] touchesArray = touches.ToArray <UITouch>();
            foreach (UITouch touch in touchesArray)
            {
                Vector2 location = new Vector2(touch.LocationInView(touch.View));
                location = window.GetOffsetPosition(location, false);
                // Check where is the touch
                bool hitInButton = false;

                if (Visible)
                {
                    foreach (ButtonDefinition button in _buttonsDefinitions)
                    {
                        hitInButton |= UpdateButton(button, location);
                        UpdateTouch(touch, button);
                    }
                }
                if (!hitInButton)
                {
                    // check the left thumbstick
                    if (Visible && (_leftThumbDefinition != null) && (CheckThumbStickHit(_leftThumbDefinition, location)))
                    {
                        _leftThumbDefinition.InitialHit = location;
                        UpdateTouch(touch, _leftThumbDefinition);
                    }
                    else
                    {
                        // check the right thumbstick
                        if (Visible && (_rightThumbDefinition != null) && (CheckThumbStickHit(_rightThumbDefinition, location)))
                        {
                            _rightThumbDefinition.InitialHit = location;
                            UpdateTouch(touch, _rightThumbDefinition);
                        }
                        else                                 // Handle mouse
                        {
                            Mouse.State.X = (int)location.X;
                            Mouse.State.Y = (int)location.Y;
                        }
                    }
                }
            }
        }
 public override void TouchesCancelled(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     if (base.Element != null)
     {
         UIView.Animate(0.25,
                        animation: async() =>
         {
             await base.Element.ScaleTo(1, 100);
         },
                        completion: () => {
             base.TouchesCancelled(touches, evt);
         }
                        );
     }
     else
     {
         base.TouchesCancelled(touches, evt);
     }
 }
Ejemplo n.º 15
0
 internal void TouchesEnded(Foundation.NSSet touches, UIKit.UIEvent e, GameWindow window)
 {
     UITouch [] touchesArray = touches.ToArray <UITouch>();
     foreach (UITouch touch in touchesArray)
     {
         Vector2 location = new Vector2(touch.LocationInView(touch.View).X, touch.LocationInView(touch.View).Y);
         location = window.GetOffsetPosition(location, false);
         // Check where is the touch
         if (Visible)
         {
             var oldItem = GetTouchesObject(touch);
             if (oldItem == null)
             {
                 continue;
             }
             if (oldItem is ButtonDefinition)
             {
                 ButtonDefinition button = (ButtonDefinition)oldItem;
                 if (CheckButtonHit(button, location))
                 {
                     _buttons &= ~(int)button.Type;
                 }
             }
             else if (oldItem == _leftThumbDefinition)
             {
                 LeftThumbStickDefinition.Offset = Vector2.Zero;
                 _leftStick = Vector2.Zero;
             }
             else if (oldItem == _rightThumbDefinition)
             {
                 _rightThumbDefinition.Offset = Vector2.Zero;
                 _rightStick = Vector2.Zero;
             }
             RemoveTouch(touch);
         }
     }
     Reset();
 }
Ejemplo n.º 16
0
 public virtual void TouchesEnded(NSSet touches, UIEvent withEvent)
 {
 }
Ejemplo n.º 17
0
 internal void TouchesCancelled(Foundation.NSSet touches, UIKit.UIEvent e)
 {
     // do nothing
 }
Ejemplo n.º 18
0
 public virtual void MotionBegan(UIEventSubtype motion, UIEvent withEvent)
 {
 }
Ejemplo n.º 19
0
 public virtual void TouchesCancelled([Unwrapped] NSSet touches, [Unwrapped] UIEvent withEvent)
 {
 }
Ejemplo n.º 20
0
 public virtual void MotionCancelled(UIEventSubtype motion, UIEvent withEvent)
 {
 }
Ejemplo n.º 21
0
 public virtual void MotionEnded(UIEventSubtype motion, UIEvent withEvent)
 {
 }
Ejemplo n.º 22
0
 public virtual void RemoteControlReceivedWithEvent(UIEvent @event)
 {
 }
Ejemplo n.º 23
0
 public virtual void TouchesBegan(NSSet touches, UIEvent withEvent)
 {
 }
Ejemplo n.º 24
0
        public override void TouchesEnded(NSSet touches, UIKit.UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            zxingView.AutoFocus();
        }
Ejemplo n.º 25
0
        internal void TouchesMoved(Foundation.NSSet touches, UIKit.UIEvent e, GameWindow window)
        {
            UITouch [] touchesArray = touches.ToArray <UITouch>();
            foreach (UITouch touch in touchesArray)
            {
                Vector2 location = new Vector2(touch.LocationInView(touch.View));
                location = window.GetOffsetPosition(location, false);

                var oldItem = GetTouchesObject(touch);
                // Check if touch any button
                bool hitInButton = false;
                if (Visible)
                {
                    if (oldItem != null && oldItem is ButtonDefinition)
                    {
                        hitInButton |= UpdateButton((ButtonDefinition)oldItem, location);
                    }
                    if (!hitInButton)
                    {
                        foreach (ButtonDefinition button in _buttonsDefinitions)
                        {
                            hitInButton |= UpdateButton(button, location);
                            if (hitInButton)
                            {
                                UpdateTouch(touch, button);
                                continue;
                            }
                        }
                    }
                }

                if (!hitInButton)
                {
                    if (oldItem != null && oldItem == _leftThumbDefinition)
                    {
                        Vector2 movement = location - LeftThumbStickDefinition.InitialHit;
                        if (movement.X > 20)
                        {
                            movement.X = 20;
                        }
                        else if (movement.X < -20)
                        {
                            movement.X = -20;
                        }

                        if (movement.Y > 20)
                        {
                            movement.Y = 20;
                        }
                        else if (movement.Y < -20)
                        {
                            movement.Y = -20;
                        }
                        _leftThumbDefinition.Offset = movement;
                        _leftStick = new Vector2(movement.X / 20, movement.Y / -20);
                    }
                    else if (Visible && (_leftThumbDefinition != null) && (CheckThumbStickHit(_leftThumbDefinition, location)))
                    {
                        Vector2 movement = location - LeftThumbStickDefinition.InitialHit;

                        UpdateTouch(touch, _leftThumbDefinition);
                        LeftThumbStickDefinition.InitialHit = location;

                        // Keep the stick in the "hole"
                        float radius = (movement.X * movement.X) + (movement.Y * movement.Y);

                        if (radius <= _thumbStickRadius)
                        {
                            _leftThumbDefinition.Offset = movement;
                            _leftStick = new Vector2(movement.X / 20, movement.Y / -20);
                        }
                    }
                    else
                    {
                        // reset left thumbstick
                        if (_leftThumbDefinition != null)
                        {
                            _leftThumbDefinition.Offset = Vector2.Zero;
                            _leftStick = Vector2.Zero;
                        }


                        if (oldItem != null && oldItem == _rightThumbDefinition)
                        {
                            Vector2 movement = location - _rightThumbDefinition.InitialHit;
                            _rightThumbDefinition.Offset = movement;
                            _rightStick = new Vector2(movement.X / 20, movement.Y / -20);
                        }
                        else if (Visible && (_rightThumbDefinition != null) && (CheckThumbStickHit(_rightThumbDefinition, location)))
                        {
                            Vector2 movement = location - _rightThumbDefinition.InitialHit;

                            // Keep the stick in the "hole"
                            float radius = (movement.X * movement.X) + (movement.Y * movement.Y);
                            if (radius <= _thumbStickRadius)
                            {
                                _rightThumbDefinition.Offset = movement;
                                _rightStick = new Vector2(movement.X / 20, movement.Y / -20);
                            }
                        }
                        else
                        {
                            // reset right thumbstick
                            if (_rightThumbDefinition != null)
                            {
                                _rightThumbDefinition.Offset = Vector2.Zero;
                                _rightStick = Vector2.Zero;
                            }

                            // Handle the mouse
                            Mouse.State.X = (int)location.X;
                            Mouse.State.Y = (int)location.Y;
                        }
                    }
                }
            }
        }
Ejemplo n.º 26
0
 public override void TouchesEnded(Foundation.NSSet touches, UIKit.UIEvent evt)
 {
     base.TouchesEnded(touches, evt);
 }
 partial void PlayerOneOption1(UIKit.UIButton sender, UIKit.UIEvent @event)
 {
     Application.PlayerCharacterOption[0] = "Fighter1";
 }
Ejemplo n.º 28
0
 void Control_TouchesBegan(Foundation.NSSet arg1, UIKit.UIEvent arg2)
 {
 }