summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs
blob: a360ddeb438787f85f563d4e79f5d81f5c288da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using UnityEngine;

namespace XMainClient
{
	internal class XTouchItem
	{
		public bool Fake { get; set; }

		public float DeltaTime
		{
			get
			{
				return this.Fake ? this.faketouch.deltaTime : this.touch.deltaTime;
			}
		}

		public int FingerId
		{
			get
			{
				return this.Fake ? this.faketouch.fingerId : this.touch.fingerId;
			}
		}

		public TouchPhase Phase
		{
			get
			{
				return this.Fake ? this.faketouch.phase : this.touch.phase;
			}
		}

		public Vector2 Position
		{
			get
			{
				return this.Fake ? this.faketouch.position : this.touch.position;
			}
		}

		public Vector2 RawPosition
		{
			get
			{
				return this.Fake ? this.faketouch.rawPosition : this.touch.rawPosition;
			}
		}

		public int TapCount
		{
			get
			{
				return this.Fake ? this.faketouch.tapCount : this.touch.tapCount;
			}
		}

		public Touch touch;

		public XFakeTouch faketouch;

		public void Convert2FakeTouch(TouchPhase phase)
		{
			this.faketouch.fingerId = this.touch.fingerId;
			this.faketouch.position = this.touch.position;
			this.faketouch.deltaTime = this.touch.deltaTime;
			this.faketouch.deltaPosition = this.touch.deltaPosition;
			this.faketouch.phase = phase;
			this.faketouch.tapCount = this.touch.tapCount;
			this.Fake = true;
		}

		public override string ToString()
		{
			return "DeltaTime=" + DeltaTime + ", FingerId=" + FingerId + ", Phase=" + Phase + ", Pos=" + Position + ", RawPos=" + RawPosition + ", TapCount=" + TapCount;  
		}

	}
}