EnviromentController.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Newtonsoft.Json;
  5. using System.IO;
  6. using UnityEngine.Networking;
  7. using System;
  8. public class EnviromentController : MonoBehaviour
  9. {
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. // 读取language.json
  14. string filePath = EnviromentSetting.filePath;
  15. string json = File.ReadAllText(filePath);
  16. //json = Regex.Replace(json, @"[\r\n]", "");
  17. EnviromentSetting.languageData = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
  18. // 读取系统语言
  19. string systemLanguage = Application.systemLanguage.ToString();
  20. if (systemLanguage == "ChineseSimplified")
  21. {
  22. EnviromentSetting.languageCode = "zh-cn";
  23. }
  24. // 默认语言为en
  25. // 读取操作系统,unique Id
  26. EnviromentSetting.platform = Application.platform.ToString();
  27. EnviromentSetting.UUID = SystemInfo.deviceUniqueIdentifier;
  28. // todo 开发代码,加载狗的信息,以后要移到ProgressBar页面
  29. DogProperty puppy_1 = new();
  30. EnviromentSetting.InitialPuppies(puppy_1);
  31. }
  32. // Update is called once per frame
  33. //void Update()
  34. //{
  35. //}
  36. }