From 806bd0d4046f83c9931db1e5e300bd0ac6b60833 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Mon, 31 Mar 2025 08:39:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0VR=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIKit/Scripts/Resources/VRUIRoot.prefab | 14 +++++------ Assets/Scripts/Extension/DeviceDraggable.cs | 24 +++++++++++++++++++ .../Scripts/Extension/DeviceDraggable.cs.meta | 11 +++++++++ Assets/Scripts/Item/DeviceItem.cs | 2 ++ Assets/WebPlatform.meta | 8 +++++++ 5 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 Assets/Scripts/Extension/DeviceDraggable.cs create mode 100644 Assets/Scripts/Extension/DeviceDraggable.cs.meta create mode 100644 Assets/WebPlatform.meta diff --git a/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab b/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab index 343b267b..7fc3f886 100644 --- a/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab +++ b/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab @@ -123,8 +123,8 @@ Transform: m_GameObject: {fileID: 598348144801550191} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.1465, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: 0, y: 2.1975, z: 0} + m_LocalScale: {x: 15, y: 15, z: 15} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5974269590546671381} @@ -144,7 +144,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Frame: {fileID: 6717849271440217812} - ViewerScale: 1 + ViewerScale: 15 --- !u!1 &765259898297824089 GameObject: m_ObjectHideFlags: 0 @@ -174,7 +174,7 @@ Transform: serializedVersion: 2 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_LocalScale: {x: 15, y: 15, z: 15} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 964729101505013327} @@ -192,7 +192,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b20817e9db276aa4182f6e0885aa2ddf, type: 3} m_Name: m_EditorClassIdentifier: - ViewerScale: 1 + ViewerScale: 15 --- !u!114 &2720570802681005941 MonoBehaviour: m_ObjectHideFlags: 0 @@ -634,7 +634,7 @@ Transform: m_GameObject: {fileID: 3400309332038407868} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0, z: -0.000000059604645} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1129,7 +1129,7 @@ Transform: m_GameObject: {fileID: 4951725383111470759} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0, z: -0.000000059604645} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Scripts/Extension/DeviceDraggable.cs b/Assets/Scripts/Extension/DeviceDraggable.cs new file mode 100644 index 00000000..1e91f2fe --- /dev/null +++ b/Assets/Scripts/Extension/DeviceDraggable.cs @@ -0,0 +1,24 @@ +using GCSeries.Core.Samples; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; + +public class DeviceDraggable : Draggable +{ + Vector3 pos; + Vector3 rot; + private void Awake() + { + pos = transform.position; + rot = transform.localEulerAngles; + } + + public override void OnEndDrag(PointerEventData eventData) + { + base.OnEndDrag(eventData); + transform.position = pos; + transform.localEulerAngles = rot; + } + +} diff --git a/Assets/Scripts/Extension/DeviceDraggable.cs.meta b/Assets/Scripts/Extension/DeviceDraggable.cs.meta new file mode 100644 index 00000000..74aa391c --- /dev/null +++ b/Assets/Scripts/Extension/DeviceDraggable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c2b2028d0dec50841b6e5477b275f265 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index 81b8a599..dda21e49 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -54,6 +54,8 @@ public class DeviceItem : MonoBehaviour UIRoot.Instance.transform.Find("ZStylus").GetComponent().OnObjectExited.AddListener(OnObjExit); UIRoot.Instance.transform.Find("ZMouse").GetComponent().OnClick.AddListener(OnClick); UIRoot.Instance.transform.Find("ZStylus").GetComponent().OnClick.AddListener(OnClick); + + gameObject.GetOrAddComponent(); #endif } diff --git a/Assets/WebPlatform.meta b/Assets/WebPlatform.meta new file mode 100644 index 00000000..b4ce8b4f --- /dev/null +++ b/Assets/WebPlatform.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8daec37f39bdca34e922be7644ef97c1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: