using Bright.Serialization; using GameBase; using GameConfig; using TEngine; using UnityEngine; /// /// 配置加载器。 /// public class ConfigLoader : 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) { var textAssets = GameModule.Resource.LoadAsset(file); byte[] ret = textAssets.bytes; return new ByteBuf(ret); } } public class ConfigSystem : BaseLogicSys { public Tables Tables => ConfigLoader.Instance.Tables; public override bool OnInit() { InitConfig(); return base.OnInit(); } private void InitConfig() { ConfigLoader.Instance.Load(); } }