28 lines
627 B
C#
28 lines
627 B
C#
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
using TMPro;
|
||
|
|
|
||
|
|
public class ServerStatusIndicator : MonoBehaviour
|
||
|
|
{
|
||
|
|
private Color offlineColor = Color.red;
|
||
|
|
private Color onlineColor = Color.green;
|
||
|
|
|
||
|
|
[SerializeField] private TMP_Text onlineText;
|
||
|
|
[SerializeField] private Image serverStatusIndicator;
|
||
|
|
|
||
|
|
|
||
|
|
public void PingServer(bool status)
|
||
|
|
{
|
||
|
|
if (status)
|
||
|
|
{
|
||
|
|
onlineText.text = "Online";
|
||
|
|
serverStatusIndicator.color = onlineColor;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
onlineText.text = "Offline";
|
||
|
|
serverStatusIndicator.color = offlineColor;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|