From 39372c3aa2e11b4f24e3049b1b4bffa29cf0943e Mon Sep 17 00:00:00 2001 From: Mateus Pires Date: Mon, 10 Oct 2016 09:27:34 -0300 Subject: [PATCH] Fix iOS resizer; URL encode; Fix connection error message; Fix avatar z --- Assets/Scenes/Main.unity | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------- Assets/Scripts/Player Manager/GenericPlayerManager.cs | 406 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Assets/Scripts/PlayerManager.cs | 14 +++++++++----- Assets/Scripts/UI/InputResizer.cs | 39 --------------------------------------- Assets/Scripts/UI/InputResizer.cs.meta | 12 ------------ Assets/Scripts/UI/Resizers/BarResizer.cs | 20 ++++++++++---------- Assets/Scripts/UI/Resizers/InputResizer.cs | 39 +++++++++++++++++++++++++++++++++++++++ Assets/Scripts/UI/Resizers/InputResizer.cs.meta | 12 ++++++++++++ Assets/Scripts/UI/SlidingHidder.cs | 14 +++++++------- 9 files changed, 349 insertions(+), 304 deletions(-) delete mode 100644 Assets/Scripts/UI/InputResizer.cs delete mode 100644 Assets/Scripts/UI/InputResizer.cs.meta create mode 100644 Assets/Scripts/UI/Resizers/InputResizer.cs create mode 100644 Assets/Scripts/UI/Resizers/InputResizer.cs.meta diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 4ea7e4a..dc3fd70 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -1236,6 +1236,7 @@ RectTransform: m_Children: - {fileID: 1476138800} - {fileID: 1173561061} + - {fileID: 1071047504} - {fileID: 1632068377} - {fileID: 1874017187} m_Father: {fileID: 202190019} @@ -3178,7 +3179,7 @@ BoxCollider: m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 6.828157, y: 7.3689804, z: 1} + m_Size: {x: 6.828157, y: 7.3689804, z: 6} m_Center: {x: -0.04474616, y: 3.5875206, z: -0.00000001458015} --- !u!1 &554210566 GameObject: @@ -3775,7 +3776,7 @@ RectTransform: m_AnchorMin: {x: 0.1, y: 0.5} m_AnchorMax: {x: 0.5, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: -32.424988} + m_SizeDelta: {x: 0, y: -92} m_Pivot: {x: 0.5, y: 1} --- !u!114 &613136922 MonoBehaviour: @@ -5083,8 +5084,8 @@ RectTransform: m_Children: [] m_Father: {fileID: 1585560343} m_RootOrder: 0 - m_AnchorMin: {x: 0, y: 0.15} - m_AnchorMax: {x: 0, y: 0.85} + m_AnchorMin: {x: -0.04, y: 0.15} + m_AnchorMax: {x: -0.04, y: 0.85} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 0} m_Pivot: {x: 1, y: 0.5} @@ -5155,7 +5156,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} propertyPath: m_LocalPosition.z - value: 3.7 + value: 4 objectReference: {fileID: 0} - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} propertyPath: m_LocalRotation.x @@ -5755,7 +5756,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &970584909 RectTransform: m_ObjectHideFlags: 0 @@ -6629,6 +6630,80 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1069760790} +--- !u!1 &1071047503 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1071047504} + - 222: {fileID: 1071047506} + - 114: {fileID: 1071047505} + m_Layer: 5 + m_Name: version + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1071047504 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1071047503} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 263018772} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 0.586} + m_AnchorMax: {x: 1, y: 0.618} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1071047505 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1071047503} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.78431374} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: 1d71629ab414fbe4a9015401607e12a6, type: 3} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Version 3.0.34 +--- !u!222 &1071047506 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1071047503} --- !u!1 &1097871559 GameObject: m_ObjectHideFlags: 0 @@ -10850,7 +10925,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 263018772} - m_RootOrder: 2 + m_RootOrder: 3 m_AnchorMin: {x: 0.06, y: 0.46} m_AnchorMax: {x: 0.94, y: 0.58} m_AnchoredPosition: {x: 0, y: 0} @@ -11031,8 +11106,8 @@ RectTransform: m_Children: [] m_Father: {fileID: 1585560343} m_RootOrder: 4 - m_AnchorMin: {x: 1, y: 0.15} - m_AnchorMax: {x: 1, y: 0.85} + m_AnchorMin: {x: 1.04, y: 0.15} + m_AnchorMax: {x: 1.04, y: 0.85} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 0} m_Pivot: {x: 0, y: 0.5} @@ -11275,7 +11350,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.9, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: -32.424988} + m_SizeDelta: {x: 0, y: -92} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1763761725 MonoBehaviour: @@ -11889,7 +11964,7 @@ RectTransform: - {fileID: 948041468} - {fileID: 670462553} m_Father: {fileID: 263018772} - m_RootOrder: 3 + m_RootOrder: 4 m_AnchorMin: {x: 0, y: 0.1} m_AnchorMax: {x: 1, y: 0.4} m_AnchoredPosition: {x: 0, y: 0} diff --git a/Assets/Scripts/Player Manager/GenericPlayerManager.cs b/Assets/Scripts/Player Manager/GenericPlayerManager.cs index 1455152..033574a 100644 --- a/Assets/Scripts/Player Manager/GenericPlayerManager.cs +++ b/Assets/Scripts/Player Manager/GenericPlayerManager.cs @@ -19,6 +19,9 @@ * Quando não há acesso aos bundles dos sinais de pontuação, eles são ignorados. * Ç adicionado como TYPE_WORD. * + * Versão 2.5 + * - Espera de requisição http com timeout. + * * Log directory: http://docs.unity3d.com/Manual/LogFiles.html */ @@ -58,7 +61,7 @@ public abstract class GenericPlayerManager : MonoBehaviour { // Sinais ignorados na apresentação de legenda private HashSet flags = new HashSet(); - // True quando está na função LoadAndPlay + // True quando está na função Loader private volatile bool loading = false; // True quando está reproduzindo qualquer animação private volatile bool playing = false; @@ -174,8 +177,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { /* Para carregamento e animações */ public void stopAll() { - StopCoroutine("loadAndPlay"); - this.randomAnimations.unlockFor("loadAndPlay"); + StopCoroutine("Loader"); + this.randomAnimations.unlockFor("Loader"); loading = false; stopAnimations(); @@ -184,8 +187,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { /* Para animações */ public void stopAnimations() { - StopCoroutine("handleStates"); - this.randomAnimations.unlockFor("handleStates"); + StopCoroutine("AnimationsHandler"); + this.randomAnimations.unlockFor("AnimationsHandler"); this.subtitles.setText(""); lock (this.animQueue) { this.animQueue.Clear(); } @@ -301,54 +304,32 @@ public abstract class GenericPlayerManager : MonoBehaviour { setPauseState( ! this.paused); } - private System.Object LOCKER_PLAY = new System.Object(); - /* Play if anything loading or playing */ public bool playIfEmpty(string gloss) { - lock (LOCKER_PLAY) - { - if (this.loading || this.playing) - return false; - - StartCoroutine("loadAndPlay", gloss); - } + if (this.loading || this.playing) + return false; + StartCoroutine("Loader", gloss); return true; } - /* Enqueue animations for playing */ - public void playQueued(string gloss) - { - lock (LOCKER_PLAY) - { - StartCoroutine("loadAndPlay", gloss); - } - } - /* Stop all and play */ public void playNow(string gloss) { - lock (LOCKER_PLAY) - { - stopAll(); - StartCoroutine("loadAndPlay", gloss); - } + stopAll(); + StartCoroutine("Loader", gloss); } /* Reproduz animação de intervalo */ public bool playIntervalAnimation(string name) { - if ( ! Monitor.TryEnter(LOCKER_PLAY)) + if (this.loading || this.playing) return false; - - lock (LOCKER_PLAY) - { - playDefaultAnimation(true); - this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); - playDefaultAnimation(false); - } - + + playDefaultAnimation(true); + this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); + playDefaultAnimation(false); return true; } @@ -477,253 +458,238 @@ public abstract class GenericPlayerManager : MonoBehaviour { } } - private System.Object LOCKER_LOADING = new System.Object(); - - public void clearLoadedBundles() - { - this.loadedAssetBundles.Clear(); + public void clearLoadedBundles() { + this.loadedAssetBundles.Clear(); } /* Carrega animações e reproduz */ - private IEnumerator loadAndPlay(string gloss) + private IEnumerator Loader(string gloss) { - lock (LOCKER_LOADING) - { - this.randomAnimations.lockFor("loadAndPlay"); - this.loading = true; - // onPlayingStateChange(); + this.loading = true; + this.randomAnimations.lockFor("Loader"); + // onPlayingStateChange(); - string lastAnimationSubtitle = ""; - bool spelled = false; + string lastAnimationSubtitle = ""; + bool spelled = false; - if ( ! this.playing) - StartCoroutine("handleStates"); + if ( ! this.playing) + StartCoroutine("AnimationsHandler"); - String[] stringPos = gloss.Split(' '); + String[] stringPos = gloss.Split(' '); - Queue toPlayQueue = new Queue(); - int wordsCount = 0; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); + Queue toPlayQueue = new Queue(); + int wordsCount = 0; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); - /*WWW checkConnectionRequest = getCheckConnectionRequest(); - bool connected = false; + /*WWW checkConnectionRequest = getCheckConnectionRequest(); + bool connected = false; - while ( ! checkConnectionRequest.isDone) - yield return checkConnectionRequest; + while ( ! checkConnectionRequest.isDone) + yield return checkConnectionRequest; - if (checkConnectionRequest.responseHeaders.Count > 0) - { - PlayerLogger.Log(checkConnectionRequest.responseHeaders["STATUS"]); - connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404"); - } - else PlayerLogger.Log("No response headers.");*/ + if (checkConnectionRequest.responseHeaders.Count > 0) + { + PlayerLogger.Log(checkConnectionRequest.responseHeaders["STATUS"]); + connected = checkConnectionRequest.responseHeaders["STATUS"].Contains("404"); + } + else PlayerLogger.Log("No response headers.");*/ - bool connected = true; - bool playingStarted = false; + bool connected = true; + bool playingStarted = false; - foreach (string aniName in stringPos) - { - wordsCount++; - if (String.IsNullOrEmpty(aniName)) continue; + foreach (string aniName in stringPos) + { + wordsCount++; + if (String.IsNullOrEmpty(aniName)) continue; - bool nonexistent = nonexistentAssetBundles.Contains(aniName); - bool loaded = loadedAssetBundles.Contains(aniName); + bool nonexistent = nonexistentAssetBundles.Contains(aniName); + bool loaded = loadedAssetBundles.Contains(aniName); - if ( ! nonexistent && ! loaded && connected) - { - WWW bundleRequest = loadAssetBundle(aniName); - yield return WaitForResponse(bundleRequest); + if ( ! nonexistent && ! loaded && connected) + { + WWW bundleRequest = loadAssetBundle(aniName); + yield return WaitForResponse(bundleRequest); - PlayerLogger.Log("GPM", "lAP", "Bundle request done (" + aniName + ")."); + PlayerLogger.Log("GPM", "L", "Bundle request done (" + aniName + ")."); - if (bundleRequest.isDone && bundleRequest.error == null) + if (bundleRequest.isDone && bundleRequest.error == null) + { + AssetBundle bundle = bundleRequest.assetBundle; + + if (bundle != null && !String.IsNullOrEmpty(bundle.mainAsset.name)) { - AssetBundle bundle = bundleRequest.assetBundle; + AnimationClip aniClip = bundle.mainAsset as AnimationClip; + bundle.Unload(false); - if (bundle != null && !String.IsNullOrEmpty(bundle.mainAsset.name)) + if (aniClip) { - AnimationClip aniClip = bundle.mainAsset as AnimationClip; - bundle.Unload(false); - - if (aniClip) - { - COMPONENT_ANIMATION.AddClip(aniClip, aniName); - if (playingStarted) yield return new WaitForEndOfFrame(); + COMPONENT_ANIMATION.AddClip(aniClip, aniName); + if (playingStarted) yield return new WaitForEndOfFrame(); - loadedAssetBundles.Add(aniName); - loaded = true; + loadedAssetBundles.Add(aniName); + loaded = true; - PlayerLogger.Log("GPM", "lAP", "Bundle \"" + aniName + "\" loaded!"); - } - else PlayerLogger.Log("GPM", "lAP", "Sign \"" + aniName + "\" wasn't loaded successfuly."); + PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" loaded!"); } - else PlayerLogger.Log("GPM", "lAP", "Bundle \"" + aniName + "\" wasn't loaded successfuly."); - - if ( ! loaded) nonexistentAssetBundles.Add(aniName); + else PlayerLogger.Log("GPM", "L", "Sign \"" + aniName + "\" wasn't loaded successfuly."); } - else - { - PlayerLogger.Log("GPM", "lAP", "Connection error."); - onConnectionError(gloss, aniName); - } - } + else PlayerLogger.Log("GPM", "L", "Bundle \"" + aniName + "\" wasn't loaded successfuly."); - // Reproduz palavra - if (loaded) - { - if (spelled) - { - // Default - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this)); - spelled = false; - } + if ( ! loaded) nonexistentAssetBundles.Add(aniName); + } + else + { + PlayerLogger.Log("GPM", "L", "Connection error."); + onConnectionError(gloss, aniName); + } + } - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) - { - lastAnimationSubtitle = ""; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this)); - } - else - { - lastAnimationSubtitle = aniName; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this)); - } + // Reproduz palavra + if (loaded) + { + if (spelled) + { + // Default + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this)); + spelled = false; } - // Soletra palavra + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) + { + lastAnimationSubtitle = ""; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this)); + } else { - PlayerLogger.Log("GPM", "lAP", "To spell: " + aniName); + lastAnimationSubtitle = aniName; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this)); + } + } - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) - { + // Soletra palavra + else + { + PlayerLogger.Log("GPM", "L", "To spell: " + aniName); + + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) + { + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); + spelled = false; + } + else + { + // Se já houve o soletramento de alguma palavra, reproduz animação default + if (spelled) toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); - spelled = false; - } else - { - // Se já houve o soletramento de alguma palavra, reproduz animação default - if (spelled) - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); - else - spelled = true; + spelled = true; - lastAnimationSubtitle = spellWord(toPlayQueue, aniName); - } + lastAnimationSubtitle = spellWord(toPlayQueue, aniName); } + } - if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) { - playingStarted = true; + if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) { + playingStarted = true; - while (toPlayQueue.Count > 0) - { - toPlayQueue.Dequeue().play(this); - yield return new WaitForEndOfFrame(); - } + while (toPlayQueue.Count > 0) + { + toPlayQueue.Dequeue().play(this); + yield return new WaitForEndOfFrame(); } - - if (playingStarted) yield return new WaitForEndOfFrame(); } - // Default - playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, ""); + if (playingStarted) yield return new WaitForEndOfFrame(); + } - this.loading = false; - // onPlayingStateChange(); - this.randomAnimations.unlockFor("loadAndPlay"); - } - } + // Default + playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, ""); - private System.Object LOCKER_PLAYING = new System.Object(); + // onPlayingStateChange(); + this.randomAnimations.unlockFor("Loader"); + this.loading = false; + } /* Sincroniza as legendas com as animações. */ - IEnumerator handleStates() + IEnumerator AnimationsHandler() { - lock (LOCKER_PLAYING) - { - this.randomAnimations.lockFor("handleStates"); - this.playing = true; - onPlayingStateChange(); + this.playing = true; + this.randomAnimations.lockFor("AnimationsHandler"); + onPlayingStateChange(); - bool isNotEmpty; - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } + bool isNotEmpty = this.animQueue.Count > 0; - // Animação anterior a atual - AnimationReference endedAnimation = null; + // Animação anterior a atual + AnimationReference endedAnimation = null; - // Enquanto estiver executando a corotina "loadAndPlay" - // ou existir animações na fila de reprodução - while (loading || isNotEmpty) + // Enquanto estiver executando a corotina "Loader" + // ou existir animações na fila de reprodução + while (loading || isNotEmpty) + { + // Se não houver animações na fila, espera + if (isNotEmpty) { - // Se não houver animações na fila, espera - if (isNotEmpty) + // Pega primeira animação + AnimationReference reference; + lock (this.animQueue) { reference = this.animQueue.Peek(); } + + // Se estiver sendo reproduzida + if (COMPONENT_ANIMATION.IsPlaying(reference.name)) { - // Pega primeira animação - AnimationReference reference; - lock (this.animQueue) { reference = this.animQueue.Peek(); } + this.subtitles.setText(reference.subtitle); - // Se estiver sendo reproduzida - if (COMPONENT_ANIMATION.IsPlaying(reference.name)) + // Animação seguinte + AnimationReference next = null; + lock (this.animQueue) { - this.subtitles.setText(reference.subtitle); + this.animationPlaying = this.animQueue.Dequeue(); - // Animação seguinte - AnimationReference next = null; - lock (this.animQueue) - { - this.animationPlaying = this.animQueue.Dequeue(); - - if (this.animQueue.Count > 0) - next = this.animQueue.Peek(); - } + if (this.animQueue.Count > 0) + next = this.animQueue.Peek(); + } - while (true) + while (true) + { + // Se a próxima animação estiver sendo reproduzida (no fade) + if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) { - // Se a próxima animação estiver sendo reproduzida (no fade) - if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) - { - // Se a animação anterior a atual não tiver acabado, - // espera acabar e só então conta o tempo - if (endedAnimation != null) - while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) - yield return null; - - // Tempo para pular para a legenda da próxima animação - yield return new WaitForSeconds(0.4F); - - // Deprecated - // yield return WaitForContinuousMillis.Wait(this, 300); - - endedAnimation = reference; - break; - } - - else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) - yield return null; - - else break; + // Se a animação anterior a atual não tiver acabado, + // espera acabar e só então conta o tempo + if (endedAnimation != null) + while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) + yield return null; + + // Tempo para pular para a legenda da próxima animação + yield return new WaitForSeconds(0.4F); + + endedAnimation = reference; + break; } - reference = null; + else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) + yield return null; + + else break; } - // Se a animação não tiver sido liberada e seu AnimationState for nulo, - // a animação será liberada - if (reference != null && reference.state == null) - lock (this.animQueue) { this.animQueue.Dequeue(); } - else - yield return null; + reference = null; } - else yield return null; - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } + // Se a animação não tiver sido liberada e seu AnimationState for nulo, + // a animação será liberada + if (reference != null && reference.state == null) + this.animQueue.Dequeue(); + else + yield return null; } + else yield return null; - this.subtitles.setText(""); - - resetStates(); - this.randomAnimations.unlockFor("handleStates"); + isNotEmpty = this.animQueue.Count > 0; } + + this.subtitles.setText(""); + + resetStates(); + this.randomAnimations.unlockFor("AnimationsHandler"); } public void resetStates() diff --git a/Assets/Scripts/PlayerManager.cs b/Assets/Scripts/PlayerManager.cs index c9e7a4e..8764d25 100644 --- a/Assets/Scripts/PlayerManager.cs +++ b/Assets/Scripts/PlayerManager.cs @@ -120,8 +120,10 @@ public class PlayerManager : GenericPlayerManager { protected override WWW loadAssetBundle(string aniName) { - PlayerLogger.Log("PM", "lAB", "Requesting bundle: " + BASE_URL + regionPath + aniName); - return WWW.LoadFromCacheOrDownload(BASE_URL + regionPath + aniName, this.regionHash); + string address = BASE_URL + regionPath + WWW.EscapeURL(aniName); + + PlayerLogger.Log("PM", "lAB", "Requesting bundle: " + address); + return WWW.LoadFromCacheOrDownload(address, this.regionHash); } private System.Object LOCKER_STATE = new System.Object(); @@ -137,9 +139,11 @@ public class PlayerManager : GenericPlayerManager { { if (gloss.Equals(this.dictWord)) { - base.stopAll(); + this.dictWord = ""; this.screenManager.showConnectionErrorDialog( PlayerManager.ERROR_STATUS_MESSAGE.INTERNET_CONNECTION_FAILURE); + + base.stopAll(); } } @@ -224,8 +228,8 @@ public class PlayerManager : GenericPlayerManager { timer += Time.deltaTime; yield return null; #elif UNITY_IOS - timer += 0.1f; - yield return new WaitForSeconds(0.1f); + timer += 0.1f; + yield return new WaitForSeconds(0.1f); #endif } diff --git a/Assets/Scripts/UI/InputResizer.cs b/Assets/Scripts/UI/InputResizer.cs deleted file mode 100644 index e9055fb..0000000 --- a/Assets/Scripts/UI/InputResizer.cs +++ /dev/null @@ -1,39 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -public class InputResizer : MonoBehaviour { - - protected void Start() - { - Text text = gameObject.GetComponent(); - - if (Screen.dpi < 140) - { - text.fontSize = 20; - } - - // 240 - else if (Screen.dpi < 280) - { - text.fontSize = 32; - } - - // 320 - else if (Screen.dpi < 400) - { - text.fontSize = 44; - } - - // 480 - else if (Screen.dpi < 500) - { - text.fontSize = 56; - } - - else - { - text.fontSize = 56; - } - } - -} diff --git a/Assets/Scripts/UI/InputResizer.cs.meta b/Assets/Scripts/UI/InputResizer.cs.meta deleted file mode 100644 index 640e481..0000000 --- a/Assets/Scripts/UI/InputResizer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f8db495bb0057e14eb35ef4f2df7910e -timeCreated: 1475710064 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UI/Resizers/BarResizer.cs b/Assets/Scripts/UI/Resizers/BarResizer.cs index 69ea3fc..2c8fa36 100644 --- a/Assets/Scripts/UI/Resizers/BarResizer.cs +++ b/Assets/Scripts/UI/Resizers/BarResizer.cs @@ -12,25 +12,25 @@ public class BarResizer : MonoBehaviour { #if UNITY_IOS this.microButton.SetActive(false); - if (Screen.dpi < 140) - this.barBottomLayout.spacing = 42; + if (Screen.width < 400) + this.barBottomLayout.spacing = 8; // 240 - else if (Screen.dpi < 280) - this.barBottomLayout.spacing = 72; + else if (Screen.width < 500) + this.barBottomLayout.spacing = 116; // 320 - else if (Screen.dpi < 400) - this.barBottomLayout.spacing = 108; + else if (Screen.width < 620) + this.barBottomLayout.spacing = 142; // 480 - else if (Screen.dpi < 500) - this.barBottomLayout.spacing = 158; + else if (Screen.width < 840) + this.barBottomLayout.spacing = 190; else - this.barBottomLayout.spacing = 108; + this.barBottomLayout.spacing = 210; #else - if (Screen.dpi < 140) + if (Screen.dpi < 140) this.barBottomLayout.spacing = 48; // 240 diff --git a/Assets/Scripts/UI/Resizers/InputResizer.cs b/Assets/Scripts/UI/Resizers/InputResizer.cs new file mode 100644 index 0000000..e9055fb --- /dev/null +++ b/Assets/Scripts/UI/Resizers/InputResizer.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using UnityEngine.UI; + +public class InputResizer : MonoBehaviour { + + protected void Start() + { + Text text = gameObject.GetComponent(); + + if (Screen.dpi < 140) + { + text.fontSize = 20; + } + + // 240 + else if (Screen.dpi < 280) + { + text.fontSize = 32; + } + + // 320 + else if (Screen.dpi < 400) + { + text.fontSize = 44; + } + + // 480 + else if (Screen.dpi < 500) + { + text.fontSize = 56; + } + + else + { + text.fontSize = 56; + } + } + +} diff --git a/Assets/Scripts/UI/Resizers/InputResizer.cs.meta b/Assets/Scripts/UI/Resizers/InputResizer.cs.meta new file mode 100644 index 0000000..640e481 --- /dev/null +++ b/Assets/Scripts/UI/Resizers/InputResizer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f8db495bb0057e14eb35ef4f2df7910e +timeCreated: 1475710064 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/SlidingHidder.cs b/Assets/Scripts/UI/SlidingHidder.cs index 1c97303..073391d 100644 --- a/Assets/Scripts/UI/SlidingHidder.cs +++ b/Assets/Scripts/UI/SlidingHidder.cs @@ -12,7 +12,7 @@ namespace LAViD.VLibras.UI { public float speed = 1f; public bool disableWhenHidden = true; - private Transform transform; + private Transform thisTransform; private Vector2 hiddenPosition; private Vector2 visiblePosition; @@ -27,23 +27,23 @@ namespace LAViD.VLibras.UI { void Start() { - this.transform = this.gameObject.transform; + this.thisTransform = this.gameObject.transform; this.speed = Screen.width * this.speed; Rect obj = this.gameObject.GetComponent().rect; - this.visiblePosition = transform.position; - this.hiddenPosition = transform.position; + this.visiblePosition = thisTransform.position; + this.hiddenPosition = thisTransform.position; if (this.slideOnX) this.hiddenPosition.x += toLeft ? -obj.width : obj.width; //if (this.slideOnY) this.hiddenPosition.y += toTop ? -obj.height: obj.height; - this.transform.position = base.isVisible() ? this.visiblePosition : this.hiddenPosition; + this.thisTransform.position = base.isVisible() ? this.visiblePosition : this.hiddenPosition; this.gameObject.SetActive(base.isVisible()); } void Update() { - Vector2 position = transform.position; + Vector2 position = thisTransform.position; Vector2 objective = base.isVisible() ? this.visiblePosition : this.hiddenPosition; bool changed = true; @@ -62,7 +62,7 @@ namespace LAViD.VLibras.UI { if (changed) { - this.transform.position = position; + this.thisTransform.position = position; this.gameObject.SetActive( ! this.disableWhenHidden || (position.x != this.hiddenPosition.x /*|| position.y != hiddenPosition.y*/) ); -- libgit2 0.21.2