123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Newtonsoft.Json;
- using System.IO;
- public class EnviromentController : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- // 读取language.json
- string filePath = EnviromentSetting.filePath;
- string json = File.ReadAllText(filePath);
- //json = Regex.Replace(json, @"[\r\n]", "");
- EnviromentSetting.languageData = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
- // 读取系统语言
- string systemLanguage = Application.systemLanguage.ToString();
- if (systemLanguage == "ChineseSimplified")
- {
- EnviromentSetting.languageCode = "zh-cn";
- }
- // 默认语言为en
- // 读取操作系统,unique Id
- EnviromentSetting.platform = Application.platform.ToString();
- EnviromentSetting.uniqueId = SystemInfo.deviceUniqueIdentifier;
- }
- // Update is called once per frame
- //void Update()
- //{
- //}
- }
|