using Luban;
using GameBase;
using GameConfig;
using TEngine;
using UnityEngine;
///
/// 配置加载器。
///
public class ConfigSystem : Singleton
{
private bool _init = false;
private Tables _tables;
public Tables Tables
{
get
{
if (!_init)
{
Load();
}
return _tables;
}
}
///
/// 加载配置。
///
public void Load()
{
_tables = new Tables(LoadByteBuf);
_init = true;
}
///
/// 加载二进制配置。
///
/// FileName
/// ByteBuf
private ByteBuf LoadByteBuf(string file)
{
TextAsset textAsset = GameModule.Resource.LoadAsset(file);
byte[] bytes = textAsset.bytes;
GameModule.Resource.UnloadAsset(textAsset);
return new ByteBuf(bytes);
}
}