mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
LubanTools支持
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Luban;
|
||||
using GameBase;
|
||||
using GameConfig;
|
||||
using TEngine;
|
||||
using UnityEngine;
|
||||
@@ -7,8 +6,12 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 配置加载器。
|
||||
/// </summary>
|
||||
public class ConfigSystem : Singleton<ConfigSystem>
|
||||
public class ConfigSystem
|
||||
{
|
||||
private static ConfigSystem _instance;
|
||||
|
||||
public static ConfigSystem Instance => _instance ??= new ConfigSystem();
|
||||
|
||||
private bool _init = false;
|
||||
|
||||
private Tables _tables;
|
||||
@@ -25,6 +28,8 @@ public class ConfigSystem : Singleton<ConfigSystem>
|
||||
return _tables;
|
||||
}
|
||||
}
|
||||
|
||||
private IResourceModule _resourceModule;
|
||||
|
||||
/// <summary>
|
||||
/// 加载配置。
|
||||
@@ -42,9 +47,12 @@ public class ConfigSystem : Singleton<ConfigSystem>
|
||||
/// <returns>ByteBuf</returns>
|
||||
private ByteBuf LoadByteBuf(string file)
|
||||
{
|
||||
TextAsset textAsset = GameModule.Resource.LoadAsset<TextAsset>(file);
|
||||
if (_resourceModule == null)
|
||||
{
|
||||
_resourceModule = ModuleSystem.GetModule<IResourceModule>();
|
||||
}
|
||||
TextAsset textAsset = _resourceModule.LoadAsset<TextAsset>(file);
|
||||
byte[] bytes = textAsset.bytes;
|
||||
GameModule.Resource.UnloadAsset(textAsset);
|
||||
return new ByteBuf(bytes);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user