snakes_mp/Assets/Scripts/Utils/GameOverScreen.cs

41 lines
967 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GameOverScreen : MonoBehaviour
{
public static GameOverScreen instance;
void Awake(){
instance = this;
}
public GameObject gameOverScreen;
public TMP_Text winnerTxt;
public GameObject processingText;
public GameObject leaveButton;
// Update is called once per frame
void Start(){
gameOverScreen.SetActive(false);
leaveButton.GetComponent<Button>().onClick.AddListener(Leave);
}
void Leave(){
JSBridge.instance.OnClose(0);
}
public void Show(bool won){
gameOverScreen.SetActive(true);
winnerTxt.text = won ? "You Won" : "You Lost";
processingText.SetActive(true);
leaveButton.SetActive(false);
}
public void Processed(){
processingText.SetActive(false);
leaveButton.SetActive(true);
}
}