// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Q)) { config1 = CsvManager.GetLevel("1"); } }
/// <summary> /// 读取TypeARCsvLevel表的第id行 /// </summary> /// <param name="id"></param> /// <returns></returns> public static TypeARCsvLevel GetLevel(string id) { //创建一个唯一的 有意义的key值 string key = "public static TypeARCsvLevel GetLevel(string id)" + id; //判断当前的key值 所对应的数据是不是已经被缓存过了 if (_cache.ContainsKey(key)) { return((TypeARCsvLevel)_cache[key]); } //读表 参数表的 全名 CsvReader reader = _reader["level.csv"]; //解析表 参数是 表中 第一列字段对应的 编号 TypeARCsvLevel csv = reader.GetData <TypeARCsvLevel>(id); if (csv == null) { _cache.Add(key, null); } else { _cache.Add(key, (CsvBase)csv); } return(csv); }