diff --git a/POINT-VR-Chapter-1/Assets/POINT/4D-SpacetimeAssets/FloatingObjectives.cs b/POINT-VR-Chapter-1/Assets/POINT/4D-SpacetimeAssets/FloatingObjectives.cs index c1cfcfa6..19f6ad17 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/4D-SpacetimeAssets/FloatingObjectives.cs +++ b/POINT-VR-Chapter-1/Assets/POINT/4D-SpacetimeAssets/FloatingObjectives.cs @@ -44,7 +44,7 @@ private void Update() public void UpdateObjectiveLanguage(int idx, string s) { - if (idx >= 0 && idx < objectives.Count) + if (objectives != null && idx >= 0 && idx < objectives.Count) { objectives[idx] = s; ReloadObjectives(); diff --git a/POINT-VR-Chapter-1/Assets/POINT/Audio/Narration/NarrationManager.cs b/POINT-VR-Chapter-1/Assets/POINT/Audio/Narration/NarrationManager.cs index da55db76..5dd35847 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/Audio/Narration/NarrationManager.cs +++ b/POINT-VR-Chapter-1/Assets/POINT/Audio/Narration/NarrationManager.cs @@ -36,7 +36,7 @@ public GameManager.Language SubtitlesLanguage set { subtitlesLanguage = value; - DisplaySubtitles(); + if (isSubtitlePlaying) DisplaySubtitles(); } } diff --git a/POINT-VR-Chapter-1/Assets/POINT/Credits/EndCreditsManager.cs b/POINT-VR-Chapter-1/Assets/POINT/Credits/EndCreditsManager.cs index eebea844..90151ea0 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/Credits/EndCreditsManager.cs +++ b/POINT-VR-Chapter-1/Assets/POINT/Credits/EndCreditsManager.cs @@ -3,7 +3,6 @@ using UnityEngine.UI; using TMPro; - public class EndCreditsManager : MonoBehaviour { // Rich text tags for different classes of text @@ -38,6 +37,9 @@ private class CreditsPosition } #endregion + [Tooltip("Default localized string that appears under current objective in the UI menu")] + [SerializeField] private UnityEngine.Localization.LocalizedString defaultObjective; + [Header("Credits Segments")] [Tooltip("The GameObject containing all components for the funding acknowledgements section")] [SerializeField] private GameObject fundingAcknowledgements = null; @@ -95,6 +97,7 @@ private IEnumerator Start() { yield return WaitForPlayerSpawn(); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(defaultObjective); player.GetComponent().PlayClipWithSubtitles("temporary_ending_2"); if (fundingAcknowledgements != null) diff --git a/POINT-VR-Chapter-1/Assets/POINT/InputAssets/StartMenuManager.cs b/POINT-VR-Chapter-1/Assets/POINT/InputAssets/StartMenuManager.cs index d05001ad..c2a0fe1c 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/InputAssets/StartMenuManager.cs +++ b/POINT-VR-Chapter-1/Assets/POINT/InputAssets/StartMenuManager.cs @@ -74,6 +74,8 @@ public int Language } } } + + uiManager.Language = value; } language = value; @@ -93,8 +95,7 @@ public int SubtitleLanguage } } - if (value > 0) value = 1; - + int toggleIdx = (value == 0) ? 0 : 1; if (uiManager != null && subtitlesParent != null) { for (int i = 0; i < subtitlesParent.childCount; i++) @@ -102,7 +103,7 @@ public int SubtitleLanguage Image imageComponent = subtitlesParent.GetChild(i).GetComponentInChildren(); if (imageComponent != null) { - if (i == value) // selected toggle + if (i == toggleIdx) // selected toggle { imageComponent.sprite = uiManager.toggleSelected; } @@ -112,6 +113,8 @@ public int SubtitleLanguage } } } + + uiManager.SubtitleLanguage = value; } subtitleLanguage = value; @@ -171,7 +174,7 @@ private IEnumerator DisablePause() yield return new WaitUntil(() => Camera.current != null); player = Camera.current.transform.parent.gameObject; - player.GetComponentInChildren(true).UpdateCurrentObjective(defaultObjective); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(defaultObjective); player.GetComponent().ToggleReference.action.Disable(); } diff --git a/POINT-VR-Chapter-1/Assets/POINT/InputAssets/TutorialManager.cs b/POINT-VR-Chapter-1/Assets/POINT/InputAssets/TutorialManager.cs index ffd2b7f4..b35d8039 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/InputAssets/TutorialManager.cs +++ b/POINT-VR-Chapter-1/Assets/POINT/InputAssets/TutorialManager.cs @@ -48,7 +48,6 @@ public class TutorialManager : MonoBehaviour private string menuString; private string openMenuString; - // Cache private TMP_Text instructions = null; private Camera currentCamera = null; @@ -166,9 +165,10 @@ private void StartTutorial() // Turn tutorial controlsImage.sprite = turnSprite; turnText.RefreshString(); + UpdateTurnString(turnText.GetLocalizedString()); instructions.text = turnString; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(turnText); player.GetComponent().PlayClipWithSubtitles("Tutorial\\Tutorial_Intro"); StartCoroutine(WaitForTurn()); @@ -181,13 +181,13 @@ IEnumerator WaitForTurn() yield return new WaitUntil(() => player.transform.rotation.y != initialRotation); // Teleportation tutorial - player.GetComponent().PlayClipWithSubtitles("Tutorial\\Tutorial_Teleport"); controlsImage.sprite = teleportationSprite; teleportationText.RefreshString(); + UpdateTeleportationString(teleportationText.GetLocalizedString()); instructions.text = teleportationString; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(teleportationText); StartCoroutine(WaitForTeleport()); @@ -215,9 +215,10 @@ IEnumerator WaitForTeleport() // Grab tutorial controlsImage.sprite = grabSprite; grabText.RefreshString(); + UpdateGrabString(grabText.GetLocalizedString()); instructions.text = grabString; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(grabText); player.GetComponent().PlayClipWithSubtitles("Tutorial\\Tutorial_Grab"); StartCoroutine(WaitForGrab()); @@ -232,9 +233,10 @@ IEnumerator WaitForGrab() // Push and pull tutorial controlsImage.sprite = pushPullSprite; pushPullText.RefreshString(); + UpdatePushPullString(pushPullText.GetLocalizedString()); instructions.text = pushPullString; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(pushPullText); player.GetComponent().PlayClipWithSubtitles("Tutorial\\Tutorial_Push&Pull"); StartCoroutine(WaitForPushPull()); @@ -257,9 +259,10 @@ IEnumerator WaitForPushPull() // Activate Menu controlsImage.sprite = menuSprite; openMenuText.RefreshString(); + UpdateOpenMenuString(openMenuText.GetLocalizedString()); instructions.text = openMenuString; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(openMenuText); player.GetComponent().PlayClipWithSubtitles("Tutorial\\Tutorial_Menu_Open"); StartCoroutine(WaitForMenuPopup()); @@ -325,6 +328,7 @@ IEnumerator WaitForSceneSelection() yield return new WaitForSecondsRealtime(11); // Set to the audio file above's duration in seconds overText.RefreshString(); + UpdateOverString(overText.GetLocalizedString()); instructions.text = overString; SceneUIContainer.SetActive(true); @@ -356,7 +360,7 @@ private void UpdateTeleportationString(string s) if (instructions.text == teleportationString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { @@ -372,7 +376,7 @@ private void UpdateTurnString(string s) if (instructions.text == turnString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { @@ -388,7 +392,7 @@ private void UpdateGrabString(string s) if (instructions.text == grabString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { @@ -404,7 +408,7 @@ private void UpdatePushPullString(string s) if (instructions.text == pushPullString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { @@ -420,7 +424,7 @@ private void UpdateOverString(string s) if (instructions.text == overString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { @@ -436,7 +440,7 @@ private void UpdateMenuString(string s) if (instructions.text == menuString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { @@ -452,7 +456,7 @@ private void UpdateOpenMenuString(string s) if (instructions.text == openMenuString) { instructions.text = s; - player.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); + player.transform.parent.GetComponentInChildren(true).UpdateCurrentObjective(instructions.text); } else { diff --git a/POINT-VR-Chapter-1/Assets/POINT/Localization/English (en).asset b/POINT-VR-Chapter-1/Assets/POINT/Localization/English (en).asset index 195df54b..a1f24a97 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/Localization/English (en).asset +++ b/POINT-VR-Chapter-1/Assets/POINT/Localization/English (en).asset @@ -15,10 +15,15 @@ MonoBehaviour: m_Identifier: m_Code: en m_Metadata: - m_Items: [] + m_Items: + - id: 0 m_LocaleName: English (en) m_CustomFormatCultureCode: m_UseCustomFormatter: 0 m_SortOrder: 10000 references: version: 1 + 00000000: + type: {class: FallbackLocale, ns: UnityEngine.Localization.Metadata, asm: Unity.Localization} + data: + m_Locale: {fileID: 11400000} diff --git a/POINT-VR-Chapter-1/Assets/POINT/Localization/LocalizationSettings.asset b/POINT-VR-Chapter-1/Assets/POINT/Localization/LocalizationSettings.asset index ab6b0bec..01ee4970 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/Localization/LocalizationSettings.asset +++ b/POINT-VR-Chapter-1/Assets/POINT/Localization/LocalizationSettings.asset @@ -56,8 +56,8 @@ MonoBehaviour: asm: Unity.Localization} data: m_DefaultTableReference: - m_TableCollectionName: - m_UseFallback: 0 + m_TableCollectionName: UILocalization + m_UseFallback: 1 m_MissingTranslationState: 1 m_NoTranslationFoundMessage: No translation found for '{key}' in {table.TableCollectionName} m_SmartFormat: diff --git a/POINT-VR-Chapter-1/Assets/POINT/Localization/Spanish (es).asset b/POINT-VR-Chapter-1/Assets/POINT/Localization/Spanish (es).asset index 750f0985..a0b5fc3c 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/Localization/Spanish (es).asset +++ b/POINT-VR-Chapter-1/Assets/POINT/Localization/Spanish (es).asset @@ -15,10 +15,15 @@ MonoBehaviour: m_Identifier: m_Code: es m_Metadata: - m_Items: [] + m_Items: + - id: 0 m_LocaleName: Spanish (es) m_CustomFormatCultureCode: m_UseCustomFormatter: 0 m_SortOrder: 10000 references: version: 1 + 00000000: + type: {class: FallbackLocale, ns: UnityEngine.Localization.Metadata, asm: Unity.Localization} + data: + m_Locale: {fileID: 11400000, guid: 27f713b6a8d9f414db8697ee04ee224b, type: 2} diff --git a/POINT-VR-Chapter-1/Assets/POINT/Scenes/Chapter1/EndCredits.unity b/POINT-VR-Chapter-1/Assets/POINT/Scenes/Chapter1/EndCredits.unity index a150342d..3120eda7 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/Scenes/Chapter1/EndCredits.unity +++ b/POINT-VR-Chapter-1/Assets/POINT/Scenes/Chapter1/EndCredits.unity @@ -298,6 +298,15 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8730d809b4759534fa8731325c636774, type: 3} m_Name: m_EditorClassIdentifier: + defaultObjective: + m_TableReference: + m_TableCollectionName: GUID:ea97502b36f6cd149b6a571be6e2583f + m_TableEntryReference: + m_KeyId: 13430563209777159 + m_Key: + m_FallbackState: 0 + m_WaitForCompletion: 0 + m_LocalVariables: [] fundingAcknowledgements: {fileID: 1180836758} projectLinks: {fileID: 831191579} fadeDuration: 2 @@ -309,6 +318,8 @@ MonoBehaviour: endY: 5 fadeDistance: 1 scrollSpeed: 0.3 + references: + version: 1 --- !u!1 &635651177 GameObject: m_ObjectHideFlags: 0 diff --git a/POINT-VR-Chapter-1/Assets/POINT/UIAssets/UIManager.cs b/POINT-VR-Chapter-1/Assets/POINT/UIAssets/UIManager.cs index 13915ce0..6b581883 100644 --- a/POINT-VR-Chapter-1/Assets/POINT/UIAssets/UIManager.cs +++ b/POINT-VR-Chapter-1/Assets/POINT/UIAssets/UIManager.cs @@ -203,12 +203,13 @@ public int SubtitleLanguage } + int toggleIdx = (value == 0) ? 0 : 1; for (int i = 0; i < subtitleParent.childCount; i++) { Image imageComponent = subtitleParent.GetChild(i).GetComponentInChildren(); if (imageComponent != null) { - if (i == value) // selected toggle + if (i == toggleIdx) // selected toggle; note: should change to i == value if subtitles has language options instead of on/off { imageComponent.sprite = toggleSelected; } diff --git a/POINT-VR-Chapter-1/Builds/localization-stress.apk b/POINT-VR-Chapter-1/Builds/localization-stress.apk new file mode 100644 index 00000000..a2d86144 Binary files /dev/null and b/POINT-VR-Chapter-1/Builds/localization-stress.apk differ diff --git a/POINT-VR-Chapter-1/ProjectSettings/ProjectSettings.asset b/POINT-VR-Chapter-1/ProjectSettings/ProjectSettings.asset index a21a0452..5f9fcc1e 100644 --- a/POINT-VR-Chapter-1/ProjectSettings/ProjectSettings.asset +++ b/POINT-VR-Chapter-1/ProjectSettings/ProjectSettings.asset @@ -324,6 +324,7 @@ PlayerSettings: - {fileID: 0} - {fileID: 0} - {fileID: 11400000, guid: 2eb42e1390af4ba4ab51a9b482e68338, type: 2} + - {fileID: 11400000, guid: 4dd5ea5325ca26a4cbf5b83149f74bec, type: 2} - {fileID: 4814008871340846074, guid: 7c600385b2e0246499112b5f537d1007, type: 2} - {fileID: 11400000, guid: 2eac5b88f02ba704abc6cff84097461a, type: 2} metroInputSource: 0