diff --git a/src/Luban.Job.Cfg/Source/DataVisitors/IsSimpleLiteralDataVisitor2.cs b/src/Luban.Job.Cfg/Source/DataVisitors/IsSimpleLiteralDataVisitor2.cs new file mode 100644 index 0000000..4e8cc59 --- /dev/null +++ b/src/Luban.Job.Cfg/Source/DataVisitors/IsSimpleLiteralDataVisitor2.cs @@ -0,0 +1,126 @@ +using Luban.Job.Cfg.Datas; +using System; +using System.Numerics; + +namespace Luban.Job.Cfg.DataVisitors +{ + class IsSimpleLiteralDataVisitor2 : IDataFuncVisitor + { + public static IsSimpleLiteralDataVisitor2 Ins { get; } = new(); + + public bool Accept(DBool type) + { + return true; + } + + public bool Accept(DByte type) + { + return true; + } + + public bool Accept(DShort type) + { + return true; + } + + public bool Accept(DFshort type) + { + return true; + } + + public bool Accept(DInt type) + { + return true; + } + + public bool Accept(DFint type) + { + return true; + } + + public bool Accept(DLong type) + { + return true; + } + + public bool Accept(DFlong type) + { + return true; + } + + public bool Accept(DFloat type) + { + return true; + } + + public bool Accept(DDouble type) + { + return true; + } + + public bool Accept(DEnum type) + { + return true; + } + + public bool Accept(DString type) + { + return true; + } + + public bool Accept(DBytes type) + { + throw new NotSupportedException(); + } + + public bool Accept(DText type) + { + return true; + } + + public bool Accept(DBean type) + { + return false; + } + + public bool Accept(DArray type) + { + return false; + } + + public bool Accept(DList type) + { + return false; + } + + public bool Accept(DSet type) + { + return false; + } + + public bool Accept(DMap type) + { + return false; + } + + public bool Accept(DVector2 type) + { + return true; + } + + public bool Accept(DVector3 type) + { + return true; + } + + public bool Accept(DVector4 type) + { + return true; + } + + public bool Accept(DDateTime type) + { + return true; + } + } +} diff --git a/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs b/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs index 8650675..4ebc9a8 100644 --- a/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs +++ b/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs @@ -353,7 +353,7 @@ namespace Luban.Job.Cfg.Defs for (int i = 1; i < attrs.Length; i++) { - var pair = attrs[i].Split('='); + var pair = attrs[i].Split('=', 2); if (pair.Length != 2) { throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{f.Name}' attr:'{attrs[i]}' is invalid!"); @@ -406,6 +406,11 @@ namespace Luban.Job.Cfg.Defs cf.DefaultValue = attrValue; break; } + case "tags": + { + cf.Tags = attrValue; + break; + } default: { throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{f.Name}' attr:'{attrs[i]}' is invalid!"); diff --git a/src/Luban.Job.Cfg/Source/Utils/DTypeTemplateExtends.cs b/src/Luban.Job.Cfg/Source/Utils/DTypeTemplateExtends.cs index c260288..6eec628 100644 --- a/src/Luban.Job.Cfg/Source/Utils/DTypeTemplateExtends.cs +++ b/src/Luban.Job.Cfg/Source/Utils/DTypeTemplateExtends.cs @@ -16,6 +16,11 @@ namespace Luban.Job.Cfg.Utils return type.Apply(IsSimpleLiteralDataVisitor.Ins); } + public static bool IsSimpleLiteralData2(DType type) + { + return type.Apply(IsSimpleLiteralDataVisitor2.Ins); + } + public static string ToLocalizedText(DText type) { var ass = DefAssembly.LocalAssebmly;