Commit 8e6d750824bebae4bf3d587c471d0396abbea5a9
1 parent
48a02ab3
Exists in
master
Problemas de strings nulas resolvidos e anti aliasing implementado
Showing
4 changed files
with
67 additions
and
77 deletions
Show diff stats
Assets/Scenes/Main.unity
... | ... | @@ -496,11 +496,11 @@ Prefab: |
496 | 496 | objectReference: {fileID: 0} |
497 | 497 | - target: {fileID: 22483792, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
498 | 498 | propertyPath: m_AnchoredPosition.x |
499 | - value: 57.2999992 | |
499 | + value: 61.9000015 | |
500 | 500 | objectReference: {fileID: 0} |
501 | 501 | - target: {fileID: 22483792, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
502 | 502 | propertyPath: m_AnchoredPosition.y |
503 | - value: -137.100006 | |
503 | + value: 62.5 | |
504 | 504 | objectReference: {fileID: 0} |
505 | 505 | - target: {fileID: 22483792, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
506 | 506 | propertyPath: m_AnchorMin.x |
... | ... | @@ -512,11 +512,11 @@ Prefab: |
512 | 512 | objectReference: {fileID: 0} |
513 | 513 | - target: {fileID: 22483792, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
514 | 514 | propertyPath: m_AnchorMin.y |
515 | - value: .5 | |
515 | + value: 0 | |
516 | 516 | objectReference: {fileID: 0} |
517 | 517 | - target: {fileID: 22483792, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
518 | 518 | propertyPath: m_AnchorMax.y |
519 | - value: .5 | |
519 | + value: 0 | |
520 | 520 | objectReference: {fileID: 0} |
521 | 521 | - target: {fileID: 22483792, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
522 | 522 | propertyPath: m_SizeDelta.y |
... | ... | @@ -546,6 +546,10 @@ Prefab: |
546 | 546 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName |
547 | 547 | value: start_web_play |
548 | 548 | objectReference: {fileID: 0} |
549 | + - target: {fileID: 11451458, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} | |
550 | + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode | |
551 | + value: 1 | |
552 | + objectReference: {fileID: 0} | |
549 | 553 | m_RemovedComponents: [] |
550 | 554 | m_ParentPrefab: {fileID: 100100000, guid: a310db7b56d86974ca7dc72c28f6a7f6, type: 2} |
551 | 555 | m_IsPrefabParent: 0 | ... | ... |
Assets/Scripts/PlayerManager.cs
... | ... | @@ -15,6 +15,7 @@ public class PlayerManager : MonoBehaviour { |
15 | 15 | public static float hSliderValue = 1.1f; |
16 | 16 | |
17 | 17 | public static string alphabet = "0123456789,ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
18 | + public string glosa = " _default "; | |
18 | 19 | public static String[] stringPos = {"_default"};//vetor que sera usado para quebrar a glosa |
19 | 20 | |
20 | 21 | // Guarda os nomes das palavras ja carregadas |
... | ... | @@ -22,18 +23,11 @@ public class PlayerManager : MonoBehaviour { |
22 | 23 | // Guarda os nomes das palavras que nao tem assetbundle |
23 | 24 | HashSet<string> nonexistentAssetBundles = new HashSet<string>(); |
24 | 25 | |
25 | - | |
26 | - // Contem todos os nomes das anims na ordem que serao reproduzidas | |
27 | - public static Queue<string> playList = new Queue<string>(); | |
28 | - | |
29 | 26 | AnimationClip aniClip; |
30 | - public string glosa = " _default "; | |
31 | - | |
32 | - | |
27 | + | |
33 | 28 | GameObject AVATAR; |
34 | 29 | Animation COMPONENT_ANIMATION; |
35 | 30 | |
36 | - //Primeiro metodo que o player executa | |
37 | 31 | void Start( ){ |
38 | 32 | |
39 | 33 | Application.ExternalCall("onLoadPlayer");//var onLoadPlayer = function(){} |
... | ... | @@ -44,33 +38,21 @@ public class PlayerManager : MonoBehaviour { |
44 | 38 | |
45 | 39 | } |
46 | 40 | |
47 | - void Update(){ | |
48 | - if(COMPONENT_ANIMATION.isPlaying) | |
49 | - foreach(AnimationState anim in COMPONENT_ANIMATION) | |
50 | - anim.speed = hSliderValue; | |
51 | - } | |
41 | + void Update( ){ if(COMPONENT_ANIMATION.isPlaying) foreach(AnimationState anim in COMPONENT_ANIMATION) anim.speed = hSliderValue; } | |
52 | 42 | |
53 | 43 | //define a velocidade das animacoes com base no slider da GUI |
54 | - public void setSlider( float x ){ | |
55 | - hSliderValue = x; | |
56 | - | |
57 | - } | |
44 | + public void setSlider( float x ){ hSliderValue = x; } | |
58 | 45 | |
59 | 46 | //adiciona alfabeto e numerais ao componente animador do avatar |
60 | 47 | void addAlpha( ){ |
61 | 48 | |
62 | - | |
63 | - | |
64 | - foreach( char letter in alphabet ){ | |
65 | - | |
66 | - aniClip = Resources.Load<AnimationClip> ("ANIMS/"+letter); | |
49 | + foreach( char letter in alphabet ){ aniClip = Resources.Load<AnimationClip> ("ANIMS/"+letter); | |
67 | 50 | |
68 | 51 | if( aniClip ) COMPONENT_ANIMATION.AddClip(aniClip, ""+letter); |
69 | 52 | else Debug.Log("Anim "+letter+" not found"); |
70 | 53 | |
71 | 54 | } |
72 | 55 | |
73 | - | |
74 | 56 | }//addAlpha |
75 | 57 | |
76 | 58 | public void stop_animations( ){ |
... | ... | @@ -81,97 +63,82 @@ public class PlayerManager : MonoBehaviour { |
81 | 63 | |
82 | 64 | } |
83 | 65 | |
84 | - public void catchGlosa(){ | |
66 | + public void catchGlosa(String glosa){ | |
85 | 67 | |
86 | - this.glosa = " _default "+glosa+" _default "; | |
68 | + //Debug.Log ("glosa antes do catch: "+glosa); | |
69 | + this.glosa = glosa; | |
70 | + //Debug.Log("glosa depois do catch: "+glosa); | |
71 | + start_web_play(); | |
87 | 72 | |
88 | 73 | } |
89 | - | |
90 | - | |
91 | - | |
92 | - public void start_inputfield_web_play( ){ | |
93 | - int version = 1; | |
94 | - StartCoroutine(webPlay(INFIELD.text.ToUpper(), version)); | |
95 | - } | |
96 | - | |
97 | - public void start_web_play( ){ | |
98 | - | |
99 | - catchGlosa(); | |
100 | - int version = 1; | |
101 | - StartCoroutine(webPlay(INFIELD.text.ToUpper(), version)); | |
102 | - | |
74 | + | |
75 | + public void start_web_play( ){ int version = 1; | |
76 | + try{ StartCoroutine(webPlay(glosa, version)); | |
77 | + }catch(Exception e){Debug.Log (e+" :: Ops! Tivemos um problema capiscioso e cabriocrarico...");} | |
103 | 78 | } |
104 | 79 | |
105 | 80 | IEnumerator webPlay(String glosa, int version) { |
106 | 81 | |
107 | - | |
108 | - | |
109 | 82 | stop_animations( ); |
110 | 83 | |
111 | - Subtitles.WORDS.Clear(); | |
112 | - foreach( char letter in alphabet ) Subtitles.WORDS.Add(""+letter); | |
113 | - | |
84 | + if(Subtitles.WORDS.Count==0) foreach( char letter in alphabet ) Subtitles.WORDS.Add(""+letter); | |
114 | 85 | |
115 | 86 | stringPos = glosa.Split(' '); |
116 | - String BaseURL = "http://150.165.205.9/anims/WEBGL/"; | |
117 | 87 | |
118 | - //aniClip = www.assetBundle.mainAsset as AnimationClip; | |
88 | + String BaseURL = "http://150.165.205.9/anims/WEBGL/"; | |
119 | 89 | |
120 | 90 | COMPONENT_ANIMATION.CrossFadeQueued("_default", 0.6F, QueueMode.CompleteOthers); |
121 | 91 | |
122 | 92 | foreach(string aniName in stringPos){ |
123 | 93 | |
124 | - try{ | |
125 | - | |
126 | - if (String.IsNullOrEmpty(aniName)) continue; | |
127 | - | |
128 | - }catch(Exception e){ Debug.Log(e+" :: NotNullNotEmpty"); } | |
94 | + try{ if(String.IsNullOrEmpty(aniName)) continue; | |
95 | + }catch(Exception e){ Debug.Log(e+" :: NotNullNotEmpty"); } | |
129 | 96 | |
130 | 97 | // Se ja estiver carregado: reproduz animaçao |
131 | - if (loadedAssetBundles.Contains(aniName)){ | |
98 | + if(loadedAssetBundles.Contains(aniName)){ | |
132 | 99 | |
133 | - Subtitles.WORDS.Add(aniName); | |
134 | 100 | COMPONENT_ANIMATION.CrossFadeQueued(aniName, 0.6F, QueueMode.CompleteOthers); |
135 | 101 | |
136 | - }else if (nonexistentAssetBundles.Contains(aniName)){//se nao estiver, soletra | |
102 | + }else if(nonexistentAssetBundles.Contains(aniName)){//se nao estiver, soletra | |
137 | 103 | foreach (char letter in aniName) |
138 | 104 | COMPONENT_ANIMATION.CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); |
139 | 105 | |
140 | 106 | }else{ |
141 | 107 | |
108 | + if(String.IsNullOrEmpty(aniName)){ Debug.Log("NULL aniName:"+aniName+" vazio!"); continue; } | |
109 | + | |
142 | 110 | WWW www = WWW.LoadFromCacheOrDownload(BaseURL+aniName, version); |
143 | 111 | yield return www; |
144 | 112 | |
145 | - if (www.error != null){//soletra se o ww inexistir | |
113 | + if(www.error != null){//soletra se o ww inexistir | |
114 | + | |
146 | 115 | //throw new Exception("Erro no WWW: " + www.error); |
147 | 116 | |
148 | 117 | Debug.Log("Sinal nao disponivel em banco de sinais. SOLETRANDO "+aniName); |
149 | 118 | |
150 | - foreach (char letter in aniName) | |
151 | - COMPONENT_ANIMATION.CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); | |
152 | - | |
119 | + foreach (char letter in aniName) COMPONENT_ANIMATION.CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); | |
153 | 120 | nonexistentAssetBundles.Add(aniName); |
154 | 121 | continue; |
155 | 122 | |
156 | - }else{ | |
123 | + } | |
157 | 124 | |
158 | - //Debug.Log (www.assetBundle.name); | |
159 | - aniClip = www.assetBundle.mainAsset as AnimationClip; | |
125 | + AssetBundle bundle = www.assetBundle; | |
160 | 126 | |
161 | - if (aniClip){ | |
127 | + if(String.IsNullOrEmpty(bundle.mainAsset.name)){ Debug.Log(bundle.name+" vazio!"); continue; } | |
162 | 128 | |
163 | - COMPONENT_ANIMATION.AddClip(aniClip, aniName); | |
164 | - COMPONENT_ANIMATION.CrossFadeQueued(aniName, 0.6F, QueueMode.CompleteOthers); // 0.4 | |
129 | + aniClip = bundle.mainAsset as AnimationClip; | |
165 | 130 | |
131 | + bundle.Unload(false); | |
166 | 132 | |
167 | - Subtitles.WORDS.Add(aniName); loadedAssetBundles.Add(aniName); | |
133 | + if(aniClip){ | |
168 | 134 | |
169 | - }else{ | |
170 | - foreach (char letter in aniName) | |
171 | - COMPONENT_ANIMATION.CrossFadeQueued("" + letter, 0.6F, QueueMode.CompleteOthers); | |
135 | + COMPONENT_ANIMATION.AddClip(aniClip, aniName); | |
136 | + COMPONENT_ANIMATION.CrossFadeQueued(aniName, 0.6F, QueueMode.CompleteOthers); // 0.4 | |
172 | 137 | |
173 | - } | |
138 | + Subtitles.WORDS.Add(aniName); loadedAssetBundles.Add(aniName); | |
174 | 139 | |
140 | + }else{ Debug.Log ("eita"); | |
141 | + foreach(char letter in aniName) COMPONENT_ANIMATION.CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); | |
175 | 142 | } |
176 | 143 | |
177 | 144 | }//else |
... | ... | @@ -181,5 +148,10 @@ public class PlayerManager : MonoBehaviour { |
181 | 148 | COMPONENT_ANIMATION.CrossFadeQueued("_default", 0.6F, QueueMode.CompleteOthers); |
182 | 149 | |
183 | 150 | } |
184 | - | |
185 | -} | |
186 | 151 | \ No newline at end of file |
152 | + | |
153 | + public void start_inputfield_web_play( ){ int version = 1; | |
154 | + try{ StartCoroutine(webPlay(INFIELD.text.ToUpper(), version)); | |
155 | + }catch(Exception e){Debug.Log (e+" :: Exception StartCourr"); } | |
156 | + } | |
157 | + | |
158 | +} | ... | ... |
Assets/Scripts/Subtitles.cs
... | ... | @@ -13,6 +13,7 @@ public class Subtitles : MonoBehaviour { |
13 | 13 | public Text SUBTITLES; |
14 | 14 | GameObject AVATAR; |
15 | 15 | Animation COMPONENT_ANIMATION; |
16 | + private HashSet<String> numeros; | |
16 | 17 | |
17 | 18 | public static HashSet<String> WORDS = new HashSet<String>(); |
18 | 19 | |
... | ... | @@ -32,6 +33,18 @@ public class Subtitles : MonoBehaviour { |
32 | 33 | |
33 | 34 | string GetCurrentPlayingAnimationClip( ){ |
34 | 35 | |
36 | + foreach(AnimationState aniName in COMPONENT_ANIMATION) | |
37 | + if( COMPONENT_ANIMATION.IsPlaying(aniName.name) && !aniName.name[0].Equals('_')) return aniName.name.Split(' ')[0]; | |
38 | + | |
39 | + return null; | |
40 | + | |
41 | + } | |
42 | + | |
43 | + | |
44 | + | |
45 | + | |
46 | + string _AGetCurrentPlayingAnimationClip( ){ | |
47 | + | |
35 | 48 | foreach(String aniName in WORDS) |
36 | 49 | if(COMPONENT_ANIMATION.IsPlaying(aniName+" - Queued Clone")) |
37 | 50 | return aniName; |
... | ... | @@ -40,7 +53,8 @@ public class Subtitles : MonoBehaviour { |
40 | 53 | |
41 | 54 | } |
42 | 55 | |
43 | - /*string GetCurrentPlayingAnimationClip( ){ if(isCaptionActiveFlag) foreach(string anim in words_from_glosa){ if( COMPONENT_ANIMATION.IsPlaying( anim+" - Queued Clone" ) ) //if( !(anim.Equals("_default - Queued Clone") || anim.Equals("_default") ) ) return anim; } return null; }*/ | |
56 | + /*string GetCurrentPlayingAnimationClip( ){ | |
57 | + * if(isCaptionActiveFlag) foreach(string anim in words_from_glosa){ if( COMPONENT_ANIMATION.IsPlaying( anim+" - Queued Clone" ) ) //if( !(anim.Equals("_default - Queued Clone") || anim.Equals("_default") ) ) return anim; } return null; }*/ | |
44 | 58 | |
45 | 59 | bool isCaptionActiveFlag = true; |
46 | 60 | ... | ... |
ProjectSettings/QualitySettings.asset