Commit e36e60467b806ed5e9694840d61592f2df67aa5d
1 parent
e21ff780
Exists in
master
and in
6 other branches
Fix
Showing
12 changed files
with
544 additions
and
544 deletions
Show diff stats
Assets/Scripts/Player Manager/GenericPlayerManager.cs
... | ... | @@ -41,8 +41,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
41 | 41 | protected float fadeLength = 0.6F; |
42 | 42 | public string gloss = ""; |
43 | 43 | |
44 | - // Referencia para o avatar | |
45 | - private GameObject AVATAR; | |
44 | + // Referencia para o avatar | |
45 | + private GameObject AVATAR; | |
46 | 46 | // Referencia para o componente animador do avatar |
47 | 47 | private Animation COMPONENT_ANIMATION; |
48 | 48 | public Text SUBTITLES; |
... | ... | @@ -88,7 +88,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
88 | 88 | subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed(2.1F, 2.8F); |
89 | 89 | subtitles.DefaultLetterSpeed = new DefaultSignSpeed(3F, 4.3F); |
90 | 90 | subtitles.DefaultNumberSpeed = new DefaultSignSpeed(1.5F, 2.9F); |
91 | - PlayerLogger.Log("Subtitles object: " + subtitles); | |
91 | + PlayerLogger.Log("Subtitles object: " + subtitles); | |
92 | 92 | |
93 | 93 | AVATAR = GameObject.FindGameObjectWithTag("avatar"); |
94 | 94 | COMPONENT_ANIMATION = AVATAR.GetComponent<Animation>(); |
... | ... | @@ -122,7 +122,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
122 | 122 | // Impede que a animação default seja confundida com não-reprodução na UI |
123 | 123 | COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[DEFAULT_ANIMATION].clip, DEFAULT_ANIMATION_MIDDLE); |
124 | 124 | |
125 | - StartCoroutine(AnimationsWatcher()); | |
125 | + StartCoroutine(AnimationsWatcher()); | |
126 | 126 | } |
127 | 127 | |
128 | 128 | public bool isPlayingIntervalAnimation() { return intervalAnimationState != null; } |
... | ... | @@ -226,7 +226,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
226 | 226 | return state; |
227 | 227 | } |
228 | 228 | catch (NullReferenceException nre) { |
229 | - PlayerLogger.Log("'" + name + "' não foi encontrado!\n" + nre.ToString()); | |
229 | + PlayerLogger.Log("'" + name + "' não foi encontrado!\n" + nre.ToString()); | |
230 | 230 | } |
231 | 231 | |
232 | 232 | return null; |
... | ... | @@ -255,26 +255,26 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
255 | 255 | */ |
256 | 256 | protected abstract WWW loadAssetBundle(string aniName); |
257 | 257 | |
258 | - /** | |
258 | + /** | |
259 | 259 | * Called when a bundle request causes error. |
260 | - * @param gloss - gloss been loaded. | |
261 | - * @param word - bundle requested. | |
260 | + * @param gloss - gloss been loaded. | |
261 | + * @param word - bundle requested. | |
262 | 262 | */ |
263 | - public abstract void onConnectionError(string gloss, string word); | |
263 | + public abstract void onConnectionError(string gloss, string word); | |
264 | 264 | |
265 | - /** | |
265 | + /** | |
266 | 266 | * Listen to changes in the playing status. |
267 | 267 | */ |
268 | - public abstract void onPlayingStateChange(); | |
268 | + public abstract void onPlayingStateChange(); | |
269 | 269 | |
270 | - /** | |
271 | - * Waits for response or time runs out. | |
272 | - * Check for WWW.isDone, true if success, false if timeout. | |
273 | - * @param www - request. | |
274 | - */ | |
275 | - protected abstract IEnumerator WaitForResponse(WWW www); | |
270 | + /** | |
271 | + * Waits for response or time runs out. | |
272 | + * Check for WWW.isDone, true if success, false if timeout. | |
273 | + * @param www - request. | |
274 | + */ | |
275 | + protected abstract IEnumerator WaitForResponse(WWW www); | |
276 | 276 | |
277 | - protected abstract WWW getCheckConnectionRequest(); | |
277 | + protected abstract WWW getCheckConnectionRequest(); | |
278 | 278 | |
279 | 279 | /* Pause or continue animations */ |
280 | 280 | public void setPauseState(bool paused) |
... | ... | @@ -396,37 +396,37 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
396 | 396 | } |
397 | 397 | |
398 | 398 | short type = getType(anim); |
399 | - string animName; | |
399 | + string animName; | |
400 | 400 | |
401 | - try { | |
402 | - animName = nextLetterAnimation(anim); | |
401 | + try { | |
402 | + animName = nextLetterAnimation(anim); | |
403 | 403 | |
404 | - // Não há animação | |
405 | - if (type == Subtitle.TYPE_NONE) | |
406 | - { | |
407 | - // Reproduz animação default apenas uma vez | |
408 | - if ( ! defaultPlayed) | |
409 | - { | |
410 | - defaultPlayed = true; | |
411 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, this)); | |
412 | - | |
413 | - // A reprodução da próxima letra deve ser longa para não ser cortada no fade | |
414 | - this.subtitles.updateLetterSpeed(); | |
415 | - } | |
416 | - | |
417 | - PlayerLogger.Log("Animação \"" + animName + "\" inexistente."); | |
418 | - } | |
419 | - else | |
420 | - { | |
421 | - toPlayQueue.Enqueue(new ToPlay(type, animName, lastAnimationSubtitle, this)); | |
422 | - | |
423 | - defaultPlayed = false; | |
424 | - this.subtitles.updateLetterSpeed(); | |
425 | - } | |
426 | - } | |
427 | - catch (IndexOutOfRangeException) { | |
428 | - Debug.Log("GPM.sW(" + word + "): Caractere '" + anim + "' inválido."); | |
429 | - } | |
404 | + // Não há animação | |
405 | + if (type == Subtitle.TYPE_NONE) | |
406 | + { | |
407 | + // Reproduz animação default apenas uma vez | |
408 | + if ( ! defaultPlayed) | |
409 | + { | |
410 | + defaultPlayed = true; | |
411 | + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, this)); | |
412 | + | |
413 | + // A reprodução da próxima letra deve ser longa para não ser cortada no fade | |
414 | + this.subtitles.updateLetterSpeed(); | |
415 | + } | |
416 | + | |
417 | + PlayerLogger.Log("Animação \"" + animName + "\" inexistente."); | |
418 | + } | |
419 | + else | |
420 | + { | |
421 | + toPlayQueue.Enqueue(new ToPlay(type, animName, lastAnimationSubtitle, this)); | |
422 | + | |
423 | + defaultPlayed = false; | |
424 | + this.subtitles.updateLetterSpeed(); | |
425 | + } | |
426 | + } | |
427 | + catch (IndexOutOfRangeException) { | |
428 | + Debug.Log("GPM.sW(" + word + "): Caractere '" + anim + "' inválido."); | |
429 | + } | |
430 | 430 | |
431 | 431 | } |
432 | 432 | |
... | ... | @@ -460,12 +460,12 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
463 | - public void clearLoadedBundles() { | |
463 | + public void clearLoadedBundles() { | |
464 | 464 | this.loadedAssetBundles.Clear(); |
465 | - } | |
465 | + } | |
466 | 466 | |
467 | - /* Carrega animações e reproduz */ | |
468 | - private IEnumerator Loader(string gloss) | |
467 | + /* Carrega animações e reproduz */ | |
468 | + private IEnumerator Loader(string gloss) | |
469 | 469 | { |
470 | 470 | this.loading = true; |
471 | 471 | this.randomAnimations.lockFor("Loader"); |
... | ... | @@ -477,24 +477,24 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
477 | 477 | Queue<ToPlay> toPlayQueue = new Queue<ToPlay>(); |
478 | 478 | toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); |
479 | 479 | |
480 | - /*WWW checkConnectionRequest = getCheckConnectionRequest(); | |
481 | - bool connected = false; | |
480 | + /*WWW checkConnectionRequest = getCheckConnectionRequest(); | |
481 | + bool connected = false; | |
482 | 482 | |
483 | - while ( ! checkConnectionRequest.isDone) | |
484 | - yield return checkConnectionRequest; | |
483 | + while ( ! checkConnectionRequest.isDone) | |
484 | + yield return checkConnectionRequest; | |
485 | 485 | |
486 | - if (checkConnectionRequest.responseHeaders.Count > 0) | |
487 | - { | |
488 | - PlayerLogger.Log(checkConnectionRequest.responseHeaders["STATUS"]); | |
489 | - connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404"); | |
490 | - } | |
491 | - else PlayerLogger.Log("No response headers.");*/ | |
486 | + if (checkConnectionRequest.responseHeaders.Count > 0) | |
487 | + { | |
488 | + PlayerLogger.Log(checkConnectionRequest.responseHeaders["STATUS"]); | |
489 | + connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404"); | |
490 | + } | |
491 | + else PlayerLogger.Log("No response headers.");*/ | |
492 | 492 | |
493 | - bool connected = true; | |
494 | - bool playingStarted = false; | |
493 | + bool connected = true; | |
494 | + bool playingStarted = false; | |
495 | 495 | |
496 | 496 | String[] stringPos = gloss.Split(' '); |
497 | - foreach (string aniName in stringPos) | |
497 | + foreach (string aniName in stringPos) | |
498 | 498 | { |
499 | 499 | if (String.IsNullOrEmpty(aniName)) continue; |
500 | 500 | |
... | ... | @@ -503,47 +503,47 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
503 | 503 | |
504 | 504 | if ( ! nonexistent && ! loaded && connected) |
505 | 505 | { |
506 | - WWW bundleRequest = loadAssetBundle(aniName); | |
507 | - | |
508 | - if (bundleRequest != null) | |
509 | - { | |
510 | - yield return WaitForResponse(bundleRequest); | |
511 | - | |
512 | - PlayerLogger.Log("GPM", "L", "Bundle request done (" + aniName + ")."); | |
513 | - | |
514 | - if (bundleRequest.isDone && bundleRequest.error == null) | |
515 | - { | |
516 | - AssetBundle bundle = bundleRequest.assetBundle; | |
517 | - | |
518 | - if (bundle != null && !String.IsNullOrEmpty(bundle.mainAsset.name)) | |
519 | - { | |
520 | - AnimationClip aniClip = bundle.mainAsset as AnimationClip; | |
521 | - bundle.Unload(false); | |
522 | - | |
523 | - if (aniClip) | |
524 | - { | |
525 | - COMPONENT_ANIMATION.AddClip(aniClip, aniName); | |
526 | - if (playingStarted) yield return new WaitForEndOfFrame(); | |
527 | - | |
528 | - loadedAssetBundles.Add(aniName); | |
529 | - loaded = true; | |
530 | - | |
531 | - PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" loaded!"); | |
532 | - } | |
533 | - else PlayerLogger.Log("GPM", "L", "Sign \"" + aniName + "\" wasn't loaded successfuly."); | |
534 | - } | |
535 | - else PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" wasn't loaded successfuly."); | |
536 | - | |
537 | - if ( ! loaded) nonexistentAssetBundles.Add(aniName); | |
538 | - } | |
539 | - else | |
540 | - { | |
541 | - PlayerLogger.Log("GPM", "L", "Connection error."); | |
542 | - onConnectionError(gloss, aniName); | |
543 | - } | |
544 | - } | |
545 | - else PlayerLogger.Log("GPM", "L", "Animation of \"" + aniName + "\" do not exist."); | |
546 | - } | |
506 | + WWW bundleRequest = loadAssetBundle(aniName); | |
507 | + | |
508 | + if (bundleRequest != null) | |
509 | + { | |
510 | + yield return WaitForResponse(bundleRequest); | |
511 | + | |
512 | + PlayerLogger.Log("GPM", "L", "Bundle request done (" + aniName + ")."); | |
513 | + | |
514 | + if (bundleRequest.isDone && bundleRequest.error == null) | |
515 | + { | |
516 | + AssetBundle bundle = bundleRequest.assetBundle; | |
517 | + | |
518 | + if (bundle != null && !String.IsNullOrEmpty(bundle.mainAsset.name)) | |
519 | + { | |
520 | + AnimationClip aniClip = bundle.mainAsset as AnimationClip; | |
521 | + bundle.Unload(false); | |
522 | + | |
523 | + if (aniClip) | |
524 | + { | |
525 | + COMPONENT_ANIMATION.AddClip(aniClip, aniName); | |
526 | + if (playingStarted) yield return new WaitForEndOfFrame(); | |
527 | + | |
528 | + loadedAssetBundles.Add(aniName); | |
529 | + loaded = true; | |
530 | + | |
531 | + PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" loaded!"); | |
532 | + } | |
533 | + else PlayerLogger.Log("GPM", "L", "Sign \"" + aniName + "\" wasn't loaded successfuly."); | |
534 | + } | |
535 | + else PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" wasn't loaded successfuly."); | |
536 | + | |
537 | + if ( ! loaded) nonexistentAssetBundles.Add(aniName); | |
538 | + } | |
539 | + else | |
540 | + { | |
541 | + PlayerLogger.Log("GPM", "L", "Connection error."); | |
542 | + onConnectionError(gloss, aniName); | |
543 | + } | |
544 | + } | |
545 | + else PlayerLogger.Log("GPM", "L", "Animation of \"" + aniName + "\" do not exist."); | |
546 | + } | |
547 | 547 | |
548 | 548 | // Reproduz palavra |
549 | 549 | if (loaded) |
... | ... | @@ -570,7 +570,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
570 | 570 | // Soletra palavra |
571 | 571 | else |
572 | 572 | { |
573 | - PlayerLogger.Log("GPM", "L", "To spell: " + aniName); | |
573 | + PlayerLogger.Log("GPM", "L", "To spell: " + aniName); | |
574 | 574 | |
575 | 575 | if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) |
576 | 576 | { |
... | ... | @@ -590,21 +590,21 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
590 | 590 | } |
591 | 591 | |
592 | 592 | if (toPlayQueue.Count > 4) { |
593 | - playingStarted = true; | |
594 | - | |
595 | - while (toPlayQueue.Count > 0) | |
596 | - { | |
593 | + playingStarted = true; | |
594 | + | |
595 | + while (toPlayQueue.Count > 0) | |
596 | + { | |
597 | 597 | toPlayQueue.Dequeue().play(this); |
598 | - yield return new WaitForEndOfFrame(); | |
599 | - } | |
600 | - } | |
598 | + yield return new WaitForEndOfFrame(); | |
599 | + } | |
600 | + } | |
601 | 601 | |
602 | - if (playingStarted) | |
603 | - yield return new WaitForEndOfFrame(); | |
602 | + if (playingStarted) | |
603 | + yield return new WaitForEndOfFrame(); | |
604 | 604 | |
605 | - while (this.animQueue.Count > 6) | |
606 | - yield return new WaitForEndOfFrame(); | |
607 | - } | |
605 | + while (this.animQueue.Count > 6) | |
606 | + yield return new WaitForEndOfFrame(); | |
607 | + } | |
608 | 608 | |
609 | 609 | while (toPlayQueue.Count > 0) |
610 | 610 | { |
... | ... | @@ -627,71 +627,71 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
627 | 627 | |
628 | 628 | while (true) |
629 | 629 | { |
630 | - if (this.animQueue.Count > 0) | |
631 | - { | |
632 | - if (!this.playing) | |
633 | - { | |
634 | - PlayerLogger.Log("GPM", "AW", "Playing."); | |
635 | - | |
636 | - this.playing = true; | |
637 | - onPlayingStateChange(); | |
638 | - | |
639 | - this.randomAnimations.lockFor("AnimationsWatcher"); | |
640 | - } | |
641 | - | |
642 | - // Gets first animation | |
643 | - AnimationReference reference = this.animQueue.Peek(); | |
644 | - // PlayerLogger.Log("GPM", "AW", "Got " + reference.name + "."); | |
645 | - | |
646 | - if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | |
647 | - { | |
648 | - // PlayerLogger.Log("GPM", "AW", "And its playing!"); | |
649 | - | |
650 | - this.animationPlaying = this.animQueue.Dequeue(); | |
651 | - this.subtitles.setText(reference.subtitle); | |
652 | - | |
653 | - // Watches transition between current and next animation | |
654 | - while (true) | |
655 | - { | |
656 | - yield return new WaitForEndOfFrame(); | |
657 | - | |
658 | - // Gets next animation | |
659 | - AnimationReference next = this.animQueue.Count > 0 ? this.animQueue.Peek() : null; | |
660 | - | |
661 | - if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) | |
662 | - { | |
663 | - // PlayerLogger.Log("GPM", "AW", "Next: " + next.name + "."); | |
664 | - | |
665 | - // Waits next animation starts | |
666 | - while (!COMPONENT_ANIMATION.IsPlaying(next.name)) | |
667 | - yield return new WaitForEndOfFrame(); | |
668 | - | |
669 | - // Waits half fade | |
670 | - yield return new WaitForSeconds(this.fadeLength / 2); | |
671 | - break; | |
672 | - } | |
673 | - else if (!COMPONENT_ANIMATION.IsPlaying(reference.name)) break; | |
674 | - } | |
675 | - } | |
676 | - // Animation played but was not tracked | |
677 | - else | |
678 | - { | |
679 | - if (reference.state == null) | |
680 | - this.animQueue.Dequeue(); | |
681 | - | |
682 | - yield return new WaitForEndOfFrame(); | |
683 | - } | |
684 | - } | |
685 | - else if (this.playing && !this.loading) | |
686 | - { | |
687 | - PlayerLogger.Log("GPM", "AW", "Not playing."); | |
688 | - | |
689 | - resetStates(); | |
690 | - | |
691 | - this.subtitles.setText(""); | |
692 | - this.randomAnimations.unlockFor("AnimationsWatcher"); | |
693 | - } | |
694 | - else yield return new WaitForEndOfFrame(); | |
630 | + if (this.animQueue.Count > 0) | |
631 | + { | |
632 | + if (!this.playing) | |
633 | + { | |
634 | + PlayerLogger.Log("GPM", "AW", "Playing."); | |
635 | + | |
636 | + this.playing = true; | |
637 | + onPlayingStateChange(); | |
638 | + | |
639 | + this.randomAnimations.lockFor("AnimationsWatcher"); | |
640 | + } | |
641 | + | |
642 | + // Gets first animation | |
643 | + AnimationReference reference = this.animQueue.Peek(); | |
644 | + // PlayerLogger.Log("GPM", "AW", "Got " + reference.name + "."); | |
645 | + | |
646 | + if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | |
647 | + { | |
648 | + // PlayerLogger.Log("GPM", "AW", "And its playing!"); | |
649 | + | |
650 | + this.animationPlaying = this.animQueue.Dequeue(); | |
651 | + this.subtitles.setText(reference.subtitle); | |
652 | + | |
653 | + // Watches transition between current and next animation | |
654 | + while (true) | |
655 | + { | |
656 | + yield return new WaitForEndOfFrame(); | |
657 | + | |
658 | + // Gets next animation | |
659 | + AnimationReference next = this.animQueue.Count > 0 ? this.animQueue.Peek() : null; | |
660 | + | |
661 | + if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) | |
662 | + { | |
663 | + // PlayerLogger.Log("GPM", "AW", "Next: " + next.name + "."); | |
664 | + | |
665 | + // Waits next animation starts | |
666 | + while (!COMPONENT_ANIMATION.IsPlaying(next.name)) | |
667 | + yield return new WaitForEndOfFrame(); | |
668 | + | |
669 | + // Waits half fade | |
670 | + yield return new WaitForSeconds(this.fadeLength / 2); | |
671 | + break; | |
672 | + } | |
673 | + else if (!COMPONENT_ANIMATION.IsPlaying(reference.name)) break; | |
674 | + } | |
675 | + } | |
676 | + // Animation played but was not tracked | |
677 | + else | |
678 | + { | |
679 | + if (reference.state == null) | |
680 | + this.animQueue.Dequeue(); | |
681 | + | |
682 | + yield return new WaitForEndOfFrame(); | |
683 | + } | |
684 | + } | |
685 | + else if (this.playing && !this.loading) | |
686 | + { | |
687 | + PlayerLogger.Log("GPM", "AW", "Not playing."); | |
688 | + | |
689 | + resetStates(); | |
690 | + | |
691 | + this.subtitles.setText(""); | |
692 | + this.randomAnimations.unlockFor("AnimationsWatcher"); | |
693 | + } | |
694 | + else yield return new WaitForEndOfFrame(); | |
695 | 695 | } |
696 | 696 | } |
697 | 697 | ... | ... |
Assets/Scripts/Player Manager/PlayerLogger.cs
... | ... | @@ -2,31 +2,31 @@ |
2 | 2 | using UnityEngine.UI; |
3 | 3 | |
4 | 4 | namespace LAViD.VLibras.Utils { |
5 | - | |
6 | - public abstract class PlayerLogger : MonoBehaviour { | |
5 | + | |
6 | + public abstract class PlayerLogger : MonoBehaviour { | |
7 | 7 | |
8 | - public static PlayerLogger instance; | |
8 | + public static PlayerLogger instance; | |
9 | 9 | |
10 | - protected virtual void Start() | |
11 | - { | |
12 | - PlayerLogger.instance = this; | |
13 | - } | |
10 | + protected virtual void Start() | |
11 | + { | |
12 | + PlayerLogger.instance = this; | |
13 | + } | |
14 | 14 | |
15 | - protected abstract void write(string text); | |
15 | + protected abstract void write(string text); | |
16 | 16 | |
17 | - public static void Log(string text) | |
18 | - { | |
19 | - if (PlayerLogger.instance != null) | |
20 | - PlayerLogger.instance.write(text); | |
17 | + public static void Log(string text) | |
18 | + { | |
19 | + if (PlayerLogger.instance != null) | |
20 | + PlayerLogger.instance.write(text); | |
21 | 21 | |
22 | - Debug.Log(text); | |
23 | - } | |
22 | + Debug.Log(text); | |
23 | + } | |
24 | 24 | |
25 | - public static void Log(string classSign, string methodSign, string text) | |
26 | - { | |
27 | - PlayerLogger.Log(classSign + "." + methodSign + ": " + text); | |
28 | - } | |
25 | + public static void Log(string classSign, string methodSign, string text) | |
26 | + { | |
27 | + PlayerLogger.Log(classSign + "." + methodSign + ": " + text); | |
28 | + } | |
29 | 29 | |
30 | - } | |
30 | + } | |
31 | 31 | |
32 | 32 | } | ... | ... |
Assets/Scripts/Player Manager/Utils.cs
1 | 1 | using UnityEngine; |
2 | 2 | using UnityEngine.UI; |
3 | 3 | |
4 | -namespace LAViD.VLibras.Utils { | |
4 | +namespace LAViD.Unity.Utils { | |
5 | 5 | |
6 | 6 | public static class Definitions { |
7 | 7 | |
... | ... | @@ -10,6 +10,6 @@ namespace LAViD.VLibras.Utils { |
10 | 10 | return new Color(color.r, color.g, color.b, alpha); |
11 | 11 | } |
12 | 12 | |
13 | - } | |
13 | + } | |
14 | 14 | |
15 | 15 | } | ... | ... |
Assets/Scripts/RegionSelector.cs
... | ... | @@ -8,41 +8,41 @@ public class RegionSelector : MonoBehaviour { |
8 | 8 | |
9 | 9 | private readonly Dictionary<string, string> regions = new Dictionary<string, string> { |
10 | 10 | |
11 | - { "Padrão Nacional", "" }, | |
12 | - { "Acre", "AC/" }, | |
13 | - { "Alagoas", "AL/" }, | |
14 | - { "Amapá", "AP/" }, | |
15 | - { "Amazonas", "AM/" }, | |
16 | - { "Bahia", "BA/" }, | |
17 | - { "Ceará", "CE/" }, | |
18 | - { "Distrito Federal", "DF/" }, | |
19 | - { "Espírito Santo", "ES/" }, | |
20 | - { "Goiás", "GO/" }, | |
21 | - { "Maranhão", "MA/" }, | |
22 | - { "Mato Grosso", "MT/" }, | |
23 | - { "Mato Grosso do Sul", "MS/" }, | |
24 | - { "Minas Gerais", "MG/" }, | |
25 | - { "Pará", "PA/" }, | |
11 | + { "Padrão Nacional", "" }, | |
12 | + { "Acre", "AC/" }, | |
13 | + { "Alagoas", "AL/" }, | |
14 | + { "Amapá", "AP/" }, | |
15 | + { "Amazonas", "AM/" }, | |
16 | + { "Bahia", "BA/" }, | |
17 | + { "Ceará", "CE/" }, | |
18 | + { "Distrito Federal", "DF/" }, | |
19 | + { "Espírito Santo", "ES/" }, | |
20 | + { "Goiás", "GO/" }, | |
21 | + { "Maranhão", "MA/" }, | |
22 | + { "Mato Grosso", "MT/" }, | |
23 | + { "Mato Grosso do Sul", "MS/" }, | |
24 | + { "Minas Gerais", "MG/" }, | |
25 | + { "Pará", "PA/" }, | |
26 | 26 | { "Paraíba", "PB/" }, |
27 | - { "Paraná", "PR/"}, | |
27 | + { "Paraná", "PR/"}, | |
28 | 28 | { "Pernambuco", "PE/" }, |
29 | - { "Piauí", "PI/" }, | |
30 | - { "Rio de Janeiro", "RJ/" }, | |
31 | - { "Rio Grande do Norte", "RN/" }, | |
32 | - { "Rio Grande do Sul", "RS/" }, | |
33 | - { "Rondônia", "RO/" }, | |
34 | - { "Roraima", "RR/" }, | |
35 | - { "Santa Catarina", "SC/" }, | |
36 | - { "São Paulo", "SP/" }, | |
37 | - { "Sergipe", "SE/" }, | |
38 | - { "Tocantins", "TO/" } | |
29 | + { "Piauí", "PI/" }, | |
30 | + { "Rio de Janeiro", "RJ/" }, | |
31 | + { "Rio Grande do Norte", "RN/" }, | |
32 | + { "Rio Grande do Sul", "RS/" }, | |
33 | + { "Rondônia", "RO/" }, | |
34 | + { "Roraima", "RR/" }, | |
35 | + { "Santa Catarina", "SC/" }, | |
36 | + { "São Paulo", "SP/" }, | |
37 | + { "Sergipe", "SE/" }, | |
38 | + { "Tocantins", "TO/" } | |
39 | 39 | |
40 | 40 | }; |
41 | 41 | |
42 | 42 | public PlayerManager manager; |
43 | 43 | public GameObject list; |
44 | 44 | public GameObject SampleItem; |
45 | - public Text label; | |
45 | + public Text label; | |
46 | 46 | |
47 | 47 | private Region activeItem = null; |
48 | 48 | private Region selectedItem = null; |
... | ... | @@ -86,16 +86,16 @@ public class RegionSelector : MonoBehaviour { |
86 | 86 | { |
87 | 87 | this.activeItem = this.selectedItem; |
88 | 88 | this.manager.setRegion(this.activeItem.Path); |
89 | - this.manager.clearLoadedBundles(); | |
89 | + this.manager.clearLoadedBundles(); | |
90 | 90 | |
91 | - if (selectedItem.Path == "") | |
92 | - { | |
93 | - this.label.text = "BR"; | |
94 | - }else | |
95 | - { | |
96 | - this.label.text = selectedItem.Path.Replace('/', ' '); | |
91 | + if (selectedItem.Path == "") | |
92 | + { | |
93 | + this.label.text = "BR"; | |
94 | + }else | |
95 | + { | |
96 | + this.label.text = selectedItem.Path.Replace('/', ' '); | |
97 | 97 | |
98 | - } | |
98 | + } | |
99 | 99 | } |
100 | 100 | |
101 | 101 | } | ... | ... |
Assets/Scripts/TutorialManager.cs
... | ... | @@ -24,7 +24,7 @@ public class TutorialManager : MonoBehaviour { |
24 | 24 | "Barra de velocidade\n\nNa barra você pode escolher a velocidade que deseja visualizar o sinal", |
25 | 25 | }; |
26 | 26 | |
27 | - private Image[] buttons; | |
27 | + private Image[] buttons; | |
28 | 28 | |
29 | 29 | protected void Start () |
30 | 30 | { |
... | ... | @@ -56,16 +56,16 @@ public class TutorialManager : MonoBehaviour { |
56 | 56 | this.description.fontSize = 14; |
57 | 57 | } |
58 | 58 | |
59 | - this.buttons = new Image[] { | |
60 | - this.translateImage, | |
59 | + this.buttons = new Image[] { | |
60 | + this.translateImage, | |
61 | 61 | this.micImage, |
62 | 62 | this.dictionaryImage, |
63 | 63 | this.subtitlesImage |
64 | - }; | |
64 | + }; | |
65 | 65 | } |
66 | 66 | |
67 | 67 | private Image getButton() { |
68 | - return this.index <= 3 ? this.buttons[this.index] : null; | |
68 | + return this.index <= 3 ? this.buttons[this.index] : null; | |
69 | 69 | } |
70 | 70 | |
71 | 71 | public void next() |
... | ... | @@ -78,15 +78,15 @@ public class TutorialManager : MonoBehaviour { |
78 | 78 | else |
79 | 79 | { |
80 | 80 | #if UNITY_IOS |
81 | - // Jump mic | |
82 | - select(this.index == 0 ? 2 : this.index + 1); | |
81 | + // Jump mic | |
82 | + select(this.index == 0 ? 2 : this.index + 1); | |
83 | 83 | #else |
84 | - select(this.index + 1); | |
84 | + select(this.index + 1); | |
85 | 85 | #endif |
86 | - } | |
87 | - } | |
86 | + } | |
87 | + } | |
88 | 88 | |
89 | - public void select(int index) | |
89 | + public void select(int index) | |
90 | 90 | { |
91 | 91 | if (this.index <= 3) |
92 | 92 | getButton().color = disabledColor; |
... | ... | @@ -98,9 +98,9 @@ public class TutorialManager : MonoBehaviour { |
98 | 98 | if (this.index <= 3) |
99 | 99 | getButton().color = enabledColor; |
100 | 100 | else |
101 | - this.sliderShadow.SetActive(false); | |
101 | + this.sliderShadow.SetActive(false); | |
102 | 102 | |
103 | - this.description.text = this.descriptions[index]; | |
103 | + this.description.text = this.descriptions[index]; | |
104 | 104 | } |
105 | 105 | |
106 | 106 | } |
107 | 107 | \ No newline at end of file | ... | ... |
Assets/Scripts/UI/ExchangeableVisibility.cs
... | ... | @@ -2,20 +2,20 @@ |
2 | 2 | |
3 | 3 | namespace LAViD.VLibras.UI { |
4 | 4 | |
5 | - public class ExchangeableVisibility : MonoBehaviour { | |
5 | + public class ExchangeableVisibility : MonoBehaviour { | |
6 | 6 | |
7 | - public bool visible = false; | |
8 | - | |
9 | - public bool isVisible() | |
10 | - { | |
11 | - return this.visible; | |
12 | - } | |
7 | + public bool visible = false; | |
8 | + | |
9 | + public bool isVisible() | |
10 | + { | |
11 | + return this.visible; | |
12 | + } | |
13 | 13 | |
14 | - public virtual void Animate(bool visible) | |
15 | - { | |
16 | - this.visible = visible; | |
17 | - } | |
14 | + public virtual void Animate(bool visible) | |
15 | + { | |
16 | + this.visible = visible; | |
17 | + } | |
18 | 18 | |
19 | - } | |
19 | + } | |
20 | 20 | |
21 | 21 | } | ... | ... |
Assets/Scripts/UI/Fadder.cs
... | ... | @@ -2,82 +2,82 @@ |
2 | 2 | |
3 | 3 | namespace LAViD.VLibras.UI { |
4 | 4 | |
5 | - public class Fadder : ExchangeableVisibility { | |
6 | - | |
7 | - public float visibleAlpha = 1f; | |
8 | - public float hiddenAlpha = 0f; | |
9 | - public float showingSpeed = 0.01f; | |
10 | - public float hiddingSpeed = 0.01f; | |
11 | - public bool disableWhenHidden = true; | |
12 | - | |
13 | - private CanvasRenderer mainRenderer; | |
14 | - private CanvasRenderer[] renderers; | |
15 | - private bool visibilityChange = false; | |
16 | - | |
17 | - private readonly Vector3 visibleScale = new Vector3(1, 1, 1); | |
18 | - private readonly Vector3 hiddenScale = new Vector3(0, 0, 0); | |
19 | - | |
20 | - public override void Animate(bool visible) | |
21 | - { | |
22 | - if (base.isVisible() != visible) | |
23 | - { | |
24 | - this.gameObject.transform.localScale = visibleScale; | |
25 | - base.Animate(visible); | |
26 | - this.visibilityChange = true; | |
27 | - } | |
28 | - } | |
29 | - | |
30 | - public void brutallySetVisible(bool visible) | |
31 | - { | |
32 | - base.Animate(visible); | |
33 | - | |
34 | - float alpha = visible ? visibleAlpha : hiddenAlpha; | |
35 | - | |
36 | - foreach (CanvasRenderer renderer in renderers) | |
37 | - renderer.SetAlpha(alpha); | |
38 | - | |
39 | - updateScale(); | |
40 | - } | |
41 | - | |
42 | - private void updateScale() | |
43 | - { | |
44 | - if (disableWhenHidden && this.mainRenderer.GetAlpha() == hiddenAlpha) | |
45 | - this.gameObject.transform.localScale = hiddenScale; | |
46 | - | |
47 | - } | |
48 | - | |
49 | - void Start() | |
50 | - { | |
51 | - this.mainRenderer = this.gameObject.GetComponent<CanvasRenderer>(); | |
52 | - this.renderers = this.gameObject.GetComponentsInChildren<CanvasRenderer>(); | |
53 | - this.hiddingSpeed = -hiddingSpeed; | |
54 | - | |
55 | - this.brutallySetVisible(base.isVisible()); | |
56 | - } | |
57 | - | |
58 | - void Update() | |
59 | - { | |
60 | - if (visibilityChange) | |
61 | - { | |
62 | - float objective = base.isVisible() ? this.visibleAlpha : this.hiddenAlpha; | |
63 | - this.visibilityChange = false; | |
64 | - | |
65 | - foreach (CanvasRenderer renderer in renderers) | |
66 | - { | |
67 | - float alpha = renderer.GetAlpha(); | |
68 | - | |
69 | - if (alpha != objective) | |
70 | - { | |
71 | - float speed = base.isVisible() ? this.showingSpeed : this.hiddingSpeed; | |
72 | - renderer.SetAlpha(Mathf.Abs(alpha - objective) < Mathf.Abs(speed) ? objective : alpha + speed); | |
73 | - this.visibilityChange = true; | |
74 | - } | |
75 | - } | |
76 | - | |
77 | - if (this.visibilityChange) this.updateScale(); | |
78 | - } | |
79 | - } | |
80 | - | |
81 | - } | |
5 | + public class Fadder : ExchangeableVisibility { | |
6 | + | |
7 | + public float visibleAlpha = 1f; | |
8 | + public float hiddenAlpha = 0f; | |
9 | + public float showingSpeed = 0.01f; | |
10 | + public float hiddingSpeed = 0.01f; | |
11 | + public bool disableWhenHidden = true; | |
12 | + | |
13 | + private CanvasRenderer mainRenderer; | |
14 | + private CanvasRenderer[] renderers; | |
15 | + private bool visibilityChange = false; | |
16 | + | |
17 | + private readonly Vector3 visibleScale = new Vector3(1, 1, 1); | |
18 | + private readonly Vector3 hiddenScale = new Vector3(0, 0, 0); | |
19 | + | |
20 | + public override void Animate(bool visible) | |
21 | + { | |
22 | + if (base.isVisible() != visible) | |
23 | + { | |
24 | + this.gameObject.transform.localScale = visibleScale; | |
25 | + base.Animate(visible); | |
26 | + this.visibilityChange = true; | |
27 | + } | |
28 | + } | |
29 | + | |
30 | + public void brutallySetVisible(bool visible) | |
31 | + { | |
32 | + base.Animate(visible); | |
33 | + | |
34 | + float alpha = visible ? visibleAlpha : hiddenAlpha; | |
35 | + | |
36 | + foreach (CanvasRenderer renderer in renderers) | |
37 | + renderer.SetAlpha(alpha); | |
38 | + | |
39 | + updateScale(); | |
40 | + } | |
41 | + | |
42 | + private void updateScale() | |
43 | + { | |
44 | + if (disableWhenHidden && this.mainRenderer.GetAlpha() == hiddenAlpha) | |
45 | + this.gameObject.transform.localScale = hiddenScale; | |
46 | + | |
47 | + } | |
48 | + | |
49 | + void Start() | |
50 | + { | |
51 | + this.mainRenderer = this.gameObject.GetComponent<CanvasRenderer>(); | |
52 | + this.renderers = this.gameObject.GetComponentsInChildren<CanvasRenderer>(); | |
53 | + this.hiddingSpeed = -hiddingSpeed; | |
54 | + | |
55 | + this.brutallySetVisible(base.isVisible()); | |
56 | + } | |
57 | + | |
58 | + void Update() | |
59 | + { | |
60 | + if (visibilityChange) | |
61 | + { | |
62 | + float objective = base.isVisible() ? this.visibleAlpha : this.hiddenAlpha; | |
63 | + this.visibilityChange = false; | |
64 | + | |
65 | + foreach (CanvasRenderer renderer in renderers) | |
66 | + { | |
67 | + float alpha = renderer.GetAlpha(); | |
68 | + | |
69 | + if (alpha != objective) | |
70 | + { | |
71 | + float speed = base.isVisible() ? this.showingSpeed : this.hiddingSpeed; | |
72 | + renderer.SetAlpha(Mathf.Abs(alpha - objective) < Mathf.Abs(speed) ? objective : alpha + speed); | |
73 | + this.visibilityChange = true; | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + if (this.visibilityChange) this.updateScale(); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + } | |
82 | 82 | |
83 | 83 | } |
84 | 84 | \ No newline at end of file | ... | ... |
Assets/Scripts/UI/Resizers/BarResizer.cs
Assets/Scripts/UI/Resizers/InputResizer.cs
... | ... | @@ -3,37 +3,37 @@ using UnityEngine.UI; |
3 | 3 | |
4 | 4 | public class InputResizer : MonoBehaviour { |
5 | 5 | |
6 | - protected void Start() | |
7 | - { | |
8 | - Text text = gameObject.GetComponent<Text>(); | |
9 | - | |
10 | - if (Screen.dpi < 140) | |
11 | - { | |
12 | - text.fontSize = 20; | |
13 | - } | |
14 | - | |
15 | - // 240 | |
16 | - else if (Screen.dpi < 280) | |
17 | - { | |
18 | - text.fontSize = 32; | |
19 | - } | |
20 | - | |
21 | - // 320 | |
22 | - else if (Screen.dpi < 400) | |
23 | - { | |
24 | - text.fontSize = 44; | |
25 | - } | |
26 | - | |
27 | - // 480 | |
28 | - else if (Screen.dpi < 500) | |
29 | - { | |
30 | - text.fontSize = 56; | |
31 | - } | |
32 | - | |
33 | - else | |
34 | - { | |
35 | - text.fontSize = 56; | |
36 | - } | |
37 | - } | |
6 | + protected void Start() | |
7 | + { | |
8 | + Text text = gameObject.GetComponent<Text>(); | |
9 | + | |
10 | + if (Screen.dpi < 140) | |
11 | + { | |
12 | + text.fontSize = 20; | |
13 | + } | |
14 | + | |
15 | + // 240 | |
16 | + else if (Screen.dpi < 280) | |
17 | + { | |
18 | + text.fontSize = 32; | |
19 | + } | |
20 | + | |
21 | + // 320 | |
22 | + else if (Screen.dpi < 400) | |
23 | + { | |
24 | + text.fontSize = 44; | |
25 | + } | |
26 | + | |
27 | + // 480 | |
28 | + else if (Screen.dpi < 500) | |
29 | + { | |
30 | + text.fontSize = 56; | |
31 | + } | |
32 | + | |
33 | + else | |
34 | + { | |
35 | + text.fontSize = 56; | |
36 | + } | |
37 | + } | |
38 | 38 | |
39 | 39 | } | ... | ... |
Assets/Scripts/UI/ScreenManager.cs
... | ... | @@ -22,8 +22,8 @@ public class ScreenManager : MonoBehaviour { |
22 | 22 | |
23 | 23 | public GameObject loadingSnippet; |
24 | 24 | public GameObject connectionErrorDialog; |
25 | - public Text connectionErrorText; | |
26 | - public GameObject pauseMenu; | |
25 | + public Text connectionErrorText; | |
26 | + public GameObject pauseMenu; | |
27 | 27 | public GameObject repeatLayer; |
28 | 28 | |
29 | 29 | public GameObject textButton; |
... | ... | @@ -31,10 +31,10 @@ public class ScreenManager : MonoBehaviour { |
31 | 31 | |
32 | 32 | public BoxCollider avatarCollider; |
33 | 33 | |
34 | - public RegionSelector regionSelector; | |
35 | - public SlidingHidder settingsPanel; | |
36 | - public Fadder regionPanel; | |
37 | - public Fadder shadow; | |
34 | + public RegionSelector regionSelector; | |
35 | + public SlidingHidder settingsPanel; | |
36 | + public Fadder regionPanel; | |
37 | + public Fadder shadow; | |
38 | 38 | |
39 | 39 | private bool exit = false; |
40 | 40 | |
... | ... | @@ -65,14 +65,14 @@ public class ScreenManager : MonoBehaviour { |
65 | 65 | { |
66 | 66 | makersScreen.SetActive(false); |
67 | 67 | } |
68 | - else if (regionPanel.isVisible()) | |
69 | - { | |
70 | - closeRegionPanel(true); | |
71 | - } | |
72 | - else if (settingsPanel.isVisible()) | |
73 | - { | |
74 | - closeSettingsPanel(); | |
75 | - } | |
68 | + else if (regionPanel.isVisible()) | |
69 | + { | |
70 | + closeRegionPanel(true); | |
71 | + } | |
72 | + else if (settingsPanel.isVisible()) | |
73 | + { | |
74 | + closeSettingsPanel(); | |
75 | + } | |
76 | 76 | else |
77 | 77 | { |
78 | 78 | if (exit) Application.Quit(); |
... | ... | @@ -93,7 +93,7 @@ public class ScreenManager : MonoBehaviour { |
93 | 93 | |
94 | 94 | public void hideScreen() |
95 | 95 | { |
96 | - setAvatarColliderState(true); | |
96 | + setAvatarColliderState(true); | |
97 | 97 | randomAnimations.unlockFor(LOCK_ID); |
98 | 98 | |
99 | 99 | if (infoScreen.activeSelf) |
... | ... | @@ -125,11 +125,11 @@ public class ScreenManager : MonoBehaviour { |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - private void pause() | |
129 | - { | |
130 | - playerManager.setPauseState(true); | |
131 | - setPauseMenuState(true); | |
132 | - } | |
128 | + private void pause() | |
129 | + { | |
130 | + playerManager.setPauseState(true); | |
131 | + setPauseMenuState(true); | |
132 | + } | |
133 | 133 | |
134 | 134 | public void switchScreen(GameObject screen) |
135 | 135 | { |
... | ... | @@ -141,13 +141,13 @@ public class ScreenManager : MonoBehaviour { |
141 | 141 | |
142 | 142 | screen.SetActive(true); |
143 | 143 | |
144 | - if (playerManager.isPlayingIntervalAnimation()) | |
145 | - playerManager.stopAll(); | |
144 | + if (playerManager.isPlayingIntervalAnimation()) | |
145 | + playerManager.stopAll(); | |
146 | 146 | |
147 | - else if (playerManager.isPlaying()) | |
148 | - pause(); | |
147 | + else if (playerManager.isPlaying()) | |
148 | + pause(); | |
149 | 149 | |
150 | - setAvatarColliderState(false); | |
150 | + setAvatarColliderState(false); | |
151 | 151 | randomAnimations.lockFor(LOCK_ID); |
152 | 152 | |
153 | 153 | if (screen == infoScreen) |
... | ... | @@ -180,59 +180,59 @@ public class ScreenManager : MonoBehaviour { |
180 | 180 | return null; |
181 | 181 | } |
182 | 182 | |
183 | - public void openSettingsPanel() | |
184 | - { | |
185 | - settingsPanel.Animate(true); | |
186 | - setPanelOpen(true); | |
187 | - | |
188 | - if (playerManager.isPlaying()) | |
189 | - pause(); | |
190 | - } | |
191 | - | |
192 | - public void openRegionPanel() | |
193 | - { | |
194 | - settingsPanel.Animate(false); | |
195 | - regionPanel.Animate(true); | |
196 | - setPanelOpen(true); | |
197 | - } | |
198 | - | |
199 | - public void openInfoScreen() | |
200 | - { | |
201 | - closeSettingsPanel(); | |
202 | - switchScreen(infoScreen); | |
203 | - } | |
204 | - | |
205 | - public void closeSettingsPanel() | |
206 | - { | |
207 | - settingsPanel.Animate(false); | |
208 | - setPanelOpen(false); | |
209 | - } | |
210 | - | |
211 | - public void closeRegionPanel(bool restoreActiveItem) | |
212 | - { | |
213 | - regionPanel.Animate(false); | |
214 | - setPanelOpen(false); | |
215 | - | |
216 | - if (restoreActiveItem) | |
217 | - regionSelector.ReselectActiveItem(); | |
218 | - } | |
219 | - | |
220 | - public void onPanelOutClick() | |
221 | - { | |
222 | - if (regionPanel.isVisible()) | |
223 | - closeRegionPanel(true); | |
224 | - | |
225 | - else if (settingsPanel.isVisible()) | |
226 | - closeSettingsPanel(); | |
227 | - | |
228 | - else setPanelOpen(false); | |
229 | - } | |
230 | - | |
231 | - private void setPanelOpen(bool open) | |
232 | - { | |
233 | - shadow.Animate(open); | |
234 | - setAvatarColliderState( ! open); | |
235 | - } | |
183 | + public void openSettingsPanel() | |
184 | + { | |
185 | + settingsPanel.Animate(true); | |
186 | + setPanelOpen(true); | |
187 | + | |
188 | + if (playerManager.isPlaying()) | |
189 | + pause(); | |
190 | + } | |
191 | + | |
192 | + public void openRegionPanel() | |
193 | + { | |
194 | + settingsPanel.Animate(false); | |
195 | + regionPanel.Animate(true); | |
196 | + setPanelOpen(true); | |
197 | + } | |
198 | + | |
199 | + public void openInfoScreen() | |
200 | + { | |
201 | + closeSettingsPanel(); | |
202 | + switchScreen(infoScreen); | |
203 | + } | |
204 | + | |
205 | + public void closeSettingsPanel() | |
206 | + { | |
207 | + settingsPanel.Animate(false); | |
208 | + setPanelOpen(false); | |
209 | + } | |
210 | + | |
211 | + public void closeRegionPanel(bool restoreActiveItem) | |
212 | + { | |
213 | + regionPanel.Animate(false); | |
214 | + setPanelOpen(false); | |
215 | + | |
216 | + if (restoreActiveItem) | |
217 | + regionSelector.ReselectActiveItem(); | |
218 | + } | |
219 | + | |
220 | + public void onPanelOutClick() | |
221 | + { | |
222 | + if (regionPanel.isVisible()) | |
223 | + closeRegionPanel(true); | |
224 | + | |
225 | + else if (settingsPanel.isVisible()) | |
226 | + closeSettingsPanel(); | |
227 | + | |
228 | + else setPanelOpen(false); | |
229 | + } | |
230 | + | |
231 | + private void setPanelOpen(bool open) | |
232 | + { | |
233 | + shadow.Animate(open); | |
234 | + setAvatarColliderState( ! open); | |
235 | + } | |
236 | 236 | |
237 | 237 | public void setPauseMenuState(bool active) |
238 | 238 | { |
... | ... | @@ -248,15 +248,15 @@ public class ScreenManager : MonoBehaviour { |
248 | 248 | this.pauseMenu.SetActive(false); |
249 | 249 | } |
250 | 250 | |
251 | - public void showConnectionErrorDialog() | |
252 | - { | |
253 | - this.connectionErrorDialog.SetActive(true); | |
254 | - } | |
251 | + public void showConnectionErrorDialog() | |
252 | + { | |
253 | + this.connectionErrorDialog.SetActive(true); | |
254 | + } | |
255 | 255 | |
256 | - public void showConnectionErrorDialog(PlayerManager.ERROR_STATUS_MESSAGE msg)//int error_code | |
257 | - { | |
258 | - this.connectionErrorDialog.SetActive(true); | |
259 | - this.connectionErrorText.text = PlayerManager.get_connection_status_message(msg); | |
256 | + public void showConnectionErrorDialog(PlayerManager.ERROR_STATUS_MESSAGE msg)//int error_code | |
257 | + { | |
258 | + this.connectionErrorDialog.SetActive(true); | |
259 | + this.connectionErrorText.text = PlayerManager.get_connection_status_message(msg); | |
260 | 260 | } |
261 | 261 | |
262 | 262 | public void setAvatarColliderState(bool active) { | ... | ... |
Assets/Scripts/UI/SlidingHidder.cs
... | ... | @@ -3,72 +3,72 @@ using System.Collections; |
3 | 3 | |
4 | 4 | namespace LAViD.VLibras.UI { |
5 | 5 | |
6 | - public class SlidingHidder : ExchangeableVisibility { | |
7 | - | |
8 | - public bool slideOnX = true; | |
9 | - public bool toLeft = true; | |
10 | - //public bool slideOnY = false; | |
11 | - //public bool toTop = false; | |
12 | - public float speed = 1f; | |
13 | - public bool disableWhenHidden = true; | |
14 | - | |
15 | - private Transform thisTransform; | |
16 | - private Vector2 hiddenPosition; | |
17 | - private Vector2 visiblePosition; | |
18 | - | |
19 | - public override void Animate(bool visible) | |
20 | - { | |
21 | - if (base.isVisible() != visible) | |
22 | - { | |
23 | - this.gameObject.SetActive(true); | |
24 | - base.Animate(visible); | |
25 | - } | |
26 | - } | |
27 | - | |
28 | - void Start() | |
29 | - { | |
30 | - this.thisTransform = this.gameObject.transform; | |
31 | - this.speed = Screen.width * this.speed; | |
32 | - Rect obj = this.gameObject.GetComponent<RectTransform>().rect; | |
33 | - | |
34 | - this.visiblePosition = thisTransform.position; | |
35 | - this.hiddenPosition = thisTransform.position; | |
36 | - | |
37 | - if (this.slideOnX) this.hiddenPosition.x += toLeft ? -obj.width : obj.width; | |
38 | - //if (this.slideOnY) this.hiddenPosition.y += toTop ? -obj.height: obj.height; | |
39 | - | |
40 | - this.thisTransform.position = base.isVisible() ? this.visiblePosition : this.hiddenPosition; | |
41 | - this.gameObject.SetActive(base.isVisible()); | |
42 | - } | |
43 | - | |
44 | - void Update() | |
45 | - { | |
46 | - Vector2 position = thisTransform.position; | |
47 | - Vector2 objective = base.isVisible() ? this.visiblePosition : this.hiddenPosition; | |
48 | - bool changed = true; | |
49 | - | |
50 | - if (this.slideOnX && Mathf.Abs(position.x - objective.x) > this.speed) | |
51 | - position.x += position.x < objective.x ? this.speed : -this.speed; | |
52 | - | |
53 | - else if (position.x != objective.x) | |
54 | - position.x = objective.x; | |
55 | - | |
56 | - else changed = false; | |
57 | - | |
58 | - /*if (slideOnY && Mathf.Abs(position.y - objective.y) > speed) | |
59 | - position.y = position.y + (position.y < objective.y ? speed : -speed); | |
60 | - else | |
61 | - position.y = objective.y;*/ | |
62 | - | |
63 | - if (changed) | |
64 | - { | |
65 | - this.thisTransform.position = position; | |
66 | - this.gameObject.SetActive( ! this.disableWhenHidden | |
67 | - || (position.x != this.hiddenPosition.x /*|| position.y != hiddenPosition.y*/) | |
68 | - ); | |
69 | - } | |
70 | - } | |
71 | - | |
72 | - } | |
6 | + public class SlidingHidder : ExchangeableVisibility { | |
7 | + | |
8 | + public bool slideOnX = true; | |
9 | + public bool toLeft = true; | |
10 | + //public bool slideOnY = false; | |
11 | + //public bool toTop = false; | |
12 | + public float speed = 1f; | |
13 | + public bool disableWhenHidden = true; | |
14 | + | |
15 | + private Transform thisTransform; | |
16 | + private Vector2 hiddenPosition; | |
17 | + private Vector2 visiblePosition; | |
18 | + | |
19 | + public override void Animate(bool visible) | |
20 | + { | |
21 | + if (base.isVisible() != visible) | |
22 | + { | |
23 | + this.gameObject.SetActive(true); | |
24 | + base.Animate(visible); | |
25 | + } | |
26 | + } | |
27 | + | |
28 | + void Start() | |
29 | + { | |
30 | + this.thisTransform = this.gameObject.transform; | |
31 | + this.speed = Screen.width * this.speed; | |
32 | + Rect obj = this.gameObject.GetComponent<RectTransform>().rect; | |
33 | + | |
34 | + this.visiblePosition = thisTransform.position; | |
35 | + this.hiddenPosition = thisTransform.position; | |
36 | + | |
37 | + if (this.slideOnX) this.hiddenPosition.x += toLeft ? -obj.width : obj.width; | |
38 | + //if (this.slideOnY) this.hiddenPosition.y += toTop ? -obj.height: obj.height; | |
39 | + | |
40 | + this.thisTransform.position = base.isVisible() ? this.visiblePosition : this.hiddenPosition; | |
41 | + this.gameObject.SetActive(base.isVisible()); | |
42 | + } | |
43 | + | |
44 | + void Update() | |
45 | + { | |
46 | + Vector2 position = thisTransform.position; | |
47 | + Vector2 objective = base.isVisible() ? this.visiblePosition : this.hiddenPosition; | |
48 | + bool changed = true; | |
49 | + | |
50 | + if (this.slideOnX && Mathf.Abs(position.x - objective.x) > this.speed) | |
51 | + position.x += position.x < objective.x ? this.speed : -this.speed; | |
52 | + | |
53 | + else if (position.x != objective.x) | |
54 | + position.x = objective.x; | |
55 | + | |
56 | + else changed = false; | |
57 | + | |
58 | + /*if (slideOnY && Mathf.Abs(position.y - objective.y) > speed) | |
59 | + position.y = position.y + (position.y < objective.y ? speed : -speed); | |
60 | + else | |
61 | + position.y = objective.y;*/ | |
62 | + | |
63 | + if (changed) | |
64 | + { | |
65 | + this.thisTransform.position = position; | |
66 | + this.gameObject.SetActive( ! this.disableWhenHidden | |
67 | + || (position.x != this.hiddenPosition.x /*|| position.y != hiddenPosition.y*/) | |
68 | + ); | |
69 | + } | |
70 | + } | |
71 | + | |
72 | + } | |
73 | 73 | |
74 | 74 | } | ... | ... |
Assets/Scripts/VisualLogger.cs
... | ... | @@ -3,29 +3,29 @@ using UnityEngine.UI; |
3 | 3 | |
4 | 4 | namespace LAViD.VLibras.Utils { |
5 | 5 | |
6 | - public class VisualLogger : PlayerLogger { | |
6 | + public class VisualLogger : PlayerLogger { | |
7 | 7 | |
8 | - private Text textObj; | |
9 | - public int maximumLines = 20; | |
8 | + private Text textObj; | |
9 | + public int maximumLines = 20; | |
10 | 10 | |
11 | - private List<string> logs = new List<string>(); | |
11 | + private List<string> logs = new List<string>(); | |
12 | 12 | |
13 | - protected override void Start() | |
14 | - { | |
15 | - base.Start(); | |
16 | - this.textObj = this.gameObject.GetComponent<Text>(); | |
17 | - } | |
13 | + protected override void Start() | |
14 | + { | |
15 | + base.Start(); | |
16 | + this.textObj = this.gameObject.GetComponent<Text>(); | |
17 | + } | |
18 | 18 | |
19 | - protected override void write(string text) | |
20 | - { | |
21 | - this.logs.Insert(0, text); | |
19 | + protected override void write(string text) | |
20 | + { | |
21 | + this.logs.Insert(0, text); | |
22 | 22 | |
23 | - if (this.logs.Count > this.maximumLines) | |
24 | - this.logs.RemoveAt(this.logs.Count - 1); | |
23 | + if (this.logs.Count > this.maximumLines) | |
24 | + this.logs.RemoveAt(this.logs.Count - 1); | |
25 | 25 | |
26 | - this.textObj.text = string.Join("\n", this.logs.ToArray()); | |
27 | - } | |
26 | + this.textObj.text = string.Join("\n", this.logs.ToArray()); | |
27 | + } | |
28 | 28 | |
29 | - } | |
29 | + } | |
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file | ... | ... |