1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using SC.XR.Unity.Module_InputSystem;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class AllMoveEvent : MonoBehaviour
- {
-
- void Start()
- {
- DispatcherBase.KeyDownDelegateRegister(downEvent);
- DispatcherBase.KeyUpDelegateRegister(upEvent);
- }
- InputDevicePartBase NowPart ;
- private void upEvent(InputKeyCode keyCode, InputDevicePartBase part)
- {
- if(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject!=null&& part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>()==null)
- {
- checkMoveUp(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject, part);
- }
- NowPart = null;
- }
- public void checkMoveUp(GameObject obj, InputDevicePartBase part)
- {
- if(obj)
- {
- ManipulationHandler m = obj.GetComponent<ManipulationHandler>();
- if(m!=null)
- {
- m.OnPointerUp(part.inputDataBase.SCPointEventData);
- }
- else
- {
- if (obj.transform.parent != null)
- checkMoveUp(obj.transform.parent.gameObject, part);
- }
- }
- }
- private void downEvent(InputKeyCode keyCode, InputDevicePartBase part)
- {
- if (part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject != null && part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>() == null)
- {
- checkMoveDown(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject, part);
- }
- NowPart = part;
- }
- public void checkMoveDown(GameObject obj, InputDevicePartBase part)
- {
- if (obj)
- {
- ManipulationHandler m = obj.GetComponent<ManipulationHandler>();
- if (m != null)
- {
- m.OnPointerDown(part.inputDataBase.SCPointEventData);
- }
- else
- {
- if (obj.transform.parent != null)
- checkMoveDown(obj.transform.parent.gameObject, part);
- }
- }
- }
-
- void Update()
- {
- if (NowPart!=null&&NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject != null && NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>() == null)
- {
- checkMoveDrag(NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject, NowPart);
- }
- }
- public void checkMoveDrag(GameObject obj, InputDevicePartBase part)
- {
- if (obj)
- {
- ManipulationHandler m = obj.GetComponent<ManipulationHandler>();
- if (m != null)
- {
- m.OnDrag(part.inputDataBase.SCPointEventData);
- }
- else
- {
- if(obj.transform.parent!=null)
- checkMoveDrag(obj.transform.parent.gameObject, part);
- }
- }
- }
- }
|