LubanTools支持

This commit is contained in:
Alex-Rachel
2025-03-12 11:40:05 +08:00
parent 106d90da4d
commit 77d07e175a
5 changed files with 46 additions and 4 deletions

View File

@@ -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);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: caeffc4d6ca44936a5c2e191a6ef906e
timeCreated: 1741750069

View File

@@ -0,0 +1,20 @@
using UnityEditor;
using UnityEngine;
namespace TEngine.Editor
{
public static class LubanTools
{
[MenuItem("TEngine/Luban/转表 &X", priority = -100)]
private static void ZhuanXiaoYi()
{
#if UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX
string path = Application.dataPath + "/../../Configs/GameConfig/gen_code_bin_to_project_lazyload.sh";
#elif UNITY_EDITOR_WIN
string path = Application.dataPath + "/../../Configs/GameConfig/gen_code_bin_to_project_lazyload.bat";
#endif
Debug.Log($"执行转表:{path}");
ShellHelper.RunByPath(path);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 16ad4ede8ed745f3b6f90b58b7427f5e
timeCreated: 1741750081

View File

@@ -102,5 +102,13 @@ namespace TEngine.Editor
process.Close();
}
}
public static void RunByPath(string path)
{
if (!string.IsNullOrEmpty(path))
{
Process.Start(path);
}
}
}
}