41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
|
|||
|
|
namespace GeneralTools
|
|||
|
|
{
|
|||
|
|
public class SetMessageShow : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
public Button closeBtn;
|
|||
|
|
public Button confirmBtn;
|
|||
|
|
public Text buttonText;
|
|||
|
|
public Text tittleText;
|
|||
|
|
public Text showText;
|
|||
|
|
|
|||
|
|
public void Show(string tittleStr, string messageStr, string buttonStr, Action action, Action closeAction)
|
|||
|
|
{
|
|||
|
|
closeBtn.gameObject.SetActive(false);
|
|||
|
|
closeBtn.onClick.RemoveAllListeners();
|
|||
|
|
confirmBtn.onClick.RemoveAllListeners();
|
|||
|
|
|
|||
|
|
closeBtn.onClick.AddListener(() => { closeAction(); });
|
|||
|
|
confirmBtn.onClick.AddListener(() => { action(); });
|
|||
|
|
|
|||
|
|
buttonText.text = buttonStr;
|
|||
|
|
tittleText.text = tittleStr;
|
|||
|
|
showText.text = messageStr;
|
|||
|
|
|
|||
|
|
gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
public void Show(MessageShowClass message, Action closeAction)
|
|||
|
|
{
|
|||
|
|
Show(message.tittleStr, message.messageStr, message.buttonStr, message.action, closeAction);
|
|||
|
|
}
|
|||
|
|
public void Hide()
|
|||
|
|
{
|
|||
|
|
gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|