Frame/Assets/Scripts/UI/Logic/GameSceneResultUI.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2024-04-09 18:16:37 +08:00
using System.Threading;
using Cysharp.Threading.Tasks;
2024-04-10 16:18:32 +08:00
using TMPro;
2024-04-09 18:16:37 +08:00
using UnityEngine.UI;
namespace Game
2024-04-09 18:16:37 +08:00
{
[UIType(UIType.GameSceneResultUI)]
public class GameSceneResultUI : UIBase
2024-04-09 18:16:37 +08:00
{
private Image img_Lose;
private Image img_Success;
private TMP_Text txt_LoseContent;
private TMP_Text txt_SuccessContent;
public override void Init()
{
base.Init();
this.img_Lose = this.self.transform.FindChildDeep<Image>("img_Lose");
this.img_Success = this.self.transform.FindChildDeep<Image>("img_Success");
this.txt_LoseContent = this.self.transform.FindChildDeep<TMP_Text>("txt_LoseContent");
this.txt_SuccessContent = this.self.transform.FindChildDeep<TMP_Text>("txt_SuccessContent");
}
public override void Dispose()
{
base.Dispose();
}
public async UniTask WaitShowAndCloseResultAsync(CancellationToken token)
{
await UniTask.Delay(4000);
Game.uiManager.CloseLast();
}
public void SetResult(string str, bool isSuccess)
{
img_Success.gameObject.SetActive(isSuccess);
this.img_Lose.gameObject.SetActive(!isSuccess);
this.txt_SuccessContent.text = str;
this.txt_LoseContent.text = str;
}
2024-04-10 16:18:32 +08:00
}
2024-04-09 18:16:37 +08:00
}