【新增】EmmeLua文档注解接口
parent
1a1fc3ca2f
commit
f3949f9c72
|
|
@ -100,6 +100,11 @@ namespace Luban.Job.Common.Defs
|
||||||
{
|
{
|
||||||
return type.Apply(LuaCommentTypeVisitor.Ins);
|
return type.Apply(LuaCommentTypeVisitor.Ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string EmmeLuaCommentType(TType type)
|
||||||
|
{
|
||||||
|
return type.Apply(EmmeLuaCommentTypeVisitor.Ins);
|
||||||
|
}
|
||||||
|
|
||||||
public static string LuaSerializeWhileNil(string bufName, string fieldName, TType type)
|
public static string LuaSerializeWhileNil(string bufName, string fieldName, TType type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
using Luban.Job.Common.Types;
|
||||||
|
|
||||||
|
namespace Luban.Job.Common.TypeVisitors
|
||||||
|
{
|
||||||
|
public class EmmeLuaCommentTypeVisitor : ITypeFuncVisitor<string>
|
||||||
|
{
|
||||||
|
public static EmmeLuaCommentTypeVisitor Ins { get; } = new EmmeLuaCommentTypeVisitor();
|
||||||
|
|
||||||
|
public string Accept(TBool type)
|
||||||
|
{
|
||||||
|
return "boolean";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TByte type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TShort type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TFshort type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TInt type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TFint type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TLong type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TFlong type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TFloat type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TDouble type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TEnum type)
|
||||||
|
{
|
||||||
|
return type.DefineEnum.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TString type)
|
||||||
|
{
|
||||||
|
return "string";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TBytes type)
|
||||||
|
{
|
||||||
|
return $"string";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TText type)
|
||||||
|
{
|
||||||
|
return "string";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TBean type)
|
||||||
|
{
|
||||||
|
return type.Bean.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TArray type)
|
||||||
|
{
|
||||||
|
return $"{type.ElementType.Apply(this)}[]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TList type)
|
||||||
|
{
|
||||||
|
return $"{type.ElementType.Apply(this)}[]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TSet type)
|
||||||
|
{
|
||||||
|
return $"{type.ElementType.Apply(this)}[]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TMap type)
|
||||||
|
{
|
||||||
|
return $"table<{type.KeyType.Apply(this)},{type.ValueType.Apply(this)}>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TVector2 type)
|
||||||
|
{
|
||||||
|
return "vector2";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TVector3 type)
|
||||||
|
{
|
||||||
|
return "vector3";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TVector4 type)
|
||||||
|
{
|
||||||
|
return "vector4";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Accept(TDateTime type)
|
||||||
|
{
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue