You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1006 B
36 lines
1006 B
using System.Runtime.InteropServices; |
|
using UnityEngine; |
|
using UnityEngine.EventSystems; |
|
|
|
namespace BestHTTP.Examples |
|
{ |
|
public class Link : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler |
|
{ |
|
public string url; |
|
public Texture2D linkSelectCursor; |
|
|
|
void IPointerDownHandler.OnPointerDown(PointerEventData eventData) |
|
{ |
|
#if UNITY_WEBGL && !UNITY_EDITOR |
|
openWindow(this.url); |
|
#else |
|
Application.OpenURL(this.url); |
|
#endif |
|
} |
|
|
|
void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) |
|
{ |
|
Cursor.SetCursor(this.linkSelectCursor, Vector2.zero, CursorMode.Auto); |
|
} |
|
|
|
void IPointerExitHandler.OnPointerExit(PointerEventData eventData) |
|
{ |
|
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); |
|
} |
|
|
|
#if UNITY_WEBGL && !UNITY_EDITOR |
|
[DllImport("__Internal")] |
|
private static extern void openWindow(string url); |
|
#endif |
|
} |
|
} |