Skip to content

Commit 620230b

Browse files
Add hyperlink function in Xnft (#110)
* opening external link (#102) Covered: 1. WebGL simple one 2. xnft within backpack wallet 3. deeplink mobile * ✨ Add Hyperlink in XNFT --------- Co-authored-by: Zen Republic <[email protected]>
1 parent 3f4afe2 commit 620230b

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mergeInto(LibraryManager.library, {
2+
HyperlinkXNFT : function(linkUrl)
3+
{
4+
url = UTF8ToString(linkUrl);
5+
window.xnft.openWindow(url);
6+
}
7+
});

Runtime/Plugins/HyperlinkXNFT/HyperlinkXNFT.jslib.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Runtime.InteropServices;
2+
using UnityEngine;
3+
4+
// ReSharper disable once CheckNamespace
5+
6+
public class HyperlinkXnft : MonoBehaviour
7+
{
8+
9+
[DllImport("__Internal")]
10+
private static extern void HyperlinkXNFT(string linkUrl);
11+
12+
public void OpenLink(string link)
13+
{
14+
//xnft link has to start with https:// and not have "www" after it. Very important!
15+
#if UNITY_EDITOR
16+
Application.OpenURL(link);
17+
#else
18+
Application.OpenURL(link);
19+
HyperlinkXNFT(link);
20+
#endif
21+
}
22+
23+
24+
}

Runtime/Plugins/HyperlinkXNFT/HyperlinkXnft.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Plugins/HyperlinkXnft.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)