12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEditorInternal;
- using System.Text.RegularExpressions;
- using Newtonsoft.Json;
- public static class EnviromentSetting
- {
- // 服务器ip
- public const string serverIp = "101.34.23.118";
- //language.json读取
- public static string filePath = "Assets/Resources/Data/languages.json";
- public static Dictionary<string, object> languageData = new();
- // access Token
- public static string accessToken;
- //系统语言 default=en
- public static string languageCode = "en";
- //操作系统
- public static string platform = "NA";
- // Unity Unique Id
- public static string uniqueId = string.Empty;
- //用于获取多层级Dictionary中的value
- public static string GetValueAtPath(Dictionary<string, object> root, string[] path)
- {
- Dictionary<string, object> current = root;
- int count = 0;
- foreach (string key in path)
- {
- string rawValue = current[key].ToString();
- rawValue = Regex.Replace(rawValue, @"[\r\n]", "");
- if (count == path.Length-1)
- {
- return rawValue;
- }
- Dictionary<string, object> value = JsonConvert.DeserializeObject<Dictionary<string, object>>(rawValue);
- current = value;
- count++;
- }
- return null;
- }
- }
|