拓展自定义鲁班加载配置,支持UniTask异步 默认使用同步加载

拓展自定义鲁班加载配置,支持UniTask异步 默认使用同步加载
This commit is contained in:
ALEXTANG
2023-08-17 22:00:55 +08:00
parent d7a60002d4
commit bf73ce333b
15 changed files with 592 additions and 107 deletions

View File

@@ -1,14 +1,11 @@
using System.Collections.Generic;
using System.Threading;
using Bright.Serialization;
using Cysharp.Threading.Tasks;
using GameBase;
using GameConfig;
using TEngine;
using UnityEngine;
/// <summary>
/// 配置加载器
/// 配置加载器
/// </summary>
public class ConfigLoader:Singleton<ConfigLoader>
{
@@ -22,84 +19,46 @@ public class ConfigLoader:Singleton<ConfigLoader>
{
if (!_init)
{
Log.Error("Config not loaded. You need Take LoadAsync at first.");
Load();
}
return _tables;
}
}
private readonly Dictionary<string, TextAsset> _configs = new Dictionary<string, TextAsset>();
/// <summary>
/// 异步加载配置。
/// 加载配置。
/// </summary>
public async UniTask LoadAsync()
public void Load()
{
_tables = new Tables();
await _tables.LoadAsync(LoadByteBufAsync);
_tables = new Tables(LoadByteBuf);
_init = true;
}
/// <summary>
/// 异步加载二进制配置。
/// 加载二进制配置。
/// </summary>
/// <param name="file">FileName</param>
/// <returns>ByteBuf</returns>
private async UniTask<ByteBuf> LoadByteBufAsync(string file)
private ByteBuf LoadByteBuf(string file)
{
#if false
GameTickWatcher gameTickWatcher = new GameTickWatcher();
#endif
byte[] ret;
var location = file;
if (_configs.TryGetValue(location, out var config))
{
ret = config.bytes;
}
else
{
var textAssets = await GameModule.Resource.LoadAssetAsync<TextAsset>(location,CancellationToken.None);
ret = textAssets.bytes;
RegisterTextAssets(file, textAssets);
}
#if false
Log.Warning($"LoadByteBuf {file} used time {gameTickWatcher.ElapseTime()}");
#endif
var textAssets = GameModule.Resource.LoadAsset<TextAsset>($"{SettingsUtils.FrameworkGlobalSettings.ConfigFolderName}{file}.bytes");
byte[] ret = textAssets.bytes;
return new ByteBuf(ret);
}
/// <summary>
/// 注册配置资源。
/// </summary>
/// <param name="key">资源Key。</param>
/// <param name="value">资源实例。</param>
/// <returns>注册成功。</returns>
private bool RegisterTextAssets(string key, TextAsset value)
{
if (string.IsNullOrEmpty(key))
{
return false;
}
if (value == null)
{
return false;
}
_configs[key] = value;
return true;
}
}
public class ConfigSystem : BaseLogicSys<ConfigSystem>
{
public override bool OnInit()
{
InitConfig().Forget();
Log.Warning("ConfigSystem OnInit");
InitConfig();
return base.OnInit();
}
private async UniTaskVoid InitConfig()
private void InitConfig()
{
await ConfigLoader.Instance.LoadAsync();
ConfigLoader.Instance.Load();
}
}
}

View File

@@ -6,53 +6,36 @@
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using Cysharp.Threading.Tasks;
using System.Collections.Generic;
namespace GameConfig
{
public partial class Tables
{
public sealed class Tables
{
public item.TbItem TbItem {get; private set; }
public Battle.TbSkill TbSkill {get; private set; }
public Battle.TbBuff TbBuff {get; private set; }
public Battle.TbBuffAttr TbBuffAttr {get; private set; }
public item.TbItem TbItem {get; }
public Battle.TbSkill TbSkill {get; }
public Battle.TbBuff TbBuff {get; }
public Battle.TbBuffAttr TbBuffAttr {get; }
public Tables() { }
public async UniTask LoadAsync(System.Func<string, UniTask<ByteBuf>> loader)
public Tables(System.Func<string, ByteBuf> loader)
{
var tables = new System.Collections.Generic.Dictionary<string, object>();
List<UniTask> list = new List<UniTask>();
list.Add(UniTask.Create(async () =>
{
TbItem = new item.TbItem(await loader("item_tbitem"));
tables.Add("item.TbItem", TbItem);
}));
list.Add(UniTask.Create(async () =>
{
TbSkill = new Battle.TbSkill(await loader("battle_tbskill"));
tables.Add("Battle.TbSkill", TbSkill);
}));
list.Add(UniTask.Create(async () =>
{
TbBuff = new Battle.TbBuff(await loader("battle_tbbuff"));
tables.Add("Battle.TbBuff", TbBuff);
}));
list.Add(UniTask.Create(async () =>
{
TbBuffAttr = new Battle.TbBuffAttr(await loader("battle_tbbuffattr"));
tables.Add("Battle.TbBuffAttr", TbBuffAttr);
}));
await UniTask.WhenAll(list);
TbItem = new item.TbItem(loader("item_tbitem"));
tables.Add("item.TbItem", TbItem);
TbSkill = new Battle.TbSkill(loader("battle_tbskill"));
tables.Add("Battle.TbSkill", TbSkill);
TbBuff = new Battle.TbBuff(loader("battle_tbbuff"));
tables.Add("Battle.TbBuff", TbBuff);
TbBuffAttr = new Battle.TbBuffAttr(loader("battle_tbbuffattr"));
tables.Add("Battle.TbBuffAttr", TbBuffAttr);
PostInit();
TbItem.Resolve(tables);
TbSkill.Resolve(tables);
TbBuff.Resolve(tables);
TbBuffAttr.Resolve(tables);
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
@@ -62,6 +45,9 @@ public sealed class Tables
TbBuff.TranslateText(translator);
TbBuffAttr.TranslateText(translator);
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -22,6 +22,7 @@ public sealed partial class Item : Bright.Config.BeanBase
UpgradeToItemId = _buf.ReadInt();
if(_buf.ReadBool()){ ExpireTime = _buf.ReadInt(); } else { ExpireTime = null; }
BatchUseable = _buf.ReadBool();
Quality = (item.EQuality)_buf.ReadInt();
ExchangeStream = item.ItemExchange.DeserializeItemExchange(_buf);
{int n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);ExchangeList = new System.Collections.Generic.List<item.ItemExchange>(n0);for(var i0 = 0 ; i0 < n0 ; i0++) { item.ItemExchange _e0; _e0 = item.ItemExchange.DeserializeItemExchange(_buf); ExchangeList.Add(_e0);}}
ExchangeColumn = item.ItemExchange.DeserializeItemExchange(_buf);
@@ -63,6 +64,10 @@ public sealed partial class Item : Bright.Config.BeanBase
/// </summary>
public bool BatchUseable { get; private set; }
/// <summary>
/// 品质
/// </summary>
public item.EQuality Quality { get; private set; }
/// <summary>
/// 道具兑换配置
/// </summary>
public item.ItemExchange ExchangeStream { get; private set; }
@@ -101,6 +106,7 @@ public sealed partial class Item : Bright.Config.BeanBase
+ "UpgradeToItemId:" + UpgradeToItemId + ","
+ "ExpireTime:" + ExpireTime + ","
+ "BatchUseable:" + BatchUseable + ","
+ "Quality:" + Quality + ","
+ "ExchangeStream:" + ExchangeStream + ","
+ "ExchangeList:" + Bright.Common.StringUtil.CollectionToString(ExchangeList) + ","
+ "ExchangeColumn:" + ExchangeColumn + ","

View File

@@ -0,0 +1,64 @@
using Bright.Serialization;
using GameBase;
using GameConfig;
using TEngine;
using UnityEngine;
/// <summary>
/// 配置加载器。
/// </summary>
public class ConfigLoader:Singleton<ConfigLoader>
{
private bool _init = false;
private Tables _tables;
public Tables Tables
{
get
{
if (!_init)
{
Load();
}
return _tables;
}
}
/// <summary>
/// 加载配置。
/// </summary>
public void Load()
{
_tables = new Tables(LoadByteBuf);
_init = true;
}
/// <summary>
/// 加载二进制配置。
/// </summary>
/// <param name="file">FileName</param>
/// <returns>ByteBuf</returns>
private ByteBuf LoadByteBuf(string file)
{
var textAssets = GameModule.Resource.LoadAsset<TextAsset>($"{SettingsUtils.FrameworkGlobalSettings.ConfigFolderName}{file}.bytes");
byte[] ret = textAssets.bytes;
return new ByteBuf(ret);
}
}
public class ConfigSystem : BaseLogicSys<ConfigSystem>
{
public override bool OnInit()
{
Log.Warning("ConfigSystem OnInit");
InitConfig();
return base.OnInit();
}
private void InitConfig()
{
ConfigLoader.Instance.Load();
}
}

View File

@@ -0,0 +1,110 @@
using System.Collections.Generic;
using System.Threading;
using Bright.Serialization;
using Cysharp.Threading.Tasks;
using GameBase;
using GameConfig;
using TEngine;
using UnityEngine;
/// <summary>
/// 配置加载器
/// </summary>
public class ConfigLoader:Singleton<ConfigLoader>
{
private bool _init = false;
private Tables _tables;
public Tables Tables
{
get
{
if (!_init)
{
#if !UNITY_WEBGL
_init = true;
#endif
Log.Error("Config not loaded. You need Take LoadAsync at first.");
}
return _tables;
}
}
private readonly Dictionary<string, TextAsset> _configs = new Dictionary<string, TextAsset>();
/// <summary>
/// 异步加载配置。
/// </summary>
public async UniTask LoadAsync()
{
_tables = new Tables();
await _tables.LoadAsync(LoadByteBufAsync);
_init = true;
}
/// <summary>
/// 异步加载二进制配置。
/// </summary>
/// <param name="file">FileName</param>
/// <returns>ByteBuf</returns>
private async UniTask<ByteBuf> LoadByteBufAsync(string file)
{
#if false
GameTickWatcher gameTickWatcher = new GameTickWatcher();
#endif
byte[] ret;
var location = file;
if (_configs.TryGetValue(location, out var config))
{
ret = config.bytes;
}
else
{
var textAssets = await GameModule.Resource.LoadAssetAsync<TextAsset>(location,CancellationToken.None);
ret = textAssets.bytes;
RegisterTextAssets(file, textAssets);
}
#if false
Log.Warning($"LoadByteBuf {file} used time {gameTickWatcher.ElapseTime()}");
#endif
return new ByteBuf(ret);
}
/// <summary>
/// 注册配置资源。
/// </summary>
/// <param name="key">资源Key。</param>
/// <param name="value">资源实例。</param>
/// <returns>注册成功。</returns>
private bool RegisterTextAssets(string key, TextAsset value)
{
if (string.IsNullOrEmpty(key))
{
return false;
}
if (value == null)
{
return false;
}
_configs[key] = value;
return true;
}
}
public class ConfigSystem : BaseLogicSys<ConfigSystem>
{
public override bool OnInit()
{
Log.Warning("ConfigSystem OnInit");
InitConfig().Forget();
return base.OnInit();
}
private async UniTaskVoid InitConfig()
{
await ConfigLoader.Instance.LoadAsync();
}
}

View File

@@ -0,0 +1,115 @@
using Bright.Serialization;
using System.Collections.Generic;
{{
name = x.name
parent_def_type = x.parent_def_type
export_fields = x.export_fields
hierarchy_export_fields = x.hierarchy_export_fields
}}
{{cs_start_name_space_grace x.namespace_with_top_module}}
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.escape_comment}}
/// </summary>
{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
{
{{~ for field in export_fields ~}}
{{cs_deserialize '_buf' field.convention_name field.ctype}}
{{~if field.index_field~}}
foreach(var _v in {{field.convention_name}})
{
{{field.convention_name}}_Index.Add(_v.{{field.index_field.convention_name}}, _v);
}
{{~end~}}
{{~end~}}
PostInit();
}
public static {{name}} Deserialize{{name}}(ByteBuf _buf)
{
{{~if x.is_abstract_type~}}
switch (_buf.ReadInt())
{
{{~for child in x.hierarchy_not_abstract_children~}}
case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf);
{{~end~}}
default: throw new SerializationException();
}
{{~else~}}
return new {{x.full_name}}(_buf);
{{~end~}}
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.escape_comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.convention_name}} { get; private set; }
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.convention_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
{{~end~}}
{{~if field.gen_ref~}}
public {{field.cs_ref_validator_define}}
{{~end~}}
{{~if (gen_datetime_mills field.ctype) ~}}
public long {{field.convention_name}}_Millis => {{field.convention_name}} * 1000L;
{{~end~}}
{{~if field.gen_text_key~}}
public {{cs_define_text_key_field field}} { get; }
{{~end~}}
{{~end~}}
{{~if !x.is_abstract_type~}}
public const int __ID__ = {{x.id}};
public override int GetTypeId() => __ID__;
{{~end~}}
public {{x.cs_method_modifier}} void Resolve(Dictionary<string, object> _tables)
{
{{~if parent_def_type~}}
base.Resolve(_tables);
{{~end~}}
{{~ for field in export_fields ~}}
{{~if field.gen_ref~}}
{{cs_ref_validator_resolve field}}
{{~else if field.has_recursive_ref~}}
{{cs_recursive_resolve field '_tables'}}
{{~end~}}
{{~end~}}
PostResolve();
}
public {{x.cs_method_modifier}} void TranslateText(System.Func<string, string, string> translator)
{
{{~if parent_def_type~}}
base.TranslateText(translator);
{{~end~}}
{{~ for field in export_fields ~}}
{{~if field.gen_text_key~}}
{{cs_translate_text field 'translator'}}
{{~else if field.has_recursive_text~}}
{{cs_recursive_translate_text field 'translator'}}
{{~end~}}
{{~end~}}
}
public override string ToString()
{
return "{{full_name}}{ "
{{~for field in hierarchy_export_fields ~}}
+ "{{field.convention_name}}:" + {{cs_to_string field.convention_name field.ctype}} + ","
{{~end~}}
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
{{cs_end_name_space_grace x.namespace_with_top_module}}

View File

@@ -0,0 +1,173 @@
using Bright.Serialization;
using System.Collections.Generic;
{{cs_start_name_space_grace x.namespace_with_top_module}}
{{
name = x.name
key_type = x.key_ttype
key_type1 = x.key_ttype1
key_type2 = x.key_ttype2
value_type = x.value_ttype
}}
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.escape_comment}}
/// </summary>
{{~end~}}
public partial class {{name}}
{
{{~if x.is_map_table ~}}
private readonly Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> _dataMap;
private readonly List<{{cs_define_type value_type}}> _dataList;
public {{name}}(ByteBuf _buf)
{
_dataMap = new Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}>();
_dataList = new List<{{cs_define_type value_type}}>();
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
{{cs_define_type value_type}} _v;
{{cs_deserialize '_buf' '_v' value_type}}
_dataList.Add(_v);
_dataMap.Add(_v.{{x.index_field.convention_name}}, _v);
}
PostInit();
}
public Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> DataMap => _dataMap;
public List<{{cs_define_type value_type}}> DataList => _dataList;
{{~if value_type.is_dynamic~}}
public T GetOrDefaultAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
public T GetAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => (T)_dataMap[key];
{{~end~}}
public {{cs_define_type value_type}} GetOrDefault({{cs_define_type key_type}} key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public {{cs_define_type value_type}} Get({{cs_define_type key_type}} key) => _dataMap[key];
public {{cs_define_type value_type}} this[{{cs_define_type key_type}} key] => _dataMap[key];
public void Resolve(Dictionary<string, object> _tables)
{
foreach(var v in _dataList)
{
v.Resolve(_tables);
}
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
foreach(var v in _dataList)
{
v.TranslateText(translator);
}
}
{{~else if x.is_list_table ~}}
private readonly List<{{cs_define_type value_type}}> _dataList;
{{~if x.is_union_index~}}
private {{cs_table_union_map_type_name x}} _dataMapUnion;
{{~else if !x.index_list.empty?~}}
{{~for idx in x.index_list~}}
private Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> _dataMap_{{idx.index_field.name}};
{{~end~}}
{{~end~}}
public {{name}}(ByteBuf _buf)
{
_dataList = new List<{{cs_define_type value_type}}>();
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
{{cs_define_type value_type}} _v;
{{cs_deserialize '_buf' '_v' value_type}}
_dataList.Add(_v);
}
{{~if x.is_union_index~}}
_dataMapUnion = new {{cs_table_union_map_type_name x}}();
foreach(var _v in _dataList)
{
_dataMapUnion.Add(({{cs_table_key_list x "_v"}}), _v);
}
{{~else if !x.index_list.empty?~}}
{{~for idx in x.index_list~}}
_dataMap_{{idx.index_field.name}} = new Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}>();
{{~end~}}
foreach(var _v in _dataList)
{
{{~for idx in x.index_list~}}
_dataMap_{{idx.index_field.name}}.Add(_v.{{idx.index_field.convention_name}}, _v);
{{~end~}}
}
{{~end~}}
PostInit();
}
public List<{{cs_define_type value_type}}> DataList => _dataList;
{{~if x.is_union_index~}}
public {{cs_define_type value_type}} Get({{cs_table_get_param_def_list x}}) => _dataMapUnion.TryGetValue(({{cs_table_get_param_name_list x}}), out {{cs_define_type value_type}} __v) ? __v : null;
{{~else if !x.index_list.empty? ~}}
{{~for idx in x.index_list~}}
public {{cs_define_type value_type}} GetBy{{idx.index_field.convention_name}}({{cs_define_type idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{cs_define_type value_type}} __v) ? __v : null;
{{~end~}}
{{~end~}}
public void Resolve(Dictionary<string, object> _tables)
{
foreach(var v in _dataList)
{
v.Resolve(_tables);
}
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
foreach(var v in _dataList)
{
v.TranslateText(translator);
}
}
{{~else~}}
private readonly {{cs_define_type value_type}} _data;
public {{name}}(ByteBuf _buf)
{
int n = _buf.ReadSize();
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
{{cs_deserialize '_buf' '_data' value_type}}
PostInit();
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.escape_comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.convention_name}} => _data.{{field.convention_name}};
{{~end~}}
public void Resolve(Dictionary<string, object> _tables)
{
_data.Resolve(_tables);
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
_data.TranslateText(translator);
}
{{~end~}}
partial void PostInit();
partial void PostResolve();
}
{{cs_end_name_space_grace x.namespace_with_top_module}}

View File

@@ -0,0 +1,46 @@
using Bright.Serialization;
using System.Threading.Tasks;
{{
name = x.name
namespace = x.namespace
tables = x.tables
}}
namespace {{namespace}}
{
public sealed class {{name}}
{
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/// <summary>
/// {{table.escape_comment}}
/// </summary>
{{~end~}}
public {{table.full_name}} {{table.name}} {get; private set; }
{{~end~}}
public {{name}}() { }
public async Task LoadAsync(System.Func<string, Task<ByteBuf>> loader)
{
var tables = new System.Collections.Generic.Dictionary<string, object>();
{{~for table in tables ~}}
{{table.name}} = new {{table.full_name}}(await loader("{{table.output_data_file}}"));
tables.Add("{{table.full_name}}", {{table.name}});
{{~end~}}
{{~for table in tables ~}}
{{table.name}}.Resolve(tables);
{{~end~}}
}
public void TranslateText(System.Func<string, string, string> translator)
{
{{~for table in tables ~}}
{{table.name}}.TranslateText(translator);
{{~end~}}
}
}
}

View File

@@ -1,15 +1,14 @@
using Bright.Serialization;
using System.Threading.Tasks;
{{
name = x.name
namespace = x.namespace
tables = x.tables
}}
namespace {{namespace}}
{
public sealed class {{name}}
{{cs_start_name_space_grace x.namespace}}
public partial class {{name}}
{
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
@@ -17,22 +16,22 @@ public sealed class {{name}}
/// {{table.escape_comment}}
/// </summary>
{{~end~}}
public {{table.full_name}} {{table.name}} {get; private set; }
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}
public {{name}}() { }
public async Task LoadAsync(System.Func<string, Task<ByteBuf>> loader)
public {{name}}(System.Func<string, ByteBuf> loader)
{
var tables = new System.Collections.Generic.Dictionary<string, object>();
{{~for table in tables ~}}
{{table.name}} = new {{table.full_name}}(await loader("{{table.output_data_file}}"));
{{table.name}} = new {{table.full_name}}(loader("{{table.output_data_file}}"));
tables.Add("{{table.full_name}}", {{table.name}});
{{~end~}}
PostInit();
{{~for table in tables ~}}
{{table.name}}.Resolve(tables);
{{~end~}}
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
@@ -41,6 +40,9 @@ public sealed class {{name}}
{{table.name}}.TranslateText(translator);
{{~end~}}
}
partial void PostInit();
partial void PostResolve();
}
}
{{cs_end_name_space_grace x.namespace}}

View File

@@ -4,14 +4,17 @@ set WORKSPACE=..
set GEN_CLIENT=%WORKSPACE%\Luban\Luban.ClientServer\Luban.ClientServer.exe
set CONF_ROOT=%WORKSPACE%\Luban\Config
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
set CUSTOM_TEMP=%WORKSPACE%\Luban\CustomTemplate_Client
%GEN_CLIENT% --template_search_path CustomTemplate -j cfg --^
xcopy %CUSTOM_TEMP%\ConfigLoader.cs %WORKSPACE%\Assets\GameScripts\HotFix\GameProto\\ConfigLoader.cs /s /e /i /y
%GEN_CLIENT% -j cfg --^
-d %CONF_ROOT%\Defines\__root__.xml ^
--input_data_dir %CONF_ROOT%\Datas ^
--output_code_dir %WORKSPACE%/Assets/GameScripts/HotFix/GameProto/GameConfig ^
--output_data_dir %WORKSPACE%/Assets/AssetRaw/Configs/bytes/ ^
--output_data_dir ..\GenerateDatas\bytes ^
--gen_types code_cs_unity_bin,data_bin ^
-s client
-s all
echo ======== 生成配置文件结束 ========

View File

@@ -0,0 +1,21 @@
cd /d %~dp0
set WORKSPACE=..
set GEN_CLIENT=%WORKSPACE%\Luban\Luban.ClientServer\Luban.ClientServer.exe
set CONF_ROOT=%WORKSPACE%\Luban\Config
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
set CUSTOM_TEMP=%WORKSPACE%\Luban\CustomTemplate_Client_UniTask
xcopy %CUSTOM_TEMP%\ConfigLoader.cs %WORKSPACE%\Assets\GameScripts\HotFix\GameProto\\ConfigLoader.cs /s /e /i /y
%GEN_CLIENT% --template_search_path CustomTemplate_Client_UniTask -j cfg --^
-d %CONF_ROOT%\Defines\__root__.xml ^
--input_data_dir %CONF_ROOT%\Datas ^
--output_code_dir %WORKSPACE%/Assets/GameScripts/HotFix/GameProto/GameConfig ^
--output_data_dir %WORKSPACE%/Assets/AssetRaw/Configs/bytes/ ^
--gen_types code_cs_unity_bin,data_bin ^
-s client
echo ======== 生成配置文件结束 ========
pause

View File

@@ -5,7 +5,7 @@ set GEN_CLIENT=%WORKSPACE%\Luban\Luban.ClientServer\Luban.ClientServer.exe
set CONF_ROOT=%WORKSPACE%\Luban\Config
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
%GEN_CLIENT% -j cfg --^
%GEN_CLIENT% --template_search_path CustomTemplate_Server_Task -j cfg --^
-d %CONF_ROOT%\Defines\__root__.xml ^
--input_data_dir %CONF_ROOT%\Datas ^
--output_code_dir %WORKSPACE%/DotNet/Logic/src/Config/GameConfig ^