forked from zxl/LaboratoryProtection
59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
|
using System;
|
|||
|
using TMPro;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
namespace UnityTest.ZXL
|
|||
|
{
|
|||
|
public class BigStrongTipsUI : UI
|
|||
|
{
|
|||
|
public TextMeshProUGUI titleText;
|
|||
|
public TextMeshProUGUI contentText;
|
|||
|
public Button btnLeft;
|
|||
|
public Button btnRight;
|
|||
|
|
|||
|
private Action _action;
|
|||
|
|
|||
|
public override void OnInit()
|
|||
|
{
|
|||
|
base.OnInit();
|
|||
|
btnLeft.onClick.AddListener(ClickSure);
|
|||
|
btnRight.onClick.AddListener(ClickCancel);
|
|||
|
}
|
|||
|
|
|||
|
private void ClickSure()
|
|||
|
{
|
|||
|
UIManager.Instance().HideUI(uiType);
|
|||
|
_action?.Invoke();
|
|||
|
}
|
|||
|
|
|||
|
private void ClickCancel()
|
|||
|
{
|
|||
|
UIManager.Instance().HideUI(uiType);
|
|||
|
}
|
|||
|
|
|||
|
public void SetContent(string title, string content)
|
|||
|
{
|
|||
|
titleText.text = title;
|
|||
|
contentText.text = content;
|
|||
|
}
|
|||
|
|
|||
|
public void SetContent(string title, string content, Action callback, int btnCount)
|
|||
|
{
|
|||
|
titleText.text = title;
|
|||
|
contentText.text = content;
|
|||
|
_action = callback;
|
|||
|
|
|||
|
btnLeft.gameObject.SetActive(true);
|
|||
|
btnRight.gameObject.SetActive(true);
|
|||
|
if (btnCount == 0)
|
|||
|
{
|
|||
|
btnLeft.gameObject.SetActive(false);
|
|||
|
btnRight.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
else if (btnCount == 1)
|
|||
|
{
|
|||
|
btnRight.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|