蓝色星空 1 an în urmă
părinte
comite
febec2b0ca

+ 74 - 0
Assets/Resources/Template/Prefab/Text.prefab

@@ -28,6 +28,7 @@ RectTransform:
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 2828833022409846366}
   m_RootOrder: 0
@@ -60,6 +61,7 @@ MonoBehaviour:
   m_Material: {fileID: 0}
   m_Color: {r: 1, g: 1, b: 1, a: 1}
   m_RaycastTarget: 1
+  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
   m_Maskable: 1
   m_OnCullStateChanged:
     m_PersistentCalls:
@@ -103,6 +105,7 @@ RectTransform:
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 2828833022409846366}
   m_RootOrder: 1
@@ -135,6 +138,7 @@ MonoBehaviour:
   m_Material: {fileID: 0}
   m_Color: {r: 1, g: 1, b: 1, a: 1}
   m_RaycastTarget: 1
+  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
   m_Maskable: 1
   m_OnCullStateChanged:
     m_PersistentCalls:
@@ -196,6 +200,7 @@ RectTransform:
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 0.001, y: 0.001, z: 0.001}
+  m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2828833021118674286}
   - {fileID: 2828833021312147513}
@@ -250,6 +255,7 @@ MonoBehaviour:
   m_FallbackScreenDPI: 96
   m_DefaultSpriteDPI: 96
   m_DynamicPixelsPerUnit: 1
+  m_PresetInfoIsWorld: 0
 --- !u!114 &2828833022409846361
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -279,6 +285,8 @@ GameObject:
   - component: {fileID: 4020363977020836969}
   - component: {fileID: 6564544425676368077}
   - component: {fileID: 183926529109974472}
+  - component: {fileID: 3735631276721690460}
+  - component: {fileID: 8298780282426106108}
   m_Layer: 0
   m_Name: Text
   m_TagString: Untagged
@@ -296,6 +304,7 @@ Transform:
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2828833022409846366}
   m_Father: {fileID: 0}
@@ -367,3 +376,68 @@ MonoBehaviour:
   canTwoHandScale: 0
   minScaleRatio: 0.5
   maxScaleRatio: 3
+--- !u!114 &3735631276721690460
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2828833022510646943}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 761d3c9fbe9f13f47818f9c59cd6aa03, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  activation: 0
+  flattenAxis: 3
+  activeHandle: 6
+  m_HandlerAssets: {fileID: 0}
+  activeScaleMinRestrict: 1
+  scaleMinimum: 0.05
+  activeScaleMaxRestrict: 0
+  scaleMaximum: 2
+  scaleHandleSize: 0.016
+  BoundBoxCollider: {fileID: 0}
+  rotationHandleSize: 0.016
+  showRotationHandleForX: 1
+  showRotationHandleForY: 1
+  showRotationHandleForZ: 1
+  axisScaleHandleSize: 0.016
+  activeAxis: -2
+  RotateStartAudio: 4
+  RotateStopAudio: 3
+  ScaleStartAudio: 4
+  ScaleStopAudio: 3
+  RotateStarted:
+    m_PersistentCalls:
+      m_Calls: []
+  RotateStopped:
+    m_PersistentCalls:
+      m_Calls: []
+  ScaleStarted:
+    m_PersistentCalls:
+      m_Calls: []
+  ScaleStopped:
+    m_PersistentCalls:
+      m_Calls: []
+  Rotating:
+    m_PersistentCalls:
+      m_Calls: []
+  Scaling:
+    m_PersistentCalls:
+      m_Calls: []
+--- !u!114 &8298780282426106108
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2828833022510646943}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: f2c924915f6be274b8af2986784ee2c1, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  boundingBox: {fileID: 3735631276721690460}
+  manipulationHandler: {fileID: 183926529109974472}
+  obj_BoundingBox: {fileID: 0}

+ 98 - 0
Assets/Scripts/AllMoveEvent.cs

@@ -0,0 +1,98 @@
+using SC.XR.Unity.Module_InputSystem;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class AllMoveEvent : MonoBehaviour
+{
+    // Start is called before the first frame update
+    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);
+            }
+        }
+    }
+
+
+    // Update is called once per frame
+    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);
+            }
+        }
+    }
+}

+ 11 - 0
Assets/Scripts/AllMoveEvent.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0f8cfa0dd8d754142b739c1d8685f79c
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: