Unity_Web/Assets/1_Script/InfoPageCtrl.cs

40 lines
903 B
C#

using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class InfoPageCtrl : MonoBehaviour
{
[SerializeField] TMP_Text message;
[SerializeField] Image outLine;
[SerializeField] Image button;
[SerializeField] Color success;
[SerializeField] Color fail;
private Action action;
public void Set(string message, Action action = null)
{
outLine.color = success;
button.color = success;
this.message.text = message;
this.action = action;
gameObject.SetActive(true);
}
public void SetError(string message, Action action = null)
{
outLine.color = fail;
button.color = fail;
this.message.text = message;
this.action = action;
gameObject.SetActive(true);
}
public void okButton()
{
action?.Invoke();
gameObject.SetActive(false);
}
}