51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Text;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class RecordPanel : MonoBehaviour, IUIPanel
|
|
{
|
|
public bool IsOpen => gameObject.activeSelf;
|
|
|
|
public readonly StringBuilder recordStr = new();
|
|
|
|
public void Show()
|
|
{
|
|
ShowText();
|
|
GameManager.Instance.PauseGame();
|
|
gameObject.SetActive(true);
|
|
|
|
var btn = transform.Find("Title").Find("Return").GetComponent<Button>();
|
|
btn.onClick.AddListener(ReturnGame);
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
GameManager.Instance.ContinueGame();
|
|
// 关闭时停止渲染
|
|
ClearText();
|
|
var btn = transform.Find("Title").Find("Return").GetComponent<Button>();
|
|
btn.onClick.RemoveAllListeners();
|
|
}
|
|
|
|
private void ShowText()
|
|
{
|
|
var text = transform.Find("Log View").GetComponentInChildren<TMP_Text>();
|
|
text.text = recordStr.ToString();
|
|
}
|
|
|
|
private void ClearText()
|
|
{
|
|
var text = transform.Find("Log View").GetComponentInChildren<TMP_Text>();
|
|
text.text = null;
|
|
}
|
|
|
|
private void ReturnGame()
|
|
{
|
|
UIManager.Instance.HidePanel<RecordPanel>();
|
|
}
|
|
}
|
|
} |