diff --git a/Assets/Resources/sinais.txt b/Assets/Resources/sinais.txt index ee76a0c..22a779f 100644 --- a/Assets/Resources/sinais.txt +++ b/Assets/Resources/sinais.txt @@ -1,5 +1,3 @@ - -% , 0 1 @@ -2351,16 +2349,6 @@ CUSTEAR CUSTOSO CUTANEO CUTUCAR -Cotovelo -Cozinheira -Cpf -Crer -Crianca -Cueca -Cuidadoso -Cumprimentos -Cunhada -Curitiba DÓLAR D DA @@ -2848,7 +2836,7 @@ DIGITADOR DIGITAL DIGITALIZADA DIGITALIZADO -DIGITAR 23-Sep-2015 17:56 61K +DIGITAR DIGITO DIGNIDADE DIGNO @@ -3054,18 +3042,18 @@ DURO DUVIDA DUVIDOSO DVD -Dama -Decidir -Dedo -Default Take -Descer -Diminuir -Diretor -Disputar -Distrito-federal -Dividir -Divorciar -Domino +DAMA +DECIDIR +DEDO +DEFAULT TAKE +DESCER +DIMINUIR +DIRETOR +DISPUTAR +DISTRITO-FEDERAL +DIVIDIR +DIVORCIAR +DOMINO E EBRIO ECOLOGIA @@ -5249,7 +5237,7 @@ LACRIMEJANTE LACRIMEJAR LACTEO LACTOSE -LADO24-Sep-2015 09:59 19K +LADO LADRAR LADRILHO LAGARTA diff --git a/Assets/Scripts/Animation List/ListManager.cs b/Assets/Scripts/Animation List/ListManager.cs index 97c993a..75656df 100644 --- a/Assets/Scripts/Animation List/ListManager.cs +++ b/Assets/Scripts/Animation List/ListManager.cs @@ -61,18 +61,20 @@ public class ListManager : MonoBehaviour { public IEnumerator load() { - string[] lines; - WWW www = new WWW("http://vlibras.lavid.ufpb.br/sinais.txt"); + WWW www = new WWW("http://150.165.205.9/anims/sinais.txt"); yield return www; - if (www.error != null) + string[] lines = new string[0]; + + if (string.IsNullOrEmpty(www.error)) { - TextAsset file = Resources.Load("sinais") as TextAsset; - lines = file.text.Split("\n"[0]); + lines = System.Text.Encoding.UTF8.GetString(www.bytes, 0, www.bytes.Length).Split('\n'); } else { - lines = www.text.Split("\n"[0]); + TextAsset file = Resources.Load("sinais") as TextAsset; + lines = System.Text.Encoding.UTF8.GetString(file.bytes, 0, file.bytes.Length).Split('\n'); + // lines = file.text.Split("\n"[0]); } this.trie = new TrieST(); @@ -109,6 +111,7 @@ public class ListManager : MonoBehaviour { Destroy(go); populateList(); + this.scrollView.verticalNormalizedPosition = 1F; } private void populateList() diff --git a/Assets/Scripts/Animation List/TrieST.cs b/Assets/Scripts/Animation List/TrieST.cs index 98237e4..a4bb37a 100644 --- a/Assets/Scripts/Animation List/TrieST.cs +++ b/Assets/Scripts/Animation List/TrieST.cs @@ -52,7 +52,6 @@ public class TrieST private Node put(Node x, String key, String val, int d) { - if (x == null) x = new Node(); if (d == key.Length) { @@ -60,10 +59,16 @@ public class TrieST x.val = val; return x; } - int c = indexes[key[d]]; - x.next[c] = put(x.next[c], key, val, d + 1); - return x; + try { + int c = indexes[key[d]]; + x.next[c] = put(x.next[c], key, val, d + 1); + } + catch (IndexOutOfRangeException) { + Debug.Log("Error at TrieST.put: { key: " + key + "; index: " + d + "; value: " + ((int) key[d]) + " }"); + } + + return x; } public Queue keys() diff --git a/Assets/Scripts/Player Manager/GenericPlayerManager.cs b/Assets/Scripts/Player Manager/GenericPlayerManager.cs index aa73d14..513a556 100644 --- a/Assets/Scripts/Player Manager/GenericPlayerManager.cs +++ b/Assets/Scripts/Player Manager/GenericPlayerManager.cs @@ -1,8 +1,12 @@ /** Gerenciador genérico e principal dos players. * - * Versão: 2.1 + * Versão 2.1 * - Acompanhamento da legenda - * Corrigido problema na soletração quando a velocidade ultrapassava ~1 + * Corrigido problema na soletração quando a velocidade ultrapassava ~1. + * + * Versão 2.2 + * - Acompanhamento da legenda + * Corrigido problema na soletração quando o estado muda para pausado. */ //Log Dir http://docs.unity3d.com/Manual/LogFiles.html @@ -479,8 +483,10 @@ public abstract class GenericPlayerManager : MonoBehaviour { loadedAssetBundles.Add(aniName); loaded = true; + + Debug.Log("Bundle \"" + aniName + "\" loaded!"); } - else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" não carregado corretamente."); + else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" foi não carregado corretamente."); } } else onConnectionError(gloss, aniName); @@ -522,18 +528,19 @@ public abstract class GenericPlayerManager : MonoBehaviour { if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) { - //playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", 1.6F); toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); - continue; + spelled = false; } - - // Se já houve o soletramento de alguma palavra, reproduz animação default - if (spelled) - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, 1.6F)); else - spelled = true; + { + // Se já houve o soletramento de alguma palavra, reproduz animação default + if (spelled) + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); + else + spelled = true; - lastAnimationSubtitle = spellWord(toPlayQueue, aniName); + lastAnimationSubtitle = spellWord(toPlayQueue, aniName); + } } if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) diff --git a/Assets/Scripts/Player Manager/RandomAnimations.cs b/Assets/Scripts/Player Manager/RandomAnimations.cs index 4578c4e..606811b 100644 --- a/Assets/Scripts/Player Manager/RandomAnimations.cs +++ b/Assets/Scripts/Player Manager/RandomAnimations.cs @@ -60,36 +60,37 @@ public class RandomAnimations : MonoBehaviour { { while (true) { - while (this.playerManager.isPlayingIntervalAnimation()) - yield return new WaitForSeconds(1); + // Espera enquanto estiver reproduzindo animações de intervalo + do { yield return null; } + while (this.playerManager.isPlayingIntervalAnimation()); - bool isNotBlocked; - lock (this.blockingObjects) { - isNotBlocked = this.blockingObjects.Count == 0; - } - - if (isNotBlocked) + // Se houver bloqueio, espera acabar + while (true) { - yield return new WaitForSeconds(this.time); - lock (this.blockingObjects) { - if (this.blockingObjects.Count > 0) - continue; + if (this.blockingObjects.Count == 0) + break; } - int index = sortIndex(); + yield return null; + } - if (index != -1) - { - if (index == this.lastIndex) - index = sortIndex(); + // Espera time + yield return new WaitForSeconds(this.time); - //this.playerManager.play(this.names[index], true, false, true); - this.playerManager.playIntervalAnimation(this.names[index]); - } + // Se houver bloqueio, volta a esperar + lock (this.blockingObjects) { + if (this.blockingObjects.Count > 0) + continue; } - - yield return null; + + int index = sortIndex(); + + if (index != -1 && index == this.lastIndex) + index = sortIndex(); + + if (index != -1) + this.playerManager.playIntervalAnimation(this.names[index]); } } -- libgit2 0.21.2