WebAndUpdateHandler.cs 1.65 KB
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
using System.Threading;

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;

	public void UpdateCheck()
	{

		Debug.Log("init update_check");

		int updateStatus = 0;

		updateStatus = coreUpdateCheck();

		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;

		}

		AGUARDE.SetActive(false);

		Debug.Log("update_check finished");

	}

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

}