//解析strInfo,将解析好的配置表导入配置管理表 private Config _loadConfigSource(Type t, long id) { Config instance = null; if (_byteDataDic.ContainsKey(t)) { instance = t.Assembly.CreateInstance(t.FullName) as Config; if (instance != null) { byte[] readBytes = _byteDataDic[t][id]; _byteBuffer.clear(); _byteBuffer.writeBytes(readBytes, 0, readBytes.Length); FieldInfo[] fields = instance.GetType().GetFields(); FieldInfo field; for (int m = 0; m < fields.Length; m++) { field = fields[m]; if (!field.IsInitOnly) { continue; } field.SetValue(instance, ConfigTools.ReadSimpleBuffer(field.FieldType, _byteBuffer)); } _configs[t].Add(id, instance); } else { Debug.Log("解析byte配置类型: " + t.Name + " ID: " + id + " 发生错误."); } return(instance); } if (_sourceData.ContainsKey(t)) { Type baseType = null; //derivedType不为空的特殊处理 FileLineInfo flInfo; if (!_sourceData[t].TryGetValue(id, out flInfo)) { Debug.Log("配置表 " + t + " 中未能找到: " + id); return(null); } if (flInfo.DerivedType != null) { baseType = t; t = _sourceData[t][id].DerivedType; } Type dicType = baseType ?? t; instance = _parseConfigSource(_dicFileFieldInfo[t.Name][0], _dicFileFieldInfo[t.Name][2], _sourceData[dicType][id].LineData, t); if (instance != null) { _configs[dicType].Add(id, instance); } else { Debug.Log("解析配置类型: " + t.Name + " ID: " + id + " 发生错误."); } return(instance); } return(null); }