30 lines
916 B
C#
30 lines
916 B
C#
using System;
|
|
using Code.Infrastructure.UI;
|
|
using PrimeTween;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Code.Example.Race.UI
|
|
{
|
|
public class WinScreen : UIPanel
|
|
{
|
|
[SerializeField] private Image image;
|
|
[SerializeField] private TMP_Text winText;
|
|
[SerializeField] private Color shownColor;
|
|
[SerializeField] private Color hiddenColor;
|
|
|
|
public void SetText(string text) => winText.text = text;
|
|
public override void Open(Action callback = null)
|
|
{
|
|
Tween.Color(image,shownColor, 1f);
|
|
Tween.Color(winText,shownColor, 1f).OnComplete( () => callback?.Invoke());
|
|
}
|
|
|
|
public override void Close(Action callback = null)
|
|
{
|
|
Tween.Color(image,hiddenColor, 1f);
|
|
Tween.Color(winText,hiddenColor, 1f).OnComplete( () => callback?.Invoke());
|
|
}
|
|
}
|
|
} |