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.
72 lines
2.2 KiB
72 lines
2.2 KiB
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
[RequireComponent(typeof(TextMeshProUGUI))]
|
|
public class ChatLogClick : MonoBehaviour, IPointerClickHandler
|
|
{
|
|
[SerializeField]
|
|
private TextMeshProUGUI txtClick;
|
|
[SerializeField]
|
|
private Canvas canvasUI;
|
|
[SerializeField]
|
|
private Camera cameraUI;
|
|
|
|
|
|
public void Init(Canvas canvasui, Camera cameraui)
|
|
{
|
|
canvasUI = canvasui;
|
|
cameraUI = cameraui;
|
|
txtClick = GetComponent<TextMeshProUGUI>();
|
|
txtClick.ForceMeshUpdate();
|
|
}
|
|
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
//switch (BattleHandler.Type)
|
|
//{
|
|
// case BattleType.Stage:
|
|
// case BattleType.PVE:
|
|
// case BattleType.PVEBattle:
|
|
// break;
|
|
// default:
|
|
// return;
|
|
//}
|
|
|
|
int linkIndex = TMP_TextUtilities.FindIntersectingLink(txtClick, Input.mousePosition, cameraUI);
|
|
if (linkIndex != -1)
|
|
{
|
|
TMP_LinkInfo linkInfo = txtClick.textInfo.linkInfo[linkIndex];
|
|
try
|
|
{
|
|
Debug.Log("Click");
|
|
//string[] chat = linkInfo.GetLinkID().Split(FormatString.Sharp);
|
|
//if (chat == null || chat.Length < 4)
|
|
// return;
|
|
//if (int.Parse(chat[0]) == (int)eChatType.PromotePve)
|
|
//{
|
|
// switch (BattleHandler.Type)
|
|
// {
|
|
// case BattleType.Stage:
|
|
// if (PveManager.Instance.IsOpenPveMain())
|
|
// PveManager.Instance.AutoFillCode(chat[3]);
|
|
// else
|
|
// PveManager.Instance.OpenMain();
|
|
// break;
|
|
// case BattleType.PVE:
|
|
// PveManager.Instance.AutoFillCode(chat[3]);
|
|
// break;
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// if (!chat[1].Equals(DataHandler.PlayData.playerID))
|
|
// ChatUIManager.Instance.OpenUser(chat[1], chat[2], chat[3]);
|
|
//}
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
|
|
}
|