using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Text.RegularExpressions; using Newtonsoft.Json; using static System.Net.WebRequestMethods; /* 本文件包含EnviromentSetting 主要功能上游戏运行环境设定 */ public static class EnviromentSetting { // 服务器ip 正式发布需要替换掉ip public static string serverIp = "http://101.34.23.118"; //language.json读取和存放 public static string langFilePath = "Assets/Resources/Data/languages.json"; public static Dictionary languageData = null; // access Token public static string accessToken; public static DateTime accessTokenReceivedTime; // 不需要access Token的请求 public static string[] accessTokenWhiteList = { "/api/login/token/", "/api/game/quick_start/", "/api/login/" }; //系统语言 default=en public static string languageCode = "en"; //操作系统 public static string platform = "NA"; // Unity Unique Id public static string UUID = null; // 狗的数据库 public static string dogDBFilePath = "Assets/Resources/Data/dogDB.json"; public static DogBreed[] dogBreeds; //用于获取多层级Dictionary中的value public static string GetValueAtPath(Dictionary root, string[] path) { Dictionary 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 value = JsonConvert.DeserializeObject>(rawValue); current = value; count++; } return null; } }