some updates
This commit is contained in:
@@ -25,8 +25,24 @@ public class TrackTouchRegion : MonoBehaviour, IPointerDownHandler, IPointerUpHa
|
||||
private int activePointerId = int.MinValue;
|
||||
private bool pressed = false;
|
||||
|
||||
private static bool ShouldProcessTouchInput()
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (!ShouldProcessTouchInput())
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
if (!ShouldProcessTouchInput()) return;
|
||||
if (pressed) return; // already driven by another finger; ignore extras
|
||||
var im = InputManager.Instance;
|
||||
if (im == null) return;
|
||||
@@ -38,6 +54,7 @@ public class TrackTouchRegion : MonoBehaviour, IPointerDownHandler, IPointerUpHa
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
if (!ShouldProcessTouchInput()) return;
|
||||
if (!pressed || eventData.pointerId != activePointerId) return;
|
||||
var im = InputManager.Instance;
|
||||
|
||||
@@ -48,6 +65,8 @@ public class TrackTouchRegion : MonoBehaviour, IPointerDownHandler, IPointerUpHa
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (!ShouldProcessTouchInput()) return;
|
||||
|
||||
// If the region is hidden/destroyed mid-hold, make sure the track is released
|
||||
// so a note is not left stuck in the held state.
|
||||
if (pressed)
|
||||
|
||||
Reference in New Issue
Block a user