102 lines
2.2 KiB
C#
102 lines
2.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using AFeijia.UI;
|
|
using System;
|
|
|
|
public class TipsPanel : UITool
|
|
{
|
|
[Manual]
|
|
public static TipsPanel Instance;
|
|
/// <summary>
|
|
/// ÕÚÕÖ
|
|
/// </summary>
|
|
public RectTransform Mask;
|
|
/// <summary>
|
|
/// Ìáʾ±êÌâ
|
|
/// </summary>
|
|
public TextMeshProUGUI TipsTittle;
|
|
/// <summary>
|
|
/// ÌáʾÄÚÈÝ
|
|
/// </summary>
|
|
public TextMeshProUGUI TipsContent;
|
|
/// <summary>
|
|
/// È¡Ïû°´Å¥
|
|
/// </summary>
|
|
public Button CancelBtn;
|
|
/// <summary>
|
|
/// È·Èϰ´Å¥
|
|
/// </summary>
|
|
public Button ConfirmBtn;
|
|
|
|
public RectTransform WaitingMask;
|
|
|
|
public TextMeshProUGUI submiting;
|
|
|
|
[Manual]
|
|
public Action<bool> Callback;
|
|
|
|
[Manual]
|
|
public Action<bool> Callback_HideSubmiting;
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
Instance = this;
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
CancelBtn.onClick.AddListener(TipsCancel);
|
|
ConfirmBtn.onClick.AddListener(TipsConfirm);
|
|
}
|
|
|
|
public void Tips(string tittle, string content, Action<bool> callback)
|
|
{
|
|
Callback = callback;
|
|
|
|
TipsTittle.text = tittle;
|
|
TipsContent.text = content;
|
|
|
|
this.Mask.gameObject.SetActive(true);
|
|
}
|
|
|
|
public void ForceTips(string tittle, string content, Action<bool> callback)
|
|
{
|
|
CancelBtn.gameObject.SetActive(false);
|
|
Callback = callback;
|
|
|
|
TipsTittle.text = tittle;
|
|
TipsContent.text = content;
|
|
|
|
this.Mask.gameObject.SetActive(true);
|
|
}
|
|
|
|
private void TipsConfirm()
|
|
{
|
|
Callback?.Invoke(true);
|
|
Callback = null;
|
|
this.Mask.gameObject.SetActive(false);
|
|
CancelBtn.gameObject.SetActive(true);
|
|
}
|
|
|
|
private void TipsCancel()
|
|
{
|
|
Callback?.Invoke(false);
|
|
Callback = null;
|
|
this.Mask.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void WaitingSubmit(bool _submit)
|
|
{
|
|
WaitingMask.gameObject.SetActive(_submit);
|
|
}
|
|
|
|
public void WaitingText(string _str = "")
|
|
{
|
|
submiting.text = string.IsNullOrEmpty(_str) ? "ÕýÔÚÌá½»..." : _str;
|
|
}
|
|
}
|