예제 #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 ) );
 }
예제 #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;
     }
 }
예제 #4
0
 private void touchesBeganHandler(object sender, TouchEventArgs e)
 {
     foreach (var point in e.Touches)
     {
         spawnPrefabAt(point.Position);
     }
 }
예제 #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;
            }
        }
예제 #6
0
 public void ChangeToStatusScene(object sender, TouchEventArgs e)
 {
     Sounds.PlayOk();
     Scenes.characterStatusScene.UpdateValue();
     Scenes.characterStatusScene.ScrollPanel_1_Skills.UpdateSkills();
     UISystem.SetScene(Scenes.characterStatusScene);
 }
예제 #7
0
 private void closeDialog(object sender, TouchEventArgs e)
 {
     FadeOutEffect fadeOutEffect = new FadeOutEffect(
             this, 500, FadeOutEffectInterpolator.Linear);
     fadeOutEffect.Start();
     this.Hide(fadeOutEffect);
 }
예제 #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;
            }
        }
예제 #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;
     }
 }
예제 #12
0
파일: Form1.cs 프로젝트: bcaf/bcaf
 private void UpdateInput(object sender, TouchEventArgs e)
 {
     TouchPoint tmp = e.TouchPoint;
     if (tmp.IsTagRecognized)
     {
         SendUpdate.doSend(tmp);
     }
 }
예제 #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;
            }
        }
예제 #15
0
파일: ButtonBase.cs 프로젝트: cg123/xenko
        protected override void OnTouchUp(TouchEventArgs args)
        {
            base.OnTouchUp(args);

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

            IsPressed = false;
        }
예제 #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);
     }
 }
예제 #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);
         }
     }
 }
예제 #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");
        }
예제 #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);
     }
 }
예제 #21
0
파일: ButtonBase.cs 프로젝트: cg123/xenko
        protected override void OnTouchDown(TouchEventArgs args)
        {
            base.OnTouchDown(args);

            IsPressed = true;

            if (ClickMode == ClickMode.Press)
                RaiseEvent(new RoutedEventArgs(ClickEvent));
        }
예제 #22
0
    private void touchBeganHandler(object sender, TouchEventArgs e)
    {
		print ("handling");
        foreach (var point in e.Touches)
        {
            spawnPrefabAt(point.Position);
			print ("sending");
        }
    }
예제 #23
0
파일: Form1.cs 프로젝트: 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();
     }
 }
예제 #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);
     }
 }
예제 #26
0
        public void ChangeToGameScene(object sender, TouchEventArgs e)
        {
            if(Button_1.Enabled){
                Sounds.PlayOk();
                Game.StartGame(stageId);
                Global.isStartGame = true;
            }else{

            }
        }
예제 #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;
        }
예제 #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);
        }
예제 #31
0
 private void OnPinDetailsTouchDown(object sender, TouchEventArgs e)
 {
     m_aboutTextView.CaptureTouch(e.TouchDevice);
 }
예제 #32
0
 // Touch event
 private void Preview_TouchDown(object sender, TouchEventArgs e)
 {
     throw new NotImplementedException();
 }
예제 #33
0
 private void bg_TouchDown(object sender, TouchEventArgs e)
 {
     WhenClickDay(sender);
 }
예제 #34
0
 private void DataJson_TouchEnter(object sender, TouchEventArgs e)
 {
     MessageBox.Show("TouchEnter");
 }
예제 #35
0
 private void Obj_Button_Normal_Touch(object sender, TouchEventArgs e)
 {
     ChangeDifficulty = "Normal";
 }
예제 #36
0
 private void handleTouchDown(object sender, TouchEventArgs e)
 {
 }
예제 #37
0
 private void txtLabel_TouchDown(object sender, TouchEventArgs e)
 {
 }
예제 #38
0
 private void scrolls_PreviewTouchDown(object sender, TouchEventArgs e)
 {
     this.GetLast(e.Source);
 }
예제 #39
0
 private void scrolls_PreviewTouchMove(object sender, TouchEventArgs e)
 {
     this.ScrollMove(e.Source);
 }
예제 #40
0
 private void CZBackGround_TouchUp(object sender, TouchEventArgs e)
 {
     Click?.Invoke(XPos, YPos, this);
 }
예제 #41
0
 private void touchBeganHandler(object sender, TouchEventArgs e)
 {
     spawnPrefabAt(e.Touch.Position);
 }
예제 #42
0
 void SceneMainControl_TouchUp(object sender, TouchEventArgs e)
 {
     SceneTrackball.ResetTouchMove();
 }
예제 #43
0
 private void Obj_Button_Hard_Touch(object sender, TouchEventArgs e)
 {
     ChangeDifficulty = "Hard";
 }
예제 #44
0
파일: EditText.cs 프로젝트: dhootha/paradox
        protected override void OnTouchMove(TouchEventArgs args)
        {
            base.OnTouchMove(args);

            OnTouchMoveImpl(args);
        }
예제 #45
0
 private void Obj_Button_Easy_Touch(object sender, TouchEventArgs e)
 {
     ChangeDifficulty = "Easy";
 }
예제 #46
0
 void HandleTouch(object sender, TouchEventArgs e)
 {
     _detector.OnTouchEvent(e.Event);
 }
예제 #47
0
 private void OnTouchUpImpl(TouchEventArgs args)
 {
 }
예제 #48
0
 private static void OnTouchDownImpl(TouchEventArgs args)
 {
 }
예제 #49
0
 private void border_TouchDown(object sender, TouchEventArgs e)
 {
     e.Handled = true;
 }
예제 #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();
 }
예제 #51
0
        private void CallButtonCommand(object sender, TouchEventArgs e)
        {
            var button = sender as Button;

            button.Command.Execute(button.CommandParameter);
        }
예제 #52
0
 private void ListView_TouchDown(object sender, TouchEventArgs e)
 {
 }
예제 #53
0
 private static void OnTouchMoveImpl(TouchEventArgs args)
 {
 }
 internal NativeTouchEventArgs(TouchEventArgs src, NativeJsObject jsObject)
 {
     CopyProps(src, this);
     _jsObject = jsObject;
 }
예제 #55
0
 private void IOTitle_TouchDown(object sender, TouchEventArgs e)
 {
     SetOriginView();
 }
예제 #56
0
 private void OnPinDetailsTouchUp(object sender, TouchEventArgs e)
 {
     m_AboutPageView.ReleaseTouchCapture(e.TouchDevice);
 }
예제 #57
0
 private void Button_TouchDown_2(object sender, TouchEventArgs e)
 {
     ResIdx = 1;
     Close();
 }
예제 #58
0
 protected override void OnPreviewTouchUp(TouchEventArgs e)
 {
     this.ReleaseCurrentDevice();
 }
예제 #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);
    }
예제 #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));
 }