From 241a8b2712de2481409592e0456364f246c22559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nauris=20Andz=CC=8Ca=CC=84ns?= Date: Fri, 19 Apr 2024 15:29:08 +0300 Subject: [PATCH 1/3] Added helper for WebGL clipboard functionality. --- Assets/Plugins/WebGL.meta | 8 +++++ Assets/Plugins/WebGL/WebGLClipboard.jslib | 11 +++++++ .../Plugins/WebGL/WebGLClipboard.jslib.meta | 32 +++++++++++++++++++ .../TDK/Runtime/Connect/Utils/CopyButton.cs | 2 +- .../TDK/Runtime/Utils/ClipboardHelper.cs | 17 ++++++++++ .../TDK/Runtime/Utils/ClipboardHelper.cs.meta | 11 +++++++ 6 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 Assets/Plugins/WebGL.meta create mode 100644 Assets/Plugins/WebGL/WebGLClipboard.jslib create mode 100644 Assets/Plugins/WebGL/WebGLClipboard.jslib.meta create mode 100644 Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs create mode 100644 Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs.meta diff --git a/Assets/Plugins/WebGL.meta b/Assets/Plugins/WebGL.meta new file mode 100644 index 00000000..cc0cf57f --- /dev/null +++ b/Assets/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c0cf1a16aa6c14f10816ee5f16ff709e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/WebGL/WebGLClipboard.jslib b/Assets/Plugins/WebGL/WebGLClipboard.jslib new file mode 100644 index 00000000..4f42fa65 --- /dev/null +++ b/Assets/Plugins/WebGL/WebGLClipboard.jslib @@ -0,0 +1,11 @@ +// WebGLClipboard.jslib +mergeInto(LibraryManager.library, { + CopyToClipboard: function(textPointer) { + var text = UTF8ToString(textPointer); + navigator.clipboard.writeText(text).then(function() { + console.log('Text copied to clipboard'); + }).catch(function(err) { + console.error('Could not copy text:', err); + }); + } +}); \ No newline at end of file diff --git a/Assets/Plugins/WebGL/WebGLClipboard.jslib.meta b/Assets/Plugins/WebGL/WebGLClipboard.jslib.meta new file mode 100644 index 00000000..e56819e5 --- /dev/null +++ b/Assets/Plugins/WebGL/WebGLClipboard.jslib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: d09a7c21a48fd491a8d5f93e2ec44d41 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Treasure/TDK/Runtime/Connect/Utils/CopyButton.cs b/Assets/Treasure/TDK/Runtime/Connect/Utils/CopyButton.cs index dd9b6485..0f17fe3c 100644 --- a/Assets/Treasure/TDK/Runtime/Connect/Utils/CopyButton.cs +++ b/Assets/Treasure/TDK/Runtime/Connect/Utils/CopyButton.cs @@ -27,7 +27,7 @@ private void Start() { button.onClick.AddListener(() => { - GUIUtility.systemCopyBuffer = _textToCopy; + ClipboardHelper.Copy(_textToCopy); icon.sprite = checkIcon; }); } diff --git a/Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs b/Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs new file mode 100644 index 00000000..f90a56f7 --- /dev/null +++ b/Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs @@ -0,0 +1,17 @@ +using System.Runtime.InteropServices; +using UnityEngine; + +public static class ClipboardHelper +{ + [DllImport("__Internal")] + private static extern void CopyToClipboard(string text); + + public static void Copy(string text) + { +#if UNITY_WEBGL + CopyToClipboard(text); +#else + GUIUtility.systemCopyBuffer = text; +#endif + } +} \ No newline at end of file diff --git a/Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs.meta b/Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs.meta new file mode 100644 index 00000000..065c24e5 --- /dev/null +++ b/Assets/Treasure/TDK/Runtime/Utils/ClipboardHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 37e84d98121bf4997b14b00e51ff86b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 7da6325e684b17560365389b177869a497dfa4d7 Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:27:57 -0500 Subject: [PATCH 2/3] update mainnet contract addresses (#40) * update mainnet contract addresses * add emberwing mainnet address --- Assets/Treasure/TDK/Runtime/Common/Constants.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Treasure/TDK/Runtime/Common/Constants.cs b/Assets/Treasure/TDK/Runtime/Common/Constants.cs index b370f81f..b433367d 100644 --- a/Assets/Treasure/TDK/Runtime/Common/Constants.cs +++ b/Assets/Treasure/TDK/Runtime/Common/Constants.cs @@ -38,9 +38,9 @@ public static class Constants { Contract.Consumables, "0xf3d00a2559d84de7ac093443bcaada5f4ee4165c" }, { Contract.Legions, "0xfe8c1ac365ba6780aec5a985d989b327c27670a1" }, { Contract.Treasures, "0xebba467ecb6b21239178033189ceae27ca12eadf" }, - { Contract.CorruptionRemoval, "0xebba467ecb6b21239178033189ceae27ca12eadf" }, + { Contract.CorruptionRemoval, "0x08f3533acdf2b9c400204056f771bdd6f1f1c200" }, { Contract.ERC1155TokenSetCorruptionHandler, "0x3c62778d8e01ed17c1048b64edaf121d36c71a4e" }, - { Contract.HarvesterEmberwing, "0x08f3533acdf2b9c400204056f771bdd6f1f1c200" }, + { Contract.HarvesterEmberwing, "0x36882e71d11eadd9f869b0fd70d18d5045939986" }, { Contract.ZeeverseZee, "0x094fa8ae08426ab180e71e60fa253b079e13b9fe" }, { Contract.ZeeverseItems, "0x58318bceaa0d249b62fad57d134da7475e551b47" }, } From 8824c7fd3e5a2cc00d6b86f8e087b3aea715c308 Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:30:24 -0500 Subject: [PATCH 3/3] bump version (#41) --- Assets/Treasure/TDK/Runtime/TDKVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Treasure/TDK/Runtime/TDKVersion.cs b/Assets/Treasure/TDK/Runtime/TDKVersion.cs index 9a77684c..51487750 100644 --- a/Assets/Treasure/TDK/Runtime/TDKVersion.cs +++ b/Assets/Treasure/TDK/Runtime/TDKVersion.cs @@ -3,6 +3,6 @@ public static class TDKVersion { public static string name = "tdk-unity"; - public static string version = "0.2.7"; + public static string version = "0.2.8"; } }