【更新】修正一些过时的excel格式的文档
parent
eb34a4cb7f
commit
5d8c3d454e
|
|
@ -18,20 +18,26 @@
|
|||
|
||||
文件内容如下
|
||||
|
||||

|
||||
|##|id|name|desc|count|
|
||||
|-|-|-|-|-|
|
||||
|##type|int|string|string|int|
|
||||
|##|id|名字|描述|个数|
|
||||
||1001|item1| desc1| 10|
|
||||
||1002|item2| desc2| 10|
|
||||
||1003|item3| desc3| 10|
|
||||
||1004|item4| desc4| 10|
|
||||
|
||||
- 第 1 行是 meta 行,包含关于excel文件的元描述,title_rows=4表示除了meta行外,有4行标题头。此值默认为3,可以根据需求调整。
|
||||
单元格 A1 必须是 ##。表示这是一个有效数据表。
|
||||
- 第 2 行是程序字段名行。
|
||||
- 第3行是属性行。格式为 type&属性1=值1&属性2=值2 ...
|
||||
- 第 4 行是标题头行。策划自行填写,可留空。
|
||||
- 第 5 行是描述行。策划可以填写字段的补充描述。可留空。
|
||||
- 从第 6 开始为实际的数据行。如果某个数据行整行为空,则会被跳过。
|
||||
|
||||
- 第 1 行是 主字段行,包含表字段定义。单元格 A1 必须是 ##。表示这是一个有效数据表。
|
||||
- 第 2 行是类型行,第1个单元格必须为 ##type。
|
||||
- 第 3 行是注释行。 以##开头。 可以有0-N个注释行,而且可以出现在任何位置
|
||||
- 第 4 行起是数据行。
|
||||
|
||||
3. 在 Datas 目录下的__tables__.xlsx添加表声明。如下图:
|
||||
|
||||

|
||||
|
||||
|##|full_name|value_type|define_from_excel|input|index|mode|group|comment|patch_input|tags|output|
|
||||
|-|-|-|-|-|-|-|-|-|-|-|-|
|
||||
||demo.TbItem|Item|true|物品表.xlsx||||||||
|
||||
|
||||
4. 至此,物品表的创建工作大功告成!
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
|
||||
if (typeRowIndex < 0)
|
||||
{
|
||||
throw new Exception($"缺失type行");
|
||||
throw new Exception($"缺失type行。请用'##type'标识type行");
|
||||
}
|
||||
List<Cell> typeRow = cells[typeRowIndex];
|
||||
List<Cell> descRow = cells.Count > typeRowIndex + 1 ? cells[typeRowIndex + 1] : null;
|
||||
|
|
|
|||
|
|
@ -174,12 +174,16 @@ namespace Luban.Job.Common.Defs
|
|||
return type.Apply(RustTypeNameVisitor.Ins);
|
||||
}
|
||||
|
||||
|
||||
public static string RustConstValue(TType type, string value)
|
||||
{
|
||||
return type.Apply(LuaConstValueVisitor.Ins, value);
|
||||
}
|
||||
|
||||
public static string ErlangDefineType(TType type)
|
||||
{
|
||||
return type.Apply(ErlangDefineTypeNameVisitor.Ins);
|
||||
}
|
||||
|
||||
public static bool HasTag(dynamic obj, string attrName)
|
||||
{
|
||||
return obj.HasTag(attrName);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
using Luban.Job.Common.Types;
|
||||
|
||||
namespace Luban.Job.Common.TypeVisitors
|
||||
{
|
||||
public class ErlangDefineTypeNameVisitor : ITypeFuncVisitor<string>
|
||||
{
|
||||
public static ErlangDefineTypeNameVisitor Ins { get; } = new();
|
||||
|
||||
public string Accept(TBool type)
|
||||
{
|
||||
return "boolean()";
|
||||
}
|
||||
|
||||
public string Accept(TByte type)
|
||||
{
|
||||
return "binary()";
|
||||
}
|
||||
|
||||
public string Accept(TShort type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
|
||||
public string Accept(TFshort type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
|
||||
public string Accept(TInt type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
|
||||
public string Accept(TFint type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
|
||||
public string Accept(TLong type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
|
||||
public string Accept(TFlong type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
|
||||
public string Accept(TFloat type)
|
||||
{
|
||||
return "float()";
|
||||
}
|
||||
|
||||
public string Accept(TDouble type)
|
||||
{
|
||||
return "float()";
|
||||
}
|
||||
|
||||
public string Accept(TEnum type)
|
||||
{
|
||||
return "string()";
|
||||
}
|
||||
|
||||
public string Accept(TString type)
|
||||
{
|
||||
return "string()";
|
||||
}
|
||||
|
||||
public string Accept(TBytes type)
|
||||
{
|
||||
return "[binary()]";
|
||||
}
|
||||
|
||||
public string Accept(TText type)
|
||||
{
|
||||
return "string()";
|
||||
}
|
||||
|
||||
public string Accept(TBean type)
|
||||
{
|
||||
return $"'{type.Bean.FullName}'()" ;
|
||||
}
|
||||
|
||||
public virtual string Accept(TArray type)
|
||||
{
|
||||
return $"[{type.ElementType.Apply(this)}]";
|
||||
}
|
||||
|
||||
public virtual string Accept(TList type)
|
||||
{
|
||||
return $"[{type.ElementType.Apply(this)}]";
|
||||
}
|
||||
|
||||
public virtual string Accept(TSet type)
|
||||
{
|
||||
return $"[{type.ElementType.Apply(this)}]";
|
||||
}
|
||||
|
||||
public virtual string Accept(TMap type)
|
||||
{
|
||||
return string.Format("#{{0} => {1}}",type.KeyType.Apply(this),type.ValueType.Apply(this));
|
||||
}
|
||||
|
||||
public string Accept(TVector2 type)
|
||||
{
|
||||
return "[float()]";
|
||||
}
|
||||
|
||||
public string Accept(TVector3 type)
|
||||
{
|
||||
return "[float()]";
|
||||
}
|
||||
|
||||
public string Accept(TVector4 type)
|
||||
{
|
||||
return "[float()]";
|
||||
}
|
||||
|
||||
public string Accept(TDateTime type)
|
||||
{
|
||||
return "integer()";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue