diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs | 79 |
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;
+ }
+
+ }
+}
|