Commit e37ad421d07875a0509dd209cca61861dae64270

Authored by Mateus Lustosa
1 parent a89919da

Fix merge

Assets/InputResizer.cs
... ... @@ -1,39 +0,0 @@
1   -using UnityEngine;
2   -using UnityEngine.UI;
3   -
4   -public class InputResizer : MonoBehaviour {
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   - }
38   -
39   -}
Assets/InputResizer.cs.meta
... ... @@ -1,12 +0,0 @@
1   -fileFormatVersion: 2
2   -guid: f8db495bb0057e14eb35ef4f2df7910e
3   -timeCreated: 1475710064
4   -licenseType: Pro
5   -MonoImporter:
6   - serializedVersion: 2
7   - defaultReferences: []
8   - executionOrder: 0
9   - icon: {instanceID: 0}
10   - userData:
11   - assetBundleName:
12   - assetBundleVariant:
Assets/Logger.cs
... ... @@ -1,25 +0,0 @@
1   -using UnityEngine;
2   -using System.Collections;
3   -using UnityEngine.UI;
4   -
5   -public class Logger : MonoBehaviour {
6   -
7   - public static Logger instance;
8   -
9   - private Text textObj;
10   -
11   - void Start ()
12   - {
13   - Logger.instance = this;
14   - this.textObj = this.gameObject.GetComponent<Text>();
15   - }
16   -
17   - public static void Log(string text)
18   - {
19   - if (Logger.instance != null)
20   - Logger.instance.textObj.text = text + "\n" + Logger.instance.textObj.text;
21   -
22   - Debug.Log(text);
23   - }
24   -
25   -}
Assets/Logger.cs.meta
... ... @@ -1,12 +0,0 @@
1   -fileFormatVersion: 2
2   -guid: a9cc0ccbda0accb4ea816c19265b622f
3   -timeCreated: 1475670486
4   -licenseType: Pro
5   -MonoImporter:
6   - serializedVersion: 2
7   - defaultReferences: []
8   - executionOrder: 0
9   - icon: {instanceID: 0}
10   - userData:
11   - assetBundleName:
12   - assetBundleVariant:
Assets/Scripts/Player Manager/GenericPlayerManager.cs
... ... @@ -27,6 +27,7 @@ using System.Collections.Generic;
27 27 using System;
28 28 using System.Threading;
29 29 using UnityEngine.UI;
  30 +using LAViD.VLibras;
30 31  
31 32 public abstract class GenericPlayerManager : MonoBehaviour {
32 33  
... ... @@ -219,7 +220,7 @@ public abstract class GenericPlayerManager : MonoBehaviour {
219 220 return state;
220 221 }
221 222 catch (NullReferenceException nre) {
222   - Logger.Log("'" + name + "' não foi encontrado!\n" + nre.ToString());
  223 + LAViD.VLibras.Utils.Logger.Log("'" + name + "' não foi encontrado!\n" + nre.ToString());
223 224 }
224 225  
225 226 return null;
... ... @@ -422,7 +423,7 @@ public abstract class GenericPlayerManager : MonoBehaviour {
422 423 this.subtitles.updateLetterSpeed();
423 424 }
424 425  
425   - Logger.Log("Animação \"" + animName + "\" inexistente.");
  426 + LAViD.VLibras.Utils.Logger.Log("Animação \"" + animName + "\" inexistente.");
426 427 }
427 428 else
428 429 {
... ... @@ -504,10 +505,10 @@ public abstract class GenericPlayerManager : MonoBehaviour {
504 505  
505 506 if (checkConnectionRequest.responseHeaders.Count > 0)
506 507 {
507   - Logger.Log(checkConnectionRequest.responseHeaders["STATUS"]);
  508 + LAViD.VLibras.Utils.Logger.Log(checkConnectionRequest.responseHeaders["STATUS"]);
508 509 connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404");
509 510 }
510   - else Logger.Log("No response headers.");*/
  511 + else LAViD.VLibras.Utils.Logger.Log("No response headers.");*/
511 512  
512 513 bool connected = true;
513 514 bool playingStarted = false;
... ... @@ -525,15 +526,15 @@ public abstract class GenericPlayerManager : MonoBehaviour {
525 526 WWW www = loadAssetBundle(aniName);
526 527 yield return www;
527 528  
528   - Logger.Log("Bundle request done (" + aniName + ").");
  529 + LAViD.VLibras.Utils.Logger.Log("Bundle request done (" + aniName + ").");
529 530  
530 531 if (www.error == null)
531 532 {
532 533 AssetBundle bundle = www.assetBundle;
533 534  
534   - /*Logger.Log("count: " + www.responseHeaders.Count);
  535 + /*LAViD.VLibras.Utils.Logger.Log("count: " + www.responseHeaders.Count);
535 536 if (www.responseHeaders.Count > 0)
536   - Logger.Log(www.responseHeaders["STATUS"]);
  537 + LAViD.VLibras.Utils.Logger.Log(www.responseHeaders["STATUS"]);
537 538  
538 539 // if (www.responseHeaders.Count > 0 && www.responseHeaders["STATUS"].EndsWith("200 OK"));
539 540 */
... ... @@ -551,14 +552,14 @@ public abstract class GenericPlayerManager : MonoBehaviour {
551 552 loadedAssetBundles.Add(aniName);
552 553 loaded = true;
553 554  
554   - Logger.Log("Bundle \"" + aniName + "\" loaded!");
  555 + LAViD.VLibras.Utils.Logger.Log("Bundle \"" + aniName + "\" loaded!");
555 556 }
556   - else Logger.Log("Sinal \"" + aniName + "\" foi não carregado corretamente.");
  557 + else LAViD.VLibras.Utils.Logger.Log("Sinal \"" + aniName + "\" foi não carregado corretamente.");
557 558 }
558 559 }
559 560 else
560 561 {
561   - Logger.Log("Connection error");
  562 + LAViD.VLibras.Utils.Logger.Log("Connection error");
562 563 onConnectionError(gloss, aniName);
563 564 }
564 565 }
... ... @@ -592,11 +593,11 @@ public abstract class GenericPlayerManager : MonoBehaviour {
592 593 // adiciona ao set de animações não existentes
593 594 if ( ! nonexistent && connected)
594 595 {
595   - Logger.Log("Non existent");
  596 + LAViD.VLibras.Utils.Logger.Log("Non existent");
596 597 nonexistentAssetBundles.Add(aniName);
597 598 }
598 599  
599   - Logger.Log("~~ To spell: " + aniName);
  600 + LAViD.VLibras.Utils.Logger.Log("~~ To spell: " + aniName);
600 601  
601 602 if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName))
602 603 {
... ...
Assets/Scripts/Player Manager/Logger.cs 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +using UnityEngine;
  2 +using UnityEngine.UI;
  3 +
  4 +namespace LAViD.VLibras.Utils {
  5 +
  6 + public class Logger : MonoBehaviour {
  7 +
  8 + public static Logger instance;
  9 +
  10 + private Text textObj;
  11 +
  12 + void Start()
  13 + {
  14 + Logger.instance = this;
  15 + this.textObj = this.gameObject.GetComponent<Text>();
  16 + }
  17 +
  18 + public static void Log(string text)
  19 + {
  20 + if (Logger.instance != null)
  21 + Logger.instance.textObj.text = text + "\n" + Logger.instance.textObj.text;
  22 +
  23 + Debug.Log(text);
  24 + }
  25 +
  26 + }
  27 +
  28 +}
... ...
Assets/Scripts/Player Manager/Logger.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: a9cc0ccbda0accb4ea816c19265b622f
  3 +timeCreated: 1475716239
  4 +licenseType: Pro
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Scripts/Player Manager/Utils.cs
1 1 using UnityEngine;
  2 +using UnityEngine.UI;
2 3  
3   -namespace Utils {
  4 +namespace LAViD.VLibras.Utils {
4 5  
5 6 public static class Definitions {
6 7  
... ...
Assets/Scripts/PlayerManager.cs
... ... @@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
12 12 using UnityEngine.UI;
13 13 using System.Threading;
14 14 using System.Net;
15   -using Utils;
  15 +using LAViD.VLibras.Utils;
16 16  
17 17 public class PlayerManager : GenericPlayerManager {
18 18  
... ... @@ -84,7 +84,7 @@ public class PlayerManager : GenericPlayerManager {
84 84  
85 85 public void playDict(string word)
86 86 {
87   - Logger.Log("Requesting dictionary: " + word);
  87 + LAViD.VLibras.Utils.Logger.Log("Requesting dictionary: " + word);
88 88  
89 89 this.dictWord = word;
90 90 base.gloss = word;
... ... @@ -130,7 +130,7 @@ public class PlayerManager : GenericPlayerManager {
130 130  
131 131 protected override WWW loadAssetBundle(string aniName)
132 132 {
133   - Logger.Log("Requesting bundle: " + BASE_URL + regionPath + aniName);
  133 + LAViD.VLibras.Utils.Logger.Log("Requesting bundle: " + BASE_URL + regionPath + aniName);
134 134 return WWW.LoadFromCacheOrDownload(BASE_URL + regionPath + aniName, this.regionHash);
135 135 }
136 136  
... ... @@ -156,11 +156,11 @@ public class PlayerManager : GenericPlayerManager {
156 156 // Called from microphone icon at main interface
157 157 public void callVoiceRecognizer()
158 158 {
159   - Logger.Log("Requesting voice recognizer");
  159 + LAViD.VLibras.Utils.Logger.Log("Requesting voice recognizer");
160 160  
161 161 string gloss = voiceRecognizer.callRecognition();
162 162 this.translateScreenText.text = gloss;
163   - Logger.Log("Voice recognizer answer: " + gloss);
  163 + LAViD.VLibras.Utils.Logger.Log("Voice recognizer answer: " + gloss);
164 164  
165 165 this.screenManager.switchScreen("translate");
166 166 }
... ... @@ -179,11 +179,11 @@ public class PlayerManager : GenericPlayerManager {
179 179 if (connection.error == null)
180 180 {
181 181 if (connection.responseHeaders.Count > 0)
182   - Logger.Log(connection.responseHeaders["STATUS"]);
  182 + LAViD.VLibras.Utils.Logger.Log(connection.responseHeaders["STATUS"]);
183 183 else
184   - Logger.Log("No STATUS");
  184 + LAViD.VLibras.Utils.Logger.Log("No STATUS");
185 185 }
186   - else Logger.Log("ERROR: " + connection.error);
  186 + else LAViD.VLibras.Utils.Logger.Log("ERROR: " + connection.error);
187 187  
188 188 return false;*/
189 189  
... ... @@ -199,7 +199,7 @@ public class PlayerManager : GenericPlayerManager {
199 199 {
200 200 if (e.Response != null)
201 201 {
202   - Logger.Log(((HttpWebResponse)e.Response).StatusCode);
  202 + LAViD.VLibras.Utils.Logger.Log(((HttpWebResponse)e.Response).StatusCode);
203 203 return ((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.NotFound;
204 204 }
205 205 }
... ... @@ -215,20 +215,20 @@ public class PlayerManager : GenericPlayerManager {
215 215 bool returnSuccess = true;
216 216 bool timeout = false;
217 217  
218   - Logger.Log("Requesting translator: " + gloss);
  218 + LAViD.VLibras.Utils.Logger.Log("Requesting translator: " + gloss);
219 219  
220 220 base.randomAnimations.lockFor("translate");
221 221 this.screenManager.setLoadingSnippetState(true);
222 222  
223 223 WWW glossRequest = new WWW(SERVER_URL + WWW.EscapeURL(gloss));
224   - Logger.Log("Translate: Request: " + SERVER_URL + WWW.EscapeURL(gloss));
  224 + LAViD.VLibras.Utils.Logger.Log("Translate: Request: " + SERVER_URL + WWW.EscapeURL(gloss));
225 225  
226 226 if (glossRequest != null)
227 227 {
228 228 const float timeoutLimit = 10f;
229 229 float timer = 0;
230 230  
231   - Logger.Log("Translate: Stating time check.");
  231 + LAViD.VLibras.Utils.Logger.Log("Translate: Stating time check.");
232 232  
233 233 while (!glossRequest.isDone)
234 234 {
... ... @@ -242,20 +242,20 @@ public class PlayerManager : GenericPlayerManager {
242 242 yield return null;
243 243 }
244 244  
245   - Logger.Log("Translate: Timeout check finished.");
  245 + LAViD.VLibras.Utils.Logger.Log("Translate: Timeout check finished.");
246 246  
247 247 if (!timeout)
248 248 {
249 249 if (glossRequest.error == null)
250 250 {
251   - Logger.Log("Translate: Request: count=" + glossRequest.responseHeaders.Count + ", status=" + glossRequest.responseHeaders["STATUS"]);
  251 + LAViD.VLibras.Utils.Logger.Log("Translate: Request: count=" + glossRequest.responseHeaders.Count + ", status=" + glossRequest.responseHeaders["STATUS"]);
252 252 returnSuccess = glossRequest.responseHeaders.Count > 0 && glossRequest.responseHeaders["STATUS"].EndsWith("200 OK");
253 253  
254 254 if (returnSuccess)
255 255 {
256 256 if (!String.IsNullOrEmpty(glossRequest.text))
257 257 {
258   - Logger.Log("Translator answer: " + glossRequest.text);
  258 + LAViD.VLibras.Utils.Logger.Log("Translator answer: " + glossRequest.text);
259 259  
260 260 base.gloss = glossRequest.text;
261 261 base.playNow(glossRequest.text);
... ... @@ -264,15 +264,15 @@ public class PlayerManager : GenericPlayerManager {
264 264  
265 265 yield break;
266 266 }
267   - else Logger.Log("Error at PlayerManager.translate: empty answer.");
  267 + else LAViD.VLibras.Utils.Logger.Log("Error at PlayerManager.translate: empty answer.");
268 268 }
269   - else Logger.Log("Error at PlayerManager.translate: unsuccessful answer.");
  269 + else LAViD.VLibras.Utils.Logger.Log("Error at PlayerManager.translate: unsuccessful answer.");
270 270 }
271   - else Logger.Log("Error at PlayerManager.translate: (WWW) glosaRequest: " + glossRequest.error);
  271 + else LAViD.VLibras.Utils.Logger.Log("Error at PlayerManager.translate: (WWW) glosaRequest: " + glossRequest.error);
272 272 }
273   - else Logger.Log("Error at PlayerManager.translate: timeout.");
  273 + else LAViD.VLibras.Utils.Logger.Log("Error at PlayerManager.translate: timeout.");
274 274 }
275   - else Logger.Log ("Error at PlayerManager.translate: (WWW) glosaRequest is NULL.");
  275 + else LAViD.VLibras.Utils.Logger.Log ("Error at PlayerManager.translate: (WWW) glosaRequest is NULL.");
276 276  
277 277 base.gloss = gloss.ToUpper();
278 278  
... ...
Assets/Scripts/UI/InputResizer.cs 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +using UnityEngine;
  2 +using UnityEngine.UI;
  3 +
  4 +public class InputResizer : MonoBehaviour {
  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 + }
  38 +
  39 +}
... ...
Assets/Scripts/UI/InputResizer.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: f8db495bb0057e14eb35ef4f2df7910e
  3 +timeCreated: 1475710064
  4 +licenseType: Pro
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...