diff --git a/Assets/Scripts/PlayerManager/GenericPlayerManager.cs b/Assets/Scripts/PlayerManager/GenericPlayerManager.cs index c6233ce..023970f 100644 --- a/Assets/Scripts/PlayerManager/GenericPlayerManager.cs +++ b/Assets/Scripts/PlayerManager/GenericPlayerManager.cs @@ -86,6 +86,15 @@ public abstract class GenericPlayerManager : MonoBehaviour { private bool[] lastLetterAnimations = new bool[256]; + private HashSet allowedCharacters = 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', + '1', '2', '3', '4', '5', '6', '7', '8', + '9', '0', '%', '.', ',', '!', '?', + }; + public virtual void Start() { // Configuração de velocidade das animações @@ -377,29 +386,35 @@ public abstract class GenericPlayerManager : MonoBehaviour { for (int i = 0; i < word.Length; i++) { - lastAnimationSubtitle = Subtitle.highlight(word, i); - char anim = word[i]; - switch (word[i]) { case 'Á': case 'Â': case 'À': - case 'Ã': anim = 'A'; - break; + case 'Ã': word = word.Replace(word[i], 'A'); break; case 'É': - case 'Ê': anim = 'E'; - break; - case 'Í': anim = 'I'; - break; + case 'Ê': word = word.Replace(word[i], 'E'); break; + case 'Í': word = word.Replace(word[i], 'I'); break; case 'Ó': case 'Ô': - case 'Õ': anim = 'O'; - break; - case 'Ú': anim = 'U'; - break; + case 'Õ': word = word.Replace(word[i], 'O'); break; + case 'Ú': word = word.Replace(word[i], 'U'); break; } + if (!allowedCharacters.Contains(word[i])) + { + Debug.Log(word[i] + " is not allowed"); + + word = word.Remove(i, 1); + i--; + } + } + + for (int i = 0; i < word.Length; i++) + { + lastAnimationSubtitle = Subtitle.highlight(word, i); + char anim = word[i]; + short type = getType(anim); string animName = nextLetterAnimation(anim); @@ -416,7 +431,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { this.subtitles.updateLetterSpeed(); } - UnityEngine.Debug.Log("GPM.sW(" + word + "): Animação \"" + animName + "\" inexistente."); + Debug.Log("GPM.sW(" + word + "): Animação \"" + animName + "\" inexistente."); } else { @@ -473,7 +488,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { StartCoroutine(subtitlesSynchronizer); - String[] stringPos = gloss.Split(' '); + string[] stringPos = gloss.Split(' '); Queue toPlayQueue = new Queue(); int wordsCount = 0; @@ -506,7 +521,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { Debug.Log("GPM:LAP(" + gloss + "): www.error == null"); bundle = www.assetBundle; - if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name)) + if (bundle != null && ! string.IsNullOrEmpty(bundle.mainAsset.name)) { AnimationClip aniClip = bundle.mainAsset as AnimationClip; bundle.Unload(false); diff --git a/Assets/Scripts/ServerDebug.cs b/Assets/Scripts/ServerDebug.cs index cffa7c3..75cb50a 100644 --- a/Assets/Scripts/ServerDebug.cs +++ b/Assets/Scripts/ServerDebug.cs @@ -1,20 +1,4 @@ -/********************** -********LAVID********** -*******VLibras********* -*------------------------------------------------------------------------ -*Description: -*Server gets pts from Core (client) by TCP connection -*and runs the animations until a final tag is found. -*------------------------------------------------------------------------ -*Author: Claudiomar Araujo # claudiomar.araujo@lavid.ufpb.br -*------------------------------------------------------------------------ -***********************/ - using UnityEngine; -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; using System.Collections.Generic; public class ServerDebug { @@ -30,23 +14,18 @@ public class ServerDebug { public bool IsNotReady { get { return !isReady; } } - - /** - * Starts receiving of glosa and time from server. - * Stops when receive "FINALIZE". - */ + public void StartCommunication() { List messages = new List() { - "TESTE#1000", "TEST2'#2000", "FINALIZE" + "`TÉST\"E#1000", "TES´T2'#2000", "FINALIZE" }; - + Debug.Log("S.SC()"); foreach (string text in messages) { Message message = new Message(text); - Debug.Log("S.SC(): Received: " + message.Text); if (message.Text.Equals("FINALIZE")) @@ -60,4 +39,6 @@ public class ServerDebug { Debug.Log("S.SC(): END"); } + public void SendFinalizeToCore() { } + } \ No newline at end of file -- libgit2 0.21.2