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);
|
||||
}
|
||||
}
|
3
UnityProject/Assets/TEngine/Editor/LubanTools.meta
Normal file
3
UnityProject/Assets/TEngine/Editor/LubanTools.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: caeffc4d6ca44936a5c2e191a6ef906e
|
||||
timeCreated: 1741750069
|
20
UnityProject/Assets/TEngine/Editor/LubanTools/LubanTools.cs
Normal file
20
UnityProject/Assets/TEngine/Editor/LubanTools/LubanTools.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16ad4ede8ed745f3b6f90b58b7427f5e
|
||||
timeCreated: 1741750081
|
@@ -102,5 +102,13 @@ namespace TEngine.Editor
|
||||
process.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void RunByPath(string path)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Process.Start(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user