ScreenReferences.cs
2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**********************
********LAVID**********
***VLibras Project*****
*------------------------------------------------------------------------
*Description:
*
* Controls screens transactions (back button)
*
*------------------------------------------------------------------------
**Author: Claudiomar Araujo
*claudiomar.araujo@lavid.ufpb.br
*/
using UnityEngine;
using System.Collections;
using System.Threading;
using UnityEngine.UI;
using System.ComponentModel;
public class ScreenReferences : MonoBehaviour {
// tutorials
public GameObject infos;
public GameObject t_1;
public GameObject t_2;
public GameObject t_3;
public GameObject t_4;
public GameObject t_5;
public GameObject b_text;
public GameObject b_micro;
public GameObject b_sub;
public GameObject b_info;
public Button[] home_screen_bar_buttons;
public BoxCollider _collider;
// screens
public GameObject text_entry;
public GameObject i_bar;
public PlayerManager player_manager;
public static bool HOME_SCREEN;
void Update()
{
if (Input.GetKey(KeyCode.Escape))
{
if(HOME_SCREEN)
{
Debug.Log("ta home");
Application.Quit();
}
else
{
GameObject.FindGameObjectWithTag("avatar").GetComponent<BoxCollider>().enabled = true;
Debug.Log("not home");
BackToHomeScreen();
}
Thread.Sleep(500);
}
}
void Start()
{
//home_screen_bar_buttons = new Button[4];
HOME_SCREEN = true;
_collider = GameObject.FindGameObjectWithTag("avatar").GetComponent<BoxCollider>();
}
void BackToHomeScreen()
{
_collider.enabled = true;
// if connection pop up not true
if(!player_manager.canvas_connection_error.isActiveAndEnabled){
HOME_SCREEN = true;
}
if(infos.activeSelf)
{
infos.SetActive(false);
}
if(t_1.activeSelf)
{
t_1.SetActive(false);
}
if(t_2.activeSelf)
{
t_2.SetActive(false);
}
if(t_3.activeSelf)
{
t_3.SetActive(false);
}
if(t_4.activeSelf)
{
t_4.SetActive(false);
}
if(t_5.activeSelf)
{
t_5.SetActive(false);
}
if(!i_bar.activeSelf)
{
i_bar.SetActive(true);
}
if(text_entry.activeSelf)
{
text_entry.SetActive(false);
}
GameObject.FindGameObjectWithTag("conn_err").GetComponent<Canvas>().enabled = false;
}
public void setHomeScreen(bool value)
{
HOME_SCREEN = value;
}
}