mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Luban;
|
||||
using SimpleJSON;
|
||||
|
||||
{{namespace_with_grace_begin __namespace}}
|
||||
public partial class {{__name}}
|
||||
{
|
||||
{{~for table in __tables ~}}
|
||||
{{~if table.comment != '' ~}}
|
||||
/// <summary>
|
||||
/// {{escape_comment table.comment}}
|
||||
/// </summary>
|
||||
{{~end~}}
|
||||
public {{table.full_name}} {{format_property_name __code_style table.name}} { get; private set; }
|
||||
{{~end~}}
|
||||
|
||||
public readonly int Count = {{ __tables | array.size }};
|
||||
|
||||
public Tables() { }
|
||||
|
||||
public async UniTask LoadAsync(System.Func<string, UniTask<ByteBuf>> loader)
|
||||
{
|
||||
{{~for table in __tables ~}}
|
||||
{{format_property_name __code_style table.name}} = new {{table.full_name}}(await loader("{{table.output_data_file}}"));
|
||||
{{~end~}}
|
||||
ResolveRef();
|
||||
}
|
||||
|
||||
private void ResolveRef()
|
||||
{
|
||||
{{~for table in __tables ~}}
|
||||
{{format_property_name __code_style table.name}}.ResolveRef(this);
|
||||
{{~end~}}
|
||||
}
|
||||
}
|
||||
|
||||
{{namespace_with_grace_end __namespace}}
|
@@ -0,0 +1,55 @@
|
||||
using Luban;
|
||||
|
||||
{{namespace_with_grace_begin __namespace}}
|
||||
public partial class {{__name}}
|
||||
{
|
||||
#region The Tables
|
||||
|
||||
{{~for table in __tables ~}}
|
||||
{{~if table.comment != '' ~}}
|
||||
/// <summary>
|
||||
/// {{escape_comment table.comment}}
|
||||
/// </summary>
|
||||
{{~end~}}
|
||||
private {{table.full_name}} m_{{table.name}};
|
||||
public {{table.full_name}} {{format_property_name __code_style table.name}}
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_{{table.name}} == null)
|
||||
{
|
||||
m_{{table.name}} = new {{table.full_name}}(defaultLoader("{{table.output_data_file}}"));
|
||||
m_{{table.name}}.ResolveRef(this);
|
||||
}
|
||||
return m_{{table.name}};
|
||||
}
|
||||
set
|
||||
{
|
||||
m_{{table.name}} = value;
|
||||
m_{{table.name}}.ResolveRef(this);
|
||||
}
|
||||
}
|
||||
{{~end~}}
|
||||
|
||||
#endregion
|
||||
|
||||
System.Func<string, ByteBuf> defaultLoader;
|
||||
|
||||
public {{__name}}(System.Func<string, ByteBuf> loader)
|
||||
{
|
||||
SetDefaultLoader(loader);
|
||||
Init();
|
||||
}
|
||||
|
||||
public void SetDefaultLoader(System.Func<string, ByteBuf> loader)
|
||||
{
|
||||
defaultLoader = null;
|
||||
defaultLoader = loader;
|
||||
}
|
||||
|
||||
//public partial void Init();
|
||||
|
||||
public void Init(){}
|
||||
}
|
||||
|
||||
{{namespace_with_grace_end __namespace}}
|
@@ -0,0 +1,163 @@
|
||||
using Luban;
|
||||
|
||||
{{
|
||||
key_type = __table.key_ttype
|
||||
value_type = __table.value_ttype
|
||||
|
||||
func index_type_name
|
||||
ret (declaring_type_name $0.type)
|
||||
end
|
||||
|
||||
func table_union_map_type_name
|
||||
ret 'System.Collections.Generic.Dictionary<(' + (array.each __table.index_list @index_type_name | array.join ', ') + '), ' + (declaring_type_name value_type) + '>'
|
||||
end
|
||||
|
||||
func table_key_list
|
||||
varName = $0
|
||||
indexList = __table.index_list |array.each do; ret varName + '.' + (format_property_name __code_style $0.index_field.name); end;
|
||||
ret array.join indexList ', '
|
||||
end
|
||||
|
||||
func table_param_def_list
|
||||
paramList = __table.index_list |array.each do; ret (declaring_type_name $0.type) + ' ' + $0.index_field.name; end
|
||||
ret array.join paramList ', '
|
||||
end
|
||||
|
||||
func table_param_name_list
|
||||
paramList = __table.index_list |array.each do; ret $0.index_field.name; end
|
||||
ret array.join paramList ', '
|
||||
end
|
||||
}}
|
||||
{{namespace_with_grace_begin __namespace_with_top_module}}
|
||||
{{~if __table.comment != '' ~}}
|
||||
/// <summary>
|
||||
/// {{escape_comment __table.comment}}
|
||||
/// </summary>
|
||||
{{~end~}}
|
||||
public partial class {{__name}}
|
||||
{
|
||||
{{~if __table.is_map_table ~}}
|
||||
private readonly System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> _dataMap;
|
||||
private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
|
||||
|
||||
public {{__name}}(ByteBuf _buf)
|
||||
{
|
||||
_dataMap = new System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}>();
|
||||
_dataList = new System.Collections.Generic.List<{{declaring_type_name value_type}}>();
|
||||
|
||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
||||
{
|
||||
{{declaring_type_name value_type}} _v;
|
||||
{{deserialize '_buf' '_v' value_type}}
|
||||
_dataList.Add(_v);
|
||||
_dataMap.Add(_v.{{format_property_name __code_style __table.index_field.name}}, _v);
|
||||
}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.Dictionary<{{declaring_type_name key_type}}, {{declaring_type_name value_type}}> DataMap => _dataMap;
|
||||
public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
|
||||
|
||||
{{~if value_type.is_dynamic~}}
|
||||
public T GetOrDefaultAs<T>({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
|
||||
public T GetAs<T>({{declaring_type_name key_type}} key) where T : {{declaring_type_name value_type}} => (T)_dataMap[key];
|
||||
{{~end~}}
|
||||
public {{declaring_type_name value_type}} GetOrDefault({{declaring_type_name key_type}} key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
||||
public {{declaring_type_name value_type}} Get({{declaring_type_name key_type}} key) => _dataMap[key];
|
||||
public {{declaring_type_name value_type}} this[{{declaring_type_name key_type}} key] => _dataMap[key];
|
||||
|
||||
public void ResolveRef({{__manager_name}} tables)
|
||||
{
|
||||
foreach(var _v in _dataList)
|
||||
{
|
||||
_v.ResolveRef(tables);
|
||||
}
|
||||
}
|
||||
|
||||
{{~else if __table.is_list_table ~}}
|
||||
private readonly System.Collections.Generic.List<{{declaring_type_name value_type}}> _dataList;
|
||||
|
||||
{{~if __table.is_union_index~}}
|
||||
private {{table_union_map_type_name}} _dataMapUnion;
|
||||
{{~else if !__table.index_list.empty?~}}
|
||||
{{~for idx in __table.index_list~}}
|
||||
private System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}> _dataMap_{{idx.index_field.name}};
|
||||
{{~end~}}
|
||||
{{~end~}}
|
||||
|
||||
public {{__name}}(ByteBuf _buf)
|
||||
{
|
||||
_dataList = new System.Collections.Generic.List<{{declaring_type_name value_type}}>();
|
||||
|
||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
||||
{
|
||||
{{declaring_type_name value_type}} _v;
|
||||
{{deserialize '_buf' '_v' value_type}}
|
||||
_dataList.Add(_v);
|
||||
}
|
||||
{{~if __table.is_union_index~}}
|
||||
_dataMapUnion = new {{table_union_map_type_name}}();
|
||||
foreach(var _v in _dataList)
|
||||
{
|
||||
_dataMapUnion.Add(({{table_key_list "_v"}}), _v);
|
||||
}
|
||||
{{~else if !__table.index_list.empty?~}}
|
||||
{{~for idx in __table.index_list~}}
|
||||
_dataMap_{{idx.index_field.name}} = new System.Collections.Generic.Dictionary<{{declaring_type_name idx.type}}, {{declaring_type_name value_type}}>();
|
||||
{{~end~}}
|
||||
foreach(var _v in _dataList)
|
||||
{
|
||||
{{~for idx in __table.index_list~}}
|
||||
_dataMap_{{idx.index_field.name}}.Add(_v.{{format_property_name __code_style idx.index_field.name}}, _v);
|
||||
{{~end~}}
|
||||
}
|
||||
{{~end~}}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<{{declaring_type_name value_type}}> DataList => _dataList;
|
||||
|
||||
{{~if __table.is_union_index~}}
|
||||
public {{declaring_type_name value_type}} Get({{table_param_def_list}}) => _dataMapUnion.TryGetValue(({{table_param_name_list}}), out {{declaring_type_name value_type}} __v) ? __v : null;
|
||||
{{~else if !__table.index_list.empty? ~}}
|
||||
{{~for idx in __table.index_list~}}
|
||||
public {{declaring_type_name value_type}} GetBy{{format_property_name __code_style idx.index_field.name}}({{declaring_type_name idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{declaring_type_name value_type}} __v) ? __v : null;
|
||||
{{~end~}}
|
||||
{{~end~}}
|
||||
|
||||
public void ResolveRef({{__manager_name}} tables)
|
||||
{
|
||||
foreach(var _v in _dataList)
|
||||
{
|
||||
_v.ResolveRef(tables);
|
||||
}
|
||||
}
|
||||
{{~else~}}
|
||||
|
||||
private readonly {{declaring_type_name value_type}} _data;
|
||||
|
||||
public {{declaring_type_name value_type}} Data => _data;
|
||||
|
||||
public {{__name}}(ByteBuf _buf)
|
||||
{
|
||||
int n = _buf.ReadSize();
|
||||
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
|
||||
{{deserialize '_buf' '_data' value_type}}
|
||||
}
|
||||
|
||||
|
||||
{{~ for field in value_type.def_bean.hierarchy_export_fields ~}}
|
||||
{{~if field.comment != '' ~}}
|
||||
/// <summary>
|
||||
/// {{escape_comment field.comment}}
|
||||
/// </summary>
|
||||
{{~end~}}
|
||||
public {{declaring_type_name field.ctype}} {{format_property_name __code_style field.name}} => _data.{{format_property_name __code_style field.name}};
|
||||
{{~end~}}
|
||||
|
||||
public void ResolveRef({{__manager_name}} tables)
|
||||
{
|
||||
_data.ResolveRef(tables);
|
||||
}
|
||||
{{~end~}}
|
||||
}
|
||||
|
||||
{{namespace_with_grace_end __namespace_with_top_module}}
|
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/__beans__.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/__beans__.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/__enums__.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/__enums__.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/__tables__.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/__tables__.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/item.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/item.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/全局表.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/全局表.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/副本系统/副本表.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/副本系统/副本表.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/副本系统/金币副本表.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/副本系统/金币副本表.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/副本系统/锻造石副本表.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/副本系统/锻造石副本表.xlsx
Normal file
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.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/常用/资源表.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/常用/资源表.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/地图.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/地图.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/宠物/宠物技能.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/宠物/宠物技能.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/宠物/宠物攻击.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/宠物/宠物攻击.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/宠物/宠物表.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/宠物/宠物表.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/属性/宠物初始属性.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/属性/宠物初始属性.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/属性/属性.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/属性/属性.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/属性/属性战力.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/属性/属性战力.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/战斗资源素材.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/战斗/战斗资源素材.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/服务器/服务器配置.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/服务器/服务器配置.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/活动/活动配置.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/活动/活动配置.xlsx
Normal file
Binary file not shown.
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/活动/竞技场/竞技场配置.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/活动/竞技场/竞技场配置.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/礼包/商店/商店礼包布局.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/礼包/商店/商店礼包布局.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/礼包/礼包.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/礼包/礼包.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/系统福利/每天挂机福利.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/系统福利/每天挂机福利.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/系统福利/每日签到.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/系统福利/每日签到.xlsx
Normal file
Binary file not shown.
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/邮箱/邮件文本.xlsx
Normal file
BIN
JNFrame2/Modules/Luban/DesignerConfigs/Datas/邮箱/邮件文本.xlsx
Normal file
Binary file not shown.
17
JNFrame2/Modules/Luban/DesignerConfigs/Defines/builtin.xml
Normal file
17
JNFrame2/Modules/Luban/DesignerConfigs/Defines/builtin.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<module name="">
|
||||
<bean name="vector2" valueType="1" sep=",">
|
||||
<var name="x" type="float"/>
|
||||
<var name="y" type="float"/>
|
||||
</bean>
|
||||
<bean name="vector3" valueType="1" sep=",">
|
||||
<var name="x" type="float"/>
|
||||
<var name="y" type="float"/>
|
||||
<var name="z" type="float"/>
|
||||
</bean>
|
||||
<bean name="vector4" valueType="1" sep=",">
|
||||
<var name="x" type="float"/>
|
||||
<var name="y" type="float"/>
|
||||
<var name="z" type="float"/>
|
||||
<var name="w" type="float"/>
|
||||
</bean>
|
||||
</module>
|
22
JNFrame2/Modules/Luban/DesignerConfigs/luban.conf
Normal file
22
JNFrame2/Modules/Luban/DesignerConfigs/luban.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"groups":
|
||||
[
|
||||
{"names":["c"], "default":true},
|
||||
{"names":["s"], "default":true},
|
||||
{"names":["e"], "default":true}
|
||||
],
|
||||
"schemaFiles":
|
||||
[
|
||||
{"fileName":"Defines", "type":""},
|
||||
{"fileName":"Datas/__tables__.xlsx", "type":"table"},
|
||||
{"fileName":"Datas/__beans__.xlsx", "type":"bean"},
|
||||
{"fileName":"Datas/__enums__.xlsx", "type":"enum"}
|
||||
],
|
||||
"dataDir": "Datas",
|
||||
"targets":
|
||||
[
|
||||
{"name":"server", "manager":"Tables", "groups":["s"], "topModule":"GameConfig"},
|
||||
{"name":"client", "manager":"Tables", "groups":["c"], "topModule":"GameConfig"},
|
||||
{"name":"all", "manager":"Tables", "groups":["c","s","e"], "topModule":"GameConfig"}
|
||||
]
|
||||
}
|
22
JNFrame2/Modules/Luban/DesignerConfigs/luban_gas.conf
Normal file
22
JNFrame2/Modules/Luban/DesignerConfigs/luban_gas.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"groups":
|
||||
[
|
||||
{"names":["c"], "default":true},
|
||||
{"names":["s"], "default":true},
|
||||
{"names":["e"], "default":true}
|
||||
],
|
||||
"schemaFiles":
|
||||
[
|
||||
{"fileName":"Defines", "type":""},
|
||||
{"fileName":"Datas/GAS/__tables__.xlsx", "type":"table"},
|
||||
{"fileName":"Datas/__beans__.xlsx", "type":"bean"},
|
||||
{"fileName":"Datas/GAS/__enums__.xlsx", "type":"enum"}
|
||||
],
|
||||
"dataDir": "Datas",
|
||||
"targets":
|
||||
[
|
||||
{"name":"server", "manager":"Tables", "groups":["s"], "topModule":"GameConfig"},
|
||||
{"name":"client", "manager":"Tables", "groups":["c"], "topModule":"GameConfig"},
|
||||
{"name":"all", "manager":"Tables", "groups":["c","s","e"], "topModule":"GameConfig"}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user