From 39b983305f0b0acb8d3c746adf36d48dbf98a8a4 Mon Sep 17 00:00:00 2001 From: ClaudiomarAraujo Date: Tue, 22 Sep 2015 16:42:29 -0300 Subject: [PATCH] Orientacao fixada em retrado. Txt do plugin de voz adicionado --- Assets/Scenes/Main.unity | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- Assets/Scripts/AndroidPluginProject.txt | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Assets/Scripts/AndroidPluginProject.txt.meta | 8 ++++++++ Assets/Scripts/GenericPlayerManager.cs | 1 + Assets/Scripts/PlayerManager.cs | 28 +--------------------------- 5 files changed, 250 insertions(+), 28 deletions(-) create mode 100644 Assets/Scripts/AndroidPluginProject.txt create mode 100644 Assets/Scripts/AndroidPluginProject.txt.meta diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 833e92d..1846942 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -525,7 +525,15 @@ Prefab: - target: {fileID: 11466268, guid: 6506218ed7927bf45b508ebbec0c1222, type: 2} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 578311380} + objectReference: {fileID: 578311381} + - target: {fileID: 11466268, guid: 6506218ed7927bf45b508ebbec0c1222, type: 2} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: callVoiceRecognizer + objectReference: {fileID: 0} + - target: {fileID: 11466268, guid: 6506218ed7927bf45b508ebbec0c1222, type: 2} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 6506218ed7927bf45b508ebbec0c1222, type: 2} m_IsPrefabParent: 0 @@ -536,6 +544,10 @@ Prefab: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.size + value: 40 + objectReference: {fileID: 0} - target: {fileID: 491010, guid: 00197fc9877daa14c963e5917de36124, type: 2} propertyPath: m_LocalPosition.x value: 0 @@ -592,6 +604,174 @@ Prefab: propertyPath: m_Center.z value: -1.45801504e-08 objectReference: {fileID: 0} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animation + value: + objectReference: {fileID: 7400000, guid: d1bd20c609a57d8408f7c651c3dbb275, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[40] + value: + objectReference: {fileID: 7400000, guid: 89457731942262c4f81ddf864d48eada, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[0] + value: + objectReference: {fileID: 7400000, guid: 89457731942262c4f81ddf864d48eada, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[1] + value: + objectReference: {fileID: 7400000, guid: aba4ebb4f2c1d1c48b482c4389ca9402, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[2] + value: + objectReference: {fileID: 7400000, guid: 1720f6b05f29fb449bcad3651b3f40cc, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[3] + value: + objectReference: {fileID: 7400000, guid: ff372f002622cb440852aeae6813089c, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[4] + value: + objectReference: {fileID: 7400000, guid: 00cacafc7d617df408370ed500935368, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[5] + value: + objectReference: {fileID: 7400000, guid: 17ea4efa9d951d14991b276a5af0fb26, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[6] + value: + objectReference: {fileID: 7400000, guid: 4c588ba833de9e7499ba381d978f5d83, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[7] + value: + objectReference: {fileID: 7400000, guid: bc68a4fd90591944c94b8b1b4719c666, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[8] + value: + objectReference: {fileID: 7400000, guid: 5f016d4a195d7694a8d4015db4811c86, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[9] + value: + objectReference: {fileID: 7400000, guid: 23077937e2ee04a4c8ae9d20df262957, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[10] + value: + objectReference: {fileID: 7400000, guid: 4ef528c573b442e4db3424874cba3fe0, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[11] + value: + objectReference: {fileID: 7400000, guid: d1bd20c609a57d8408f7c651c3dbb275, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[12] + value: + objectReference: {fileID: 7400000, guid: 3482c0ae2b16aee4b8aedb1756ba8c9a, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[13] + value: + objectReference: {fileID: 7400000, guid: b964dd8530e1719479b4af6e42677e87, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[14] + value: + objectReference: {fileID: 7400000, guid: 97f0060e88e991749baf8573e9dff6a0, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[15] + value: + objectReference: {fileID: 7400000, guid: 31af19923b41b424c843d4f2e01d515d, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[16] + value: + objectReference: {fileID: 7400000, guid: 725c5e8e8a3a1d147bbf51642238b8b0, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[17] + value: + objectReference: {fileID: 7400000, guid: fc46bcda25831724d81ffd6bfb90feb0, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[18] + value: + objectReference: {fileID: 7400000, guid: fc898e47d6ffce04c9501b6b7179bf36, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[19] + value: + objectReference: {fileID: 7400000, guid: 6e16176b3b2034e4e81e76938a091265, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[20] + value: + objectReference: {fileID: 7400000, guid: d192f4fdfb5cab64a915bcff4c0ee422, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[21] + value: + objectReference: {fileID: 7400000, guid: 07f51d1178056794d95279cb4583cceb, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[22] + value: + objectReference: {fileID: 7400000, guid: b2dc77c38f72740418eead23625b9ef2, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[23] + value: + objectReference: {fileID: 7400000, guid: c71a57593e53c5a46ae511089a3664c3, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[24] + value: + objectReference: {fileID: 7400000, guid: 731776140c9a51740ace1422431969d7, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[25] + value: + objectReference: {fileID: 7400000, guid: 44fde49e82d8cd54f8c06f92fb0e628d, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[26] + value: + objectReference: {fileID: 7400000, guid: c6f150fd4c1e02743a78dcc2d9a40c9d, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[27] + value: + objectReference: {fileID: 7400000, guid: 8655f1ac4c173e442b9460a62a628a45, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[28] + value: + objectReference: {fileID: 7400000, guid: 3663a385e61b20b498b7d70a21e3841f, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[29] + value: + objectReference: {fileID: 7400000, guid: d356552118ed06940a695ab179f1cd5f, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[30] + value: + objectReference: {fileID: 7400000, guid: 8415cb4e63f28f845bd1fba975cd35be, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[31] + value: + objectReference: {fileID: 7400000, guid: 95e28371bf9685a48ae2ccec1d32e1f1, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[32] + value: + objectReference: {fileID: 7400000, guid: 8b474cf9ba48d31449b051b5ec72d79b, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[33] + value: + objectReference: {fileID: 7400000, guid: a74f27d391e6c034bbcb774b7e1a1a11, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[34] + value: + objectReference: {fileID: 7400000, guid: 0e5fe34d018fed14788c3ccbcbdf94bd, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[35] + value: + objectReference: {fileID: 7400000, guid: ebd4fa98b34a23a408b684c5d9dfb39e, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[36] + value: + objectReference: {fileID: 7400000, guid: 04ccc2f86152d764ea9162476d997291, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[37] + value: + objectReference: {fileID: 7400000, guid: c61ac94817ee33e49ba7c26faa2b922f, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[38] + value: + objectReference: {fileID: 7400000, guid: bf1df9e5177fe844892ce68033127c3f, type: 2} + - target: {fileID: 11171278, guid: 00197fc9877daa14c963e5917de36124, type: 2} + propertyPath: m_Animations.Array.data[39] + value: + objectReference: {fileID: 7400000, guid: 4f943c1381cd5bd4181b0f2493ae4bd2, type: 2} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 00197fc9877daa14c963e5917de36124, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/Scripts/AndroidPluginProject.txt b/Assets/Scripts/AndroidPluginProject.txt new file mode 100644 index 0000000..9ba6398 --- /dev/null +++ b/Assets/Scripts/AndroidPluginProject.txt @@ -0,0 +1,59 @@ +/********************** + ********LAVID********** + ***VLibras Project***** + * + * This works as a plugin for unity. + * It needs to be exported (exportJar) + * + * Calls Google Speech API + * + * Author: Claudiomar Araujo + * claudiomar.araujo@lavid.ufpb.br + * */ + +package com.lavid.vlibrasdroid; + +import android.content.Intent; +import android.speech.RecognizerIntent; +import com.unity3d.player.UnityPlayerActivity; +import java.util.ArrayList; +import java.util.concurrent.Semaphore; + +public class MainActivity extends UnityPlayerActivity{ + + private static final int REQUEST_OK = 1; + private static String recordedAudio = ""; + private Semaphore s = new Semaphore(0); + + // Calls Google Voice Recognizer and returns "" or some recognized string + public String callGoogleSpeech() { + recordedAudio = ""; + try { + Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "pt-BR"); + startActivityForResult(i, REQUEST_OK); + } catch (Exception e) { + //Toast.makeText(this, "Error initializing speech to text engine.", Toast.LENGTH_LONG).show(); + } + try { + s.acquire(); // waits for onActivityResult + } catch (InterruptedException e) { + e.printStackTrace(); + } + return recordedAudio; // returns to unity + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + // If voice recording is ok + if (requestCode==REQUEST_OK && resultCode==RESULT_OK) { + ArrayList thingsYouSaid = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); + recordedAudio = thingsYouSaid.get(0); + } + // Releases callGoogleSpeech method whether audio is captured or not + s.release(); + } + +} diff --git a/Assets/Scripts/AndroidPluginProject.txt.meta b/Assets/Scripts/AndroidPluginProject.txt.meta new file mode 100644 index 0000000..e2c6b00 --- /dev/null +++ b/Assets/Scripts/AndroidPluginProject.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 46a263eecc3258a4ea4080e2d43ec86d +timeCreated: 1442950108 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GenericPlayerManager.cs b/Assets/Scripts/GenericPlayerManager.cs index 77e9a6b..ce68fcc 100644 --- a/Assets/Scripts/GenericPlayerManager.cs +++ b/Assets/Scripts/GenericPlayerManager.cs @@ -89,6 +89,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { public virtual void Start() { + Screen.orientation = ScreenOrientation.Portrait; AVATAR = GameObject.FindGameObjectWithTag("avatar");//referencia para o avatar COMPONENT_ANIMATION = AVATAR.GetComponent();//referencia para o componente animador do avatar AVATAR_COLLIDER = GameObject.FindGameObjectWithTag("avatar").GetComponent(); diff --git a/Assets/Scripts/PlayerManager.cs b/Assets/Scripts/PlayerManager.cs index 72b61b7..d92c14f 100644 --- a/Assets/Scripts/PlayerManager.cs +++ b/Assets/Scripts/PlayerManager.cs @@ -13,15 +13,12 @@ using UnityEngine.UI; public class PlayerManager : GenericPlayerManager { -#if UNITY_EDITOR - private const string BASE_URL = "http://150.165.205.9/anims/ANDROID/"; -#endif #if UNITY_IPHONE && !UNITY_EDITOR private const string BASE_URL = "http://150.165.205.9/anims/IOS/"; #endif -#if UNITY_ANDROID && !UNITY_EDITOR +#if UNITY_ANDROID private const string BASE_URL = "http://150.165.205.9/anims/ANDROID/"; #endif private const string SERVER_URL = "http://vlibras.lavid.ufpb.br/glosa?texto="; @@ -95,29 +92,6 @@ public class PlayerManager : GenericPlayerManager { } } - /*protected string getGlosaFromServer(string str) - { - string strToServer = ""; - - foreach (char c in str) - if (c.Equals(' ')) - strToServer += "%20"; - else - strToServer += c; - - Debug.Log("str to server -> " + strToServer); - - string urlWithText = SERVER_URL + strToServer; - - WWW www = new WWW(urlWithText); - StartCoroutine(waitForRequest(www)); - - // while(!www.isDone) Thread.Sleep(250); - - Debug.Log("returned from server -> " + www.text); - return www.text; - }*/ - protected IEnumerator waitForRequest(WWW www) { yield return www.isDone; -- libgit2 0.21.2