Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoWinnerUI.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 985 Bytes
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoWinnerUI.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoWinnerUI.cs
-
curl -L -o DinoWinnerUI.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoWinnerUI.cs
985 Bytes
| using TMPro; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class DinoWinnerUI : MonoBehaviour | |
| { | |
| public TMP_Text winnerText; | |
| public Text winnerTextLegacy; | |
| bool shown; | |
| void Update() | |
| { | |
| DinoGameManager gm = DinoGameManager.Instance; | |
| if (gm == null) | |
| return; | |
| if (!gm.IsGameOver && !gm.IsMatchOver) | |
| { | |
| if (shown) | |
| { | |
| shown = false; | |
| SetText(""); | |
| } | |
| return; | |
| } | |
| if (!shown) | |
| { | |
| shown = true; | |
| } | |
| string name = gm.WinnerName.ToString(); | |
| if (string.IsNullOrWhiteSpace(name)) | |
| name = "Unknown"; | |
| string label = gm.IsMatchOver ? "Match Winner" : "Round Winner"; | |
| SetText($"{label}: {name}"); | |
| } | |
| void SetText(string value) | |
| { | |
| if (winnerText != null) winnerText.text = value; | |
| if (winnerTextLegacy != null) winnerTextLegacy.text = value; | |
| } | |
| } | |