diff --git a/Assets/Localization/AddressableAssetsData/link.xml b/Assets/Localization/AddressableAssetsData/link.xml
new file mode 100644
index 0000000..6676355
--- /dev/null
+++ b/Assets/Localization/AddressableAssetsData/link.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Localization/AddressableAssetsData/link.xml.meta b/Assets/Localization/AddressableAssetsData/link.xml.meta
new file mode 100644
index 0000000..7b4479e
--- /dev/null
+++ b/Assets/Localization/AddressableAssetsData/link.xml.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 1348ae8b4f67ed743a4d30604cebfa9d
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity
index 7dc14c2..b985e20 100644
--- a/Assets/Scenes/ComputerView.unity
+++ b/Assets/Scenes/ComputerView.unity
@@ -1003,6 +1003,53 @@ MonoBehaviour:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 10, y: -10}
m_UseGraphicAlpha: 1
+--- !u!1 &189589442
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 189589443}
+ - component: {fileID: 189589444}
+ m_Layer: 0
+ m_Name: LanguageManager
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &189589443
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 189589442}
+ serializedVersion: 2
+ 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_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 375256414}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &189589444
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 189589442}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4ad1b9d8a84226c48a6c2eae78cc0191, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ currentStringTable:
+ m_TableReference:
+ m_TableCollectionName: GUID:9a6eec81bdcf2bb48b63d1f03a258bde
--- !u!1 &190388868
GameObject:
m_ObjectHideFlags: 0
@@ -2155,7 +2202,6 @@ MonoBehaviour:
votingPage: {fileID: 1660260835}
scoringPage: {fileID: 581333955}
promptList: {fileID: 11400000, guid: 21907abc84e40403ca34c4fb9ab30b06, type: 2}
- stringTableCollection: {fileID: 11400000, guid: 3d4b6573839c0274ca08f4bf9dedeca2, type: 2}
--- !u!114 &375256413
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -2183,6 +2229,7 @@ Transform:
m_Children:
- {fileID: 1277491650}
- {fileID: 1937957482}
+ - {fileID: 189589443}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &375256415
diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity
index dac4e22..95d2e39 100644
--- a/Assets/Scenes/PhoneView.unity
+++ b/Assets/Scenes/PhoneView.unity
@@ -198,6 +198,53 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 33958867}
m_CullTransparentMesh: 1
+--- !u!1 &89490415
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 89490416}
+ - component: {fileID: 89490417}
+ m_Layer: 0
+ m_Name: LanguageManager
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &89490416
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 89490415}
+ serializedVersion: 2
+ 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_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 429358650}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &89490417
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 89490415}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4ad1b9d8a84226c48a6c2eae78cc0191, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ currentStringTable:
+ m_TableReference:
+ m_TableCollectionName: GUID:9a6eec81bdcf2bb48b63d1f03a258bde
--- !u!1 &105416810
GameObject:
m_ObjectHideFlags: 0
@@ -971,6 +1018,7 @@ Transform:
m_Children:
- {fileID: 665178701}
- {fileID: 993463148}
+ - {fileID: 89490416}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &429358652
@@ -1003,7 +1051,6 @@ MonoBehaviour:
id:
creationDate: 0
explanationTime: 4
- stringTableCollection: {fileID: 11400000, guid: 3d4b6573839c0274ca08f4bf9dedeca2, type: 2}
roomCodeField: {fileID: 2023851070}
roomError: {fileID: 991600093}
playerNameField: {fileID: 1163479463}
diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs
index e248044..8b081bb 100644
--- a/Assets/Scripts/GameManager.cs
+++ b/Assets/Scripts/GameManager.cs
@@ -7,10 +7,7 @@
using Newtonsoft.Json;
using TMPro;
using Unity.VisualScripting;
-using UnityEditor.Localization;
using UnityEngine;
-using UnityEngine.Localization.Settings;
-using UnityEngine.Localization.Tables;
using UnityEngine.UI;
///
@@ -25,7 +22,6 @@ public class GameManager : MonoBehaviour
[Header("Other component")]
public float explanationTime = 4f;
- public StringTableCollection stringTableCollection;
[Header("Home Connection Component")]
public TMP_InputField roomCodeField;
@@ -66,11 +62,6 @@ public class GameManager : MonoBehaviour
private DatabaseReference myOnlineRoom;
private DateTime endOfViewDate = DateTime.MinValue;
- ///
- /// Contains all the translated string for the UI
- ///
- private StringTable stringTable;
-
private void Awake()
{
submitNewPlayer.interactable = false;
@@ -81,7 +72,6 @@ private void Awake()
private void Start()
{
InitializeHomePage();
- stringTable = stringTableCollection.GetTable(LocalizationSettings.SelectedLocale.Identifier) as StringTable;
}
private void InitializeHomePage()
@@ -179,7 +169,7 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
{
Debug.LogError("Player name is empty", this);
- string errorText = stringTable.GetEntry("PhoneView/Canvas/Background/HomeState/NameField/ErrorNameLabel").LocalizedValue;
+ string errorText = LanguageManager.Instance.currentStringTable.GetTable().GetEntry("PhoneView/Canvas/Background/HomeState/NameField/ErrorNameLabel").LocalizedValue;
nameError.text = errorText;
nameError.gameObject.SetActive(true);
submitNewPlayer.interactable = true;
@@ -191,7 +181,7 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
{
Debug.LogError("Room code is empty", this);
- string errorText = stringTable.GetEntry("PhoneView/Canvas/Background/HomeState/NameField/EmptyRoom").LocalizedValue;
+ string errorText = LanguageManager.Instance.currentStringTable.GetTable().GetEntry("PhoneView/Canvas/Background/HomeState/NameField/EmptyRoom").LocalizedValue;
roomError.text = errorText;
roomError.gameObject.SetActive(true);
submitNewPlayer.interactable = true;
@@ -209,7 +199,7 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
if (room == null)
{
Debug.LogError("The room doesn't exists");
- string errorText = stringTable.GetEntry("PhoneView/Canvas/Background/HomeState/NameField/ErrorRoom").LocalizedValue;
+ string errorText = LanguageManager.Instance.currentStringTable.GetTable().GetEntry("PhoneView/Canvas/Background/HomeState/NameField/ErrorRoom").LocalizedValue;
roomError.text = errorText;
roomError.gameObject.SetActive(true);
submitNewPlayer.interactable = true;
diff --git a/Assets/Scripts/LanguageManager.cs b/Assets/Scripts/LanguageManager.cs
new file mode 100644
index 0000000..2302f6f
--- /dev/null
+++ b/Assets/Scripts/LanguageManager.cs
@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Localization;
+using UnityEngine.Localization.Settings;
+using UnityEngine.Localization.Tables;
+
+public class LanguageManager : MonoBehaviour
+{
+ public static LanguageManager Instance;
+
+ ///
+ /// Contains all the translated string for the UI
+ ///
+ public LocalizedStringTable currentStringTable;
+
+ private void Awake()
+ {
+ Instance = this;
+ }
+}
diff --git a/Assets/Scripts/LanguageManager.cs.meta b/Assets/Scripts/LanguageManager.cs.meta
new file mode 100644
index 0000000..c841d2d
--- /dev/null
+++ b/Assets/Scripts/LanguageManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4ad1b9d8a84226c48a6c2eae78cc0191
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs
index 8e70472..c3dbc9b 100644
--- a/Assets/Scripts/RoomManager.cs
+++ b/Assets/Scripts/RoomManager.cs
@@ -7,11 +7,8 @@
using Newtonsoft.Json;
using System.Linq;
using System.Collections;
-using UnityEditor.Localization;
using UnityEngine.Localization.Settings;
-using UnityEngine.Localization;
using UnityEngine.Localization.Tables;
-using Google.MiniJSON;
///
/// This is the game state manager on the PC side
@@ -47,12 +44,6 @@ public class RoomManager : MonoBehaviour
[Header("Other")]
public PromptList promptList;
- public StringTableCollection stringTableCollection;
-
- ///
- /// Contains all the translated string for the UI
- ///
- private StringTable stringTable;
public Room myRoom { get; private set; } = null;
@@ -66,7 +57,6 @@ private void Awake()
{
Instance = this;
FirebaseInitializer.Instance.onFirebaseReady += Initialize;
- stringTable = stringTableCollection.GetTable(LocalizationSettings.SelectedLocale.Identifier) as StringTable;
}
private void Start()
@@ -213,7 +203,7 @@ private void SendRoomState(GameState _newState)
private void ResetAllPlayerLabels()
{
- string label = stringTable.GetEntry("ComputerView/Canvas/WaitingForPlayersPage/WaitingForP").LocalizedValue;
+ string label = LanguageManager.Instance.currentStringTable.GetTable().GetEntry("ComputerView/Canvas/WaitingForPlayersPage/WaitingForP").LocalizedValue;
for (int i = 0; i < playerStickers.Count; i++)
{
playerStickers[i].Initialize($"{label}{i + 1}", i);