using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.EventSystems; namespace AppUI.Util.Input { [RequireComponent(typeof(TMP_Text))] public class TMP_LinkOpener : MonoBehaviour, IPointerClickHandler { public TMP_Text text; public void OnPointerClick(PointerEventData eventData) { int linkIndex = TMP_TextUtilities.FindIntersectingLink( text, UnityEngine.Input.mousePosition, null); if (linkIndex != -1) { TMP_LinkInfo linkInfo = text.textInfo.linkInfo[linkIndex]; string linkId = linkInfo.GetLinkID(); Debug.Log("Clicked Link: " + linkId); GameObject o = Instantiate(Resources.Load("Prefabs/Views/AgreementView")); switch (linkId) { case "agreement": o.GetComponent().EnterUserAgreement(); break; case "privacy": o.GetComponent().EnterPrivacyAgreement(); break; } } } } }