protected new PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
{
PointerEventData pointerData;
var created = GetPointerData(input.fingerId, out pointerData, true);
pointerData.Reset();
pressed = created || (input.phase == TouchPhase.Began);
released = (input.phase == TouchPhase.Canceled) || (input.phase == TouchPhase.Ended);
//Added
if (Switch.Phase[input.fingerId] == 1)
{
released = true;
pressed = false;
Switch.Phase[input.fingerId] = 2;
}
else if (Switch.Phase[input.fingerId] == 2)
{
Switch.Phase[input.fingerId] = 3;
released = false;
pressed = true;
}
//End added
if (created)
pointerData.position = input.position;
if (pressed)
pointerData.delta = Vector2.zero;
else
pointerData.delta = input.position - pointerData.position;
pointerData.position = input.position;
pointerData.button = PointerEventData.InputButton.Left;
Debug.Log(input.fingerId);
if (Switch.Phase[input.fingerId] == 3)
{
Debug.Log("HERE");
Switch.Phase[input.fingerId] = 0;
RaycastResult result = new RaycastResult();
result.gameObject = Switch.GameObject[input.fingerId];
m_RaycastResultCache.Add(result);
Switch.GameObject[input.fingerId] = null;
}
else
{
eventSystem.RaycastAll(pointerData, m_RaycastResultCache);
}
var raycast = FindFirstRaycast(m_RaycastResultCache);
pointerData.pointerCurrentRaycast = raycast;
m_RaycastResultCache.Clear();
return pointerData;
}