From 9fce4727b42e0f30cc7db299474be670d0d043c8 Mon Sep 17 00:00:00 2001 From: Mateus Pires Date: Tue, 14 Feb 2017 20:56:22 -0300 Subject: [PATCH] Fix invalid characters search on trie [ExportVideo-issue] --- Assets/Scenes/Main.unity | 92 ++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- Assets/Scripts/Player Manager/GenericPlayerManager.cs | 30 +++++++++++++++++------------- Assets/Scripts/PlayerManager.cs | 60 ++++++++++++++++-------------------------------------------- ProjectSettings/ProjectSettings.asset | 2 +- 4 files changed, 80 insertions(+), 104 deletions(-) diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 346f827..fb6e70c 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -3478,53 +3478,53 @@ Animation: m_GameObject: {fileID: 535548070} m_Enabled: 1 serializedVersion: 3 - m_Animation: {fileID: 7400000, guid: de64c0fa1d9645d49b708f1d83901ea4, type: 2} + m_Animation: {fileID: 7400000, guid: d7ed17c702b9a5f429a0d0f911deb512, type: 2} m_Animations: - - {fileID: 7400000, guid: 1dd9ca1ea9832c84f925d6966514ea10, type: 2} - - {fileID: 7400000, guid: 1f00c2efd7d952948a095cc7b244b3da, type: 2} - - {fileID: 7400000, guid: 21546d4c40c79c444a3433872ae02f47, type: 2} - - {fileID: 7400000, guid: 307688a214159614c986c4eef2fdd3ca, type: 2} - - {fileID: 7400000, guid: 31afcc1709953c841ad6830467719274, type: 2} - - {fileID: 7400000, guid: 32f5f26286dce6c4c8adc4db846b2917, type: 2} - - {fileID: 7400000, guid: 347a80b2751fdec43bd370644d77d715, type: 2} - - {fileID: 7400000, guid: 45ebce76c19794a4db997ddc0dfb9cef, type: 2} - - {fileID: 7400000, guid: 4ccd911b507228142bd1af00f3ff7951, type: 2} - - {fileID: 7400000, guid: 58b910c043caf62448498305d225147e, type: 2} - - {fileID: 7400000, guid: 5ad0a39b27f863146a9190c7da98a869, type: 2} - - {fileID: 7400000, guid: 6256158aa94c1024aa0d3df8c189a45c, type: 2} - - {fileID: 7400000, guid: 67e0074be207cda4f9b1659e5804e150, type: 2} - - {fileID: 7400000, guid: 6a9ef1c3d9c5c1d43b12e4666a60ce1b, type: 2} - - {fileID: 7400000, guid: 7057c403ed5c03647999c2d733853f09, type: 2} - - {fileID: 7400000, guid: 71de1b41e3743564caa444f671f788bd, type: 2} - - {fileID: 7400000, guid: 7cc44263843fba34a80de9b8c4237cf2, type: 2} - - {fileID: 7400000, guid: 8aa7f1df5e160b64697225307d6a7f40, type: 2} - - {fileID: 7400000, guid: 90c5138976138a24aabc9adcd845d4e2, type: 2} - - {fileID: 7400000, guid: 9467d12da5bf1ac4f968f30a559719a6, type: 2} - - {fileID: 7400000, guid: 9a1503120426eb045a4183eb8e19a667, type: 2} - - {fileID: 7400000, guid: a06c83cfdce1bd94f9d45389bd7c7be2, type: 2} - - {fileID: 7400000, guid: a1a06509f94157f48bb98e6ca1ad3292, type: 2} - - {fileID: 7400000, guid: a59244a17ccb8244d8756e172607e1c6, type: 2} - - {fileID: 7400000, guid: b9c4bda4be1638342bf1771c0b1e7248, type: 2} - - {fileID: 7400000, guid: c0b938d84bc5252489e705f3cd08b759, type: 2} - - {fileID: 7400000, guid: c3a729bc8a27a6947b9112e2f6346b65, type: 2} - - {fileID: 7400000, guid: c4958f5087108484b8f543ce9e996370, type: 2} - - {fileID: 7400000, guid: c6c86b24b4fb40b47b26ea516e19faa9, type: 2} - - {fileID: 7400000, guid: c993e3be9ca60ee4ca7b15f37a7fcd2a, type: 2} - - {fileID: 7400000, guid: ca40f58313f31424d9fd1769a3e5774a, type: 2} - - {fileID: 7400000, guid: d74f71708ac46db419d4c522777a345d, type: 2} - - {fileID: 7400000, guid: de64c0fa1d9645d49b708f1d83901ea4, type: 2} - - {fileID: 7400000, guid: e32fe46e8cffaeb4cb6a62f978c1b410, type: 2} - - {fileID: 7400000, guid: eb705a803d7fb8640a867411fd800c66, type: 2} - - {fileID: 7400000, guid: ed1db151ae8c10c49b18540f872c0c5c, type: 2} - - {fileID: 7400000, guid: ef2cb27aa8cdde54381352d2bcca99f0, type: 2} - - {fileID: 7400000, guid: f0543498cd1a2c341892821659fe80ac, type: 2} - - {fileID: 7400000, guid: f171712ad3e7fe74e971317bb3e32097, type: 2} - - {fileID: 7400000, guid: f19b2078601165740871780ee356923d, type: 2} - - {fileID: 7400000, guid: f56dcc9eabf6dde4bb77cb3825dc562e, type: 2} - - {fileID: 7400000, guid: f876b4a97f1ac934594d6a710a840b03, type: 2} - - {fileID: 7400000, guid: f8b9421c26ef3dc46b80b9c26707bc84, type: 2} - - {fileID: 7400000, guid: fcf62432db0b0b446bf621b6b707e0ab, type: 2} - - {fileID: 7400000, guid: fd7ba644b8685174fb0f9b382297c7ad, type: 2} + - {fileID: 7400000, guid: c3116900301035d4d9ab965355a7d2da, type: 2} + - {fileID: 7400000, guid: bbc708a006c53b247950ec8d5e9d13ca, type: 2} + - {fileID: 7400000, guid: 41aad2b17985ec44f950327c98de3a61, type: 2} + - {fileID: 7400000, guid: 1bcb5872b8a9bfd4f99715b6b9a30ed1, type: 2} + - {fileID: 7400000, guid: b8cd2882336a803428d076ed421784cc, type: 2} + - {fileID: 7400000, guid: b9bc2da25c0a4bd4abce7e4102cc6840, type: 2} + - {fileID: 7400000, guid: 435cc9d222543014c95bdb031557363c, type: 2} + - {fileID: 7400000, guid: 81d578e216e55a74792ebd7ff24572a6, type: 2} + - {fileID: 7400000, guid: e01ded23bec2edf4e993362444d0c9f3, type: 2} + - {fileID: 7400000, guid: 2b852a34df329ad47ae0de994304272b, type: 2} + - {fileID: 7400000, guid: e261cb657cadf544ab682441cdf6daa2, type: 2} + - {fileID: 7400000, guid: 8171ffb55afebb248ae9dfec89dfa6d3, type: 2} + - {fileID: 7400000, guid: c3ee01c5c4f7fa844b4cbff88640774a, type: 2} + - {fileID: 7400000, guid: c89c2ac5fdcc7134e9fea639bfa0d3ee, type: 2} + - {fileID: 7400000, guid: 827c0be57e23e654693b18e8be4b9aa6, type: 2} + - {fileID: 7400000, guid: 5b096066f65f50543847312c860bdde0, type: 2} + - {fileID: 7400000, guid: ee10f576fd52c224fbb94ef465f0eca9, type: 2} + - {fileID: 7400000, guid: 0b8210c664cb429459b3b143ab958271, type: 2} + - {fileID: 7400000, guid: 1d8184f650080c94f8eb61c051fa3068, type: 2} + - {fileID: 7400000, guid: c5af08f6a6b63b64f97fa60213bae749, type: 2} + - {fileID: 7400000, guid: 76ee87d8ead47e540a41e8f816214a19, type: 2} + - {fileID: 7400000, guid: a2e5047999f55454a95de53a2576f181, type: 2} + - {fileID: 7400000, guid: a2f76c1a91828fb42853b4dbcf0b883d, type: 2} + - {fileID: 7400000, guid: 0966c5eae482c8e4c925ce47e1cc6b50, type: 2} + - {fileID: 7400000, guid: 275f1dfa6460f8c4191e7b93826387c4, type: 2} + - {fileID: 7400000, guid: c08d534bc615ee244a6e357018332fdb, type: 2} + - {fileID: 7400000, guid: 8c7eb97b053e0854987a526faa03b12b, type: 2} + - {fileID: 7400000, guid: 3bd4e3dbcfd03a643a9d714a4b878cd7, type: 2} + - {fileID: 7400000, guid: f077ebeba29221b4592ba5e2cd4a008b, type: 2} + - {fileID: 7400000, guid: b216803c06badb44ebd515779f3bcfbc, type: 2} + - {fileID: 7400000, guid: 99acc6dc112fda943a2dcec036c68d9a, type: 2} + - {fileID: 7400000, guid: a2fdbfdc90f3a2e4aafa769025f30bd8, type: 2} + - {fileID: 7400000, guid: 34a9ee8dd38b0e74dbea96b7b2dffe60, type: 2} + - {fileID: 7400000, guid: 029da2add803b0c44a3b2844b0aabf98, type: 2} + - {fileID: 7400000, guid: 9a27c7adf2e14834fba322b71ec6d32d, type: 2} + - {fileID: 7400000, guid: c3e17dadf693a9e4fac16a26cc85809d, type: 2} + - {fileID: 7400000, guid: 41bb63bd8f199f747997bfc6866e1985, type: 2} + - {fileID: 7400000, guid: 1bccc94e1444f2f43b6500725e036d99, type: 2} + - {fileID: 7400000, guid: 92290e8e121f9aa42a8105896870497c, type: 2} + - {fileID: 7400000, guid: c695109e70aa1eb46a341994fbe77947, type: 2} + - {fileID: 7400000, guid: bc2299fe63314e14397f7ea049cc5813, type: 2} + - {fileID: 7400000, guid: 4b04975fc39e6d1499f44e0de7ad5b51, type: 2} + - {fileID: 7400000, guid: 6cffd5bfbb65bc740b10b09610162a79, type: 2} + - {fileID: 7400000, guid: 07d58fffb535d124d8714c6a4504f95c, type: 2} + - {fileID: 7400000, guid: d7ed17c702b9a5f429a0d0f911deb512, type: 2} m_WrapMode: 0 m_PlayAutomatically: 1 m_AnimatePhysics: 0 diff --git a/Assets/Scripts/Player Manager/GenericPlayerManager.cs b/Assets/Scripts/Player Manager/GenericPlayerManager.cs index 77f5efb..c166364 100644 --- a/Assets/Scripts/Player Manager/GenericPlayerManager.cs +++ b/Assets/Scripts/Player Manager/GenericPlayerManager.cs @@ -78,6 +78,15 @@ public abstract class GenericPlayerManager : MonoBehaviour { private Subtitle subtitles = null; private bool[] lastLetterAnimations = new bool[256]; + + protected readonly HashSet ValidLetters = new HashSet() { + "A", "B", "C", "Ç", "D", "E", "F", "G", "H", + "I", "J", "K", "L", "M", "N", "O", "P", "Q", + "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "0", "1", "2", "3", "4", + "5", "6", "7", "8", "9", + "," + }; public virtual void Start() { @@ -100,20 +109,11 @@ public abstract class GenericPlayerManager : MonoBehaviour { foreach (string flag in flags) this.flags.Add(flag); - string[] preloadedAnims = new string[] { - "A", "B", "C", "Ç", "D", "E", "F", "G", "H", "I", - "J", "K", "L", "M", "N", "O", "P", "Q", "R", - "S", "T", "U", "V", "W", "X", "Y", "Z", - "0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", - "," - }; - // Duplica sinais para diferenciar quando há repetidos - foreach (string anim in preloadedAnims) + foreach (string anim in this.ValidLetters) COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim); - foreach (string anim in preloadedAnims) + foreach (string anim in this.ValidLetters) this.loadedAssetBundles.Add(anim); // Cria novo _default chamado _default_middle para pausas dentro de uma glosa @@ -133,6 +133,10 @@ public abstract class GenericPlayerManager : MonoBehaviour { this.subtitles.setText(text); } + public bool IsSpecialSign(string word) { + return flags.Contains(word); + } + /* Configura as animações de intervalo */ public void setRandomAnimations(string[] intervalAnimations) { @@ -476,12 +480,12 @@ public abstract class GenericPlayerManager : MonoBehaviour { bool playingStarted = false; String[] stringPos = gloss.Split(' '); - foreach (string aniName in stringPos) + foreach (string sub in stringPos) { + string aniName = sub; if (String.IsNullOrEmpty(aniName)) continue; bool loaded = loadedAssetBundles.Contains(aniName); - if ( ! loaded) { WWW bundleRequest = loadAssetBundle(aniName); diff --git a/Assets/Scripts/PlayerManager.cs b/Assets/Scripts/PlayerManager.cs index cf2252f..53e58aa 100644 --- a/Assets/Scripts/PlayerManager.cs +++ b/Assets/Scripts/PlayerManager.cs @@ -9,6 +9,7 @@ using LAViD.Structures; using System.Diagnostics; using LAViD.Unity.Utils; using LAViD.VLibras.Dictionary; +using System.Collections.Generic; public class PlayerManager : GenericPlayerManager { @@ -140,8 +141,18 @@ public class PlayerManager : GenericPlayerManager { protected override WWW loadAssetBundle(string aniName) { - if (this.regionHash == 1 && this.signs != null && !this.signs.Contains(aniName)) - return null; + UnityEngine.Debug.Log("PM.lAB: Checking " + aniName); + + if (this.regionHash == 1 && this.signs != null && !base.IsSpecialSign(aniName)) + { + try { + if (!this.signs.Contains(aniName)) + return null; + } + catch (KeyNotFoundException) { + return null; + } + } string address = BASE_URL + this.regionPath + WWW.EscapeURL(aniName); @@ -177,47 +188,8 @@ public class PlayerManager : GenericPlayerManager { this.screenManager.switchScreen("translate"); } - protected override WWW getCheckConnectionRequest() - { + protected override WWW getCheckConnectionRequest() { return new WWW(BASE_URL); - - - /*WWW connection = new WWW(SERVER_URL); - yield return connection; - //while (!glossRequest.isDone) - - if (connection.error == null) - { - if (connection.responseHeaders.Count > 0) - PlayerLogger.Log(connection.responseHeaders["STATUS"]); - else - PlayerLogger.Log("No STATUS"); - } - else PlayerLogger.Log("ERROR: " + connection.error); - - return false;*/ - - - /*HttpWebRequest request = (HttpWebRequest)WebRequest.Create(BASE_URL); - request.Method = "HEAD"; - request.Timeout = 2000; - - try { - HttpWebResponse response = (HttpWebResponse) request.GetResponse(); - } - catch (WebException e) - { - if (e.Response != null) - { - PlayerLogger.Log(((HttpWebResponse)e.Response).StatusCode); - return ((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.NotFound; - } - } - catch (Exception) - { - } - - return false;*/ } public IEnumerator WaitForResponse(WWW www, Events.RequestSuccess success, Events.RequestError error) @@ -286,12 +258,12 @@ public class PlayerManager : GenericPlayerManager { yield break; } - + + // Allows the gloss to be played when the dialog is closed base.gloss = gloss.ToUpper(); } finally { - this.screenManager.setLoadingSnippetState(false); base.randomAnimations.unlockFor("translate"); } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 226e8aa..26a45f2 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -95,7 +95,7 @@ PlayerSettings: 16:9: 1 Others: 1 bundleIdentifier: com.lavid.vlibrasdroid - bundleVersion: 3.1.0 + bundleVersion: 3.2.0 preloadedAssets: [] metroEnableIndependentInputSource: 0 xboxOneDisableKinectGpuReservation: 0 -- libgit2 0.21.2