From fd9d770b7148c8ba9c221e36aca6f6232345e55b Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 3 Jan 2025 17:00:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4VR=E7=9A=84UIRoot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIKit/Scripts/Resources/VRUIRoot.prefab | 38 +++++++++---------- Assets/Scenes/Main.unity | 2 +- Assets/Scripts/Actions/MoveAction.cs | 10 ++++- Assets/Scripts/TimeScaleController.cs | 6 +++ 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab b/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab index cb2e0177..05498737 100644 --- a/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab +++ b/Assets/QFramework/Toolkits/UIKit/Scripts/Resources/VRUIRoot.prefab @@ -155,6 +155,7 @@ GameObject: m_Component: - component: {fileID: 1943472158707926008} - component: {fileID: 6717849271440217812} + - component: {fileID: 2720570802681005941} m_Layer: 0 m_Name: ZFrame m_TagString: Untagged @@ -191,6 +192,24 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ViewerScale: 15 +--- !u!114 &2720570802681005941 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 765259898297824089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a0782d2b4482d547ad00c06c17202a4, type: 3} + m_Name: + m_EditorClassIdentifier: + moveSpeed: 5 + rotateSpeed: 1 + xRotationLimit: 60 + enableCollision: 1 + isMov: 1 + isRot: 1 --- !u!1 &1270204780161445289 GameObject: m_ObjectHideFlags: 0 @@ -389,7 +408,6 @@ GameObject: m_Component: - component: {fileID: 6541928711621635503} - component: {fileID: 960705820696497904} - - component: {fileID: -4570605377163019503} m_Layer: 0 m_Name: VRUIRoot m_TagString: Untagged @@ -439,24 +457,6 @@ MonoBehaviour: PopUI: {fileID: 3224602739211204486} RightBottom: {fileID: 3091247338916860046} CanvasPanel: {fileID: 4067008720307835646} ---- !u!114 &-4570605377163019503 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2823787777299435728} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0a0782d2b4482d547ad00c06c17202a4, type: 3} - m_Name: - m_EditorClassIdentifier: - moveSpeed: 5 - rotateSpeed: 1 - xRotationLimit: 60 - enableCollision: 1 - isMov: 1 - isRot: 1 --- !u!1 &2972153487471867409 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 98f9628d..71c1cb4f 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.2846214, g: 0.37120992, b: 0.498806, a: 1} + m_IndirectSpecularColor: {r: 0.5649007, g: 0.6356403, b: 0.72393775, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: diff --git a/Assets/Scripts/Actions/MoveAction.cs b/Assets/Scripts/Actions/MoveAction.cs index 5543055c..6507bcfe 100644 --- a/Assets/Scripts/Actions/MoveAction.cs +++ b/Assets/Scripts/Actions/MoveAction.cs @@ -52,7 +52,15 @@ public class MoveAction : IAction public void OnStart() { - GameObject obj = Utility.FindObj(path); + GameObject obj = null; +#if VR + if (path == "FlyCamera") + { + obj = UIRoot.Instance.transform.Find("ZFrame").gameObject; + } +#else + obj = Utility.FindObj(path); +#endif if (obj == null) { Debug.LogError($"ûҵ·{path}"); diff --git a/Assets/Scripts/TimeScaleController.cs b/Assets/Scripts/TimeScaleController.cs index 554d71aa..fb3cfb1e 100644 --- a/Assets/Scripts/TimeScaleController.cs +++ b/Assets/Scripts/TimeScaleController.cs @@ -12,6 +12,12 @@ public class TimeScaleController : MonoBehaviour private static extern void CopyToClipboard(string text); #endif + private void Awake() + { +#if VR + gameObject.SetActive(false); +#endif + } private void Update() { Time.timeScale = animSpeed;