private void LoadGameData() { string filePath = EditorUtility.OpenFilePanel("Select localization data file", Application.streamingAssetsPath, "json"); if (!string.IsNullOrEmpty(filePath)) { string dataAsJson = File.ReadAllText(filePath); localizationData = JsonUtility.FromJson <LocalizationData>(dataAsJson); } }
public void LoadLocalizedText(string fileName) { localizedText = new Dictionary <string, string>(); string filePath = Path.Combine(Application.streamingAssetsPath, fileName); if (File.Exists(filePath)) { string dataAsJson = File.ReadAllText(filePath); LocalizationData loadedData = JsonUtility.FromJson <LocalizationData>(dataAsJson); for (int i = 0; i < loadedData.items.Length; i++) { localizedText.Add(loadedData.items[i].key, loadedData.items[i].value); } } else { // Debug.LogError("Cannot find file!"); } isReady = true; }
private void CreateNewData() { localizationData = new LocalizationData(); }