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 1/2] =?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; From 4e33c3b66fb202650443867f65d0a68f8f96cfcb Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 3 Jan 2025 17:37:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/TimeScaleController.cs | 34 ++++++++++++++++++++------- ProjectSettings/ProjectSettings.asset | 2 +- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/TimeScaleController.cs b/Assets/Scripts/TimeScaleController.cs index fb3cfb1e..346d9436 100644 --- a/Assets/Scripts/TimeScaleController.cs +++ b/Assets/Scripts/TimeScaleController.cs @@ -37,20 +37,38 @@ public class TimeScaleController : MonoBehaviour { animSpeed = 0; } -#if UNITY_WEBGL if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { if (Input.GetKeyDown(KeyCode.Q)) { - Debug.Log("Ctrl + Q £"); string str = string.Empty; - str = $"Posision:{gameObject.transform.position}\nRotate:{gameObject.transform.eulerAngles}"; - + str = $"{gameObject.transform.position}|{gameObject.transform.eulerAngles}"; +#if UNITY_WEBGL + Debug.Log("Ctrl + Q £"); CopyToClipboard(str); - - } - } +#elif UNITY_STANDALONE_WIN && !UNITY_EDITOR + // ʾ + // ݵ + GUIUtility.systemCopyBuffer = str; #endif - } + } +#if UNITY_STANDALONE_WIN &&!UNITY_EDITOR + if (Input.GetKeyDown(KeyCode.E)) + { + string tmp = GUIUtility.systemCopyBuffer; + Debug.LogError("ǰ壺" + tmp); + tmp = tmp.Replace("(", ""); + Debug.LogError(tmp); + tmp = tmp.Replace(")", ""); + Debug.LogError(tmp); + var datas = tmp.Split('|'); + Debug.LogError(datas[0]); + Debug.LogError(datas[1]); + gameObject.transform.position = Utility.GetVector3FromStrArray(datas[0]); + gameObject.transform.eulerAngles = Utility.GetVector3FromStrArray(datas[1]); + } +#endif + } + } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 602b97e7..130e523f 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -845,7 +845,7 @@ PlayerSettings: PS5: DOTWEEN QNX: DOTWEEN Stadia: DOTWEEN - Standalone: DOTWEEN;VR + Standalone: DOTWEEN VisionOS: DOTWEEN WebGL: DOTWEEN Windows Store Apps: DOTWEEN