Init TEngine4.0.0

Init TEngine4.0.0
This commit is contained in:
ALEXTANG
2023-10-08 15:21:33 +08:00
parent 4c8c37ffd8
commit 8c3d6308b9
3773 changed files with 49313 additions and 150734 deletions

View File

@@ -0,0 +1,48 @@
using Bright.Serialization;
using GameBase;
using GameConfig;
using TEngine;
using UnityEngine;
/// <summary>
/// 配置加载器。
/// </summary>
public class ConfigSystem : Singleton<ConfigSystem>
{
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>(file);
byte[] ret = textAssets.bytes;
return new ByteBuf(ret);
}
}

View File

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

View File

@@ -0,0 +1,87 @@
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
}}
namespace {{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 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();
}
}

View File

@@ -0,0 +1,413 @@
using Bright.Serialization;
using System.Collections.Generic;
using System.Linq;
namespace {{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}}
{
public static {{name}} Instance { get; private set; }
{{~if x.is_map_table ~}}
private bool _readAll = false;
private Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> _dataMap;
private List<{{cs_define_type value_type}}> _dataList;
public Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> DataMap
{
get
{
if(!_readAll)
{
ReadAll();
_readAll = true;
}
return _dataMap;
}
}
public List<{{cs_define_type value_type}}> DataList
{
get
{
if(!_readAll)
{
ReadAll();
_readAll = true;
}
return _dataList;
}
}
private Dictionary<{{cs_define_type key_type}},int> _indexMap;
public List<{{cs_define_type key_type}}> Indexes;
private System.Func<ByteBuf> _dataLoader;
private void ReadAll()
{
_dataList.Clear();
foreach(var index in Indexes)
{
var v = Get(index);
_dataMap[index] = v;
_dataList.Add(v);
}
}
public {{name}}(ByteBuf _buf, string _tbName, System.Func<string, ByteBuf> _loader)
{
Instance = this;
_dataMap = new Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}>();
_dataList = new List<{{cs_define_type value_type}}>();
_indexMap = new Dictionary<{{cs_define_type key_type}}, int>();
_dataLoader = new System.Func<ByteBuf>(() => _loader(_tbName));
for (int n = _buf.ReadSize(); n > 0; --n)
{
{{cs_define_type key_type}} key;
{{cs_deserialize '_buf' 'key' key_type}}
int index = _buf.ReadInt();
_indexMap[key] = index;
}
Indexes = _indexMap.Keys.ToList();
PostInit();
}
{{~if value_type.is_dynamic~}}
public T GetOrDefaultAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}}
{
if(_indexMap.TryGetValue(key,out var _))
{
return (T)Get(key);
}
return default(T);
}
public T GetAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => (T)Get(key);
{{~end~}}
public {{cs_define_type value_type}} this[{{cs_define_type key_type}} key] => Get(key);
public {{cs_define_type value_type}} Get({{cs_define_type key_type}} key)
{
{{cs_define_type value_type}} _v;
if(_dataMap.TryGetValue(key, out _v))
{
return _v;
}
ResetByteBuf(_indexMap[key]);
{{cs_deserialize '_buf' '_v' value_type}}
_dataMap[_v.{{x.index_field.convention_name}}] = _v;
_v.Resolve(tables);
if(_indexMap.Count == _dataMap.Count)
{
_buf = null;
}
return _v;
}
public {{cs_define_type value_type}} GetOrDefault({{cs_define_type key_type}} key)
{
if(_indexMap.TryGetValue(key,out var _))
{
return Get(key);
}
return null;
}
{{~else if x.is_list_table ~}}
private bool _readAllList = false;
private List<{{cs_define_type value_type}}> _dataList;
public List<{{cs_define_type value_type}}> DataList
{
get
{
if(!_readAllList)
{
ReadAllList();
_readAllList = true;
}
return _dataList;
}
}
private System.Func<ByteBuf> _dataLoader;
{{~if x.is_union_index~}}
private bool _readAll;
private {{cs_table_union_map_type_name x}} _dataMapUnion;
public {{cs_table_union_map_type_name x}} DataMapUnion
{
get
{
if(!_readAll)
{
ReadAll();
_readAll = true;
}
return _dataMapUnion;
}
}
private void ReadAll()
{
foreach(var index in Indexes)
{
var ({{cs_table_get_param_name_list x}}) = index;
var v = Get({{cs_table_get_param_name_list x}});
_dataMapUnion[({{cs_table_get_param_name_list x}})] = v;
}
}
private void ReadAllList()
{
_dataList.Clear();
foreach(var index in Indexes)
{
var ({{cs_table_get_param_name_list x}}) = index;
var v = Get({{cs_table_get_param_name_list x}});
_dataList.Add(v);
}
}
private Dictionary<({{cs_table_get_param_def_list x}}),int> _indexMap;
public List<({{cs_table_get_param_def_list x}})> Indexes;
{{~else if !x.index_list.empty?~}}
{{~for idx in x.index_list~}}
private bool _readAll{{idx.index_field.convention_name}} = false;
private Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> _dataMap_{{idx.index_field.name}};
public Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> DataMap_{{idx.index_field.name}}
{
get
{
if(!_readAll{{idx.index_field.convention_name}})
{
ReadAll{{idx.index_field.convention_name}}();
_readAll{{idx.index_field.convention_name}} = true;
}
return _dataMap_{{idx.index_field.name}};
}
}
{{~if for.first ~}}
private void ReadAllList()
{
_dataList.Clear();
foreach(var index in Indexes_{{idx.index_field.name}})
{
var v = GetBy{{idx.index_field.convention_name}}(index);
_dataList.Add(v);
}
}
{{~end~}}
private void ReadAll{{idx.index_field.convention_name}}()
{
foreach(var index in Indexes_{{idx.index_field.name}})
{
var v = GetBy{{idx.index_field.convention_name}}(index);
_dataMap_{{idx.index_field.name}}[index] = v;
}
}
private Dictionary<{{cs_define_type idx.type}},int> _indexMap_{{idx.index_field.name}};
public List<{{cs_define_type idx.type}}> Indexes_{{idx.index_field.name}};
{{~end~}}
{{~else~}}
private bool _readAll = false;
private Dictionary<int,int> _indexMap;
public List<int> Indexes;
private Dictionary<int, {{cs_define_type value_type}}> _dataMap;
private Dictionary<int, {{cs_define_type value_type}}> DataMap
{
get
{
if(!_readAll)
{
ReadAllList();
}
return _dataMap;
}
}
private void ReadAllList()
{
_dataList.Clear();
foreach(var index in Indexes)
{
var v = Get(index);
_dataList.Add(v);
}
}
{{~end~}}
public {{name}}(ByteBuf _buf, string _tbName, System.Func<string, ByteBuf> _loader)
{
Instance = this;
_dataList = new List<{{cs_define_type value_type}}>();
_dataLoader = new System.Func<ByteBuf>(()=> _loader(_tbName));
{{~if x.is_union_index~}}
_dataMapUnion = new {{cs_table_union_map_type_name x}}();
_indexMap = new Dictionary<({{cs_table_get_param_def_list x}}),int>();
{{key_value ='('}}
for (int i = _buf.ReadSize(); i > 0; i--)
{
{{~for idx in x.index_list~}}
{{field_name = 'key'+for.index}}
{{cs_define_type idx.type}} {{field_name}};
{{cs_deserialize '_buf' field_name idx.type}}
{{~if for.last~}}
{{key_value=key_value+field_name+')'}}
{{~else~}}
{{key_value=key_value+field_name+', '}}
{{~end~}}
{{~end~}}
_indexMap.Add({{key_value}}, _buf.ReadInt());
}
Indexes = _indexMap.Keys.ToList();
{{~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}}>();
_indexMap_{{idx.index_field.name}} = new Dictionary<{{cs_define_type idx.type}},int>();
{{~end~}}
int size = _buf.ReadSize();
for(int i = 0; i < size; i++)
{
{{~for idx in x.index_list~}}
{{cs_define_type idx.type}} key_{{idx.index_field.name}};
{{cs_deserialize '_buf' 'key_'+idx.index_field.name idx.type}}
{{~end~}}
int index = _buf.ReadInt();
{{~for idx in x.index_list~}}
_indexMap_{{idx.index_field.name}}.Add(key_{{idx.index_field.name}},index);
{{~end~}}
}
{{~for idx in x.index_list~}}
Indexes_{{idx.index_field.name}} = _indexMap_{{idx.index_field.name}}.Keys.ToList();
{{~end~}}
{{~else~}}
_indexMap = new Dictionary<int,int>();
_dataMap = new Dictionary<int, {{cs_define_type value_type}}>();
int size = _buf.ReadSize();
for(int i = 0; i < size; i++)
{
_indexMap.Add(i,_buf.ReadInt());
}
Indexes = _indexMap.Keys.ToList();
{{~end~}}
}
{{~if x.is_union_index~}}
public {{cs_define_type value_type}} Get({{cs_table_get_param_def_list x}})
{
{{cs_define_type value_type}} __v;
if(_dataMapUnion.TryGetValue(({{cs_table_get_param_name_list x}}), out __v))
{
return __v;
}
ResetByteBuf(_indexMap[({{cs_table_get_param_name_list x}})]);
{{cs_deserialize '_buf' '__v' value_type}}
_dataList.Add(__v);
_dataMapUnion.Add(({{cs_table_get_param_name_list x}}), __v);
__v.Resolve(tables);
if(_indexMap.Count == _dataMapUnion.Count)
{
_buf = null;
}
return __v;
}
{{~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)
{
if(_dataMap_{{idx.index_field.name}}.TryGetValue(key,out var value))
{
return value;
}
int index = _indexMap_{{idx.index_field.name}}[key];
ResetByteBuf(index);
{{cs_define_type value_type}} _v;
{{cs_deserialize '_buf' '_v' value_type}}
_dataMap_{{idx.index_field.name}}[key] = _v;
_v.Resolve(tables);
return _v;
}
{{~end~}}
{{~else if x.index_list.empty? ~}}
public {{cs_define_type value_type}} this[int index] => Get(index);
public {{cs_define_type value_type}} Get(int index)
{
{{cs_define_type value_type}} _v;
if(_dataMap.TryGetValue(index, out _v))
{
return _v;
}
ResetByteBuf(_indexMap[index]);
{{cs_deserialize '_buf' '_v' value_type}}
_dataMap[index] = _v;
_v.Resolve(tables);
if(_indexMap.Count == _dataMap.Count)
{
_buf = null;
}
return _v;
}
{{~end~}}
{{~else~}}
private {{cs_define_type value_type}} _data;
public {{name}} (ByteBuf _buf, string _tbName, System.Func<string, ByteBuf> _loader)
{
Instance = this;
ByteBuf _dataBuf = _loader(_tbName);
int n = _buf.ReadSize();
int m = _dataBuf.ReadSize();
if (n != 1 || m != 1) throw new SerializationException("table mode=one, but size != 1");
{{cs_deserialize '_dataBuf' '_data' value_type}}
}
{{~ 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}};
{{~if field.gen_ref~}}
public {{cs_define_type field.ref_type}} {{field.convention_name}}_Ref => _data.{{field.convention_name}}_Ref;
{{~end~}}
{{~end~}}
{{~end~}}
{{~if x.is_map_table||x.is_list_table ~}}
private void ResetByteBuf(int readerInex = 0)
{
if( _buf == null)
{
if (_buf == null)
{
_buf = _dataLoader();
}
}
_buf.ReaderIndex = readerInex;
}
{{~end~}}
{{~if x.mode != 'ONE'~}}
private ByteBuf _buf = null;
private Dictionary<string, object> tables;
{{~end~}}
public void CacheTables(Dictionary<string, object> _tables)
{
{{~if x.mode == 'ONE'~}}
_data.Resolve(_tables);
{{~else~}}
tables = _tables;
{{~end~}}
}
partial void PostInit();
}
}

View File

@@ -0,0 +1,40 @@
using Bright.Serialization;
{{
name = x.name
namespace = x.namespace
tables = x.tables
}}
namespace {{namespace}}
{
public partial class {{name}}
{
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/// <summary>
/// {{table.escape_comment}}
/// </summary>
{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}
public {{name}}(System.Func<string, ByteBuf> idxLoader,System.Func<string, ByteBuf> dataLoader)
{
var tables = new System.Collections.Generic.Dictionary<string, object>();
{{~for table in tables ~}}
{{table.name}} = new {{table.full_name}}(idxLoader("{{table.output_data_file}}"),"{{table.output_data_file}}",dataLoader);
tables.Add("{{table.full_name}}", {{table.name}});
{{~end~}}
PostInit();
{{~for table in tables ~}}
{{table.name}}.CacheTables(tables);
{{~end~}}
}
partial void PostInit();
}
}

View File

@@ -0,0 +1,95 @@
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 ConfigSystem : Singleton<ConfigSystem>
{
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;
}
}

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,53 @@
using Bright.Serialization;
using Cysharp.Threading.Tasks;
using System.Collections.Generic;
{{
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 UniTask LoadAsync(System.Func<string, UniTask<ByteBuf>> loader)
{
var tables = new System.Collections.Generic.Dictionary<string, object>();
List<UniTask> list = new List<UniTask>();
{{~for table in tables ~}}
list.Add(UniTask.Create(async () =>
{
{{table.name}} = new {{table.full_name}}(await loader("{{table.output_data_file}}"));
tables.Add("{{table.full_name}}", {{table.name}});
}));
{{~end~}}
await UniTask.WhenAll(list);
{{~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

@@ -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~}}
}
}
}

36
Configs/Defines/Actor.xml Normal file
View File

@@ -0,0 +1,36 @@
<module name="Battle">
<enum name="ActorAttrDataType">
<var name="None" alias="无效数据" value="0"/>
<var name="MaxHp" alias="最大血量" value="1"/>
<var name="Attack" alias="攻击力" value="2"/>
<var name="PhyDamage" alias="物理伤害" value="3"/>
<var name="PhyDef" alias="物理防御" value="4"/>
<var name="MagicDamage" alias="法术伤害" value="5"/>
<var name="MagicDef" alias="法术防御" value="6"/>
<var name="MoveSpeed" alias="移动速度" value="7"/>
<var name="AttackSpeed" alias="攻击速度" value="8"/>
<var name="Hit" alias="命中率" value="9"/>
<var name="Dodge" alias="闪避率" value="10"/>
<var name="CriticalAtkRatio" alias="暴击率" value="11"/>
<var name="SanValue" alias="San值(疯狂值)" value="12"/>
<var name="MaxMp" alias="最大MP" value="13"/>
<var name="PhyDamageRatio" alias="物理伤害倍率" value="14"/>
<var name="MagicDamageRatio" alias="魔法伤害倍率" value="15"/>
<var name="CriticalRatio" alias="暴击倍率" value="16"/>
<var name="CriticalReduce" alias="暴击减免" value="17"/>
</enum>
<enum name="ActorAttrAddType">
<var name="NONE" alias="无效数据" value="0"/>
<var name="ABSOLUTE_VAL" alias="加法计算" value="1"/>
<var name="SUM_PERCENT_VAL" alias="多个项结果累加,然后对加法做乘法" value="2"/>
<var name="MUL_PERCENT_VAL" alias="每一项都是对最终结果做乘法" value="3"/>
</enum>
<bean name="ResAttrImpactData" sep="," parent="">
<var name="DataType" type="ActorAttrDataType"/>
<var name="AddType" type="ActorAttrAddType"/>
<var name="Value" type="float"/>
</bean>
</module>

View File

@@ -0,0 +1,68 @@
<module name="Battle">
<enum name="BuffTimeType">
<var name="BUFF_TIME_DURING" alias="指定持续时间" value="0"/>
<var name="BUFF_TIME_INFINIT" alias="无尽时间" value="1"/>
</enum>
<enum name="BuffReplaceType">
<var name="BUFF_REPLACE_INSTEAD" alias="更新时间范围" value="0"/>
<var name="BUFF_REPLACE_FORBIT" alias="不允许叠加" value="1"/>
<var name="BUFF_REPLACE_ADD_TIME" alias="累加时间范围" value="2"/>
<var name="BUFF_REPLACE_ADD_ATTR" alias="叠加数值" value="3"/>
<var name="BUFF_REPLACE_TYPE_COUNT" alias="叠加种类" value="4"/>
</enum>
<enum name="BuffStateID">
<var name="BUFF_STATE_NONE" alias="无状态" value="0"/>
<var name="BUFF_STATE_STUN" alias="眩晕状态" value="1"/>
<var name="BUFF_STATE_UNDEAD" alias="无敌状态" value="2"/>
<var name="BUFF_STATE_INVISIBLE" alias="隐身状态" value="3"/>
<var name="BUFF_STATE_BIGGER" alias="体形变大" value="4"/>
<var name="BUFF_STATE_NO_MOVE" alias="定身,不能移动" value="5"/>
<var name="BUFF_STATE_NO_SKILL" alias="沉默,不能放技能" value="6"/>
<var name="BUFF_STATE_SLEEP" alias="昏睡" value="7"/>
<var name="BUFF_STATE_FORCE_COLLIDER" alias="强制开启阻挡" value="8"/>
<var name="BUFF_STATE_IGNORE_COLLIDER" alias="无视阻挡" value="9"/>
<var name="BUFF_STATE_MAX" alias="最大状态" value="10"/>
</enum>
<enum name="BuffResultType">
<var name="BUFF_RESULT_NONE" alias="无" value="0"/>
<var name="BUFF_RESULT_PHY_ATK_UP" alias="物理攻击提升" value="1"/>
<var name="BUFF_RESULT_PHY_ATK_DOWN" alias="物理攻击降低" value="2"/>
<var name="BUFF_RESULT_PHY_DEF_UP" alias="物理防御提升" value="3"/>
<var name="BUFF_RESULT_PHY_DEF_DOWN" alias="物理防御降低" value="4"/>
<var name="BUFF_RESULT_PHY_HIT_UP" alias="物理命中提升" value="5"/>
<var name="BUFF_RESULT_PHY_HIT_DOWN" alias="物理命中降低" value="6"/>
<var name="BUFF_RESULT_PHY_LOSE_HP" alias="物理持续掉血" value="7"/>
<var name="BUFF_RESULT_MAG_ATK_UP" alias="法术攻击提升" value="8"/>
<var name="BUFF_RESULT_MAG_ATK_DOWN" alias="法术攻击降低" value="9"/>
<var name="BUFF_RESULT_MAG_DEF_UP" alias="法术防御提升" value="10"/>
<var name="BUFF_RESULT_MAG_DEF_DOWN" alias="法术防御降低" value="11"/>
<var name="BUFF_RESULT_MAG_HIT_UP" alias="法术命中提升" value="12"/>
<var name="BUFF_RESULT_MAG_HIT_DOWN" alias="法术命中降低" value="13"/>
<var name="BUFF_RESULT_MAG_LOSE_HP" alias="法术持续掉血" value="14"/>
<var name="BUFF_RESULT_CIRT_UP" alias="暴击率提升" value="15"/>
<var name="BUFF_RESULT_CIRT_DOWN" alias="暴击率降低" value="16"/>
<var name="BUFF_RESULT_CIRT_VALUE_UP" alias="暴击倍率提升" value="17"/>
<var name="BUFF_RESULT_CIRT_VALUE_DOWN" alias="暴击倍率降低" value="18"/>
<var name="BUFF_RESULT_MOVE_SPEED_UP" alias="移速提升" value="19"/>
<var name="BUFF_RESULT_MOVE_SPEED_DOWN" alias="移速降低" value="20"/>
</enum>
<bean name="BuffTriggleState" sep="," parent="">
<var name="StateID" type="BuffStateID"/>
<var name="StateParam" type="float"/>
</bean>
<bean name="BuffDotTickConfig" sep="," parent="">
<!-- 触发间隔,如果为0, 则只加一次 -->
<var name="TickTime" type="float"/>
<!-- 1增加buff的时候立刻触发,否则等待TickTime后再触发 -->
<var name="TickWhenAdd" type="int"/>
</bean>
</module>

View File

@@ -0,0 +1,25 @@
<module name="Battle">
<enum name="SkillMagicType"> 技能元素类型
<var name="SKILL_TYPE_NONE" alias="无类型" value="0"/>
<var name="SKILL_TYPE_DMG_PHY" alias="物理伤害属性" value="1"/>
<var name="SKILL_TYPE_DMG_MAGIC" alias="魔法伤害属性" value="2"/>
</enum>
<enum name="SkillAttrDamageType"> 伤害类型
<var name="ATTR_TYPE_NONE" alias="无数值" value="0"/>
<var name="ATTR_TYPE_DMG_WEAPON" alias="按释放者的伤害类型*X%+固定值计算,目标有防御计算" value="1"/>
<var name="ATTR_TYPE_DMG_NO_DEFEND" alias="按释放者的伤害类型*X%+固定值计算(无视目标的防御)" value="2"/>
<var name="ATTR_TYPE_DMG_TARGET_HP_NO_DEFEND" alias="按受击者的气血上限*X%+固定值计算(无视目标的防御)" value="3"/>
<var name="ATTR_TYPE_HP_AS_ATK" alias="按释放者的攻击类型*X%+固定值计算,恢复当前生命" value="4"/>
<var name="ATTR_TYPE_HP_RATIO" alias="按受击者的HP上限*X%+固定值计算,恢复当前生命" value="5"/>
</enum>
<bean name="SkillAttrDamageData" sep="," parent="">
<var name="MagicType" type="SkillMagicType"/>
<var name="AttrType" type="SkillAttrDamageType"/>
<var name="Param1" type="float"/>
<var name="Param2" type="float"/>
<var name="Param3" type="float"/>
<var name="MaxLimit" type="float"/>
</bean>
</module>

View File

@@ -0,0 +1,23 @@
<root>
<topmodule name="GameConfig"/>
<externalselector name="unity"/>
<patch name="cn"/>
<patch name="en"/>
<group name="c,client" default="1"/> client
<group name="s,server" default="1"/> server
<group name="e" default="1"/> editor
<import name="."/>
<importexcel name="__tables__.xlsx" type="table"/> 相对data目录
<importexcel name="__enums__.xlsx" type="enum"/>相对data目录
<importexcel name="__beans__.xlsx" type="bean"/>相对data目录
<service name="server" manager="Tables" group="s"/>
<service name="client" manager="Tables" group="c"/>
<service name="all" manager="Tables" group="c,s,e"/>
</root>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

@@ -0,0 +1,40 @@
cd /d %~dp0
set WORKSPACE=..
set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe
set CONF_ROOT=%WORKSPACE%\Configs
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
set CUSTOM_TEMP=%WORKSPACE%\Configs\CustomTemplate\CustomTemplate_Client_LazyLoad
xcopy %CUSTOM_TEMP%\ConfigSystem.cs %WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ConfigSystem.cs /s /e /i /y
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Client_LazyLoad -j cfg --^
-d %CONF_ROOT%\Defines\__root__.xml ^
--input_data_dir %CONF_ROOT%\Excels^
--output_code_dir %WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig ^
--output_data_dir %WORKSPACE%/UnityProject/Assets/AssetRaw/Configs/bytes/ ^
--gen_types data_bin ^
-s client
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Client_LazyLoad -j cfg --^
-d %CONF_ROOT%\Defines\__root__.xml ^
--input_data_dir %CONF_ROOT%\Excels^
--output_code_dir %WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig ^
--output_data_dir ..\GenerateDatas\bidx ^
--gen_types code_cs_unity_bin,data_bidx ^
-s client
echo ======== 生成配置文件结束 ========
set WORKSPACE=..
set "prefix=Idx_"
for %%a in (%DATA_OUTPUT%\bidx\*) do (
ren "%%a" "Idx_%%~nxa"
)
echo ======== 所有文件已添加前缀 ========
xcopy %DATA_OUTPUT%\bidx\ %WORKSPACE%\UnityProject\Assets\AssetRaw\Configs\bidx\ /s /e /i /y
pause

View File

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

View File

@@ -0,0 +1,18 @@
cd /d %~dp0
set WORKSPACE=..
set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe
set CONF_ROOT=%WORKSPACE%\Configs
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Server_Task -j cfg --^
-d %CONF_ROOT%\Defines\__root__.xml ^
--input_data_dir %CONF_ROOT%\Excels^
--output_code_dir %WORKSPACE%/DotNet/Logic/src/Config/GameConfig ^
--output_data_dir ..\DotNet\Config\GameConfig ^
--gen_types code_cs_bin,data_bin ^
-s server
echo ======== 生成配置文件结束 ========
pause