// Use this for initialization void Start() { #if UNITY_IPHONE #elif UNITY_ANDROID Debug.Log("Numero Tiri = " + OSHookBridge.ReturnNumTiri()); #endif }
public void StartCoreML() { if (Application.platform == RuntimePlatform.IPhonePlayer) { OSHookBridge.StartCoreML(); } }
public void Share() { if (platform == RuntimePlatform.Android) { OSHookBridge.shareIntent(shareText); } }
public void listar_app(string app) { #if UNITY_IPHONE IntPtr objectName = Marshal.StringToHGlobalAuto(this.name); IntPtr messageName = Marshal.StringToHGlobalAuto("SetButtonText"); IntPtr parameterName = Marshal.StringToHGlobalAuto("New Text"); OSHookBridge.SendUnityBridgeMessage(objectName, messageName, parameterName); #elif UNITY_ANDROID TextoArrayApps = "" + OSHookBridge.ReturnString(); textoapps.text = "" + TextoArrayApps; ArrayApps = TextoArrayApps.Split(new string[] { "," }, StringSplitOptions.None); for (int i = 0; i < ArrayApps.Length; i++) { if (ArrayApps[i] == app) { mensaje.text = "correcto"; break; } else { mensaje.text = "incorrecto"; } } #endif }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 50), buttonText)) { #if UNITY_IPHONE #elif UNITY_ANDROID OSHookBridge.SendUnityMessage(this.name, "SetButtonText", "Ottimo"); #endif } }
public void WalkRoute() { //Debug.Log("AMap 步行路径规划"); double mlat = 30.217220; double mlon = 120.267500; double tlat = 30.215010; double tlon = 120.271915; OSHookBridge.WalkRoute(mlat, mlon, tlat, tlon); }
public void Open_App(string app) { #if UNITY_IPHONE IntPtr objectName = Marshal.StringToHGlobalAuto(this.name); IntPtr messageName = Marshal.StringToHGlobalAuto("SetButtonText"); IntPtr parameterName = Marshal.StringToHGlobalAuto("New Text"); OSHookBridge.SendUnityBridgeMessage(objectName, messageName, parameterName); #elif UNITY_ANDROID OSHookBridge.ShowAppID(app); #endif }
void Start() { #if UNITY_ANDROID TextoArrayApps = "" + OSHookBridge.ReturnList(); ArrayApp = TextoArrayApps.Split(new string[] { "," }, StringSplitOptions.None); #endif for (int i = 0; i < series.Length; i++) { var NewPagina = Instantiate(Hijo_series) as GameObject; NewPagina.transform.SetParent(Padre_series, false); NewPagina.SetActive(true); NewPagina.GetComponent <serie>().Name = series[i].Serie_nombre; NewPagina.GetComponent <serie>().Imagen = series[i].Serie_icono; NewPagina.GetComponent <serie>().Cantidad = "" + series[i].Apps.Length; } }
public void OpenApp() { #if UNITY_ANDROID if (Estado) { OSHookBridge.ShowAppID(PAQUETE); OSHookBridge.ShowMensage("Abriendo APP"); } else { OSHookBridge.ShowAppStore(PAQUETE); OSHookBridge.ShowMensage("Abriendo en la PLAY STORE"); } #endif Controlador.AppVista(PlayerPrefs.GetString("Id"), PAQUETE); }
public void Cambiar_sonido() { if (sonido) { sonido = false; chekAudios.SetActive(false); chekAudion.SetActive(true); OSHookBridge.ShowMensage("Sonido desactivado"); } else { sonido = true; chekAudios.SetActive(true); chekAudion.SetActive(false); OSHookBridge.ShowMensage("Sonido activado"); } }
// 通过unity获取外部(摄像头等)图像,传入sdk public void SaveToIOS() { Texture2D t2d = m_textImage.sprite.texture; byte[] bytes = t2d.EncodeToJPG(); string savePath = Application.persistentDataPath + "/testImage.jpg"; //[iOS]/var/mobile/Containers/Data/Application/1B59CF4F-855D-4712-9375-C7131B9FC560/Documents/testImage.jpg File.WriteAllBytes(savePath, bytes); Debug.Log("已保存到:" + savePath); if (Application.platform == RuntimePlatform.IPhonePlayer) { OSHookBridge.ImagePathToIOS(savePath); } }
public void Enviar() { if (nombre.text == "" || email.text == "" || asunto.text == "") { mensage_no.SetActive(true); OSHookBridge.ShowMensage("Mensage no Enviado"); } else { //StartCoroutine("SaveName"); Controlador.Contacto(nombre.text, nombre.text, email.text, asunto.text); nombre.text = ""; email.text = ""; asunto.text = ""; mensage_si.SetActive(true); OSHookBridge.ShowMensage("Mensage Enviado"); } }
// Use this for initialization void Start() { #if UNITY_IPHONE || UNITY_STANDALONE_OSX string data = Marshal.PtrToStringAuto(OSHookBridge.ReturnString()); data += "\n" + OSHookBridge.ReturnInt(); displayText.text = data; Debug.Log("Returned Int = " + OSHookBridge.ReturnInt()); Debug.Log("Returned String = " + Marshal.PtrToStringAuto(OSHookBridge.ReturnString())); IntPtr handle = OSHookBridge.CreateInstance(); Debug.Log("Returned Instance Int = " + OSHookBridge.GetInstanceInt(handle)); #elif UNITY_ANDROID /*Debug.Log ("Returned Int = " + OSHookBridge.ReturnInt()); * Debug.Log ("Returned String = " + OSHookBridge.ReturnString()); * * Debug.Log("Returned Instance Int = " + OSHookBridge.ReturnInstanceInt()); * Debug.Log("Returned Instance String = " + OSHookBridge.ReturnInstanceString());*/ #endif }
IEnumerator DownloadMLModel() { string url = "http://www.setsuodu.com/download/MobileNet.mlmodel"; //WWW不支持https string filePath = Application.persistentDataPath + "/MobileNet.mlmodel"; if (!File.Exists(filePath)) { Debug.Log("开始下载MLModel..."); WWW www = new WWW(url); while (!www.isDone) { Debug.Log(www.progress * 100 + "%"); yield return(null); } yield return(www); if (!string.IsNullOrEmpty(www.error)) { Debug.Log(www.error); yield break; } if (www.isDone) { byte[] bytes = www.bytes; FileStream fileStream = File.Create(filePath); fileStream.Write(bytes, 0, bytes.Length); fileStream.Close(); } } Debug.Log("下载完成:" + filePath); // /Users/xueyutao/Library/Application Support/setsuodu/CoreMLPlugin/MobileNet.mlmodel OSHookBridge.LoadMLModel(filePath); }
public void HideMapView() { //Debug.Log("AMap 关闭地图"); OSHookBridge.HideMapView(); }
public void LocateUpdate() { //Debug.Log("AMap 持续定位"); OSHookBridge.LocateUpdate(); }
public void LocateStop() { //Debug.Log("AMap 结束定位"); OSHookBridge.LocateStop(); }
public void ShowMapView() { //Debug.Log("AMap 显示地图"); OSHookBridge.ShowMapView(); }
void OnStartButtonClick() { OSHookBridge.StartVision(); }
void OnStopButtonClick() { OSHookBridge.StopVision(); }
public void SearchKeyword() { //Debug.Log("AMap 搜索关键词"); OSHookBridge.SearchKeyword(); }
public void LocateOnce() { //Debug.Log("AMap 单次定位"); OSHookBridge.LocateOnce(); }
public void QueryWeather() { OSHookBridge.QueryWeather(); }
public void Quitar() { OSHookBridge.ShowMensage("Saliendo de la App"); Application.Quit(); }
public void LocateInit() { //Debug.Log("AMap 初始化定位"); OSHookBridge.LocateInit(); }
public void ConfigureAPIKey() { OSHookBridge.ConfigureAPIKey(); }
public void SearchAround(string str) { //Debug.Log("AMap 搜索周围"); OSHookBridge.SearchAround(str); }