summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs b/Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs
new file mode 100644
index 00000000..a360ddeb
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs
@@ -0,0 +1,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;
+ }
+
+ }
+}