WebAndUpdateHandler.cs
2.57 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
using UnityEngine;
using System.Runtime.InteropServices;
using System.Threading;
using System.Collections;
public class WebAndUpdateHandler : MonoBehaviour {
[DllImport ("CorePlugin")] public static extern int coreUpdateCheck();
[DllImport ("CorePlugin")] public static extern int coreUpdateInstall_player();
[DllImport ("CorePlugin")] public static extern int coreUpdateInstall_dict();
public GameObject update_box;
public GameObject update_dict;
public GameObject update_full;
public GameObject update_null;
public GameObject update_err;
public GameObject AGUARDE;
private int updateStatus = 1;
bool updateHandler = false;
private void ActivateComponentsAndFinishWaitSnippet()
{
update_box.SetActive(true);
switch (updateStatus)
{
case 0:
Debug.Log("update_null");
update_null.SetActive(true);
break;
case 1:
Debug.Log("update_full");
update_full.SetActive(true);
break;
case 2:
Debug.Log("update_dict");
update_dict.SetActive(true);
break;
case -1:
Debug.Log("update_err");
update_err.SetActive(true);
break;
default:
break;
}
Debug.Log("update_check finished");
}
void Update()
{
if (updateHandler)
{
ActivateComponentsAndFinishWaitSnippet();
AGUARDE.SetActive(false);
updateHandler = !updateHandler;
}
}
private void update_check()
{
updateStatus = 1;
updateStatus = coreUpdateCheck();
updateHandler = true;
}
public void UpdateCheck()
{
Debug.Log("init update_check");
AGUARDE.SetActive(true);
Thread _t1 = new Thread(new ThreadStart(update_check));
_t1.Start();
}
public void UpdateInstall_player()
{
Debug.Log("init player update_install");
Thread _t2 = new Thread (new ThreadStart(full_update));
_t2.Start();
Debug.Log("player update_install finished");
Application.Quit();
}
public void UpdateInstall_dict()
{
Debug.Log("init dict update_install");
Thread _t3 = new Thread (new ThreadStart(dict_update));
_t3.Start();
Debug.Log("dict update_install finished");
}
private void dict_update()
{
coreUpdateInstall_dict();
}
private void full_update()
{
coreUpdateInstall_player();
}
public void LoadVlibrasWebsite()
{
Application.OpenURL("http://vlibrasplayer.lavid.ufpb.br/");
}
}