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

45 lines
1.3 KiB
C#

using System.Threading;
using Cysharp.Threading.Tasks;
using TMPro;
using UnityEngine.UI;
namespace Game
{
[UIType(UIType.GameSceneResultUI)]
public class GameSceneResultUI : UIBase
{
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);
}
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;
}
}
}