Exemplo n.º 1
0
        float _ox, _oy; // 前回の絶対位置
        /// <summary>
        /// タッチイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BoxExRenderer_Touch(object sender, TouchEventArgs e)
        {
            var box = sender as Android.Views.View;
            var el = this.Element as BoxViewEx;
            switch (e.Event.Action)
            {
                case MotionEventActions.Down:
                    // 初期の相対値を保存
                    _gx = e.Event.GetX();
                    _gy = e.Event.GetY();
                    el.OnManipulationStarted(el, new ManipulationStartedRoutedEventArgs());
                    break;
                case MotionEventActions.Move:
                    // 移動距離を計算
                    float dx = e.Event.RawX - _ox;
                    float dy = e.Event.RawY - _oy;
                    // 移動
                    // TODO: 誤差で少しずれるが実用上問題ない
                    // setPos((int)box.Left + (int)dx, (int)box.Top + (int)dy);
                    // OnManipulationDelta(sender, new ManipulationDeltaRoutedEventArgs(sender, (int)dx, (int)dy));
                    // System.Diagnostics.Debug.WriteLine("move: Raw{0} {1} dx:{2} {3}", e.Event.RawX, e.Event.RawY, dx, dy);

                    // コールバック呼び出し
                    // TODO: delta 方式なのか誤差が大きい
                    el.OnManipulationDelta(el, new ManipulationDeltaRoutedEventArgs(sender, dx, dy));
                    break;
                case MotionEventActions.Up:
                    el.OnManipulationCompleted(el, new ManipulationCompletedRoutedEventArgs());
                    break;
            }
            // 現在の絶対位置を保存
            _ox = e.Event.RawX;
            _oy = e.Event.RawY;
        }
 void HandleStartButtonTouchEventReceived(object sender, TouchEventArgs e)
 {
     Console.WriteLine( selectedLevel );
     this.RootWidget.Dispose();
     UISystem.SetScene( new LoadingScene( selectedLevel ) );
     //			Director.Instance.ReplaceScene( new GameScene( selectedLevel ) );
 }
Exemplo n.º 3
0
 protected override void Touched(UUID entity, TouchEventArgs args)
 {
     switch (_control.State.GetState(args.AvatarName, args.AvatarID)) {
         case Impl.Module.Control.NothingSelected:
             _control.State.SetState(SandboxControl.DeleteSelected, args.AvatarName, args.AvatarID);
             Button.SetVisualState(1, _control.ToggleGlow);
             break;
         case SandboxControl.RouterSelected:
             _control.Record.RemoveNode(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.EPSelected:
             _control.Record.RemoveNode(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.LinkSelected:
             _control.Record.RemoveLink(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.VisualiseAlgorithmSelected:
             _control.RemoveNode(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.DeleteSelected:
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.DisplayTableSelected:
             //DO nothing
             break;
     }
 }
Exemplo n.º 4
0
 private void touchesBeganHandler(object sender, TouchEventArgs e)
 {
     foreach (var point in e.Touches)
     {
         spawnPrefabAt(point.Position);
     }
 }
Exemplo n.º 5
0
        void OnTouchImageView(object sender, TouchEventArgs e)
        {
            string message;
            switch (e.Event.Action) {
            case MotionEventActions.Down:
            case MotionEventActions.Move:
                message = "Touch Begins";
                startX = e.Event.RawX;
                break;

            case MotionEventActions.Up:
            case MotionEventActions.Cancel:
                message = "Touch Ends";
                endX = e.Event.RawX;
                if (endX - startX > 20) {
                    image.SwipedRight ();
                } else if (endX - startX < -20) {
                    image.SwipedLeft ();
                }
                break;

            default:
                message = string.Empty;
                break;
            }
        }
Exemplo n.º 6
0
 public void ChangeToStatusScene(object sender, TouchEventArgs e)
 {
     Sounds.PlayOk();
     Scenes.characterStatusScene.UpdateValue();
     Scenes.characterStatusScene.ScrollPanel_1_Skills.UpdateSkills();
     UISystem.SetScene(Scenes.characterStatusScene);
 }
Exemplo n.º 7
0
 private void closeDialog(object sender, TouchEventArgs e)
 {
     FadeOutEffect fadeOutEffect = new FadeOutEffect(
             this, 500, FadeOutEffectInterpolator.Linear);
     fadeOutEffect.Start();
     this.Hide(fadeOutEffect);
 }
Exemplo n.º 8
0
        static void HandleButtonButtonAction(object sender, TouchEventArgs e)
        {
            //if (e.TouchEvent == TouchEventType.Down)
            {
                var dialog = new Dialog();
                Label label = new Label();
                label.X = 10.0f;
                label.Y = 50.0f;
                label.Text = "Test Dialog";

                Button button = new Button();
                button.Text = "Hidding Dialog...";
                button.TextColor = new UIColor(1.0f, 0.0f, 0.0f, 1.0f);
                button.SetPosition(5.0f, 5.0f);

                button.ButtonAction += (s, ea) =>
                {
                    dialog.Hide();
                };

                dialog.AddChildLast(button);
                dialog.AddChildLast(label);

                dialog.Show();
            }
        }
		public override bool OnInterceptTouchEvent (MotionEvent ev)
		{
			TouchEventArgs eventArgs = new TouchEventArgs (true, ev);
			HandleGenericMotion (this, eventArgs);

			return base.OnInterceptTouchEvent(ev);
		}
        private void HScrollViewTouch(object sender, TouchEventArgs e)
        {
            e.Handled = false;

            switch (e.Event.Action)
            {
                case MotionEventActions.Move:
                    _deltaXResetTimer.Stop();
                    _deltaX = _scrollView.ScrollX - _prevScrollX;
                    _prevScrollX = _scrollView.ScrollX;

                    UpdateSelectedIndex();

                    _deltaXResetTimer.Start();
                    break;

                case MotionEventActions.Down:
                    _motionDown = true;
                    _scrollStopTimer.Stop();
                    break;

                case MotionEventActions.Up:
                    _motionDown = false;
                    SnapScroll();
                    _scrollStopTimer.Start();
                    break;
            }
        }
Exemplo n.º 11
0
 private void touchesEndedHandler(object sender, TouchEventArgs e)
 {
     foreach (var touch in e.Touches)
     {
         ITouch _touch;
         if (!ftlTouches.TryGetValue(touch.Id, out _touch)) return;
     }
 }
Exemplo n.º 12
0
Arquivo: Form1.cs Projeto: bcaf/bcaf
 private void UpdateInput(object sender, TouchEventArgs e)
 {
     TouchPoint tmp = e.TouchPoint;
     if (tmp.IsTagRecognized)
     {
         SendUpdate.doSend(tmp);
     }
 }
Exemplo n.º 13
0
        void MapControl_Touch(object sender, TouchEventArgs args)
        {
            if (_map.Lock) return;

            var x = (int)args.Event.RawX;
            var y = (int)args.Event.RawY;

            switch (args.Event.Action)
            {
            case MotionEventActions.Down:
                _previousMap = null;
                _mode = Drag;
                break;
            case MotionEventActions.Up:
                _previousMap = null;
                _mode = None;
                _map.ViewChanged (true);
                break;
            case MotionEventActions.Pointer2Down:
                _previousMap = null;
                _oldDist = Spacing(args.Event);
                MidPoint(_currentMid, args.Event);
                _previousMid = _currentMid;
                _mode = Zoom;
                break;
            case MotionEventActions.Pointer2Up:
                _previousMap = null;
                _previousMid = null;
                _mode = Drag;
                _map.ViewChanged (true);
                break;
            case MotionEventActions.Move:
                switch (_mode)
                {
                case Drag:
                    _currentMap = new PointF (x, y);
                    if (_previousMap != null) {
                        _map.Viewport.Transform (_currentMap.X, _currentMap.Y, _previousMap.X, _previousMap.Y);
                        RefreshGraphics ();
                    }
                    _previousMap = _currentMap;                    
                    break;
                case Zoom:
                    if (args.Event.PointerCount < 2) return;

                    var newDist = Spacing (args.Event);
                    var scale = newDist / _oldDist;

                    _oldDist = Spacing (args.Event);
                    _previousMid = new PointF (_currentMid.X, _currentMid.Y);
                    MidPoint (_currentMid, args.Event);
                    _map.Viewport.Transform(_currentMid.X, _currentMid.Y, _previousMid.X, _previousMid.Y, scale);
                    RefreshGraphics ();
                    break;
                }
                break;
            }
        }
        /// <summary>
        /// Handles the touch.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Android.Views.View.TouchEventArgs"/> instance containing the event data.</param>
        void HandleTouch (object sender, TouchEventArgs e)
        {
            var element = (ExtendedEntry)this.Element;
            switch (e.Event.Action)
            {
                case MotionEventActions.Down:
                    this.downX = e.Event.GetX();
                    this.downY = e.Event.GetY();
                    return;
                case MotionEventActions.Up:
                case MotionEventActions.Cancel:
                case MotionEventActions.Move:
                    this.upX = e.Event.GetX();
                    this.upY = e.Event.GetY();

                    float deltaX = this.downX - this.upX;
                    float deltaY = this.downY - this.upY;

                        // swipe horizontal?
                    if(Math.Abs(deltaX) > Math.Abs(deltaY))
                    {
                        if(Math.Abs(deltaX) > MinDistance)
                        {
                            if (deltaX < 0)
                            {
                                element.OnRightSwipe(this, EventArgs.Empty); 
                                return;
                            }

                            if (deltaX > 0)
                            {
                                element.OnLeftSwipe(this, EventArgs.Empty); 
                                return;
                            }
                        }
                        else 
                        {
                            Android.Util.Log.Info("ExtendedEntry", "Horizontal Swipe was only " + Math.Abs(deltaX) + " long, need at least " + MinDistance);
                            return; // We don't consume the event
                        }
                    }
                    // swipe vertical?
//                    else 
//                    {
//                        if(Math.abs(deltaY) > MIN_DISTANCE){
//                            // top or down
//                            if(deltaY < 0) { this.onDownSwipe(); return true; }
//                            if(deltaY > 0) { this.onUpSwipe(); return true; }
//                        }
//                        else {
//                            Log.i(logTag, "Vertical Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE);
//                            return false; // We don't consume the event
//                        }
//                    }

                    return;
            }
        }
Exemplo n.º 15
0
        protected override void OnTouchUp(TouchEventArgs args)
        {
            base.OnTouchUp(args);

            if (IsPressed && ClickMode == ClickMode.Release)
                RaiseEvent(new RoutedEventArgs(ClickEvent));

            IsPressed = false;
        }
Exemplo n.º 16
0
 private void touchesMovedHandler(object sender, TouchEventArgs e)
 {
     foreach (var touch in e.Touches)
     {
         if (!touch.Properties.ContainsKey("Angle")) return;
         ITouch testTouch;
         updateTouch(touch);
     }
 }
Exemplo n.º 17
0
 private void HandleTestResultItemTouchEventReceived(object sender, TouchEventArgs e)
 {
     TestResultItem item = sender as TestResultItem;
     if(item != null) {
         if(e.TouchEvents.PrimaryTouchEvent.Type == TouchEventType.Up) {
             OnTestResultItemPressed(item);
         }
     }
 }
Exemplo n.º 18
0
 public void setSkillDefault(object sender, TouchEventArgs e)
 {
     if(CheckBox_0.Checked){
         Global.setSkill = SkillID.Default;
         CheckBox_1.Checked = false;
         CheckBox_2.Checked = false;
         CheckBox_3.Checked = false;
     }
 }
        private void CanvasGallery_SwipeStarted(object sender, TouchEventArgs args)
        {
            args.Handled = true;

            this.swipePivotPosition = args.GetTouchPoint(this.canvasGallery).Position;
            this.swipePivotOffset = this.Offset;

            this.RaiseGestureChanged("Swipe");
        }
Exemplo n.º 20
0
 public void Move(Object sender, TouchEventArgs e)
 {
     if (e.TouchPoint.IsFingerRecognized)
     {
         pressedPoints[e.TouchPoint.Id] = new Point((int)e.TouchPoint.CenterX, (int)e.TouchPoint.CenterY);
         foreach (EGameMode id in Enum.GetValues(typeof(EGameMode)))
             screenParts[id].Move(e.TouchPoint);
     }
 }
Exemplo n.º 21
0
        protected override void OnTouchDown(TouchEventArgs args)
        {
            base.OnTouchDown(args);

            IsPressed = true;

            if (ClickMode == ClickMode.Press)
                RaiseEvent(new RoutedEventArgs(ClickEvent));
        }
Exemplo n.º 22
0
    private void touchBeganHandler(object sender, TouchEventArgs e)
    {
		print ("handling");
        foreach (var point in e.Touches)
        {
            spawnPrefabAt(point.Position);
			print ("sending");
        }
    }
Exemplo n.º 23
0
Arquivo: Form1.cs Projeto: bcaf/bcaf
 private void NewInput(object sender, TouchEventArgs e)
 {
     TouchPoint tmp = e.TouchPoint;
     if (tmp.IsTagRecognized)
     {
         SendNew.doSend(tmp);
     }
        //ID=16842750, Position=(345,9481, 319,9756), CenterPosition=(345,9481, 319,9756), Type=Tag (Schema=0x00000000; Series=0x0000000000000000; ExtendedValue=0x0000000000000000; Value=0x0000000000000000)
 }
 private void pauseButtonClick(object sender, TouchEventArgs e)
 {
     State status = player.Status;
     if (status == State.Stop) {
         return;
     }
     if (status != State.Pause) {
         player.Pause();
     }
 }
Exemplo n.º 25
0
 private void touchesBeganHandler(object sender, TouchEventArgs e)
 {
     foreach (var touch in e.Touches)
     {
         if (!touch.Properties.ContainsKey("Angle")) return;
         if (calibrated) return;
         if (ftlTouches.ContainsKey(touch.Id)) return;
         ftlTouches.Add (touch.Id, touch);
     }
 }
Exemplo n.º 26
0
        public void ChangeToGameScene(object sender, TouchEventArgs e)
        {
            if(Button_1.Enabled){
                Sounds.PlayOk();
                Game.StartGame(stageId);
                Global.isStartGame = true;
            }else{

            }
        }
Exemplo n.º 27
0
 private void touchesBeganHandler(object sender, TouchEventArgs e)
 {
     foreach (var touch in e.Touches)
     {
         if (!touch.Properties.ContainsKey("Angle")) return;
         if (touch.Hit != null)
         {
         }
     }
 }
        public virtual bool OnSingleTapConfirmed(MotionEvent e)
        {
            var args = new TouchEventArgs(true, e);

            if (this.SingleTapConfirmed != null)
            {
                this.SingleTapConfirmed(this, args);
            }

            return args.Handled;
        }
        public virtual bool OnDown(MotionEvent e)
        {
            var args = new TouchEventArgs(true, e);

            if (this.Down != null)
            {
                this.Down(this, args);
            }

            return args.Handled;
        }
Exemplo n.º 30
0
        protected override void Touched(UUID entity, TouchEventArgs args)
        {
            if (!_control.State.GetToggleState(SandboxControl.Build, args.AvatarID))
                return;

            Vector3 pos = Vector3.Add(args.TouchPosition, new Vector3(0f, 0f, .2f));
            if (_control.State.GetToggleState(SandboxControl.EPMode, args.AvatarID))
                _control.AddEP(args.AvatarName, args.AvatarID, pos);
            else
                _control.AddRouter(args.AvatarName, args.AvatarID, pos);
        }
Exemplo n.º 31
0
 private void OnPinDetailsTouchDown(object sender, TouchEventArgs e)
 {
     m_aboutTextView.CaptureTouch(e.TouchDevice);
 }
Exemplo n.º 32
0
 // Touch event
 private void Preview_TouchDown(object sender, TouchEventArgs e)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 33
0
 private void bg_TouchDown(object sender, TouchEventArgs e)
 {
     WhenClickDay(sender);
 }
Exemplo n.º 34
0
 private void DataJson_TouchEnter(object sender, TouchEventArgs e)
 {
     MessageBox.Show("TouchEnter");
 }
Exemplo n.º 35
0
 private void Obj_Button_Normal_Touch(object sender, TouchEventArgs e)
 {
     ChangeDifficulty = "Normal";
 }
Exemplo n.º 36
0
 private void handleTouchDown(object sender, TouchEventArgs e)
 {
 }
Exemplo n.º 37
0
 private void txtLabel_TouchDown(object sender, TouchEventArgs e)
 {
 }
Exemplo n.º 38
0
 private void scrolls_PreviewTouchDown(object sender, TouchEventArgs e)
 {
     this.GetLast(e.Source);
 }
Exemplo n.º 39
0
 private void scrolls_PreviewTouchMove(object sender, TouchEventArgs e)
 {
     this.ScrollMove(e.Source);
 }
Exemplo n.º 40
0
 private void CZBackGround_TouchUp(object sender, TouchEventArgs e)
 {
     Click?.Invoke(XPos, YPos, this);
 }
Exemplo n.º 41
0
 private void touchBeganHandler(object sender, TouchEventArgs e)
 {
     spawnPrefabAt(e.Touch.Position);
 }
Exemplo n.º 42
0
 void SceneMainControl_TouchUp(object sender, TouchEventArgs e)
 {
     SceneTrackball.ResetTouchMove();
 }
Exemplo n.º 43
0
 private void Obj_Button_Hard_Touch(object sender, TouchEventArgs e)
 {
     ChangeDifficulty = "Hard";
 }
Exemplo n.º 44
0
        protected override void OnTouchMove(TouchEventArgs args)
        {
            base.OnTouchMove(args);

            OnTouchMoveImpl(args);
        }
Exemplo n.º 45
0
 private void Obj_Button_Easy_Touch(object sender, TouchEventArgs e)
 {
     ChangeDifficulty = "Easy";
 }
Exemplo n.º 46
0
 void HandleTouch(object sender, TouchEventArgs e)
 {
     _detector.OnTouchEvent(e.Event);
 }
Exemplo n.º 47
0
 private void OnTouchUpImpl(TouchEventArgs args)
 {
 }
Exemplo n.º 48
0
 private static void OnTouchDownImpl(TouchEventArgs args)
 {
 }
Exemplo n.º 49
0
 private void border_TouchDown(object sender, TouchEventArgs e)
 {
     e.Handled = true;
 }
Exemplo n.º 50
0
 /// <summary>
 /// Provides class handling for the <see cref="E:System.Windows.UIElement.PreviewTouchDown"/> routed event that occurs when a touch presses this element.
 /// </summary>
 /// <param name="e">A <see cref="T:System.Windows.Input.TouchEventArgs"/> that contains the event data.</param>
 protected override void OnPreviewTouchDown(TouchEventArgs e)
 {
     base.OnPreviewTouchDown(e);
     BaseController.ResetLastActiveTime();
 }
Exemplo n.º 51
0
        private void CallButtonCommand(object sender, TouchEventArgs e)
        {
            var button = sender as Button;

            button.Command.Execute(button.CommandParameter);
        }
Exemplo n.º 52
0
 private void ListView_TouchDown(object sender, TouchEventArgs e)
 {
 }
Exemplo n.º 53
0
 private static void OnTouchMoveImpl(TouchEventArgs args)
 {
 }
 internal NativeTouchEventArgs(TouchEventArgs src, NativeJsObject jsObject)
 {
     CopyProps(src, this);
     _jsObject = jsObject;
 }
Exemplo n.º 55
0
 private void IOTitle_TouchDown(object sender, TouchEventArgs e)
 {
     SetOriginView();
 }
Exemplo n.º 56
0
 private void OnPinDetailsTouchUp(object sender, TouchEventArgs e)
 {
     m_AboutPageView.ReleaseTouchCapture(e.TouchDevice);
 }
Exemplo n.º 57
0
 private void Button_TouchDown_2(object sender, TouchEventArgs e)
 {
     ResIdx = 1;
     Close();
 }
Exemplo n.º 58
0
 protected override void OnPreviewTouchUp(TouchEventArgs e)
 {
     this.ReleaseCurrentDevice();
 }
Exemplo n.º 59
0
    public void Read_Works()
    {
        // Arrange
        var args = new TouchEventArgs
        {
            AltKey         = false,
            CtrlKey        = true,
            MetaKey        = true,
            ShiftKey       = false,
            Type           = "type1",
            ChangedTouches = new[]
            {
                new TouchPoint
                {
                    ClientX    = 1.3,
                    ClientY    = 2.9,
                    Identifier = 11,
                    PageX      = 7.0,
                    PageY      = 0.23,
                    ScreenX    = 1.0,
                    ScreenY    = 39.2
                },
            },
            Detail        = 789,
            TargetTouches = new[]
            {
                new TouchPoint
                {
                    ClientX    = 2.3,
                    ClientY    = 22.9,
                    Identifier = 8,
                    PageX      = 786.0,
                    PageY      = 1.4,
                    ScreenX    = 5.0,
                    ScreenY    = 9.2
                },
                new TouchPoint
                {
                    ClientX    = 12.3,
                    ClientY    = 2.9,
                    Identifier = 17,
                    PageX      = 6.3,
                    PageY      = 13.4,
                    ScreenX    = 4.0,
                    ScreenY    = 7.2
                },
            },
            Touches = new[]
            {
                new TouchPoint
                {
                    ClientX    = 6.8,
                    ClientY    = 1.9,
                    Identifier = 3,
                    PageX      = 2.3,
                    PageY      = 3.4,
                    ScreenX    = 4.1,
                    ScreenY    = 8.0,
                },
            },
        };

        var jsonElement = GetJsonElement(args);

        // Act
        var result = TouchEventArgsReader.Read(jsonElement);

        // Assert
        Assert.Equal(args.AltKey, result.AltKey);
        Assert.Equal(args.CtrlKey, result.CtrlKey);
        Assert.Equal(args.MetaKey, result.MetaKey);
        Assert.Equal(args.ShiftKey, result.ShiftKey);
        Assert.Equal(args.Type, result.Type);
        Assert.Equal(args.Detail, result.Detail);

        AssertEqual(args.Touches, result.Touches);
        AssertEqual(args.ChangedTouches, result.ChangedTouches);
        AssertEqual(args.TargetTouches, result.TargetTouches);
    }
Exemplo n.º 60
0
 private void OnTouchDownImpl(TouchEventArgs args)
 {
     // Find the appropriate position for the caret.
     CaretPosition = FindNearestCharacterIndex(new Vector2(args.WorldPosition.X - WorldMatrix.M41, args.WorldPosition.Y - WorldMatrix.M42));
 }