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 ActivateComponentsAndFinishWaitSnippetBecauseIWantAndThisIsMyCodeSoItWorksAndYouCantStopMe() { 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) { ActivateComponentsAndFinishWaitSnippetBecauseIWantAndThisIsMyCodeSoItWorksAndYouCantStopMe(); 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 t = new Thread(new ThreadStart(update_check)); t.Start(); } public void UpdateInstall_player() { Debug.Log("init player update_install"); coreUpdateInstall_player(); Debug.Log("player update_install finished"); Application.Quit(); } public void UpdateInstall_dict() { AGUARDE.SetActive(false); Debug.Log("init dict update_install"); coreUpdateInstall_dict(); Debug.Log("dict update_install finished"); } public void LoadVlibrasWebsite() { Application.OpenURL("http://vlibrasplayer.lavid.ufpb.br/"); } }