Commit 39372c3aa2e11b4f24e3049b1b4bffa29cf0943e
1 parent
86a015df
Exists in
master
and in
6 other branches
Fix iOS resizer; URL encode; Fix connection error message; Fix avatar z
Showing
9 changed files
with
349 additions
and
304 deletions
Show diff stats
Assets/Scenes/Main.unity
... | ... | @@ -1236,6 +1236,7 @@ RectTransform: |
1236 | 1236 | m_Children: |
1237 | 1237 | - {fileID: 1476138800} |
1238 | 1238 | - {fileID: 1173561061} |
1239 | + - {fileID: 1071047504} | |
1239 | 1240 | - {fileID: 1632068377} |
1240 | 1241 | - {fileID: 1874017187} |
1241 | 1242 | m_Father: {fileID: 202190019} |
... | ... | @@ -3178,7 +3179,7 @@ BoxCollider: |
3178 | 3179 | m_IsTrigger: 0 |
3179 | 3180 | m_Enabled: 1 |
3180 | 3181 | serializedVersion: 2 |
3181 | - m_Size: {x: 6.828157, y: 7.3689804, z: 1} | |
3182 | + m_Size: {x: 6.828157, y: 7.3689804, z: 6} | |
3182 | 3183 | m_Center: {x: -0.04474616, y: 3.5875206, z: -0.00000001458015} |
3183 | 3184 | --- !u!1 &554210566 |
3184 | 3185 | GameObject: |
... | ... | @@ -3775,7 +3776,7 @@ RectTransform: |
3775 | 3776 | m_AnchorMin: {x: 0.1, y: 0.5} |
3776 | 3777 | m_AnchorMax: {x: 0.5, y: 1} |
3777 | 3778 | m_AnchoredPosition: {x: 0, y: 0} |
3778 | - m_SizeDelta: {x: 0, y: -32.424988} | |
3779 | + m_SizeDelta: {x: 0, y: -92} | |
3779 | 3780 | m_Pivot: {x: 0.5, y: 1} |
3780 | 3781 | --- !u!114 &613136922 |
3781 | 3782 | MonoBehaviour: |
... | ... | @@ -5083,8 +5084,8 @@ RectTransform: |
5083 | 5084 | m_Children: [] |
5084 | 5085 | m_Father: {fileID: 1585560343} |
5085 | 5086 | m_RootOrder: 0 |
5086 | - m_AnchorMin: {x: 0, y: 0.15} | |
5087 | - m_AnchorMax: {x: 0, y: 0.85} | |
5087 | + m_AnchorMin: {x: -0.04, y: 0.15} | |
5088 | + m_AnchorMax: {x: -0.04, y: 0.85} | |
5088 | 5089 | m_AnchoredPosition: {x: 0, y: 0} |
5089 | 5090 | m_SizeDelta: {x: 100, y: 0} |
5090 | 5091 | m_Pivot: {x: 1, y: 0.5} |
... | ... | @@ -5155,7 +5156,7 @@ Prefab: |
5155 | 5156 | objectReference: {fileID: 0} |
5156 | 5157 | - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} |
5157 | 5158 | propertyPath: m_LocalPosition.z |
5158 | - value: 3.7 | |
5159 | + value: 4 | |
5159 | 5160 | objectReference: {fileID: 0} |
5160 | 5161 | - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} |
5161 | 5162 | propertyPath: m_LocalRotation.x |
... | ... | @@ -5755,7 +5756,7 @@ GameObject: |
5755 | 5756 | m_Icon: {fileID: 0} |
5756 | 5757 | m_NavMeshLayer: 0 |
5757 | 5758 | m_StaticEditorFlags: 0 |
5758 | - m_IsActive: 0 | |
5759 | + m_IsActive: 1 | |
5759 | 5760 | --- !u!224 &970584909 |
5760 | 5761 | RectTransform: |
5761 | 5762 | m_ObjectHideFlags: 0 |
... | ... | @@ -6629,6 +6630,80 @@ CanvasRenderer: |
6629 | 6630 | m_PrefabParentObject: {fileID: 0} |
6630 | 6631 | m_PrefabInternal: {fileID: 0} |
6631 | 6632 | m_GameObject: {fileID: 1069760790} |
6633 | +--- !u!1 &1071047503 | |
6634 | +GameObject: | |
6635 | + m_ObjectHideFlags: 0 | |
6636 | + m_PrefabParentObject: {fileID: 0} | |
6637 | + m_PrefabInternal: {fileID: 0} | |
6638 | + serializedVersion: 4 | |
6639 | + m_Component: | |
6640 | + - 224: {fileID: 1071047504} | |
6641 | + - 222: {fileID: 1071047506} | |
6642 | + - 114: {fileID: 1071047505} | |
6643 | + m_Layer: 5 | |
6644 | + m_Name: version | |
6645 | + m_TagString: Untagged | |
6646 | + m_Icon: {fileID: 0} | |
6647 | + m_NavMeshLayer: 0 | |
6648 | + m_StaticEditorFlags: 0 | |
6649 | + m_IsActive: 1 | |
6650 | +--- !u!224 &1071047504 | |
6651 | +RectTransform: | |
6652 | + m_ObjectHideFlags: 0 | |
6653 | + m_PrefabParentObject: {fileID: 0} | |
6654 | + m_PrefabInternal: {fileID: 0} | |
6655 | + m_GameObject: {fileID: 1071047503} | |
6656 | + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | |
6657 | + m_LocalPosition: {x: 0, y: 0, z: 0} | |
6658 | + m_LocalScale: {x: 1, y: 1, z: 1} | |
6659 | + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | |
6660 | + m_Children: [] | |
6661 | + m_Father: {fileID: 263018772} | |
6662 | + m_RootOrder: 2 | |
6663 | + m_AnchorMin: {x: 0, y: 0.586} | |
6664 | + m_AnchorMax: {x: 1, y: 0.618} | |
6665 | + m_AnchoredPosition: {x: 0, y: 0} | |
6666 | + m_SizeDelta: {x: 0, y: 0} | |
6667 | + m_Pivot: {x: 0.5, y: 0.5} | |
6668 | +--- !u!114 &1071047505 | |
6669 | +MonoBehaviour: | |
6670 | + m_ObjectHideFlags: 0 | |
6671 | + m_PrefabParentObject: {fileID: 0} | |
6672 | + m_PrefabInternal: {fileID: 0} | |
6673 | + m_GameObject: {fileID: 1071047503} | |
6674 | + m_Enabled: 1 | |
6675 | + m_EditorHideFlags: 0 | |
6676 | + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} | |
6677 | + m_Name: | |
6678 | + m_EditorClassIdentifier: | |
6679 | + m_Material: {fileID: 0} | |
6680 | + m_Color: {r: 0, g: 0, b: 0, a: 0.78431374} | |
6681 | + m_RaycastTarget: 1 | |
6682 | + m_OnCullStateChanged: | |
6683 | + m_PersistentCalls: | |
6684 | + m_Calls: [] | |
6685 | + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, | |
6686 | + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | |
6687 | + m_FontData: | |
6688 | + m_Font: {fileID: 12800000, guid: 1d71629ab414fbe4a9015401607e12a6, type: 3} | |
6689 | + m_FontSize: 14 | |
6690 | + m_FontStyle: 0 | |
6691 | + m_BestFit: 1 | |
6692 | + m_MinSize: 10 | |
6693 | + m_MaxSize: 40 | |
6694 | + m_Alignment: 1 | |
6695 | + m_AlignByGeometry: 0 | |
6696 | + m_RichText: 1 | |
6697 | + m_HorizontalOverflow: 0 | |
6698 | + m_VerticalOverflow: 0 | |
6699 | + m_LineSpacing: 1 | |
6700 | + m_Text: Version 3.0.34 | |
6701 | +--- !u!222 &1071047506 | |
6702 | +CanvasRenderer: | |
6703 | + m_ObjectHideFlags: 0 | |
6704 | + m_PrefabParentObject: {fileID: 0} | |
6705 | + m_PrefabInternal: {fileID: 0} | |
6706 | + m_GameObject: {fileID: 1071047503} | |
6632 | 6707 | --- !u!1 &1097871559 |
6633 | 6708 | GameObject: |
6634 | 6709 | m_ObjectHideFlags: 0 |
... | ... | @@ -10850,7 +10925,7 @@ RectTransform: |
10850 | 10925 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
10851 | 10926 | m_Children: [] |
10852 | 10927 | m_Father: {fileID: 263018772} |
10853 | - m_RootOrder: 2 | |
10928 | + m_RootOrder: 3 | |
10854 | 10929 | m_AnchorMin: {x: 0.06, y: 0.46} |
10855 | 10930 | m_AnchorMax: {x: 0.94, y: 0.58} |
10856 | 10931 | m_AnchoredPosition: {x: 0, y: 0} |
... | ... | @@ -11031,8 +11106,8 @@ RectTransform: |
11031 | 11106 | m_Children: [] |
11032 | 11107 | m_Father: {fileID: 1585560343} |
11033 | 11108 | m_RootOrder: 4 |
11034 | - m_AnchorMin: {x: 1, y: 0.15} | |
11035 | - m_AnchorMax: {x: 1, y: 0.85} | |
11109 | + m_AnchorMin: {x: 1.04, y: 0.15} | |
11110 | + m_AnchorMax: {x: 1.04, y: 0.85} | |
11036 | 11111 | m_AnchoredPosition: {x: 0, y: 0} |
11037 | 11112 | m_SizeDelta: {x: 100, y: 0} |
11038 | 11113 | m_Pivot: {x: 0, y: 0.5} |
... | ... | @@ -11275,7 +11350,7 @@ RectTransform: |
11275 | 11350 | m_AnchorMin: {x: 0.5, y: 0.5} |
11276 | 11351 | m_AnchorMax: {x: 0.9, y: 1} |
11277 | 11352 | m_AnchoredPosition: {x: 0, y: 0} |
11278 | - m_SizeDelta: {x: 0, y: -32.424988} | |
11353 | + m_SizeDelta: {x: 0, y: -92} | |
11279 | 11354 | m_Pivot: {x: 0.5, y: 1} |
11280 | 11355 | --- !u!114 &1763761725 |
11281 | 11356 | MonoBehaviour: |
... | ... | @@ -11889,7 +11964,7 @@ RectTransform: |
11889 | 11964 | - {fileID: 948041468} |
11890 | 11965 | - {fileID: 670462553} |
11891 | 11966 | m_Father: {fileID: 263018772} |
11892 | - m_RootOrder: 3 | |
11967 | + m_RootOrder: 4 | |
11893 | 11968 | m_AnchorMin: {x: 0, y: 0.1} |
11894 | 11969 | m_AnchorMax: {x: 1, y: 0.4} |
11895 | 11970 | m_AnchoredPosition: {x: 0, y: 0} | ... | ... |
Assets/Scripts/Player Manager/GenericPlayerManager.cs
... | ... | @@ -19,6 +19,9 @@ |
19 | 19 | * Quando não há acesso aos bundles dos sinais de pontuação, eles são ignorados. |
20 | 20 | * Ç adicionado como TYPE_WORD. |
21 | 21 | * |
22 | + * Versão 2.5 | |
23 | + * - Espera de requisição http com timeout. | |
24 | + * | |
22 | 25 | * Log directory: http://docs.unity3d.com/Manual/LogFiles.html |
23 | 26 | */ |
24 | 27 | |
... | ... | @@ -58,7 +61,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
58 | 61 | // Sinais ignorados na apresentação de legenda |
59 | 62 | private HashSet<string> flags = new HashSet<string>(); |
60 | 63 | |
61 | - // True quando está na função LoadAndPlay | |
64 | + // True quando está na função Loader | |
62 | 65 | private volatile bool loading = false; |
63 | 66 | // True quando está reproduzindo qualquer animação |
64 | 67 | private volatile bool playing = false; |
... | ... | @@ -174,8 +177,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
174 | 177 | /* Para carregamento e animações */ |
175 | 178 | public void stopAll() |
176 | 179 | { |
177 | - StopCoroutine("loadAndPlay"); | |
178 | - this.randomAnimations.unlockFor("loadAndPlay"); | |
180 | + StopCoroutine("Loader"); | |
181 | + this.randomAnimations.unlockFor("Loader"); | |
179 | 182 | loading = false; |
180 | 183 | |
181 | 184 | stopAnimations(); |
... | ... | @@ -184,8 +187,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
184 | 187 | /* Para animações */ |
185 | 188 | public void stopAnimations() |
186 | 189 | { |
187 | - StopCoroutine("handleStates"); | |
188 | - this.randomAnimations.unlockFor("handleStates"); | |
190 | + StopCoroutine("AnimationsHandler"); | |
191 | + this.randomAnimations.unlockFor("AnimationsHandler"); | |
189 | 192 | this.subtitles.setText(""); |
190 | 193 | |
191 | 194 | lock (this.animQueue) { this.animQueue.Clear(); } |
... | ... | @@ -301,54 +304,32 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
301 | 304 | setPauseState( ! this.paused); |
302 | 305 | } |
303 | 306 | |
304 | - private System.Object LOCKER_PLAY = new System.Object(); | |
305 | - | |
306 | 307 | /* Play if anything loading or playing */ |
307 | 308 | public bool playIfEmpty(string gloss) |
308 | 309 | { |
309 | - lock (LOCKER_PLAY) | |
310 | - { | |
311 | - if (this.loading || this.playing) | |
312 | - return false; | |
313 | - | |
314 | - StartCoroutine("loadAndPlay", gloss); | |
315 | - } | |
310 | + if (this.loading || this.playing) | |
311 | + return false; | |
316 | 312 | |
313 | + StartCoroutine("Loader", gloss); | |
317 | 314 | return true; |
318 | 315 | } |
319 | 316 | |
320 | - /* Enqueue animations for playing */ | |
321 | - public void playQueued(string gloss) | |
322 | - { | |
323 | - lock (LOCKER_PLAY) | |
324 | - { | |
325 | - StartCoroutine("loadAndPlay", gloss); | |
326 | - } | |
327 | - } | |
328 | - | |
329 | 317 | /* Stop all and play */ |
330 | 318 | public void playNow(string gloss) |
331 | 319 | { |
332 | - lock (LOCKER_PLAY) | |
333 | - { | |
334 | - stopAll(); | |
335 | - StartCoroutine("loadAndPlay", gloss); | |
336 | - } | |
320 | + stopAll(); | |
321 | + StartCoroutine("Loader", gloss); | |
337 | 322 | } |
338 | 323 | |
339 | 324 | /* Reproduz animação de intervalo */ |
340 | 325 | public bool playIntervalAnimation(string name) |
341 | 326 | { |
342 | - if ( ! Monitor.TryEnter(LOCKER_PLAY)) | |
327 | + if (this.loading || this.playing) | |
343 | 328 | return false; |
344 | - | |
345 | - lock (LOCKER_PLAY) | |
346 | - { | |
347 | - playDefaultAnimation(true); | |
348 | - this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); | |
349 | - playDefaultAnimation(false); | |
350 | - } | |
351 | - | |
329 | + | |
330 | + playDefaultAnimation(true); | |
331 | + this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); | |
332 | + playDefaultAnimation(false); | |
352 | 333 | return true; |
353 | 334 | } |
354 | 335 | |
... | ... | @@ -477,253 +458,238 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
477 | 458 | } |
478 | 459 | } |
479 | 460 | |
480 | - private System.Object LOCKER_LOADING = new System.Object(); | |
481 | - | |
482 | - public void clearLoadedBundles() | |
483 | - { | |
484 | - this.loadedAssetBundles.Clear(); | |
461 | + public void clearLoadedBundles() { | |
462 | + this.loadedAssetBundles.Clear(); | |
485 | 463 | } |
486 | 464 | |
487 | 465 | /* Carrega animações e reproduz */ |
488 | - private IEnumerator loadAndPlay(string gloss) | |
466 | + private IEnumerator Loader(string gloss) | |
489 | 467 | { |
490 | - lock (LOCKER_LOADING) | |
491 | - { | |
492 | - this.randomAnimations.lockFor("loadAndPlay"); | |
493 | - this.loading = true; | |
494 | - // onPlayingStateChange(); | |
468 | + this.loading = true; | |
469 | + this.randomAnimations.lockFor("Loader"); | |
470 | + // onPlayingStateChange(); | |
495 | 471 | |
496 | - string lastAnimationSubtitle = ""; | |
497 | - bool spelled = false; | |
472 | + string lastAnimationSubtitle = ""; | |
473 | + bool spelled = false; | |
498 | 474 | |
499 | - if ( ! this.playing) | |
500 | - StartCoroutine("handleStates"); | |
475 | + if ( ! this.playing) | |
476 | + StartCoroutine("AnimationsHandler"); | |
501 | 477 | |
502 | - String[] stringPos = gloss.Split(' '); | |
478 | + String[] stringPos = gloss.Split(' '); | |
503 | 479 | |
504 | - Queue<ToPlay> toPlayQueue = new Queue<ToPlay>(); | |
505 | - int wordsCount = 0; | |
506 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); | |
480 | + Queue<ToPlay> toPlayQueue = new Queue<ToPlay>(); | |
481 | + int wordsCount = 0; | |
482 | + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); | |
507 | 483 | |
508 | - /*WWW checkConnectionRequest = getCheckConnectionRequest(); | |
509 | - bool connected = false; | |
484 | + /*WWW checkConnectionRequest = getCheckConnectionRequest(); | |
485 | + bool connected = false; | |
510 | 486 | |
511 | - while ( ! checkConnectionRequest.isDone) | |
512 | - yield return checkConnectionRequest; | |
487 | + while ( ! checkConnectionRequest.isDone) | |
488 | + yield return checkConnectionRequest; | |
513 | 489 | |
514 | - if (checkConnectionRequest.responseHeaders.Count > 0) | |
515 | - { | |
516 | - PlayerLogger.Log(checkConnectionRequest.responseHeaders["STATUS"]); | |
517 | - connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404"); | |
518 | - } | |
519 | - else PlayerLogger.Log("No response headers.");*/ | |
490 | + if (checkConnectionRequest.responseHeaders.Count > 0) | |
491 | + { | |
492 | + PlayerLogger.Log(checkConnectionRequest.responseHeaders["STATUS"]); | |
493 | + connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404"); | |
494 | + } | |
495 | + else PlayerLogger.Log("No response headers.");*/ | |
520 | 496 | |
521 | - bool connected = true; | |
522 | - bool playingStarted = false; | |
497 | + bool connected = true; | |
498 | + bool playingStarted = false; | |
523 | 499 | |
524 | - foreach (string aniName in stringPos) | |
525 | - { | |
526 | - wordsCount++; | |
527 | - if (String.IsNullOrEmpty(aniName)) continue; | |
500 | + foreach (string aniName in stringPos) | |
501 | + { | |
502 | + wordsCount++; | |
503 | + if (String.IsNullOrEmpty(aniName)) continue; | |
528 | 504 | |
529 | - bool nonexistent = nonexistentAssetBundles.Contains(aniName); | |
530 | - bool loaded = loadedAssetBundles.Contains(aniName); | |
505 | + bool nonexistent = nonexistentAssetBundles.Contains(aniName); | |
506 | + bool loaded = loadedAssetBundles.Contains(aniName); | |
531 | 507 | |
532 | - if ( ! nonexistent && ! loaded && connected) | |
533 | - { | |
534 | - WWW bundleRequest = loadAssetBundle(aniName); | |
535 | - yield return WaitForResponse(bundleRequest); | |
508 | + if ( ! nonexistent && ! loaded && connected) | |
509 | + { | |
510 | + WWW bundleRequest = loadAssetBundle(aniName); | |
511 | + yield return WaitForResponse(bundleRequest); | |
536 | 512 | |
537 | - PlayerLogger.Log("GPM", "lAP", "Bundle request done (" + aniName + ")."); | |
513 | + PlayerLogger.Log("GPM", "L", "Bundle request done (" + aniName + ")."); | |
538 | 514 | |
539 | - if (bundleRequest.isDone && bundleRequest.error == null) | |
515 | + if (bundleRequest.isDone && bundleRequest.error == null) | |
516 | + { | |
517 | + AssetBundle bundle = bundleRequest.assetBundle; | |
518 | + | |
519 | + if (bundle != null && !String.IsNullOrEmpty(bundle.mainAsset.name)) | |
540 | 520 | { |
541 | - AssetBundle bundle = bundleRequest.assetBundle; | |
521 | + AnimationClip aniClip = bundle.mainAsset as AnimationClip; | |
522 | + bundle.Unload(false); | |
542 | 523 | |
543 | - if (bundle != null && !String.IsNullOrEmpty(bundle.mainAsset.name)) | |
524 | + if (aniClip) | |
544 | 525 | { |
545 | - AnimationClip aniClip = bundle.mainAsset as AnimationClip; | |
546 | - bundle.Unload(false); | |
547 | - | |
548 | - if (aniClip) | |
549 | - { | |
550 | - COMPONENT_ANIMATION.AddClip(aniClip, aniName); | |
551 | - if (playingStarted) yield return new WaitForEndOfFrame(); | |
526 | + COMPONENT_ANIMATION.AddClip(aniClip, aniName); | |
527 | + if (playingStarted) yield return new WaitForEndOfFrame(); | |
552 | 528 | |
553 | - loadedAssetBundles.Add(aniName); | |
554 | - loaded = true; | |
529 | + loadedAssetBundles.Add(aniName); | |
530 | + loaded = true; | |
555 | 531 | |
556 | - PlayerLogger.Log("GPM", "lAP", "Bundle \"" + aniName + "\" loaded!"); | |
557 | - } | |
558 | - else PlayerLogger.Log("GPM", "lAP", "Sign \"" + aniName + "\" wasn't loaded successfuly."); | |
532 | + PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" loaded!"); | |
559 | 533 | } |
560 | - else PlayerLogger.Log("GPM", "lAP", "Bundle \"" + aniName + "\" wasn't loaded successfuly."); | |
561 | - | |
562 | - if ( ! loaded) nonexistentAssetBundles.Add(aniName); | |
534 | + else PlayerLogger.Log("GPM", "L", "Sign \"" + aniName + "\" wasn't loaded successfuly."); | |
563 | 535 | } |
564 | - else | |
565 | - { | |
566 | - PlayerLogger.Log("GPM", "lAP", "Connection error."); | |
567 | - onConnectionError(gloss, aniName); | |
568 | - } | |
569 | - } | |
536 | + else PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" wasn't loaded successfuly."); | |
570 | 537 | |
571 | - // Reproduz palavra | |
572 | - if (loaded) | |
573 | - { | |
574 | - if (spelled) | |
575 | - { | |
576 | - // Default | |
577 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this)); | |
578 | - spelled = false; | |
579 | - } | |
538 | + if ( ! loaded) nonexistentAssetBundles.Add(aniName); | |
539 | + } | |
540 | + else | |
541 | + { | |
542 | + PlayerLogger.Log("GPM", "L", "Connection error."); | |
543 | + onConnectionError(gloss, aniName); | |
544 | + } | |
545 | + } | |
580 | 546 | |
581 | - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) | |
582 | - { | |
583 | - lastAnimationSubtitle = ""; | |
584 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this)); | |
585 | - } | |
586 | - else | |
587 | - { | |
588 | - lastAnimationSubtitle = aniName; | |
589 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this)); | |
590 | - } | |
547 | + // Reproduz palavra | |
548 | + if (loaded) | |
549 | + { | |
550 | + if (spelled) | |
551 | + { | |
552 | + // Default | |
553 | + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this)); | |
554 | + spelled = false; | |
591 | 555 | } |
592 | 556 | |
593 | - // Soletra palavra | |
557 | + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) | |
558 | + { | |
559 | + lastAnimationSubtitle = ""; | |
560 | + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this)); | |
561 | + } | |
594 | 562 | else |
595 | 563 | { |
596 | - PlayerLogger.Log("GPM", "lAP", "To spell: " + aniName); | |
564 | + lastAnimationSubtitle = aniName; | |
565 | + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this)); | |
566 | + } | |
567 | + } | |
597 | 568 | |
598 | - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) | |
599 | - { | |
569 | + // Soletra palavra | |
570 | + else | |
571 | + { | |
572 | + PlayerLogger.Log("GPM", "L", "To spell: " + aniName); | |
573 | + | |
574 | + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) | |
575 | + { | |
576 | + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); | |
577 | + spelled = false; | |
578 | + } | |
579 | + else | |
580 | + { | |
581 | + // Se já houve o soletramento de alguma palavra, reproduz animação default | |
582 | + if (spelled) | |
600 | 583 | toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); |
601 | - spelled = false; | |
602 | - } | |
603 | 584 | else |
604 | - { | |
605 | - // Se já houve o soletramento de alguma palavra, reproduz animação default | |
606 | - if (spelled) | |
607 | - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); | |
608 | - else | |
609 | - spelled = true; | |
585 | + spelled = true; | |
610 | 586 | |
611 | - lastAnimationSubtitle = spellWord(toPlayQueue, aniName); | |
612 | - } | |
587 | + lastAnimationSubtitle = spellWord(toPlayQueue, aniName); | |
613 | 588 | } |
589 | + } | |
614 | 590 | |
615 | - if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) { | |
616 | - playingStarted = true; | |
591 | + if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) { | |
592 | + playingStarted = true; | |
617 | 593 | |
618 | - while (toPlayQueue.Count > 0) | |
619 | - { | |
620 | - toPlayQueue.Dequeue().play(this); | |
621 | - yield return new WaitForEndOfFrame(); | |
622 | - } | |
594 | + while (toPlayQueue.Count > 0) | |
595 | + { | |
596 | + toPlayQueue.Dequeue().play(this); | |
597 | + yield return new WaitForEndOfFrame(); | |
623 | 598 | } |
624 | - | |
625 | - if (playingStarted) yield return new WaitForEndOfFrame(); | |
626 | 599 | } |
627 | 600 | |
628 | - // Default | |
629 | - playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, ""); | |
601 | + if (playingStarted) yield return new WaitForEndOfFrame(); | |
602 | + } | |
630 | 603 | |
631 | - this.loading = false; | |
632 | - // onPlayingStateChange(); | |
633 | - this.randomAnimations.unlockFor("loadAndPlay"); | |
634 | - } | |
635 | - } | |
604 | + // Default | |
605 | + playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, ""); | |
636 | 606 | |
637 | - private System.Object LOCKER_PLAYING = new System.Object(); | |
607 | + // onPlayingStateChange(); | |
608 | + this.randomAnimations.unlockFor("Loader"); | |
609 | + this.loading = false; | |
610 | + } | |
638 | 611 | |
639 | 612 | /* Sincroniza as legendas com as animações. */ |
640 | - IEnumerator handleStates() | |
613 | + IEnumerator AnimationsHandler() | |
641 | 614 | { |
642 | - lock (LOCKER_PLAYING) | |
643 | - { | |
644 | - this.randomAnimations.lockFor("handleStates"); | |
645 | - this.playing = true; | |
646 | - onPlayingStateChange(); | |
615 | + this.playing = true; | |
616 | + this.randomAnimations.lockFor("AnimationsHandler"); | |
617 | + onPlayingStateChange(); | |
647 | 618 | |
648 | - bool isNotEmpty; | |
649 | - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } | |
619 | + bool isNotEmpty = this.animQueue.Count > 0; | |
650 | 620 | |
651 | - // Animação anterior a atual | |
652 | - AnimationReference endedAnimation = null; | |
621 | + // Animação anterior a atual | |
622 | + AnimationReference endedAnimation = null; | |
653 | 623 | |
654 | - // Enquanto estiver executando a corotina "loadAndPlay" | |
655 | - // ou existir animações na fila de reprodução | |
656 | - while (loading || isNotEmpty) | |
624 | + // Enquanto estiver executando a corotina "Loader" | |
625 | + // ou existir animações na fila de reprodução | |
626 | + while (loading || isNotEmpty) | |
627 | + { | |
628 | + // Se não houver animações na fila, espera | |
629 | + if (isNotEmpty) | |
657 | 630 | { |
658 | - // Se não houver animações na fila, espera | |
659 | - if (isNotEmpty) | |
631 | + // Pega primeira animação | |
632 | + AnimationReference reference; | |
633 | + lock (this.animQueue) { reference = this.animQueue.Peek(); } | |
634 | + | |
635 | + // Se estiver sendo reproduzida | |
636 | + if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | |
660 | 637 | { |
661 | - // Pega primeira animação | |
662 | - AnimationReference reference; | |
663 | - lock (this.animQueue) { reference = this.animQueue.Peek(); } | |
638 | + this.subtitles.setText(reference.subtitle); | |
664 | 639 | |
665 | - // Se estiver sendo reproduzida | |
666 | - if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | |
640 | + // Animação seguinte | |
641 | + AnimationReference next = null; | |
642 | + lock (this.animQueue) | |
667 | 643 | { |
668 | - this.subtitles.setText(reference.subtitle); | |
644 | + this.animationPlaying = this.animQueue.Dequeue(); | |
669 | 645 | |
670 | - // Animação seguinte | |
671 | - AnimationReference next = null; | |
672 | - lock (this.animQueue) | |
673 | - { | |
674 | - this.animationPlaying = this.animQueue.Dequeue(); | |
675 | - | |
676 | - if (this.animQueue.Count > 0) | |
677 | - next = this.animQueue.Peek(); | |
678 | - } | |
646 | + if (this.animQueue.Count > 0) | |
647 | + next = this.animQueue.Peek(); | |
648 | + } | |
679 | 649 | |
680 | - while (true) | |
650 | + while (true) | |
651 | + { | |
652 | + // Se a próxima animação estiver sendo reproduzida (no fade) | |
653 | + if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) | |
681 | 654 | { |
682 | - // Se a próxima animação estiver sendo reproduzida (no fade) | |
683 | - if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) | |
684 | - { | |
685 | - // Se a animação anterior a atual não tiver acabado, | |
686 | - // espera acabar e só então conta o tempo | |
687 | - if (endedAnimation != null) | |
688 | - while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) | |
689 | - yield return null; | |
690 | - | |
691 | - // Tempo para pular para a legenda da próxima animação | |
692 | - yield return new WaitForSeconds(0.4F); | |
693 | - | |
694 | - // Deprecated | |
695 | - // yield return WaitForContinuousMillis.Wait(this, 300); | |
696 | - | |
697 | - endedAnimation = reference; | |
698 | - break; | |
699 | - } | |
700 | - | |
701 | - else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | |
702 | - yield return null; | |
703 | - | |
704 | - else break; | |
655 | + // Se a animação anterior a atual não tiver acabado, | |
656 | + // espera acabar e só então conta o tempo | |
657 | + if (endedAnimation != null) | |
658 | + while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) | |
659 | + yield return null; | |
660 | + | |
661 | + // Tempo para pular para a legenda da próxima animação | |
662 | + yield return new WaitForSeconds(0.4F); | |
663 | + | |
664 | + endedAnimation = reference; | |
665 | + break; | |
705 | 666 | } |
706 | 667 | |
707 | - reference = null; | |
668 | + else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) | |
669 | + yield return null; | |
670 | + | |
671 | + else break; | |
708 | 672 | } |
709 | 673 | |
710 | - // Se a animação não tiver sido liberada e seu AnimationState for nulo, | |
711 | - // a animação será liberada | |
712 | - if (reference != null && reference.state == null) | |
713 | - lock (this.animQueue) { this.animQueue.Dequeue(); } | |
714 | - else | |
715 | - yield return null; | |
674 | + reference = null; | |
716 | 675 | } |
717 | - else yield return null; | |
718 | 676 | |
719 | - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } | |
677 | + // Se a animação não tiver sido liberada e seu AnimationState for nulo, | |
678 | + // a animação será liberada | |
679 | + if (reference != null && reference.state == null) | |
680 | + this.animQueue.Dequeue(); | |
681 | + else | |
682 | + yield return null; | |
720 | 683 | } |
684 | + else yield return null; | |
721 | 685 | |
722 | - this.subtitles.setText(""); | |
723 | - | |
724 | - resetStates(); | |
725 | - this.randomAnimations.unlockFor("handleStates"); | |
686 | + isNotEmpty = this.animQueue.Count > 0; | |
726 | 687 | } |
688 | + | |
689 | + this.subtitles.setText(""); | |
690 | + | |
691 | + resetStates(); | |
692 | + this.randomAnimations.unlockFor("AnimationsHandler"); | |
727 | 693 | } |
728 | 694 | |
729 | 695 | public void resetStates() | ... | ... |
Assets/Scripts/PlayerManager.cs
... | ... | @@ -120,8 +120,10 @@ public class PlayerManager : GenericPlayerManager { |
120 | 120 | |
121 | 121 | protected override WWW loadAssetBundle(string aniName) |
122 | 122 | { |
123 | - PlayerLogger.Log("PM", "lAB", "Requesting bundle: " + BASE_URL + regionPath + aniName); | |
124 | - return WWW.LoadFromCacheOrDownload(BASE_URL + regionPath + aniName, this.regionHash); | |
123 | + string address = BASE_URL + regionPath + WWW.EscapeURL(aniName); | |
124 | + | |
125 | + PlayerLogger.Log("PM", "lAB", "Requesting bundle: " + address); | |
126 | + return WWW.LoadFromCacheOrDownload(address, this.regionHash); | |
125 | 127 | } |
126 | 128 | |
127 | 129 | private System.Object LOCKER_STATE = new System.Object(); |
... | ... | @@ -137,9 +139,11 @@ public class PlayerManager : GenericPlayerManager { |
137 | 139 | { |
138 | 140 | if (gloss.Equals(this.dictWord)) |
139 | 141 | { |
140 | - base.stopAll(); | |
142 | + this.dictWord = ""; | |
141 | 143 | this.screenManager.showConnectionErrorDialog( |
142 | 144 | PlayerManager.ERROR_STATUS_MESSAGE.INTERNET_CONNECTION_FAILURE); |
145 | + | |
146 | + base.stopAll(); | |
143 | 147 | } |
144 | 148 | } |
145 | 149 | |
... | ... | @@ -224,8 +228,8 @@ public class PlayerManager : GenericPlayerManager { |
224 | 228 | timer += Time.deltaTime; |
225 | 229 | yield return null; |
226 | 230 | #elif UNITY_IOS |
227 | - timer += 0.1f; | |
228 | - yield return new WaitForSeconds(0.1f); | |
231 | + timer += 0.1f; | |
232 | + yield return new WaitForSeconds(0.1f); | |
229 | 233 | #endif |
230 | 234 | } |
231 | 235 | ... | ... |
Assets/Scripts/UI/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/Scripts/UI/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/Scripts/UI/Resizers/BarResizer.cs
... | ... | @@ -12,25 +12,25 @@ public class BarResizer : MonoBehaviour { |
12 | 12 | #if UNITY_IOS |
13 | 13 | this.microButton.SetActive(false); |
14 | 14 | |
15 | - if (Screen.dpi < 140) | |
16 | - this.barBottomLayout.spacing = 42; | |
15 | + if (Screen.width < 400) | |
16 | + this.barBottomLayout.spacing = 8; | |
17 | 17 | |
18 | 18 | // 240 |
19 | - else if (Screen.dpi < 280) | |
20 | - this.barBottomLayout.spacing = 72; | |
19 | + else if (Screen.width < 500) | |
20 | + this.barBottomLayout.spacing = 116; | |
21 | 21 | |
22 | 22 | // 320 |
23 | - else if (Screen.dpi < 400) | |
24 | - this.barBottomLayout.spacing = 108; | |
23 | + else if (Screen.width < 620) | |
24 | + this.barBottomLayout.spacing = 142; | |
25 | 25 | |
26 | 26 | // 480 |
27 | - else if (Screen.dpi < 500) | |
28 | - this.barBottomLayout.spacing = 158; | |
27 | + else if (Screen.width < 840) | |
28 | + this.barBottomLayout.spacing = 190; | |
29 | 29 | |
30 | 30 | else |
31 | - this.barBottomLayout.spacing = 108; | |
31 | + this.barBottomLayout.spacing = 210; | |
32 | 32 | #else |
33 | - if (Screen.dpi < 140) | |
33 | + if (Screen.dpi < 140) | |
34 | 34 | this.barBottomLayout.spacing = 48; |
35 | 35 | |
36 | 36 | // 240 | ... | ... |
... | ... | @@ -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 | +} | ... | ... |
... | ... | @@ -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: | ... | ... |
Assets/Scripts/UI/SlidingHidder.cs
... | ... | @@ -12,7 +12,7 @@ namespace LAViD.VLibras.UI { |
12 | 12 | public float speed = 1f; |
13 | 13 | public bool disableWhenHidden = true; |
14 | 14 | |
15 | - private Transform transform; | |
15 | + private Transform thisTransform; | |
16 | 16 | private Vector2 hiddenPosition; |
17 | 17 | private Vector2 visiblePosition; |
18 | 18 | |
... | ... | @@ -27,23 +27,23 @@ namespace LAViD.VLibras.UI { |
27 | 27 | |
28 | 28 | void Start() |
29 | 29 | { |
30 | - this.transform = this.gameObject.transform; | |
30 | + this.thisTransform = this.gameObject.transform; | |
31 | 31 | this.speed = Screen.width * this.speed; |
32 | 32 | Rect obj = this.gameObject.GetComponent<RectTransform>().rect; |
33 | 33 | |
34 | - this.visiblePosition = transform.position; | |
35 | - this.hiddenPosition = transform.position; | |
34 | + this.visiblePosition = thisTransform.position; | |
35 | + this.hiddenPosition = thisTransform.position; | |
36 | 36 | |
37 | 37 | if (this.slideOnX) this.hiddenPosition.x += toLeft ? -obj.width : obj.width; |
38 | 38 | //if (this.slideOnY) this.hiddenPosition.y += toTop ? -obj.height: obj.height; |
39 | 39 | |
40 | - this.transform.position = base.isVisible() ? this.visiblePosition : this.hiddenPosition; | |
40 | + this.thisTransform.position = base.isVisible() ? this.visiblePosition : this.hiddenPosition; | |
41 | 41 | this.gameObject.SetActive(base.isVisible()); |
42 | 42 | } |
43 | 43 | |
44 | 44 | void Update() |
45 | 45 | { |
46 | - Vector2 position = transform.position; | |
46 | + Vector2 position = thisTransform.position; | |
47 | 47 | Vector2 objective = base.isVisible() ? this.visiblePosition : this.hiddenPosition; |
48 | 48 | bool changed = true; |
49 | 49 | |
... | ... | @@ -62,7 +62,7 @@ namespace LAViD.VLibras.UI { |
62 | 62 | |
63 | 63 | if (changed) |
64 | 64 | { |
65 | - this.transform.position = position; | |
65 | + this.thisTransform.position = position; | |
66 | 66 | this.gameObject.SetActive( ! this.disableWhenHidden |
67 | 67 | || (position.x != this.hiddenPosition.x /*|| position.y != hiddenPosition.y*/) |
68 | 68 | ); | ... | ... |