| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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<GameObject>("Prefabs/Views/AgreementView"));
- switch (linkId)
- {
- case "agreement":
- o.GetComponent<AgreementView>().EnterUserAgreement();
- break;
- case "privacy":
- o.GetComponent<AgreementView>().EnterPrivacyAgreement();
- break;
- }
- }
- }
- }
- }
|