1 |
bd9a601b
|
Oto Šťáva
|
using System.Collections;
|
2 |
|
|
using System.Collections.Generic;
|
3 |
|
|
using UnityEngine;
|
4 |
|
|
using UnityEngine.UI;
|
5 |
|
|
using DeltaRobotVr;
|
6 |
|
|
|
7 |
|
|
public class StatusDisplay : MonoBehaviour
|
8 |
|
|
{
|
9 |
|
|
private const string STATUS = "Status:\n";
|
10 |
|
|
private const string CONNECTED = "<color=green>Connected</color>";
|
11 |
|
|
private const string CONNECTING = "<color=red>Connecting...</color>";
|
12 |
|
|
private Text _textComp;
|
13 |
|
|
// Start is called before the first frame update
|
14 |
|
|
void Start()
|
15 |
|
|
{
|
16 |
|
|
_textComp = GetComponent<Text>();
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
// Update is called once per frame
|
20 |
|
|
void Update()
|
21 |
|
|
{
|
22 |
|
|
if (Client.Instance.IsConnected)
|
23 |
|
|
{
|
24 |
|
|
_textComp.text = STATUS + CONNECTED;
|
25 |
|
|
}
|
26 |
|
|
else
|
27 |
|
|
{
|
28 |
5b50fe1a
|
Oto Šťáva
|
if (Client.Instance.EotReason.Length == 0)
|
29 |
bd9a601b
|
Oto Šťáva
|
{
|
30 |
|
|
_textComp.text = STATUS + CONNECTING;
|
31 |
|
|
}
|
32 |
|
|
else
|
33 |
|
|
{
|
34 |
5b50fe1a
|
Oto Šťáva
|
_textComp.text = STATUS + CONNECTING + "\n" + Client.Instance.EotReason;
|
35 |
bd9a601b
|
Oto Šťáva
|
}
|
36 |
|
|
}
|
37 |
|
|
}
|
38 |
|
|
}
|