public EffectInfo(int effectIndexId, int effId) { Id = effectIndexId; effectId = effId; effectData = J_Effect.GetData(effId); effectName = effectData._model; dirtySign = 0; }
private static void Init(string _info) { List <object> jsonObjects = MiniJSON.Json.Deserialize(_info) as List <object>; for (int i = 0; i < jsonObjects.Count; i++) { D_Effect info = new D_Effect(); Dictionary <string, object> jsonObject = jsonObjects[i] as Dictionary <string, object>; if (jsonObject["id"] != null) { info._id = int.Parse(jsonObject["id"].ToString()); } else { info._id = 0; } if (jsonObject["name"] != null) { info._name = jsonObject["name"].ToString(); } else { info._name = ""; } if (jsonObject["model"] != null) { info._model = jsonObject["model"].ToString(); } else { info._model = ""; } if (jsonObject["loop"] != null) { info._loop = int.Parse(jsonObject["loop"].ToString()); } else { info._loop = 0; } infoDict.Add(info._id, info); } /* * foreach (KeyValuePair<int, D_Effect> info in infoDict) * { * Debug.Log(">>>>>"+info.Value._id+":"+info.Value._name+":"+info.Value._desc+":"+info.Value._point+":"+info.Value._label+":"+info.Value._type+":"+info.Value._number+":"+info.Value._function+":"+info.Value._para+":"+info.Value._reward+":"+"<<<<<\n"); * } */ }
/// <summary> /// 通过key获取数据 /// </summary> /// <param name="_id">字典key</param> /// <returns></returns> public static D_Effect GetData(int _id) { D_Effect data = null; if (infoDict.ContainsKey(_id)) { data = infoDict[_id]; } else { Debug.Log(">>>>>table:" + tableName + " id:" + _id + " is null<<<<<\n"); } return(data); }