Update README.md

This commit is contained in:
dingxiaowei
2022-09-11 19:20:27 +08:00
committed by GitHub
parent 0268ad7abd
commit 0095de8b57
+22
View File
@@ -231,6 +231,28 @@ else
Debug.LogError("数据读取错误"); Debug.LogError("数据读取错误");
} }
``` ```
#### 泛型读表
```
T ReadTable<T>(string tableName) where T : IBinarySerializable, new()
{
var bytes = LoadTextAsset(tableName);
if (bytes != null)
{
IBinarySerializable data = new T();
var readOK = FileManager.ReadBinaryDataFromBytes(bytes.bytes, ref data);
if (readOK)
{
return (T)data;
}
else
{
Debug.LogError($"{tableName}解析出错 类型{typeof(T)}");
}
}
return default(T);
}
```
##### 查询数据 ##### 查询数据
``` ```
var avatarguideTest = (avatarguideTestConfig)newavList; var avatarguideTest = (avatarguideTestConfig)newavList;