本文整理汇总了C#中TouchEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TouchEventArgs类的具体用法?C# TouchEventArgs怎么用?C# TouchEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TouchEventArgs类属于命名空间,在下文中一共展示了TouchEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BoxExRenderer_Touch
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;
}
示例2: OnTouchImageView
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;
}
}
示例3: HScrollViewTouch
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;
}
}
示例4: HandleButtonButtonAction
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();
}
}
示例5: Touched
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;
}
}
示例6: closeDialog
private void closeDialog(object sender, TouchEventArgs e)
{
FadeOutEffect fadeOutEffect = new FadeOutEffect(
this, 500, FadeOutEffectInterpolator.Linear);
fadeOutEffect.Start();
this.Hide(fadeOutEffect);
}
示例7: touchesBeganHandler
private void touchesBeganHandler(object sender, TouchEventArgs e)
{
foreach (var point in e.Touches)
{
spawnPrefabAt(point.Position);
}
}
示例8: ChangeToStatusScene
public void ChangeToStatusScene(object sender, TouchEventArgs e)
{
Sounds.PlayOk();
Scenes.characterStatusScene.UpdateValue();
Scenes.characterStatusScene.ScrollPanel_1_Skills.UpdateSkills();
UISystem.SetScene(Scenes.characterStatusScene);
}
示例9: HandleStartButtonTouchEventReceived
void HandleStartButtonTouchEventReceived(object sender, TouchEventArgs e)
{
Console.WriteLine( selectedLevel );
this.RootWidget.Dispose();
UISystem.SetScene( new LoadingScene( selectedLevel ) );
// Director.Instance.ReplaceScene( new GameScene( selectedLevel ) );
}
示例10: OnInterceptTouchEvent
public override bool OnInterceptTouchEvent (MotionEvent ev)
{
TouchEventArgs eventArgs = new TouchEventArgs (true, ev);
HandleGenericMotion (this, eventArgs);
return base.OnInterceptTouchEvent(ev);
}
示例11: touchesEndedHandler
private void touchesEndedHandler(object sender, TouchEventArgs e)
{
foreach (var touch in e.Touches)
{
ITouch _touch;
if (!ftlTouches.TryGetValue(touch.Id, out _touch)) return;
}
}
示例12: UpdateInput
private void UpdateInput(object sender, TouchEventArgs e)
{
TouchPoint tmp = e.TouchPoint;
if (tmp.IsTagRecognized)
{
SendUpdate.doSend(tmp);
}
}
示例13: MapControl_Touch
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;
}
}
示例14: HandleTouch
/// <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: setSkillDefault
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;
}
}