public void Load(string content_json) { Clear(); Hashtable dict = MiniJson.JsonDecode(content_json) as Hashtable; Load_ChildList(dict.Get <ArrayList>("child_list"), this.gameObject.transform); }
public AStarMapPath(string jsonConent) { Hashtable dict = MiniJson.JsonDecode(jsonConent).To <Hashtable>(); int minGridX = dict["minGridX"].To <int>(); int minGridY = dict["minGridY"].To <int>(); int maxGridX = dict["maxGridX"].To <int>(); int maxGridY = dict["maxGridY"].To <int>(); Dictionary <Vector2Int, int> dataDict = new Dictionary <Vector2Int, int>(); Hashtable _dataDict = dict["dataDict"].To <Hashtable>(); foreach (var _key in _dataDict.Keys) { Vector2 v = _key.To <string>().ToVector2(); Vector2Int key = new Vector2Int((int)v.x, (int)v.y); int value = _dataDict[_key].To <int>(); dataDict[key] = value; } int[][] grids = null; grids = grids .InitArrays(maxGridY - minGridY + 1, maxGridX - minGridX + 1, AStarConst.Default_Data_Value).ToLeftBottomBaseArrays(); gridOffsetX = minGridX; //用于astarBehaviour的非0的偏移 gridOffsetY = minGridY; //用于astarBehaviour的非0的偏移 foreach (var key in dataDict.Keys) { grids[key.x - minGridX][key.y - minGridY] = dataDict[key]; } Init(grids); }
public static object Deserialize(string txt, object context = null) { JsonSerializer.deserializeCache = new Dictionary <long, object>(); JsonSerializer.typeCache = new Dictionary <long, Type>(); object obj = MiniJson.JsonDecode(txt); object result = null; if (obj != null) { JsonSerializer.ConstructClassTable((Hashtable)((Hashtable)obj)[STR_CLS_TABLE]); result = JsonSerializer.Deserialize(obj, obj.GetType(), context); } JsonSerializer.deserializeCache.Clear(); JsonSerializer.deserializeCache = null; JsonSerializer.typeCache.Clear(); JsonSerializer.typeCache = null; return(result); }
public void Load(string contentJson) { dict.Clear(); Hashtable jsonDict = MiniJson.JsonDecode(contentJson) as Hashtable; refId = jsonDict.Get <long>("ref_id"); ArrayList assetPathRefList = jsonDict.Get <ArrayList>("assetPathRef_list"); for (var i = 0; i < assetPathRefList.Count; i++) { var assetPathRefDict = (Hashtable)assetPathRefList[i]; long refId = assetPathRefDict.Get <long>("ref_id"); string assetPath = assetPathRefDict.Get <string>("assetPath"); string guid = assetPathRefDict.Get <string>("guid"); if (refId > this.refId) { this.refId = refId; } dict[guid] = new AssetPathRef(refId, assetPath, guid); } }
public void SingleInit() { var fileInfo = new FileInfo(filePath); if (!fileInfo.Exists) { var org_data = new Hashtable() { { "user_id", "user1" }, { "dict_user_tmp", new Hashtable() }, { "dict_user", new Hashtable() } }; data = org_data; return; } var conentBytes = StdioUtil.ReadFile(filePath); //conentBytes = CompressUtil.GZipDecompress(conentBytes);--½âѹËõ var content = Encoding.UTF8.GetString(conentBytes); data = MiniJson.JsonDecode(content) as Hashtable; }