From bc24fdb3d8be31ee5b3d27aa7d5e449a5aaa4cc0 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 17:40:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=80=8D=E9=80=9F?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/TimeScaleController.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/Scripts/TimeScaleController.cs b/Assets/Scripts/TimeScaleController.cs index 95a26458..d2afdbe3 100644 --- a/Assets/Scripts/TimeScaleController.cs +++ b/Assets/Scripts/TimeScaleController.cs @@ -9,7 +9,6 @@ public class TimeScaleController : MonoBehaviour public float animSpeed = 1.0f; -#if UNITY_EDITOR private void Update() { Time.timeScale = animSpeed; @@ -30,5 +29,5 @@ public class TimeScaleController : MonoBehaviour animSpeed = 0; } } -#endif + } From ce4418010a51d52d9c331b1791e3075a79f1378c Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 2 Jan 2025 09:49:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/TimeScaleController.cs | 21 +++++++++++++++++-- .../Plugins/WebGLDownloadFile.jslib | 14 ++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/TimeScaleController.cs b/Assets/Scripts/TimeScaleController.cs index d2afdbe3..8699dd02 100644 --- a/Assets/Scripts/TimeScaleController.cs +++ b/Assets/Scripts/TimeScaleController.cs @@ -1,13 +1,16 @@ +using QFramework; using System.Collections; using System.Collections.Generic; using UnityEngine; - public class TimeScaleController : MonoBehaviour { [Range(0, 10)] public float animSpeed = 1.0f; - +#if UNITY_WEBGL + [System.Runtime.InteropServices.DllImport("__Internal")] + private static extern void CopyToClipboard(string text); +#endif private void Update() { @@ -28,6 +31,20 @@ public class TimeScaleController : MonoBehaviour { animSpeed = 0; } +#if UNITY_WEBGL + if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightControl)) + { + if (Input.GetKeyDown(KeyCode.W)) + { + Debug.Log("Ctrl + W £"); + string str = string.Empty; + str = $"Posision:{gameObject.transform.position}\nRotate:{gameObject.transform.eulerAngles}"; + + CopyToClipboard(str); + + } + } +#endif } } diff --git a/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib index 925f54ef..dcdfd155 100644 --- a/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib +++ b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib @@ -11,5 +11,17 @@ mergeInto(LibraryManager.library, { HtmlDownloadWord(bytes,reportdata); - } + }, + CopyToClipboard: function(text) { + + var str = Pointer_stringify(text); + + + if (navigator.clipboard) { + navigator.clipboard.writeText(str).then(function() { + }).catch(function(error) { + }); + } else { + } + } }); From 8e86da4115d86224308ed620b3aacc44804c9cb8 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 2 Jan 2025 09:49:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=8C=82=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/Main.unity | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index f69b36e7..98f9628d 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -139,6 +139,7 @@ GameObject: - component: {fileID: 547432238} - component: {fileID: 547432237} - component: {fileID: 547432236} + - component: {fileID: 547432244} m_Layer: 0 m_Name: FlyCamera m_TagString: MainCamera @@ -340,6 +341,19 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 19.976, y: 11.67, z: 0} +--- !u!114 &547432244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 547432235} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b2c08eae7cce6c9479adebcaad5706c3, type: 3} + m_Name: + m_EditorClassIdentifier: + animSpeed: 1 --- !u!1 &1089184132 GameObject: m_ObjectHideFlags: 0