Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/UI/DinoAccessUI.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/UI/DinoAccessUI.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/UI/DinoAccessUI.cs
-
curl -L -o DinoAccessUI.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/UI/DinoAccessUI.cs
1.11 kB
| using TMPro; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class DinoAccessUI : MonoBehaviour | |
| { | |
| public GameObject panel; | |
| public TMP_Text messageText; | |
| public Text messageTextLegacy; | |
| public string deniedMessage = "Wrong password. Access denied."; | |
| void Update() | |
| { | |
| DinoPlayer player = FindLocalPlayer(); | |
| if (player == null) | |
| return; | |
| if (player.AuthFailed) | |
| { | |
| if (panel != null) panel.SetActive(true); | |
| SetText(deniedMessage); | |
| } | |
| else | |
| { | |
| if (panel != null) panel.SetActive(false); | |
| SetText(""); | |
| } | |
| } | |
| DinoPlayer FindLocalPlayer() | |
| { | |
| DinoPlayer[] players = FindObjectsOfType<DinoPlayer>(); | |
| foreach (DinoPlayer p in players) | |
| { | |
| if (p.Object != null && p.Object.HasInputAuthority) | |
| return p; | |
| } | |
| return null; | |
| } | |
| void SetText(string value) | |
| { | |
| if (messageText != null) messageText.text = value; | |
| if (messageTextLegacy != null) messageTextLegacy.text = value; | |
| } | |
| } | |