Commit d55acff5f713b025835c477911144f24cfbe5530
1 parent
97e12b16
Exists in
master
Arquivo sinais.txt na pasta Resources; Scroll para o topo quando a pesquisa é al…
…terada; Correção de problema que fazia ultimas palavras não serem reproduzidas quando havia sinais de pontuação; Retirada de alterações no avatar collider dentro do script FadeFX.
Showing
6 changed files
with
163 additions
and
93 deletions
Show diff stats
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
@@ -48,7 +48,7 @@ public class ListManager : MonoBehaviour { | @@ -48,7 +48,7 @@ public class ListManager : MonoBehaviour { | ||
48 | 48 | ||
49 | public IEnumerator Load() | 49 | public IEnumerator Load() |
50 | { | 50 | { |
51 | - string[] lines; | 51 | + /*string[] lines; |
52 | WWW www = new WWW("http://150.165.205.9/anims/sinais.txt"); | 52 | WWW www = new WWW("http://150.165.205.9/anims/sinais.txt"); |
53 | yield return www; | 53 | yield return www; |
54 | 54 | ||
@@ -60,7 +60,19 @@ public class ListManager : MonoBehaviour { | @@ -60,7 +60,19 @@ public class ListManager : MonoBehaviour { | ||
60 | else | 60 | else |
61 | { | 61 | { |
62 | lines = www.text.Split("\n"[0]); | 62 | lines = www.text.Split("\n"[0]); |
63 | - } | 63 | + }*/ |
64 | + | ||
65 | + WWW www = new WWW("file:///" + Application.dataPath + "/Resources/sinais.txt"); | ||
66 | + yield return www; | ||
67 | + | ||
68 | + Debug.Log(Application.dataPath); | ||
69 | + | ||
70 | + string[] lines = new string[0]; | ||
71 | + | ||
72 | + if (string.IsNullOrEmpty(www.error)) | ||
73 | + lines = System.Text.Encoding.UTF8.GetString(www.bytes, 0, www.bytes.Length).Split('\n'); | ||
74 | + else | ||
75 | + Debug.Log(www.error); | ||
64 | 76 | ||
65 | this.trie = new TrieST<string>(); | 77 | this.trie = new TrieST<string>(); |
66 | 78 | ||
@@ -96,6 +108,7 @@ public class ListManager : MonoBehaviour { | @@ -96,6 +108,7 @@ public class ListManager : MonoBehaviour { | ||
96 | Destroy(go); | 108 | Destroy(go); |
97 | 109 | ||
98 | populateList(); | 110 | populateList(); |
111 | + this.scrollView.verticalNormalizedPosition = 1F; | ||
99 | } | 112 | } |
100 | 113 | ||
101 | private void populateList() | 114 | private void populateList() |
Assets/Scripts/Animation List/TrieST.cs
@@ -47,12 +47,12 @@ public class TrieST<Value> | @@ -47,12 +47,12 @@ public class TrieST<Value> | ||
47 | 47 | ||
48 | public void put(String key, String val) | 48 | public void put(String key, String val) |
49 | { | 49 | { |
50 | - root = put(root, key, val, 0); | 50 | + if ( ! String.IsNullOrEmpty(key) && ! String.IsNullOrEmpty(val)) |
51 | + root = put(root, key, val, 0); | ||
51 | } | 52 | } |
52 | 53 | ||
53 | private Node put(Node x, String key, String val, int d) | 54 | private Node put(Node x, String key, String val, int d) |
54 | { | 55 | { |
55 | - | ||
56 | if (x == null) x = new Node(); | 56 | if (x == null) x = new Node(); |
57 | if (d == key.Length) | 57 | if (d == key.Length) |
58 | { | 58 | { |
@@ -60,10 +60,16 @@ public class TrieST<Value> | @@ -60,10 +60,16 @@ public class TrieST<Value> | ||
60 | x.val = val; | 60 | x.val = val; |
61 | return x; | 61 | return x; |
62 | } | 62 | } |
63 | - int c = indexes[key[d]]; | ||
64 | - x.next[c] = put(x.next[c], key, val, d + 1); | ||
65 | - return x; | ||
66 | 63 | ||
64 | + try { | ||
65 | + int c = indexes[key[d]]; | ||
66 | + x.next[c] = put(x.next[c], key, val, d + 1); | ||
67 | + } | ||
68 | + catch (IndexOutOfRangeException) { | ||
69 | + Debug.Log("Error at TrieST.put: { key: " + key + "; index: " + d + "; value: " + ((int) key[d]) + " }" + key); | ||
70 | + } | ||
71 | + | ||
72 | + return x; | ||
67 | } | 73 | } |
68 | 74 | ||
69 | public Queue<String> keys() | 75 | 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 |
@@ -53,12 +57,16 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -53,12 +57,16 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
53 | 57 | ||
54 | // Se diferente de null, não está reproduzindo animação de intervalo | 58 | // Se diferente de null, não está reproduzindo animação de intervalo |
55 | private AnimationState intervalAnimationState = null; | 59 | private AnimationState intervalAnimationState = null; |
60 | + // Usado para pausar quando comandado | ||
61 | + private AnimationReference animationPlaying = null; | ||
56 | 62 | ||
57 | // Gerenciador de animações de intervalo | 63 | // Gerenciador de animações de intervalo |
58 | public RandomAnimations randomAnimations; | 64 | public RandomAnimations randomAnimations; |
59 | // Gerenciados de legendas | 65 | // Gerenciados de legendas |
60 | private Subtitle subtitles = null; | 66 | private Subtitle subtitles = null; |
61 | 67 | ||
68 | + private bool[] lastLetterAnimations = new bool[256]; | ||
69 | + | ||
62 | public virtual void Start() | 70 | public virtual void Start() |
63 | { | 71 | { |
64 | // Configuração de velocidade das animações | 72 | // Configuração de velocidade das animações |
@@ -80,20 +88,21 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -80,20 +88,21 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
80 | foreach (string flag in flags) | 88 | foreach (string flag in flags) |
81 | this.flags.Add(flag); | 89 | this.flags.Add(flag); |
82 | 90 | ||
83 | - // Duplica sinais para diferenciar quando há repetidos | ||
84 | - string[] toDuplicate = new string[] { | 91 | + string[] preloadedAnims = new string[] { |
85 | "A", "B", "C", "D", "E", "F", "G", "H", "I", | 92 | "A", "B", "C", "D", "E", "F", "G", "H", "I", |
86 | "J", "K", "L", "M", "N", "O", "P", "Q", "R", | 93 | "J", "K", "L", "M", "N", "O", "P", "Q", "R", |
87 | "S", "T", "U", "V", "W", "X", "Y", "Z", | 94 | "S", "T", "U", "V", "W", "X", "Y", "Z", |
88 | "0", "1", "2", "3", "4", | 95 | "0", "1", "2", "3", "4", |
89 | "5", "6", "7", "8", "9", | 96 | "5", "6", "7", "8", "9", |
90 | - "," | 97 | + "," |
91 | }; | 98 | }; |
92 | - foreach (string anim in toDuplicate) | 99 | + |
100 | + // Duplica sinais para diferenciar quando há repetidos | ||
101 | + foreach (string anim in preloadedAnims) | ||
93 | COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim); | 102 | COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim); |
94 | 103 | ||
95 | - // Sinal default é tratado como animação de intervalo: não sinaliza reprodução na UI | ||
96 | - //this.intervalAnimations.Add(DEFAULT_ANIMATION); | 104 | + foreach (string anim in preloadedAnims) |
105 | + this.loadedAssetBundles.Add(anim); | ||
97 | 106 | ||
98 | // Cria novo _default chamado _default_middle para pausas dentro de uma glosa | 107 | // Cria novo _default chamado _default_middle para pausas dentro de uma glosa |
99 | // Impede que a animação default seja confundida com não-reprodução na UI | 108 | // Impede que a animação default seja confundida com não-reprodução na UI |
@@ -131,9 +140,9 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -131,9 +140,9 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
131 | subtitles.updateNumberSpeed(); | 140 | subtitles.updateNumberSpeed(); |
132 | 141 | ||
133 | // Altera a velocidade de todas as animações em reprodução | 142 | // Altera a velocidade de todas as animações em reprodução |
134 | - if ( ! paused) lock (animQueue) | 143 | + if ( ! paused) lock (this.animQueue) |
135 | { | 144 | { |
136 | - foreach (AnimationReference reference in animQueue) | 145 | + foreach (AnimationReference reference in this.animQueue) |
137 | if (reference.type != Subtitle.TYPE_NONE && reference.state != null) | 146 | if (reference.type != Subtitle.TYPE_NONE && reference.state != null) |
138 | reference.state.speed = getSpeedByType(reference.type); | 147 | reference.state.speed = getSpeedByType(reference.type); |
139 | } | 148 | } |
@@ -169,12 +178,10 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -169,12 +178,10 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
169 | this.randomAnimations.unlockFor("handleStates"); | 178 | this.randomAnimations.unlockFor("handleStates"); |
170 | this.subtitles.setText(""); | 179 | this.subtitles.setText(""); |
171 | 180 | ||
172 | - lock (animQueue) { animQueue.Clear(); } | 181 | + lock (this.animQueue) { this.animQueue.Clear(); } |
173 | COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, QueueMode.PlayNow); | 182 | COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, QueueMode.PlayNow); |
174 | 183 | ||
175 | - playing = false; | ||
176 | - paused = false; | ||
177 | - onPlayingStateChange(); | 184 | + resetStates(); |
178 | } | 185 | } |
179 | 186 | ||
180 | /* Repete animações */ | 187 | /* Repete animações */ |
@@ -198,7 +205,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -198,7 +205,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
198 | state.speed = speed; | 205 | state.speed = speed; |
199 | 206 | ||
200 | lock (this.animQueue) { | 207 | lock (this.animQueue) { |
201 | - animQueue.Enqueue(new AnimationReference(name, subtitle, state, type)); | 208 | + this.animQueue.Enqueue(new AnimationReference(name, subtitle, state, type)); |
202 | } | 209 | } |
203 | 210 | ||
204 | return state; | 211 | return state; |
@@ -235,12 +242,17 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -235,12 +242,17 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
235 | */ | 242 | */ |
236 | protected abstract WWW loadAssetBundle(string aniName); | 243 | protected abstract WWW loadAssetBundle(string aniName); |
237 | 244 | ||
245 | + /** | ||
246 | + * Listen to changes in the playing status. | ||
247 | + */ | ||
248 | + protected abstract void onConnectionError(string gloss, string word); | ||
238 | 249 | ||
239 | /** | 250 | /** |
240 | * Listen to changes in the playing status. | 251 | * Listen to changes in the playing status. |
241 | */ | 252 | */ |
242 | protected abstract void onPlayingStateChange(); | 253 | protected abstract void onPlayingStateChange(); |
243 | 254 | ||
255 | + | ||
244 | /* Pause or continue animations */ | 256 | /* Pause or continue animations */ |
245 | public void setPauseState(bool paused) | 257 | public void setPauseState(bool paused) |
246 | { | 258 | { |
@@ -248,15 +260,22 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -248,15 +260,22 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
248 | { | 260 | { |
249 | this.paused = paused; | 261 | this.paused = paused; |
250 | 262 | ||
251 | - lock (animQueue) | 263 | + lock (this.animQueue) |
252 | { | 264 | { |
253 | - foreach (AnimationReference reference in animQueue) | 265 | + if (this.animationPlaying != null && this.animationPlaying.state != null) |
266 | + this.animationPlaying.state.speed = paused ? 0F : getSpeedByType(this.animationPlaying.type); | ||
267 | + | ||
268 | + foreach (AnimationReference reference in this.animQueue) | ||
254 | if (reference.state != null) | 269 | if (reference.state != null) |
255 | reference.state.speed = paused ? 0F : getSpeedByType(reference.type); | 270 | reference.state.speed = paused ? 0F : getSpeedByType(reference.type); |
256 | } | 271 | } |
257 | - | ||
258 | - onPlayingStateChange(); | ||
259 | } | 272 | } |
273 | + | ||
274 | + onPlayingStateChange(); | ||
275 | + } | ||
276 | + | ||
277 | + public void setAnimationEnabled(bool enabled) { | ||
278 | + COMPONENT_ANIMATION.enabled = enabled; | ||
260 | } | 279 | } |
261 | 280 | ||
262 | /* Pause or continue animations */ | 281 | /* Pause or continue animations */ |
@@ -315,6 +334,14 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -315,6 +334,14 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
315 | return true; | 334 | return true; |
316 | } | 335 | } |
317 | 336 | ||
337 | + private string nextLetterAnimation(char letter) | ||
338 | + { | ||
339 | + string animation = (this.lastLetterAnimations[letter] ? "" : "d_") + letter.ToString(); | ||
340 | + this.lastLetterAnimations[letter] = ! this.lastLetterAnimations[letter]; | ||
341 | + | ||
342 | + return animation; | ||
343 | + } | ||
344 | + | ||
318 | /* Enfileira soletração de palavra */ | 345 | /* Enfileira soletração de palavra */ |
319 | private string spellWord(Queue<ToPlay> toPlayQueue, string word) | 346 | private string spellWord(Queue<ToPlay> toPlayQueue, string word) |
320 | { | 347 | { |
@@ -329,9 +356,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -329,9 +356,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
329 | for (int i = 0; i < word.Length; i++) | 356 | for (int i = 0; i < word.Length; i++) |
330 | { | 357 | { |
331 | lastAnimationSubtitle = Subtitle.highlight(word, i); | 358 | lastAnimationSubtitle = Subtitle.highlight(word, i); |
332 | - | ||
333 | - string anim = word[i].ToString(); | ||
334 | - lastAnim = anim.Equals(lastAnim) ? "d_" + anim : anim; | 359 | + lastAnim = nextLetterAnimation(word[i]); |
360 | + //anim.Equals(lastAnim) ? "d_" + anim : anim; | ||
335 | 361 | ||
336 | short type; | 362 | short type; |
337 | 363 | ||
@@ -443,23 +469,29 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -443,23 +469,29 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
443 | AssetBundle bundle = null; | 469 | AssetBundle bundle = null; |
444 | 470 | ||
445 | if (www.error == null) | 471 | if (www.error == null) |
446 | - bundle = www.assetBundle; | ||
447 | - | ||
448 | - if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name)) | ||
449 | { | 472 | { |
450 | - AnimationClip aniClip = bundle.mainAsset as AnimationClip; | ||
451 | - bundle.Unload(false); | 473 | + bundle = www.assetBundle; |
452 | 474 | ||
453 | - if (aniClip) | 475 | + if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name)) |
454 | { | 476 | { |
455 | - COMPONENT_ANIMATION.AddClip(aniClip, aniName); | 477 | + AnimationClip aniClip = bundle.mainAsset as AnimationClip; |
478 | + bundle.Unload(false); | ||
479 | + | ||
480 | + if (aniClip) | ||
481 | + { | ||
482 | + COMPONENT_ANIMATION.AddClip(aniClip, aniName); | ||
483 | + | ||
484 | + loadedAssetBundles.Add(aniName); | ||
485 | + loaded = true; | ||
456 | 486 | ||
457 | - loadedAssetBundles.Add(aniName); | ||
458 | - loaded = true; | 487 | + Debug.Log("Bundle \"" + aniName + "\" loaded!"); |
488 | + } | ||
489 | + else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" foi não carregado corretamente."); | ||
459 | } | 490 | } |
460 | - else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" não carregado corretamente."); | ||
461 | } | 491 | } |
492 | + else onConnectionError(gloss, aniName); | ||
462 | } | 493 | } |
494 | + else onConnectionError(gloss, aniName); | ||
463 | } | 495 | } |
464 | 496 | ||
465 | // Reproduz palavra | 497 | // Reproduz palavra |
@@ -496,18 +528,19 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -496,18 +528,19 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
496 | 528 | ||
497 | if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) | 529 | if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) |
498 | { | 530 | { |
499 | - //playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", 1.6F); | ||
500 | 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)); |
501 | - continue; | 532 | + spelled = false; |
502 | } | 533 | } |
503 | - | ||
504 | - // Se já houve o soletramento de alguma palavra, reproduz animação default | ||
505 | - if (spelled) | ||
506 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, 1.6F)); | ||
507 | else | 534 | else |
508 | - 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; | ||
509 | 541 | ||
510 | - lastAnimationSubtitle = spellWord(toPlayQueue, aniName); | 542 | + lastAnimationSubtitle = spellWord(toPlayQueue, aniName); |
543 | + } | ||
511 | } | 544 | } |
512 | 545 | ||
513 | if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) | 546 | if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) |
@@ -536,65 +569,93 @@ public abstract class GenericPlayerManager : MonoBehaviour { | @@ -536,65 +569,93 @@ public abstract class GenericPlayerManager : MonoBehaviour { | ||
536 | onPlayingStateChange(); | 569 | onPlayingStateChange(); |
537 | 570 | ||
538 | bool isNotEmpty; | 571 | bool isNotEmpty; |
539 | - lock (animQueue) { isNotEmpty = animQueue.Count > 0; } | 572 | + lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } |
573 | + | ||
574 | + // Animação anterior a atual | ||
575 | + AnimationReference endedAnimation = null; | ||
540 | 576 | ||
541 | - // Enquanto estiver executando a rotina "loadAndPlay" | 577 | + // Enquanto estiver executando a corotina "loadAndPlay" |
542 | // ou existir animações na fila de reprodução | 578 | // ou existir animações na fila de reprodução |
543 | while (loading || isNotEmpty) | 579 | while (loading || isNotEmpty) |
544 | { | 580 | { |
581 | + // Se não houver animações na fila, espera | ||
545 | if (isNotEmpty) | 582 | if (isNotEmpty) |
546 | { | 583 | { |
584 | + // Pega primeira animação | ||
547 | AnimationReference reference; | 585 | AnimationReference reference; |
548 | - lock (animQueue) { reference = animQueue.Peek(); } | ||
549 | - | ||
550 | - this.subtitles.setText(reference.subtitle); | 586 | + lock (this.animQueue) { reference = this.animQueue.Peek(); } |
551 | 587 | ||
588 | + // Se estiver sendo reproduzida | ||
552 | if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | 589 | if (COMPONENT_ANIMATION.IsPlaying(reference.name)) |
553 | { | 590 | { |
591 | + this.subtitles.setText(reference.subtitle); | ||
592 | + | ||
593 | + // Animação seguinte | ||
554 | AnimationReference next = null; | 594 | AnimationReference next = null; |
555 | - lock (animQueue) | 595 | + lock (this.animQueue) |
556 | { | 596 | { |
557 | - animQueue.Dequeue(); | 597 | + this.animationPlaying = this.animQueue.Dequeue(); |
558 | 598 | ||
559 | - if (animQueue.Count > 0) | ||
560 | - next = animQueue.Peek(); | 599 | + if (this.animQueue.Count > 0) |
600 | + next = this.animQueue.Peek(); | ||
561 | } | 601 | } |
562 | 602 | ||
563 | while (true) | 603 | while (true) |
564 | { | 604 | { |
605 | + // Se a próxima animação estiver sendo reproduzida (no fade) | ||
565 | if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) | 606 | if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) |
566 | { | 607 | { |
608 | + // Se a animação anterior a atual não tiver acabado, | ||
609 | + // espera acabar e só então conta o tempo | ||
610 | + if (endedAnimation != null) | ||
611 | + while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) | ||
612 | + yield return null; | ||
613 | + | ||
614 | + // Tempo para pular para a legenda da próxima animação | ||
567 | yield return new WaitForSeconds(0.4F); | 615 | yield return new WaitForSeconds(0.4F); |
616 | + | ||
617 | + // Deprecated | ||
618 | + // yield return WaitForContinuousMillis.Wait(this, 300); | ||
619 | + | ||
620 | + endedAnimation = reference; | ||
568 | break; | 621 | break; |
569 | } | 622 | } |
623 | + | ||
570 | else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | 624 | else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) |
571 | - { | ||
572 | yield return null; | 625 | yield return null; |
573 | - } | 626 | + |
574 | else break; | 627 | else break; |
575 | } | 628 | } |
576 | 629 | ||
577 | reference = null; | 630 | reference = null; |
578 | } | 631 | } |
579 | 632 | ||
633 | + // Se a animação não tiver sido liberada e seu AnimationState for nulo, | ||
634 | + // a animação será liberada | ||
580 | if (reference != null && reference.state == null) | 635 | if (reference != null && reference.state == null) |
581 | - lock (animQueue) { animQueue.Dequeue(); } | 636 | + lock (this.animQueue) { this.animQueue.Dequeue(); } |
582 | else | 637 | else |
583 | yield return null; | 638 | yield return null; |
584 | } | 639 | } |
585 | else yield return null; | 640 | else yield return null; |
586 | 641 | ||
587 | - this.subtitles.setText(""); | ||
588 | - | ||
589 | - lock (animQueue) { isNotEmpty = animQueue.Count > 0; } | 642 | + lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } |
590 | } | 643 | } |
591 | 644 | ||
592 | - this.playing = false; | ||
593 | - this.paused = false; | ||
594 | - onPlayingStateChange(); | 645 | + this.subtitles.setText(""); |
595 | 646 | ||
647 | + resetStates(); | ||
596 | this.randomAnimations.unlockFor("handleStates"); | 648 | this.randomAnimations.unlockFor("handleStates"); |
597 | } | 649 | } |
598 | } | 650 | } |
599 | 651 | ||
652 | + public void resetStates() | ||
653 | + { | ||
654 | + this.animationPlaying = null; | ||
655 | + this.playing = false; | ||
656 | + this.paused = false; | ||
657 | + | ||
658 | + onPlayingStateChange(); | ||
659 | + } | ||
660 | + | ||
600 | } | 661 | } |
Assets/Scripts/PlayerManager.cs
@@ -74,6 +74,8 @@ public class PlayerManager : GenericPlayerManager { | @@ -74,6 +74,8 @@ public class PlayerManager : GenericPlayerManager { | ||
74 | return null; | 74 | return null; |
75 | } | 75 | } |
76 | 76 | ||
77 | + protected override void onConnectionError(string gloss, string word) { } | ||
78 | + | ||
77 | void OnApplicationQuit() | 79 | void OnApplicationQuit() |
78 | { | 80 | { |
79 | try { | 81 | try { |
Assets/Scripts/UI/FadeFX.cs
@@ -39,7 +39,7 @@ public class FadeFX : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { | @@ -39,7 +39,7 @@ public class FadeFX : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { | ||
39 | private void Activate() | 39 | private void Activate() |
40 | { | 40 | { |
41 | this.active = true; | 41 | this.active = true; |
42 | - this.screenManager.setAvatarColliderState(false); | 42 | + //this.screenManager.setAvatarColliderState(false); |
43 | 43 | ||
44 | foreach (CanvasRenderer renderer in this.renderers) | 44 | foreach (CanvasRenderer renderer in this.renderers) |
45 | renderer.SetAlpha(1F); | 45 | renderer.SetAlpha(1F); |
@@ -61,7 +61,7 @@ public class FadeFX : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { | @@ -61,7 +61,7 @@ public class FadeFX : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { | ||
61 | if ( ! SwitchResolution.showbox && ! update_box.activeSelf) | 61 | if ( ! SwitchResolution.showbox && ! update_box.activeSelf) |
62 | { | 62 | { |
63 | this.active = false; | 63 | this.active = false; |
64 | - this.screenManager.setAvatarColliderState(true); | 64 | + //this.screenManager.setAvatarColliderState(true); |
65 | 65 | ||
66 | foreach (CanvasRenderer renderer in this.renderers) | 66 | foreach (CanvasRenderer renderer in this.renderers) |
67 | renderer.SetAlpha(0.2F); | 67 | renderer.SetAlpha(0.2F); |