Commit 719babec26703efc8761deb976c4e8ece58a635b

Authored by Mateus Lustosa
1 parent 9597262e

Arquivo sinais.txt em .9/anims; Scroll para o topo quando a pesquisa é alterada;

Assets/Resources/sinais.txt
1 -  
2 -%  
3 , 1 ,
4 0 2 0
5 1 3 1
@@ -2351,16 +2349,6 @@ CUSTEAR @@ -2351,16 +2349,6 @@ CUSTEAR
2351 CUSTOSO 2349 CUSTOSO
2352 CUTANEO 2350 CUTANEO
2353 CUTUCAR 2351 CUTUCAR
2354 -Cotovelo  
2355 -Cozinheira  
2356 -Cpf  
2357 -Crer  
2358 -Crianca  
2359 -Cueca  
2360 -Cuidadoso  
2361 -Cumprimentos  
2362 -Cunhada  
2363 -Curitiba  
2364 DÓLAR 2352 DÓLAR
2365 D 2353 D
2366 DA 2354 DA
@@ -2848,7 +2836,7 @@ DIGITADOR @@ -2848,7 +2836,7 @@ DIGITADOR
2848 DIGITAL 2836 DIGITAL
2849 DIGITALIZADA 2837 DIGITALIZADA
2850 DIGITALIZADO 2838 DIGITALIZADO
2851 -DIGITAR 23-Sep-2015 17:56 61K 2839 +DIGITAR
2852 DIGITO 2840 DIGITO
2853 DIGNIDADE 2841 DIGNIDADE
2854 DIGNO 2842 DIGNO
@@ -3054,18 +3042,18 @@ DURO @@ -3054,18 +3042,18 @@ DURO
3054 DUVIDA 3042 DUVIDA
3055 DUVIDOSO 3043 DUVIDOSO
3056 DVD 3044 DVD
3057 -Dama  
3058 -Decidir  
3059 -Dedo  
3060 -Default Take  
3061 -Descer  
3062 -Diminuir  
3063 -Diretor  
3064 -Disputar  
3065 -Distrito-federal  
3066 -Dividir  
3067 -Divorciar  
3068 -Domino 3045 +DAMA
  3046 +DECIDIR
  3047 +DEDO
  3048 +DEFAULT TAKE
  3049 +DESCER
  3050 +DIMINUIR
  3051 +DIRETOR
  3052 +DISPUTAR
  3053 +DISTRITO-FEDERAL
  3054 +DIVIDIR
  3055 +DIVORCIAR
  3056 +DOMINO
3069 E 3057 E
3070 EBRIO 3058 EBRIO
3071 ECOLOGIA 3059 ECOLOGIA
@@ -5249,7 +5237,7 @@ LACRIMEJANTE @@ -5249,7 +5237,7 @@ LACRIMEJANTE
5249 LACRIMEJAR 5237 LACRIMEJAR
5250 LACTEO 5238 LACTEO
5251 LACTOSE 5239 LACTOSE
5252 -LADO24-Sep-2015 09:59 19K 5240 +LADO
5253 LADRAR 5241 LADRAR
5254 LADRILHO 5242 LADRILHO
5255 LAGARTA 5243 LAGARTA
Assets/Scripts/Animation List/ListManager.cs
@@ -61,18 +61,20 @@ public class ListManager : MonoBehaviour { @@ -61,18 +61,20 @@ public class ListManager : MonoBehaviour {
61 61
62 public IEnumerator load() 62 public IEnumerator load()
63 { 63 {
64 - string[] lines;  
65 - WWW www = new WWW("http://vlibras.lavid.ufpb.br/sinais.txt"); 64 + WWW www = new WWW("http://150.165.205.9/anims/sinais.txt");
66 yield return www; 65 yield return www;
67 66
68 - if (www.error != null) 67 + string[] lines = new string[0];
  68 +
  69 + if (string.IsNullOrEmpty(www.error))
69 { 70 {
70 - TextAsset file = Resources.Load("sinais") as TextAsset;  
71 - lines = file.text.Split("\n"[0]); 71 + lines = System.Text.Encoding.UTF8.GetString(www.bytes, 0, www.bytes.Length).Split('\n');
72 } 72 }
73 else 73 else
74 { 74 {
75 - lines = www.text.Split("\n"[0]); 75 + TextAsset file = Resources.Load("sinais") as TextAsset;
  76 + lines = System.Text.Encoding.UTF8.GetString(file.bytes, 0, file.bytes.Length).Split('\n');
  77 + // lines = file.text.Split("\n"[0]);
76 } 78 }
77 79
78 this.trie = new TrieST<string>(); 80 this.trie = new TrieST<string>();
@@ -109,6 +111,7 @@ public class ListManager : MonoBehaviour { @@ -109,6 +111,7 @@ public class ListManager : MonoBehaviour {
109 Destroy(go); 111 Destroy(go);
110 112
111 populateList(); 113 populateList();
  114 + this.scrollView.verticalNormalizedPosition = 1F;
112 } 115 }
113 116
114 private void populateList() 117 private void populateList()
Assets/Scripts/Animation List/TrieST.cs
@@ -52,7 +52,6 @@ public class TrieST&lt;Value&gt; @@ -52,7 +52,6 @@ public class TrieST&lt;Value&gt;
52 52
53 private Node put(Node x, String key, String val, int d) 53 private Node put(Node x, String key, String val, int d)
54 { 54 {
55 -  
56 if (x == null) x = new Node(); 55 if (x == null) x = new Node();
57 if (d == key.Length) 56 if (d == key.Length)
58 { 57 {
@@ -60,10 +59,16 @@ public class TrieST&lt;Value&gt; @@ -60,10 +59,16 @@ public class TrieST&lt;Value&gt;
60 x.val = val; 59 x.val = val;
61 return x; 60 return x;
62 } 61 }
63 - int c = indexes[key[d]];  
64 - x.next[c] = put(x.next[c], key, val, d + 1);  
65 - return x;  
66 62
  63 + try {
  64 + int c = indexes[key[d]];
  65 + x.next[c] = put(x.next[c], key, val, d + 1);
  66 + }
  67 + catch (IndexOutOfRangeException) {
  68 + Debug.Log("Error at TrieST.put: { key: " + key + "; index: " + d + "; value: " + ((int) key[d]) + " }");
  69 + }
  70 +
  71 + return x;
67 } 72 }
68 73
69 public Queue<String> keys() 74 public Queue<String> keys()
Assets/Scripts/Player Manager/GenericPlayerManager.cs
1 /** Gerenciador genérico e principal dos players. 1 /** Gerenciador genérico e principal dos players.
2 * 2 *
3 - * Versão: 2.1 3 + * Versão 2.1
4 * - Acompanhamento da legenda 4 * - Acompanhamento da legenda
5 - * Corrigido problema na soletração quando a velocidade ultrapassava ~1 5 + * Corrigido problema na soletração quando a velocidade ultrapassava ~1.
  6 + *
  7 + * Versão 2.2
  8 + * - Acompanhamento da legenda
  9 + * Corrigido problema na soletração quando o estado muda para pausado.
6 */ 10 */
7 11
8 //Log Dir http://docs.unity3d.com/Manual/LogFiles.html 12 //Log Dir http://docs.unity3d.com/Manual/LogFiles.html
@@ -479,8 +483,10 @@ public abstract class GenericPlayerManager : MonoBehaviour { @@ -479,8 +483,10 @@ public abstract class GenericPlayerManager : MonoBehaviour {
479 483
480 loadedAssetBundles.Add(aniName); 484 loadedAssetBundles.Add(aniName);
481 loaded = true; 485 loaded = true;
  486 +
  487 + Debug.Log("Bundle \"" + aniName + "\" loaded!");
482 } 488 }
483 - else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" não carregado corretamente."); 489 + else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" foi não carregado corretamente.");
484 } 490 }
485 } 491 }
486 else onConnectionError(gloss, aniName); 492 else onConnectionError(gloss, aniName);
@@ -522,18 +528,19 @@ public abstract class GenericPlayerManager : MonoBehaviour { @@ -522,18 +528,19 @@ public abstract class GenericPlayerManager : MonoBehaviour {
522 528
523 if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) 529 if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName))
524 { 530 {
525 - //playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", 1.6F);  
526 toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); 531 toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F));
527 - continue; 532 + spelled = false;
528 } 533 }
529 -  
530 - // Se já houve o soletramento de alguma palavra, reproduz animação default  
531 - if (spelled)  
532 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, 1.6F));  
533 else 534 else
534 - spelled = true; 535 + {
  536 + // Se já houve o soletramento de alguma palavra, reproduz animação default
  537 + if (spelled)
  538 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F));
  539 + else
  540 + spelled = true;
535 541
536 - lastAnimationSubtitle = spellWord(toPlayQueue, aniName); 542 + lastAnimationSubtitle = spellWord(toPlayQueue, aniName);
  543 + }
537 } 544 }
538 545
539 if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) 546 if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length)
Assets/Scripts/Player Manager/RandomAnimations.cs
@@ -60,36 +60,37 @@ public class RandomAnimations : MonoBehaviour { @@ -60,36 +60,37 @@ public class RandomAnimations : MonoBehaviour {
60 { 60 {
61 while (true) 61 while (true)
62 { 62 {
63 - while (this.playerManager.isPlayingIntervalAnimation())  
64 - yield return new WaitForSeconds(1); 63 + // Espera enquanto estiver reproduzindo animações de intervalo
  64 + do { yield return null; }
  65 + while (this.playerManager.isPlayingIntervalAnimation());
65 66
66 - bool isNotBlocked;  
67 - lock (this.blockingObjects) {  
68 - isNotBlocked = this.blockingObjects.Count == 0;  
69 - }  
70 -  
71 - if (isNotBlocked) 67 + // Se houver bloqueio, espera acabar
  68 + while (true)
72 { 69 {
73 - yield return new WaitForSeconds(this.time);  
74 -  
75 lock (this.blockingObjects) { 70 lock (this.blockingObjects) {
76 - if (this.blockingObjects.Count > 0)  
77 - continue; 71 + if (this.blockingObjects.Count == 0)
  72 + break;
78 } 73 }
79 74
80 - int index = sortIndex(); 75 + yield return null;
  76 + }
81 77
82 - if (index != -1)  
83 - {  
84 - if (index == this.lastIndex)  
85 - index = sortIndex(); 78 + // Espera time
  79 + yield return new WaitForSeconds(this.time);
86 80
87 - //this.playerManager.play(this.names[index], true, false, true);  
88 - this.playerManager.playIntervalAnimation(this.names[index]);  
89 - } 81 + // Se houver bloqueio, volta a esperar
  82 + lock (this.blockingObjects) {
  83 + if (this.blockingObjects.Count > 0)
  84 + continue;
90 } 85 }
91 -  
92 - yield return null; 86 +
  87 + int index = sortIndex();
  88 +
  89 + if (index != -1 && index == this.lastIndex)
  90 + index = sortIndex();
  91 +
  92 + if (index != -1)
  93 + this.playerManager.playIntervalAnimation(this.names[index]);
93 } 94 }
94 } 95 }
95 96