1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 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 {
- public abstract class DispatcherBase : SCModule {
- public InputDevicePartDispatchEventBase inputDevicePartDispatchEventBase;
- public DispatcherBase(InputDevicePartDispatchEventBase inputDevicePartDispatchEventBase) {
- this.inputDevicePartDispatchEventBase = inputDevicePartDispatchEventBase;
- }
- /// <summary>
- /// When Any part Device of Any key Down will invoke this delegate
- /// </summary>
- /// <param name="keyCode">which key</param>
- /// <param name="part">which part,part.PartType</param>
- static event AnyKeyEventDelegate AnyKeyDownDelegate;
- /// <summary>
- /// When Any part Device of Any key Up will invoke this delegate
- /// </summary>
- /// <param name="keyCode">which key</param>
- /// <param name="part">which part,part.PartType</param>
- static event AnyKeyEventDelegate AnyKeyUpDelegate;
- /// <summary>
- /// When Any part Device of Any key Long will invoke this delegate
- /// </summary>
- /// <param name="keyCode">which key</param>
- /// <param name="part">which part,part.PartType</param>
- static event AnyKeyEventDelegate AnyKeyLongDelegate;
- /// <summary>
- /// When Any part Device of Any key TouchEnter will invoke this delegate
- /// </summary>
- /// <param name="keyCode">which key</param>
- /// <param name="part">which part,part.PartType</param>
- static event AnyKeyEventDelegate AnyKeyTouchEnterDelegate;
- /// <summary>
- /// When Any part Device of Any key TouchExit will invoke this delegate
- /// </summary>
- /// <param name="keyCode">which key</param>
- /// <param name="part">which part,part.PartType</param>
- static event AnyKeyEventDelegate AnyKeyTouchExitDelegate;
- public static void KeyDownDelegateInvoke(InputKeyCode keyCode,InputDevicePartBase inputDevicePart) {
- AnyKeyDownDelegate?.Invoke(keyCode, inputDevicePart);
- }
- public static void KeyUpDelegateInvoke(InputKeyCode keyCode, InputDevicePartBase inputDevicePart) {
- AnyKeyUpDelegate?.Invoke(keyCode, inputDevicePart);
- }
- public static void KeyLongDelegateInvoke(InputKeyCode keyCode, InputDevicePartBase inputDevicePart) {
- AnyKeyLongDelegate?.Invoke(keyCode, inputDevicePart);
- }
- public static void KeyTouchEnterDelegateInvoke(InputKeyCode keyCode, InputDevicePartBase inputDevicePart) {
- AnyKeyTouchEnterDelegate?.Invoke(keyCode, inputDevicePart);
- }
- public static void KeyTouchExitDelegateInvoke(InputKeyCode keyCode, InputDevicePartBase inputDevicePart) {
- AnyKeyTouchExitDelegate?.Invoke(keyCode, inputDevicePart);
- }
- public static void KeyDownDelegateRegister(AnyKeyEventDelegate keyDownEventDelegate) { AnyKeyDownDelegate += keyDownEventDelegate; }
- public static void KeyDownDelegateUnRegister(AnyKeyEventDelegate keyDownEventDelegate) { AnyKeyDownDelegate -= keyDownEventDelegate; }
- public static void KeyUpDelegateRegister(AnyKeyEventDelegate keyUpEventDelegate) { AnyKeyUpDelegate += keyUpEventDelegate; }
- public static void KeyUpDelegateUnRegister(AnyKeyEventDelegate keyUpEventDelegate) { AnyKeyUpDelegate -= keyUpEventDelegate; }
- public static void KeyLongDelegateRegister(AnyKeyEventDelegate keyLongEventDelegate) { AnyKeyLongDelegate += keyLongEventDelegate; }
- public static void KeyLongDelegateUnRegister(AnyKeyEventDelegate keyLongEventDelegate) { AnyKeyLongDelegate -= keyLongEventDelegate; }
- public static void KeyTouchEnterDelegateRegister(AnyKeyEventDelegate keyTouchEnterEventDelegate) { AnyKeyTouchEnterDelegate += keyTouchEnterEventDelegate; }
- public static void KeyTouchEnterDelegateUnRegister(AnyKeyEventDelegate keyTouchEnterEventDelegate) { AnyKeyTouchEnterDelegate -= keyTouchEnterEventDelegate; }
- public static void KeyTouchExitDelegateRegister(AnyKeyEventDelegate keyTouchExitEventDelegate) { AnyKeyTouchExitDelegate += keyTouchExitEventDelegate; }
- public static void KeyTouchExitDelegateUnRegister(AnyKeyEventDelegate keyTouchExitEventDelegate) { AnyKeyTouchExitDelegate -= keyTouchExitEventDelegate; }
- }
- }
|