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 { + } + } });