38 lines
867 B
C#
38 lines
867 B
C#
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using TMPro;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
public class ErrorTip : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
public TextMeshProUGUI errorMsgText;
|
|||
|
|
Action<string> onError;
|
|||
|
|
string errorData;
|
|||
|
|
public static ErrorTip Instance;
|
|||
|
|
private void Awake() {
|
|||
|
|
Instance=this;
|
|||
|
|
}
|
|||
|
|
public void Init(string errorMsg,string data ,Action<string> onError)
|
|||
|
|
{
|
|||
|
|
if (errorMsg.Length > 1000)
|
|||
|
|
errorMsg = errorMsg.Substring(0, 1000);
|
|||
|
|
errorMsgText.text = errorMsg;
|
|||
|
|
this.onError = onError;
|
|||
|
|
errorData = data;
|
|||
|
|
}
|
|||
|
|
public void ReLink()
|
|||
|
|
{
|
|||
|
|
if (onError != null)
|
|||
|
|
{
|
|||
|
|
onError(errorData);
|
|||
|
|
onError = null;
|
|||
|
|
}
|
|||
|
|
Destroy(gameObject);
|
|||
|
|
}
|
|||
|
|
public void Close()
|
|||
|
|
{
|
|||
|
|
Destroy(gameObject);
|
|||
|
|
}
|
|||
|
|
}
|