123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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 InputDeviceHandPartStaticEvent : InputDeviceHandPartEventBase {
- public InputDeviceHandPartStaticEvent(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 (handInfo.iv_extinfo.ges_static[0] > -1 && handInfo.iv_extinfo.ges_static[0] < 13) {
- if (0 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Fist;
- }else if (1 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Point;
- } else if (2 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Peace;
- } else if (3 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Three;
- } else if (4 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Four;
- } else if (5 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Five;
- } else if (6 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Phone;
- } else if (7 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Damn;
- } else if (8 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Gun;
- } else if (9 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Like;
- } else if (10 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_No_Like;
- } else if (11 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_OK;
- } else if (12 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_RockAndRoll;
- } else if (-1 == handInfo.iv_extinfo.ges_static[0]) {
- newEvent = HandEventType.Static_Other;
- }
- }
- 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();
- }
- }
- }
|