コード例 #1
0
ファイル: ControlSystem.cs プロジェクト: sromic1990/STA
 private void OnTouchDown(int touchId, Direction side, Vector2 point)
 {
     if (null != TouchDown)
     {
         TouchDown.Invoke(touchId, side, point);
     }
 }
コード例 #2
0
ファイル: Widget.cs プロジェクト: randomcrab/Myra
        public virtual void OnTouchDown()
        {
            IsTouchInside = true;

            if (Enabled && AcceptsKeyboardFocus)
            {
                Desktop.FocusedKeyboardWidget = this;
            }

            if (Enabled && AcceptsMouseWheelFocus)
            {
                Desktop.FocusedMouseWheelWidget = this;
            }

            var x = Bounds.X;
            var y = Bounds.Y;

            var bounds = DragHandle != null
                                        ? new Rectangle(
                x,
                y,
                DragHandle.Bounds.Right - x,
                DragHandle.Bounds.Bottom - y
                ) : Rectangle.Empty;

            var touchPos = Desktop.TouchPosition;

            if (bounds == Rectangle.Empty || bounds.Contains(touchPos))
            {
                _startPos = new Point(touchPos.X - Left,
                                      touchPos.Y - Top);
            }

            TouchDown.Invoke(this);
        }
コード例 #3
0
        private void OnTouchEvent(TouchActivityEvent ev)
        {
            for (int i = 0; i < ev.Pointers.Count; ++i)
            {
                TouchActivityEvent.PointerInfo pointer = ev.Pointers[i];

                switch (ev.Action)
                {
                case MotionEventActions.Down:
                case MotionEventActions.PointerDown:
                {
                    TouchDown?.Invoke(this, pointer.X, pointer.Y, pointer.Id);
                    break;
                }

                case MotionEventActions.Up:
                case MotionEventActions.PointerUp:
                {
                    TouchUp?.Invoke(this, pointer.X, pointer.Y, pointer.Id);
                    break;
                }

                case MotionEventActions.Move:
                {
                    TouchMove?.Invoke(this, pointer.X, pointer.Y, pointer.Id);
                    break;
                }
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Lanza el evento cuando un dedo toca la pantalla en un elemento y este se desplaza.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void PulsarTouchDown(EventArgs e)
 {
     if (TouchDown != null)
     {
         TouchDown.Invoke(this, e);
     }
 }
コード例 #5
0
        internal void ProcessDown(int id, Vector2 position, DateTime time)
        {
            TouchElement element = new TouchElement()
            {
                Origin        = position,
                Position      = position,
                Valid         = true,
                LockedGesture = GestureType.None,
                DownTime      = DateTime.Now
            };

            _gesture.GestureType = GestureType.Down;
            _gesture.Origin      = position;
            _gesture.Position    = position;
            _gesture.TouchId     = id;
            _gesture.Offset      = Vector2.Zero;
            _gesture.Time        = time;

            OnGesture();

            element.LockedListener = _gesture.PointerCapturedBy;

            _elements.Remove(id);
            _elements.Add(id, element);

            TouchDown?.Invoke(id, position);
        }
コード例 #6
0
        public override void TouchesBegan(NSSet touches, UIEvent?evt)
        {
            base.TouchesBegan(touches, evt);

            var    viewPoints = this.GetPointsInView(evt);
            PointF viewPoint  = viewPoints.Length > 0 ? viewPoints[0] : PointF.Zero;
            var    point      = new Point(viewPoint.X, viewPoint.Y);

            TouchDown?.Invoke(this, new TouchEventArgs(point));
        }
コード例 #7
0
    protected void OnTouchDown(TouchDown e)
    {
        Vector3 touchWorldPos = Services.GameManager.MainCamera.ScreenToWorldPoint(e.touch.position);

        if (m_touchID == -1)
        {
            m_touchID = e.touch.fingerId;
            OnInputDown();
        }
    }
コード例 #8
0
 public PlatformSlider()
 {
     TouchDownEvent = delegate
     {
         TouchDown?.Invoke(this, EventArgs.Empty);
     };
     TouchUpEvent = delegate
     {
         TouchUp?.Invoke(this, EventArgs.Empty);
     };
 }
コード例 #9
0
ファイル: Seeker.cs プロジェクト: E-Playboys/OnePieceApp
 public Seeker()
 {
     TouchDownEvent = delegate
     {
         TouchDown?.Invoke(this, EventArgs.Empty);
     };
     TouchUpEvent = delegate
     {
         TouchUp?.Invoke(this, EventArgs.Empty);
     };
 }
コード例 #10
0
        internal void Internal_OnTouchDown(ref Vector2 pointerPosition, int pointerId)
        {
            Vector2 pos = pointerPosition / _dpiScale;

            bool handled = false;

            TouchDown?.Invoke(ref pos, pointerId, ref handled);
            if (handled)
            {
                return;
            }

            GUI.OnTouchDown(pos, pointerId);
        }
コード例 #11
0
    public void OnTouchDown(TouchDown e)
    {
        Vector3 touchWorldPos =
            Services.GameManager.MainCamera.ScreenToWorldPoint(
                new Vector3(
                    e.touch.position.x,
                    e.touch.position.y,
                    -Services.GameManager.MainCamera.transform.position.z));

        if (PointContainedInTile(touchWorldPos) && _touchID == -1)
        {
            OnInputDown();
        }
    }
コード例 #12
0
        internal void OnTouchDown(TouchEventArgs args)
        {
            TouchState = TouchStates.Touched;
            TouchDown?.Invoke(this, args);
            ChangeVisualState();
            if (LongTouch != null)
            {
                _longPressTimer?.Start();
            }

            if (Click != null)
            {
                args.Handled = true;
            }
        }
コード例 #13
0
        public virtual void OnTouchDown()
        {
            IsTouchInside = true;

            if (Enabled && AcceptsKeyboardFocus)
            {
                Desktop.FocusedKeyboardWidget = this;
            }

            if (Enabled && AcceptsMouseWheelFocus)
            {
                Desktop.FocusedMouseWheelWidget = this;
            }

            TouchDown.Invoke(this);
        }
コード例 #14
0
 public MySlider()
 {
     TouchDownEvent = delegate
     {
         TouchDown?.Invoke(this, EventArgs.Empty);
     };
     TouchUpEvent = delegate
     {
         TouchUp?.Invoke(this, EventArgs.Empty);
     };
     TouchProgressChanged = delegate
     {
         TouchProgress?.Invoke(this, EventArgs.Empty);
     };
     TouchUp = delegate
     {
         TouchProgress?.Invoke(this, EventArgs.Empty);
     };
 }
コード例 #15
0
        /// <summary>
        /// Saves all pending changes to the database
        /// </summary>
        public void Save()
        {
            using (var db = GameDatabase.Open())
            {
                if (NeedsToSave)
                {
                    db.Update(new PlayerDto
                    {
                        Id                   = (int)Account.Id,
                        TutorialState        = TutorialState,
                        Level                = Level,
                        TotalExperience      = (int)TotalExperience,
                        PEN                  = (int)PEN,
                        AP                   = (int)AP,
                        Coins1               = (int)Coins1,
                        Coins2               = (int)Coins2,
                        CurrentCharacterSlot = CharacterManager.CurrentSlot
                    });
                    NeedsToSave = false;
                }

                Settings.Save(db);
                Inventory.Save(db);
                CharacterManager.Save(db);
                LicenseManager.Save(db);
                DenyManager.Save(db);
                Mailbox.Save(db);

                DeathMatch.Save(db);
                TouchDown.Save(db);
                Chasser.Save(db);
                BattleRoyal.Save(db);
                CaptainMode.Save(db);
                Mission.Save(db);
            }
        }
コード例 #16
0
 public virtual void OnTouchDown(Point point)
 {
     TouchDown?.Invoke(this, EventArgs.Empty);
 }
コード例 #17
0
 /// <summary>
 /// Raises the <see cref="TouchDown"/> event.
 /// </summary>
 /// <param name="touchID">The unique identifier of the touch input.</param>
 /// <param name="fingerID">The unique identifier of the finger which caused the touch.</param>
 /// <param name="x">The normalized x-coordinate of the touch.</param>
 /// <param name="y">The normalized y-coordinate of the touch.</param>
 /// <param name="pressure">The normalized pressure of the touch.</param>
 protected virtual void OnTouchDown(Int64 touchID, Int64 fingerID, Single x, Single y, Single pressure)
 {
     TouchDown?.Invoke(this, touchID, fingerID, x, y, pressure);
 }
コード例 #18
0
 private void NeedUpdateButton_TouchDown(object sender, EventArgs e)
 {
     TouchDown?.Invoke(null, EventArgs.Empty);
 }
コード例 #19
0
 public void OnTouchDown() =>
 TouchDown?.Invoke(this, null);
コード例 #20
0
 private void OnTouchDown(float x, float y, ulong id)
 {
     TouchDown?.Invoke(this, (int)(x * _width), (int)(y * _height), id);
 }
コード例 #21
0
        private void ProcessTouches(SensorDataEventArgs eventArgs)
        {
            List <EchoPoint> currPts = new List <EchoPoint>();

            // first: calculate the new points
            for (int i = 0; i < eventArgs.Peaks.Length; i++)
            {
                double distance = GetDistance(eventArgs.Peaks[i]);

                double pressure = eventArgs.Amplitudes[i] / 1000.0;
                pressure = Math.Min(Math.Max(0.0, pressure), 1.0);

                EchoPoint echoPt = new EchoPoint(i, distance, pressure,
                                                 eventArgs.Peaks[i], eventArgs.Amplitudes[i]);
                currPts.Add(echoPt);
            }

            // match the points
            if (m_prevPoints.Count == 0)
            {
                // we did not have previous points
                if (currPts.Count != 0)
                {
                    // match those points to new points
                    for (int i = 0; i < currPts.Count; i++)
                    {
                        m_prevPoints.Add(currPts[i]);
                        TouchDown?.Invoke(this, new EchoPointEventArgs(currPts[i]));
                    }
                }
                else
                {
                    // nothing to do here
                }
            }
            else if (m_prevPoints.Count == 1)
            {
                // there was one previous point
                if (currPts.Count == 0)
                {
                    // the point disappeared
                    TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));
                    m_prevPoints.RemoveAt(0);
                }
                else if (currPts.Count == 1)
                {
                    // this is the same point (double-check distance)
                    m_prevPoints[0].Update(currPts[0]);
                    TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));
                }
                else if (currPts.Count == 2)
                {
                    // we added a point
                    // find out which one was the original
                    double distance1 = Math.Abs(currPts[0].Distance - m_prevPoints[0].Distance);
                    double distance2 = Math.Abs(currPts[1].Distance - m_prevPoints[0].Distance);
                    int    correctId = m_prevPoints[0].Id == 0 ? 1 : 0;

                    if (distance1 > distance2)
                    {
                        // the first point is new
                        currPts[0].Id = correctId;

                        m_prevPoints[0].Update(currPts[1]);
                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));

                        m_prevPoints.Add(currPts[0]);
                        TouchDown?.Invoke(this, new EchoPointEventArgs(currPts[0]));
                    }
                    else
                    {
                        // the other one is new
                        currPts[1].Id = correctId;

                        m_prevPoints[0].Update(currPts[0]);
                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));

                        m_prevPoints.Add(currPts[1]);
                        TouchDown?.Invoke(this, new EchoPointEventArgs(currPts[1]));
                    }
                }
            }
            else if (m_prevPoints.Count == 2)
            {
                // there were two previous points
                if (currPts.Count == 0)
                {
                    // the points disappeared
                    TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));
                    TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1]));

                    m_prevPoints.Clear();
                }
                else if (currPts.Count == 1)
                {
                    // we removed only one point
                    // find out which one
                    double distance1 = Math.Abs(currPts[0].Distance - m_prevPoints[0].Distance);
                    double distance2 = Math.Abs(currPts[0].Distance - m_prevPoints[1].Distance);

                    if (distance1 > distance2)
                    {
                        // the first previous is gone
                        m_prevPoints[1].Update(currPts[0]);
                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1]));

                        TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));
                        m_prevPoints.RemoveAt(0);
                    }
                    else
                    {
                        // the second previous is gone
                        m_prevPoints[0].Update(currPts[0]);
                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));

                        TouchUp?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1]));
                        m_prevPoints.RemoveAt(1);
                    }
                }
                else
                {
                    // both are still here -> update them
                    bool prevFlipped = m_prevPoints[0].Distance > m_prevPoints[1].Distance;
                    bool currFlipped = currPts[0].Distance > currPts[1].Distance;

                    if ((!prevFlipped && !currFlipped) ||
                        (prevFlipped && currFlipped))
                    {
                        m_prevPoints[0].Update(currPts[0]);
                        m_prevPoints[1].Update(currPts[1]);

                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));
                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1]));
                    }
                    else if ((!prevFlipped && currFlipped) ||
                             (prevFlipped && !currFlipped))
                    {
                        m_prevPoints[0].Update(currPts[1]);
                        m_prevPoints[1].Update(currPts[0]);

                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[0]));
                        TouchMove?.Invoke(this, new EchoPointEventArgs(m_prevPoints[1]));
                    }
                }
            }
        }
コード例 #22
0
 private void ResetInactivity(TouchDown e)
 {
     inactivityTimer = 0;
 }
コード例 #23
0
 public void OnTouchDown(EventArgs e)
 {
     TouchDown?.Invoke(this, e);
 }
コード例 #24
0
 public TouchEventSlider()
 {
     TouchDownEvent = (sender, args) => TouchDown?.Invoke(this, args);
     TouchUpEvent   = (sender, args) => TouchUp?.Invoke(this, args);
 }
コード例 #25
0
 public virtual void OnTouchDown()
 {
     TouchDown.Invoke(this);
 }
コード例 #26
0
 public void OnTouchDown(int x, int y, ulong id)
 {
     TouchDown?.Invoke(this, x, y, id);
 }
コード例 #27
0
 public void InvokeTouchDown()
 {
     TouchDown.Invoke(this, EventArgs.Empty);
 }