WebAndUpdateHandler.cs 1.18 KB
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;

public class WebAndUpdateHandler : MonoBehaviour {

	[DllImport ("CorePlugin")] public static extern int coreUpdateCheck();
	[DllImport ("CorePlugin")] public static extern int coreUpdateInstall();

	public GameObject update_box;
	public GameObject update_found;
	public GameObject update_not_found;
	public GameObject update_err;

	public void UpdateCheck()
	{

		Debug.Log("init update_check");

		int updateStatus = 1;

		updateStatus = coreUpdateCheck();

		update_box.SetActive(true);

		switch(updateStatus){

			case 0:
				Debug.Log ("update_null");
				update_not_found.SetActive(true);
				break;
			case 1:
				Debug.Log ("update_avaliable");
				update_found.SetActive(true);
				break;
			case -1:
				Debug.Log ("update_err");
				update_err.SetActive(true);
				break;
			default: 
				break;

		}

		Debug.Log("update_check finished");

	}
	
	public void UpdateInstall()
	{
		Debug.Log("init update_install");
		//coreUpdateInstall();
		Debug.Log("updating_install finished");
		Application.Quit();
	}

	public void LoadVlibrasWebsite()
	{
		Application.OpenURL("http://vlibrasplayer.lavid.ufpb.br/");
	}

}