本文整理汇总了C#中TouchPoint类的典型用法代码示例。如果您正苦于以下问题:C# TouchPoint类的具体用法?C# TouchPoint怎么用?C# TouchPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TouchPoint类属于命名空间,在下文中一共展示了TouchPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkHitUI
public UIComponent checkHitUI(TouchPoint p) {
foreach (UIComponent c in componentList)
{
return c.processTouchPoint(p);
}
return null;
}
示例2: processTouchPoint
public override UIComponent processTouchPoint(TouchPoint p)
{
if (p != null)
{
if (componentArea.Contains(new Point((int)p.X, (int)p.Y)))
{
if (verticalScroller)
{
float dFromTop;
dFromTop = (float)(p.Y - componentArea.Y);
slideRatio = dFromTop / componentArea.Height;
indicatorArea = new Rectangle(componentArea.X, (int)(slideRatio * componentArea.Height) + componentArea.Y - (defaultTexture.Width /2) , defaultTexture.Width, defaultTexture.Width);
}
else {
float dFromLeft;
dFromLeft = (float)(p.X - componentArea.X);
slideRatio = dFromLeft / componentArea.Width;
indicatorArea = new Rectangle((int)(slideRatio * componentArea.Width) + componentArea.X - (defaultTexture.Height / 2), componentArea.Y, defaultTexture.Height, defaultTexture.Height);
}
updateListeners();
return this;
}
}
return null;
}
示例3: processDrag
public bool processDrag(TouchPoint touch, float dt)
{
//If the window is touch or a previous touch is still going on
if (_area.Contains((int)touch.X, (int)touch.Y) || _touchId == touch.Id)
{
Vector2 newPos = new Vector2(touch.X, touch.Y);
Vector2 bckUpPos = _position;
_position = newPos;
Rectangle newArea = computeUIArea(this);
_position = bckUpPos;
if (!MyGame.ScreenArea.Contains(newArea) || MyGame.MapArea.Intersects(newArea))
{
newPos = _position;
}
_velocity = (_velocity * NB_MOVE_RECORDED + (newPos - _position) / dt * SPEED_COEF) / (NB_MOVE_RECORDED + 1f);
_position = newPos;
_area = computeUIArea(this);
_touchId = touch.Id;
_touchReleased = false;
//A touch should only move one UI window
return true;
}
else
{
_touchReleased = true;
return false;
}
}
示例4: TouchZone
protected TouchZone(string name, TouchConfiguration touchConfiguration, int[,] mask)
{
Name = name;
_touchConfiguration = touchConfiguration;
Mask = mask;
_current = new TouchPoint();
}
示例5: UpdateTouches
public static List<TouchPoint> UpdateTouches()
{
_Touches.Clear();
_TouchIDs.Clear();
LastCheck = Time.time;
if (Input.touchCount > 0) {
for (int i = 0; i < Input.touchCount; i++) {
Touch touch = Input.GetTouch(i);
Vector3 pos = Camera.main.ScreenToWorldPoint(touch.position);
var touchPoint = new TouchPoint {
ID = touch.fingerId,
Position = pos,
Phase = touch.phase
};
_Touches.Add(touchPoint);
_TouchIDs.Add(touchPoint.ID, touchPoint);
}
}
else if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) {
Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
TouchPhase phase = Input.GetMouseButtonDown(0) ? TouchPhase.Began : Input.GetMouseButtonUp(0) ? TouchPhase.Ended : TouchPhase.Moved;
var touchPoint = new TouchPoint {
ID = 1,
Position = pos,
Phase = phase
};
_Touches.Add(touchPoint);
_TouchIDs.Add(touchPoint.ID, touchPoint);
}
return _Touches;
}
示例6: TouchMove
public void TouchMove(object sdr, Type t, TouchDevice touchDevice, TouchPoint touchPoint)
{
My_Point point = Point_List.UpdatePoint(sdr, t, touchDevice.Id, touchPoint);
if (point != null && (t == typeof(Card_Layer)))
{
///Show gesture indicator
//if (point.Life > STATICS.MIN_GESTURE_LIFE)
//{
// FrameworkElement sender = point.Sender as FrameworkElement;
// lock (Point_List.TouchPointList)
// {
// if (!mainWindow.GestureIndicatorLayer.Contain(touchDevice.Id))
// {
// mainWindow.GestureIndicatorLayer.Add(touchDevice.Id, touchPoint.Position);
// }
// else
// {
// mainWindow.GestureIndicatorLayer.Move(touchDevice.Id, touchPoint.Position);
// }
// }
//}
}
}
示例7: updateOnce
/// <inheritdoc />
protected override void updateOnce(TouchPoint touch)
{
base.updateOnce(touch);
stringBuilder.Length = 0;
stringBuilder.Append("Touch id: ");
stringBuilder.Append(touch.Id);
gameObject.name = stringBuilder.ToString();
if (Text == null) return;
if (!ShowTouchId && !ShowTags) return;
stringBuilder.Length = 0;
if (ShowTouchId)
{
stringBuilder.Append("Id: ");
stringBuilder.Append(touch.Id);
}
if (ShowTags)
{
if (stringBuilder.Length > 0) stringBuilder.Append("\n");
stringBuilder.Append("Tags: ");
stringBuilder.Append(touch.Tags.ToString());
}
Text.text = stringBuilder.ToString();
}
示例8: Awake
void Awake()
{
//ステート
state.setState(GameState.NotPlaying);
//デブ
GameObject g = (GameObject)Resources.Load("Debu");
debu = (GameObject)Instantiate(g, g.transform.position, g.transform.rotation);
//プレイヤー
target = GameObject.Find("PlayerSibo");
//ポジション
defaultPosition = transform.position;
defaultAngles = transform.eulerAngles;
rotate = new Vector3(0, 10f, 0);
approachPoint = target.transform.position - transform.position;
//フォグ
g = (GameObject)Resources.Load("TransformFog");
transformFog =
(GameObject)Instantiate(g, g.transform.position, g.transform.rotation);
transformFog.SetActive(false);
//スキップ
skip = false;
//タッチパッド
touchPoint = FindObjectOfType<TouchPoint>();
}
示例9: GetDelta
private double GetDelta(TouchPoint tpOne, TouchPoint tpTwo)
{
double tpOneYPos = tpOne.Position.Y;
double tpTwoYPos = tpTwo.Position.Y;
return tpOneYPos > tpTwoYPos ? tpOneYPos - tpTwoYPos : tpTwoYPos - tpOneYPos;
}
示例10: IsUnderneath
public bool IsUnderneath(TouchPoint t)
{
var tx = t.CenterX;
var ty = t.CenterY;
return (tx > x && tx < x + w && ty > y && ty < y + h);
}
示例11: Tap
public void Tap(TouchPoint tp)
{
if (hasActiveId && activeId == tp.Id)
{
tapedPoint = new Point((int)tp.CenterX, (int)tp.CenterY);
taped = true;
}
}
示例12: ShouldReceiveTouch
/// <inheritdoc />
public override bool ShouldReceiveTouch(TouchPoint touch)
{
if (!IgnoreChildren) return base.ShouldReceiveTouch(touch);
if (!base.ShouldReceiveTouch(touch)) return false;
if (touch.Target != cachedTransform) return false;
return true;
}
示例13: Down
public void Down(TouchPoint tp)
{
if (hasActiveId)
return;
hasActiveId = true;
activeId = tp.Id;
startingPos = new Vector2(tp.CenterX, tp.CenterY);
actualPos = new Vector2(tp.CenterX, tp.CenterY);
}
示例14: IsTouchOnTarget
/// <summary>
/// Determines whether the touch is over a specific GameObject.
/// </summary>
/// <param name="touch"> The touch. </param>
/// <param name="target"> The target. </param>
/// <returns> <c>true</c> if the touch is over the GameObject; <c>false</c> otherwise.</returns>
public static bool IsTouchOnTarget(TouchPoint touch, Transform target)
{
if (touch == null || touch.Layer == null || target == null) return false;
TouchHit hit;
if ((touch.Layer.Hit(touch.Position, out hit) == TouchLayer.LayerHitResult.Hit) &&
(target == hit.Transform || hit.Transform.IsChildOf(target)))
return true;
return false;
}
示例15: CheckAndHandleTap
public virtual bool CheckAndHandleTap(TouchPoint t)
{
if (IsUnderneath(t))
{
action();
return true;
}
else return false;
}