Beispiel #1
0
        protected IEnumerator FindFile()
        {
            if (filePath.Contains("jar:file:/"))
            {
                UnityWebRequest www = UnityWebRequest.Get(filePath);
                yield return(www.SendWebRequest());

                dataAsJson = www.downloadHandler.text;
            }
            else
            {
                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);
            }

            if (OnLoadLocalizedText != null)
            {
                OnLoadLocalizedText();
            }
        }
Beispiel #2
0
        private void LoadGameData()
        {
            string filePath = EditorUtility.OpenFilePanel("Select localized data file", Application.streamingAssetsPath, "json");

            if (!string.IsNullOrEmpty(filePath))
            {
                string dataAsJson = File.ReadAllText(filePath);

                localizationData = JsonUtility.FromJson <LocalizationData>(dataAsJson);
            }
        }
Beispiel #3
0
 private void CreateNewData()
 {
     localizationData = new LocalizationData();
 }