Skip to content

Commit

Permalink
Fix panel was in front of text.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos2380 committed Oct 16, 2018
1 parent 85fdf98 commit 9ed4f98
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 36 deletions.
115 changes: 93 additions & 22 deletions ShowPT/Assets/Scenes/Language.unity
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: dcf8e145c81c49e42a5d7ee46fb0e794, type: 3}
m_Name:
m_EditorClassIdentifier:
upSubtitle: {fileID: 901950272}
downSubtitle: {fileID: 1487808575}
--- !u!4 &270818055
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1265,24 +1267,25 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &836237621
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 836237620}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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_Children: []
m_Father: {fileID: 901950271}
m_LocalScale: {x: 0.56627, y: 0.56627, z: 0.56627}
m_Children:
- {fileID: 901950271}
m_Father: {fileID: 1300324879}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchoredPosition: {x: 0.5999974, y: 182.8}
m_SizeDelta: {x: 49.700012, y: -409.4}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &836237622
MonoBehaviour:
Expand All @@ -1296,7 +1299,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.17647058, g: 0.17647058, b: 0.17647058, a: 0.884}
m_Color: {r: 0.17647058, g: 0.17647058, b: 0.17647058, a: 0.7058824}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -1333,7 +1336,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &901950271
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -1342,15 +1345,14 @@ RectTransform:
m_GameObject: {fileID: 901950270}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.56627, y: 0.56627, z: 0.56627}
m_Children:
- {fileID: 836237621}
m_Father: {fileID: 1300324879}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 836237621}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.6, y: 182.8}
m_AnchoredPosition: {x: -0.00000059604645, y: 0.00010681152}
m_SizeDelta: {x: 849.7, y: 40.6}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &901950272
Expand Down Expand Up @@ -1469,6 +1471,75 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 914333024}
--- !u!1 &970093089
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 970093090}
- component: {fileID: 970093092}
- component: {fileID: 970093091}
m_Layer: 0
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &970093090
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 970093089}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.566272, y: 0.566272, z: 0.566272}
m_Children:
- {fileID: 1487808574}
m_Father: {fileID: 1300324879}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.0000834, y: -155.99994}
m_SizeDelta: {x: 222.70001, y: -342.8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &970093091
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 970093089}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &970093092
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 970093089}
--- !u!1 &1054389185
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1813,8 +1884,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 901950271}
- {fileID: 1487808574}
- {fileID: 836237621}
- {fileID: 970093090}
m_Father: {fileID: 1054389186}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -1872,23 +1943,23 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &1487808574
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1487808573}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.566272, y: 0.566272, z: 0.566272}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1300324879}
m_RootOrder: 1
m_Father: {fileID: 970093090}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 6, y: -156}
m_AnchoredPosition: {x: -0.00017690659, y: -0.00012207031}
m_SizeDelta: {x: 1022.7, y: 107.2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1487808575
Expand Down
3 changes: 3 additions & 0 deletions ShowPT/Assets/Scripts/Localization/LocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using UnityEngine.UI;

public class LocalizationManager : MonoBehaviour
{

public static LocalizationManager instance;
public Text upSubtitle;
public Text downSubtitle;

private Dictionary<string, string> localizedText;
private bool isReady = false;
Expand Down
24 changes: 10 additions & 14 deletions ShowPT/Assets/Scripts/Localization/SubtitleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@ public enum SubtitleType
UPSUBTITLE,
DOWNSUBTITLE
}
private Text UpSubtitle;
private Text DownSubtitle;

private Text upSubtitle;
private Text downSubtitle;
private Text selectText;
private int iter;

private void OnEnable()
{
UpSubtitle = transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>();
DownSubtitle = transform.GetChild(0).GetChild(0).GetChild(1).GetComponent<Text>();
}


public void playSubtitle(float timeInSecs, SubtitleItem[] subtitles, SubtitleType subtitleType)
{
Expand All @@ -46,10 +42,10 @@ public void playSubtitle(float timeInSecs, SubtitleItem[] subtitles, SubtitleTyp
switch (subtitleType)
{
case SubtitleType.UPSUBTITLE:
selectText = UpSubtitle;
selectText = LocalizationManager.instance.upSubtitle;
break;
case SubtitleType.DOWNSUBTITLE:
selectText = DownSubtitle;
selectText = LocalizationManager.instance.downSubtitle;
break;
}
actualCoroutine = StartCoroutine(playSubtitleAsync(timeSec, subtitles));
Expand All @@ -58,7 +54,7 @@ public void playSubtitle(float timeInSecs, SubtitleItem[] subtitles, SubtitleTyp

IEnumerator playSubtitleAsync(int timeInSecs, SubtitleItem[] subtitles)
{
selectText.gameObject.SetActive(true);
selectText.transform.parent.gameObject.SetActive(true);
iter = 0;
while (iter < subtitles.Length-1)
{
Expand All @@ -68,13 +64,13 @@ IEnumerator playSubtitleAsync(int timeInSecs, SubtitleItem[] subtitles)
}
selectText.text = LocalizationManager.instance.getLocalizedValue(subtitles[iter].keySubtitle);
yield return new WaitForSeconds(timeInSecs - subtitles[iter].timeSec);
selectText.gameObject.SetActive(false);
selectText.transform.parent.gameObject.SetActive(false);
}

public void stopSubtitle()
{
UpSubtitle.gameObject.SetActive(false);
DownSubtitle.gameObject.SetActive(false);
LocalizationManager.instance.upSubtitle.transform.parent.gameObject.SetActive(false);
LocalizationManager.instance.downSubtitle.transform.parent.gameObject.SetActive(false);
StopCoroutine(actualCoroutine);
}

Expand Down

0 comments on commit 9ed4f98

Please sign in to comment.