From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/Input/XTouchItem.cs | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs (limited to 'Client/Assets/Scripts/XMainClient/Input/XTouchItem.cs') 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; + } + + } +} -- cgit v1.1-26-g67d0