using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using UnityEngine.EventSystems; namespace SC.XR.Unity.Module_InputSystem.InputDeviceHand { public class InputDeviceHandPartDynamicClickEvent : InputDeviceHandPartEventBase { public InputDeviceHandPartDynamicClickEvent(InputDevicePartDispatchEventHand inputDevicePartDispatchEventHand) : base(inputDevicePartDispatchEventHand) { } public override void OnSCStart() { base.OnSCStart(); newEvent = previousEvent = currentEvent = HandEventType.Null; } HandEventType newEvent; protected override void OnUpdateEvent() { currentEvent = HandEventType.Null; if (-1 == handInfo.iv_extinfo.ges_dynamic[0]) {//no action not null //newEvent = HandEventType.Null; } else if (0 == handInfo.iv_extinfo.ges_dynamic[0]) { newEvent = HandEventType.Dynamic_Click_Down; } else if (1 == handInfo.iv_extinfo.ges_dynamic[0]) { newEvent = HandEventType.Dynamic_Click; } else if (2 == handInfo.iv_extinfo.ges_dynamic[0]) { newEvent = HandEventType.Dynamic_Click_Hold; } else if (3 == handInfo.iv_extinfo.ges_dynamic[0]) { newEvent = HandEventType.Dynamic_Click_Up; } if (newEvent != previousEvent) { previousEvent = newEvent; currentEvent = newEvent; } //if (currentEvent != HandEventType.Null) { // DebugMy.Log(inputDeviceHandPart.PartType + " Event -----> " + currentEvent, this, true); //} } public override void OnSCDisable() { if (previousEvent != HandEventType.Null) { currentEvent = HandEventType.Null; } base.OnSCDisable(); } } }