//public JObject GetCopyLevelByID(int id) { return getSingleData("Section", id); } //public float GetGlobalIntArrayByID(int id) //{ // JObject global = getSingleData("GlobalValue", id); // return global["value"].ToObject<float>(); //} //public JObject GetSoundArrayByID(int id) { // return getSingleData("Sound", id, false); //} //public string GetGlobalStringArrayByID(int id) { // JObject global = getSingleData("GlobalStr", id); // return global["desc"].ToString(); //} #endregion //#region ////TODO:步骤3,根据需要添加特殊处理方法 //public int GetDropOrderCnt() //{ // return _dropOrderList.Count; //} //public Vector2Int GetDropOrder(int idx) //{ // return _dropOrderList[idx]; //} //#endregion private void loadData() { for (int idx = 0; idx < _allJsonNames.Length; ++idx) { string fileName = _allJsonNames[idx]; string jsonStr = loadFile(fileName); JArray jsonArr = JsonConvert.DeserializeObject(jsonStr) as JArray; Dictionary <int, JObject> buffer = new Dictionary <int, JObject>(); for (int idx2 = 0; idx2 < jsonArr.Count; ++idx2) { JObject jItem = jsonArr[idx2] as JObject; try { int id = jItem["ID"].ToObject <int>(); if (buffer.ContainsKey(id)) { EDebug.LogWarning(string.Format("{0}.json中包含相同的ID:{1}", fileName, id)); } else { buffer[id] = jItem; } } catch (Exception) { EDebug.LogError(string.Format("{0}.json缺少名为ID的字段", fileName)); } } _allJsonData[fileName] = buffer; } }