123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Text.RegularExpressions;
- using Newtonsoft.Json;
- /* 本文件包含EnviromentSetting 主要功能上游戏运行环境设定
- */
- public static class EnviromentSetting
- {
- // 服务器ip
- public const string serverIp = "101.34.23.118";
- //language.json读取和存放
- public static string langFilePath = "Assets/Resources/Data/languages.json";
- public static Dictionary<string, object> languageData = null;
- // access Token
- public static string accessToken;
- //系统语言 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<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;
- }
- }
|