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/"); } }