diff --git a/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs b/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs index 863a26a..52c0dfc 100644 --- a/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs +++ b/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs @@ -260,12 +260,12 @@ namespace Luban.Job.Cfg.Defs string input = XmlUtil.GetRequiredAttribute(e, "input"); string branchInput = XmlUtil.GetOptionalAttribute(e, "branch_input"); string mode = XmlUtil.GetOptionalAttribute(e, "mode"); - string attrs = XmlUtil.GetOptionalAttribute(e, "attrs"); - AddTable(CurImportFile, name, module, valueType, index, mode, group, comment, defineFromFile, input, branchInput, attrs); + string tags = XmlUtil.GetOptionalAttribute(e, "tags"); + AddTable(CurImportFile, name, module, valueType, index, mode, group, comment, defineFromFile, input, branchInput, tags); } private void AddTable(string defineFile, string name, string module, string valueType, string index, string mode, string group, - string comment, bool defineFromExcel, string input, string branchInput, string attrs) + string comment, bool defineFromExcel, string input, string branchInput, string tags) { var p = new Table() { @@ -277,7 +277,7 @@ namespace Luban.Job.Cfg.Defs Groups = CreateGroups(group), Comment = comment, Mode = ConvertMode(name, mode, index), - Attrs = attrs, + Tags = tags, }; if (p.Groups.Count == 0) @@ -329,7 +329,6 @@ namespace Luban.Job.Cfg.Defs { var cf = new CfgField() { Name = f.Name, Id = 0 }; - string[] attrs = (attrRow[f.FromIndex].Value?.ToString() ?? "").Trim().Split('&').Select(s => s.Trim()).ToArray(); if (attrs.Length == 0 || string.IsNullOrWhiteSpace(attrs[0])) @@ -456,7 +455,7 @@ namespace Luban.Job.Cfg.Defs new CfgField() { Name = "define_from_excel", Type = "bool" }, new CfgField() { Name = "input", Type = "string" }, new CfgField() { Name = "branch_input", Type = "string" }, - new CfgField() { Name = "attrs", Type = "string" }, + new CfgField() { Name = "tags", Type = "string" }, } }) { @@ -491,8 +490,8 @@ namespace Luban.Job.Cfg.Defs bool isDefineFromExcel = (data.GetField("define_from_excel") as DBool).Value; string inputFile = (data.GetField("input") as DString).Value.Trim(); string branchInput = (data.GetField("branch_input") as DString).Value.Trim(); - string attrs = (data.GetField("attrs") as DString).Value.Trim(); - AddTable(file.OriginFile, name, module, valueType, index, mode, group, comment, isDefineFromExcel, inputFile, branchInput, attrs); + string tags = (data.GetField("tags") as DString).Value.Trim(); + AddTable(file.OriginFile, name, module, valueType, index, mode, group, comment, isDefineFromExcel, inputFile, branchInput, tags); }; } } @@ -522,7 +521,7 @@ namespace Luban.Job.Cfg.Defs new CfgField() { Name = "alias", Type = "string" }, new CfgField() { Name = "value", Type = "int" }, new CfgField() { Name = "comment", Type = "string" }, - new CfgField() { Name = "attrs", Type = "string" }, + new CfgField() { Name = "tags", Type = "string" }, } }) { @@ -566,8 +565,8 @@ namespace Luban.Job.Cfg.Defs string alias = (data.GetField("alias") as DString).Value.Trim(); string value = (data.GetField("value") as DInt).Value.ToString(); string comment = (data.GetField("comment") as DString).Value.Trim(); - string attrs = (data.GetField("attrs") as DString).Value.Trim(); - curEnum.Items.Add(new EnumItem() { Name = item, Alias = alias, Value = value, Comment = comment, Attrs = attrs }); + string tags = (data.GetField("tags") as DString).Value.Trim(); + curEnum.Items.Add(new EnumItem() { Name = item, Alias = alias, Value = value, Comment = comment, Tags = tags }); }; } } @@ -604,7 +603,7 @@ namespace Luban.Job.Cfg.Defs new CfgField() { Name = "reference", Type = "string" }, new CfgField() { Name = "path", Type = "string" }, new CfgField() { Name = "comment", Type = "string" }, - new CfgField() { Name = "attrs", Type = "string" }, + new CfgField() { Name = "tags", Type = "string" }, } }) { @@ -632,7 +631,7 @@ namespace Luban.Job.Cfg.Defs new CfgField() { Name = "full_name", Type = "string" }, new CfgField() { Name = "sep", Type = "string" }, new CfgField() { Name = "comment", Type = "string" }, - new CfgField() { Name = "attrs", Type = "string" }, + new CfgField() { Name = "tags", Type = "string" }, new CfgField() { Name = "fields", Type = "list,__FieldInfo__", IsMultiRow = true }, } }) @@ -667,7 +666,7 @@ namespace Luban.Job.Cfg.Defs string sep = (data.GetField("sep") as DString).Value.Trim(); string comment = (data.GetField("comment") as DString).Value.Trim(); - string attrs = (data.GetField("attrs") as DString).Value.Trim(); + string tags = (data.GetField("tags") as DString).Value.Trim(); DList fields = data.GetField("fields") as DList; var curBean = new CfgBean() { @@ -675,7 +674,7 @@ namespace Luban.Job.Cfg.Defs Namespace = module, Sep = sep, Comment = comment, - Attrs = attrs, + Tags = tags, Parent = "", Fields = fields.Datas.Select(d => (DBean)d).Select(b => this.CreateField( (b.GetField("name") as DString).Value.Trim(), @@ -693,7 +692,7 @@ namespace Luban.Job.Cfg.Defs "", "", "", - (b.GetField("attrs") as DString).Value.Trim() + (b.GetField("tags") as DString).Value.Trim() )).ToList(), }; this._beans.Add(curBean); @@ -709,7 +708,7 @@ namespace Luban.Job.Cfg.Defs private static readonly List _fieldOptionalAttrs = new List { "index", "sep", "validator", "key_validator", "value_validator", - "ref", "path", "range", "multi_rows", "group", "res", "convert", "comment", "attrs" }; + "ref", "path", "range", "multi_rows", "group", "res", "convert", "comment", "tags" }; private static readonly List _fieldRequireAttrs = new List { "name", "type" }; @@ -732,12 +731,12 @@ namespace Luban.Job.Cfg.Defs XmlUtil.GetOptionalAttribute(e, "key_validator"), XmlUtil.GetOptionalAttribute(e, "value_validator"), XmlUtil.GetOptionalAttribute(e, "validator"), - XmlUtil.GetOptionalAttribute(e, "attrs") + XmlUtil.GetOptionalAttribute(e, "tags") ); } private Field CreateField(string name, string type, string index, string sep, bool isMultiRow, string group, string resource, string converter, - string comment, string refs, string path, string range, string keyValidator, string valueValidator, string validator, string attrs) + string comment, string refs, string path, string range, string keyValidator, string valueValidator, string validator, string tags) { var f = new CfgField() { @@ -749,7 +748,7 @@ namespace Luban.Job.Cfg.Defs Resource = resource, Converter = converter, Comment = comment, - Attrs = attrs, + Tags = tags, }; // 字段与table的默认组不一样。 @@ -776,7 +775,7 @@ namespace Luban.Job.Cfg.Defs return f; } - private static readonly List _beanOptinsAttrs = new List { "value_type", "alias", "sep", "comment", "attrs" }; + private static readonly List _beanOptinsAttrs = new List { "value_type", "alias", "sep", "comment", "tags" }; private static readonly List _beanRequireAttrs = new List { "name" }; protected override void AddBean(XElement e, string parent) @@ -794,7 +793,7 @@ namespace Luban.Job.Cfg.Defs Alias = XmlUtil.GetOptionalAttribute(e, "alias"), Sep = XmlUtil.GetOptionalAttribute(e, "sep"), Comment = XmlUtil.GetOptionalAttribute(e, "comment"), - Attrs = XmlUtil.GetOptionalAttribute(e, "attrs"), + Tags = XmlUtil.GetOptionalAttribute(e, "tags"), }; var childBeans = new List(); diff --git a/src/Luban.Job.Cfg/Source/Defs/DefTable.cs b/src/Luban.Job.Cfg/Source/Defs/DefTable.cs index 016f1af..4d1924c 100644 --- a/src/Luban.Job.Cfg/Source/Defs/DefTable.cs +++ b/src/Luban.Job.Cfg/Source/Defs/DefTable.cs @@ -22,7 +22,7 @@ namespace Luban.Job.Cfg.Defs Groups = b.Groups; _branchInputFiles = b.BranchInputFiles; Comment = b.Comment; - Attrs = DefUtil.ParseAttrs(b.Attrs); + Tags = DefUtil.ParseAttrs(b.Tags); } diff --git a/src/Luban.Job.Cfg/Source/RawDefs/Table.cs b/src/Luban.Job.Cfg/Source/RawDefs/Table.cs index f6eb8e0..82010aa 100644 --- a/src/Luban.Job.Cfg/Source/RawDefs/Table.cs +++ b/src/Luban.Job.Cfg/Source/RawDefs/Table.cs @@ -35,7 +35,7 @@ namespace Luban.Job.Cfg.RawDefs public string Comment { get; set; } - public string Attrs { get; set; } + public string Tags { get; set; } public List Groups { get; set; } = new List(); diff --git a/src/Luban.Job.Common/Source/Defs/CommonDefLoader.cs b/src/Luban.Job.Common/Source/Defs/CommonDefLoader.cs index 56bd8a8..8d8076f 100644 --- a/src/Luban.Job.Common/Source/Defs/CommonDefLoader.cs +++ b/src/Luban.Job.Common/Source/Defs/CommonDefLoader.cs @@ -195,7 +195,7 @@ namespace Luban.Job.Common.Defs } private static readonly List _fieldRequireAttrs = new List { "name", "type", }; - private static readonly List _fieldOptionalAttrs = new List { "id", "comment", "attrs" }; + private static readonly List _fieldOptionalAttrs = new List { "id", "comment", "tags" }; protected virtual Field CreateField(XElement e) { @@ -206,7 +206,7 @@ namespace Luban.Job.Common.Defs Name = XmlUtil.GetRequiredAttribute(e, "name"), Type = CreateType(e, "type"), Comment = XmlUtil.GetOptionalAttribute(e, "comment"), - Attrs = XmlUtil.GetOptionalAttribute(e, "attrs"), + Tags = XmlUtil.GetOptionalAttribute(e, "tags"), }; return f; } @@ -216,10 +216,10 @@ namespace Luban.Job.Common.Defs AddBean(e, ""); } - private static readonly List _beanOptinsAttrs1 = new List { "compatible", "value_type", "comment", "attrs" }; + private static readonly List _beanOptinsAttrs1 = new List { "compatible", "value_type", "comment", "tags" }; private static readonly List _beanRequireAttrs1 = new List { "id", "name" }; - private static readonly List _beanOptinsAttrs2 = new List { "id", "compatible", "value_type", "comment", "attrs" }; + private static readonly List _beanOptinsAttrs2 = new List { "id", "compatible", "value_type", "comment", "tags" }; private static readonly List _beanRequireAttrs2 = new List { "name" }; protected virtual void AddBean(XElement e, string parent) @@ -241,7 +241,7 @@ namespace Luban.Job.Common.Defs IsSerializeCompatible = XmlUtil.GetOptionBoolAttribute(e, "compatible", IsBeanDefaultCompatible), IsValueType = XmlUtil.GetOptionBoolAttribute(e, "value_type"), Comment = XmlUtil.GetOptionalAttribute(e, "comment"), - Attrs = XmlUtil.GetOptionalAttribute(e, "attrs"), + Tags = XmlUtil.GetOptionalAttribute(e, "tags"), }; var childBeans = new List(); @@ -336,11 +336,11 @@ namespace Luban.Job.Common.Defs _consts.Add(c); } - private static readonly List _enumOptionalAttrs = new List { "flags", "comment", "attrs" }; + private static readonly List _enumOptionalAttrs = new List { "flags", "comment", "tags" }; private static readonly List _enumRequiredAttrs = new List { "name" }; - private static readonly List _enumItemOptionalAttrs = new List { "value", "alias", "comment", "attrs" }; + private static readonly List _enumItemOptionalAttrs = new List { "value", "alias", "comment", "tags" }; private static readonly List _enumItemRequiredAttrs = new List { "name" }; protected void AddEnum(XElement e) @@ -352,7 +352,7 @@ namespace Luban.Job.Common.Defs Namespace = CurNamespace, Comment = XmlUtil.GetOptionalAttribute(e, "comment"), IsFlags = XmlUtil.GetOptionBoolAttribute(e, "flags"), - Attrs = XmlUtil.GetOptionalAttribute(e, "attrs"), + Tags = XmlUtil.GetOptionalAttribute(e, "tags"), }; foreach (XElement item in e.Elements()) @@ -364,7 +364,7 @@ namespace Luban.Job.Common.Defs Alias = XmlUtil.GetOptionalAttribute(item, "alias"), Value = XmlUtil.GetOptionalAttribute(item, "value"), Comment = XmlUtil.GetOptionalAttribute(item, "comment"), - Attrs = XmlUtil.GetOptionalAttribute(item, "attrs"), + Tags = XmlUtil.GetOptionalAttribute(item, "tags"), }); } s_logger.Trace("add enum:{@enum}", en); diff --git a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs index 408dbb7..16a5a6f 100644 --- a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs @@ -132,7 +132,7 @@ namespace Luban.Job.Common.Defs protected TType CreateNotContainerType(string module, string rawType) { bool nullable; - var (type, attrs) = DefUtil.ParseType(rawType); + var (type, tags) = DefUtil.ParseType(rawType); if (type.EndsWith('?')) { @@ -149,33 +149,33 @@ namespace Luban.Job.Common.Defs } switch (type) { - case "bool": return attrs == null ? (nullable ? TBool.NullableIns : TBool.Ins) : new TBool(nullable) { Attrs = attrs }; + case "bool": return tags == null ? (nullable ? TBool.NullableIns : TBool.Ins) : new TBool(nullable) { Tags = tags }; case "uint8": - case "byte": return attrs == null ? (nullable ? TByte.NullableIns : TByte.Ins) : new TByte(nullable) { Attrs = attrs }; + case "byte": return tags == null ? (nullable ? TByte.NullableIns : TByte.Ins) : new TByte(nullable) { Tags = tags }; case "int16": - case "short": return attrs == null ? (nullable ? TShort.NullableIns : TShort.Ins) : new TShort(nullable) { Attrs = attrs }; + case "short": return tags == null ? (nullable ? TShort.NullableIns : TShort.Ins) : new TShort(nullable) { Tags = tags }; case "fint16": - case "fshort": return attrs == null ? (nullable ? TFshort.NullableIns : TFshort.Ins) : new TFshort(nullable) { Attrs = attrs }; + case "fshort": return tags == null ? (nullable ? TFshort.NullableIns : TFshort.Ins) : new TFshort(nullable) { Tags = tags }; case "int32": - case "int": return attrs == null ? (nullable ? TInt.NullableIns : TInt.Ins) : new TInt(nullable) { Attrs = attrs }; + case "int": return tags == null ? (nullable ? TInt.NullableIns : TInt.Ins) : new TInt(nullable) { Tags = tags }; case "fint32": - case "fint": return attrs == null ? (nullable ? TFint.NullableIns : TFint.Ins) : new TFint(nullable) { Attrs = attrs }; + case "fint": return tags == null ? (nullable ? TFint.NullableIns : TFint.Ins) : new TFint(nullable) { Tags = tags }; case "int64": - case "long": return attrs == null ? (nullable ? TLong.NullableIns : TLong.Ins) : new TLong(nullable, false) { Attrs = attrs }; - case "bigint": return attrs == null ? (nullable ? TLong.NullableBigIns : TLong.BigIns) : new TLong(nullable, true) { Attrs = attrs }; + case "long": return tags == null ? (nullable ? TLong.NullableIns : TLong.Ins) : new TLong(nullable, false) { Tags = tags }; + case "bigint": return tags == null ? (nullable ? TLong.NullableBigIns : TLong.BigIns) : new TLong(nullable, true) { Tags = tags }; case "fint64": - case "flong": return attrs == null ? (nullable ? TFlong.NullableIns : TFlong.Ins) : new TFlong(nullable) { Attrs = attrs }; + case "flong": return tags == null ? (nullable ? TFlong.NullableIns : TFlong.Ins) : new TFlong(nullable) { Tags = tags }; case "float32": - case "float": return attrs == null ? (nullable ? TFloat.NullableIns : TFloat.Ins) : new TFloat(nullable) { Attrs = attrs }; + case "float": return tags == null ? (nullable ? TFloat.NullableIns : TFloat.Ins) : new TFloat(nullable) { Tags = tags }; case "float64": - case "double": return attrs == null ? (nullable ? TDouble.NullableIns : TDouble.Ins) : new TDouble(nullable) { Attrs = attrs }; - case "bytes": return attrs == null ? (nullable ? new TBytes(true) : TBytes.Ins) : new TBytes(false) { Attrs = attrs }; - case "string": return attrs == null ? (nullable ? TString.NullableIns : TString.Ins) : new TString(nullable) { Attrs = attrs }; - case "text": return attrs == null ? (nullable ? TText.NullableIns : TText.Ins) : new TText(nullable) { Attrs = attrs }; - case "vector2": return attrs == null ? (nullable ? TVector2.NullableIns : TVector2.Ins) : new TVector2(nullable) { Attrs = attrs }; - case "vector3": return attrs == null ? (nullable ? TVector3.NullableIns : TVector3.Ins) : new TVector3(nullable) { Attrs = attrs }; - case "vector4": return attrs == null ? (nullable ? TVector4.NullableIns : TVector4.Ins) : new TVector4(nullable) { Attrs = attrs }; - case "datetime": return SupportDatetimeType ? (attrs == null ? (nullable ? TDateTime.NullableIns : TDateTime.Ins) : new TDateTime(nullable) { Attrs = attrs }) : throw new NotSupportedException($"只有配置支持datetime数据类型"); + case "double": return tags == null ? (nullable ? TDouble.NullableIns : TDouble.Ins) : new TDouble(nullable) { Tags = tags }; + case "bytes": return tags == null ? (nullable ? new TBytes(true) : TBytes.Ins) : new TBytes(false) { Tags = tags }; + case "string": return tags == null ? (nullable ? TString.NullableIns : TString.Ins) : new TString(nullable) { Tags = tags }; + case "text": return tags == null ? (nullable ? TText.NullableIns : TText.Ins) : new TText(nullable) { Tags = tags }; + case "vector2": return tags == null ? (nullable ? TVector2.NullableIns : TVector2.Ins) : new TVector2(nullable) { Tags = tags }; + case "vector3": return tags == null ? (nullable ? TVector3.NullableIns : TVector3.Ins) : new TVector3(nullable) { Tags = tags }; + case "vector4": return tags == null ? (nullable ? TVector4.NullableIns : TVector4.Ins) : new TVector4(nullable) { Tags = tags }; + case "datetime": return SupportDatetimeType ? (tags == null ? (nullable ? TDateTime.NullableIns : TDateTime.Ins) : new TDateTime(nullable) { Tags = tags }) : throw new NotSupportedException($"只有配置支持datetime数据类型"); default: { var dtype = GetDefTType(module, type, nullable); diff --git a/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs b/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs index ef723ee..95021f0 100644 --- a/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs @@ -51,7 +51,7 @@ namespace Luban.Job.Common.Defs Id = b.TypeId; IsValueType = b.IsValueType; Comment = b.Comment; - Attrs = DefUtil.ParseAttrs(b.Attrs); + Tags = DefUtil.ParseAttrs(b.Tags); foreach (var field in b.Fields) { Fields.Add(CreateField(field, 0)); diff --git a/src/Luban.Job.Common/Source/Defs/DefEnum.cs b/src/Luban.Job.Common/Source/Defs/DefEnum.cs index af0672e..e19a7c8 100644 --- a/src/Luban.Job.Common/Source/Defs/DefEnum.cs +++ b/src/Luban.Job.Common/Source/Defs/DefEnum.cs @@ -23,16 +23,16 @@ namespace Luban.Job.Common.Defs public string Comment { get; init; } - public Dictionary Attrs { get; init; } + public Dictionary Tags { get; init; } - public bool HasAttr(string attrName) + public bool HasTag(string attrName) { - return Attrs != null && Attrs.ContainsKey(attrName); + return Tags != null && Tags.ContainsKey(attrName); } - public string GetAttr(string attrName) + public string GetTag(string attrName) { - return Attrs != null && Attrs.TryGetValue(attrName, out var value) ? value : null; + return Tags != null && Tags.TryGetValue(attrName, out var value) ? value : null; } } @@ -84,7 +84,7 @@ namespace Luban.Job.Common.Defs IsFlags = e.IsFlags; IsUniqueItemId = e.IsUniqueItemId; Comment = e.Comment; - Attrs = DefUtil.ParseAttrs(e.Attrs); + Tags = DefUtil.ParseAttrs(e.Tags); foreach (var item in e.Items) { @@ -95,7 +95,7 @@ namespace Luban.Job.Common.Defs Alias = item.Alias, Value = item.Value, Comment = string.IsNullOrWhiteSpace(item.Comment) ? item.Alias : item.Comment, - Attrs = DefUtil.ParseAttrs(item.Attrs), + Tags = DefUtil.ParseAttrs(item.Tags), }); } } diff --git a/src/Luban.Job.Common/Source/Defs/DefFieldBase.cs b/src/Luban.Job.Common/Source/Defs/DefFieldBase.cs index 6796955..6c1dc17 100644 --- a/src/Luban.Job.Common/Source/Defs/DefFieldBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefFieldBase.cs @@ -72,16 +72,16 @@ namespace Luban.Job.Common.Defs public string Comment { get; } - public Dictionary Attrs { get; } + public Dictionary Tags { get; } - public bool HasAttr(string attrName) + public bool HasTag(string attrName) { - return Attrs != null && Attrs.ContainsKey(attrName); + return Tags != null && Tags.ContainsKey(attrName); } - public string GetAttr(string attrName) + public string GetTag(string attrName) { - return Attrs != null && Attrs.TryGetValue(attrName, out var value) ? value : null; + return Tags != null && Tags.TryGetValue(attrName, out var value) ? value : null; } public DefFieldBase(DefTypeBase host, Field f, int idOffset) @@ -91,7 +91,7 @@ namespace Luban.Job.Common.Defs Name = f.Name; Type = f.Type; Comment = f.Comment; - Attrs = DefUtil.ParseAttrs(f.Attrs); + Tags = DefUtil.ParseAttrs(f.Tags); } public virtual void Compile() diff --git a/src/Luban.Job.Common/Source/Defs/DefTypeBase.cs b/src/Luban.Job.Common/Source/Defs/DefTypeBase.cs index a426c77..3e53d4e 100644 --- a/src/Luban.Job.Common/Source/Defs/DefTypeBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefTypeBase.cs @@ -46,16 +46,16 @@ namespace Luban.Job.Common.Defs public string Comment { get; protected set; } - public Dictionary Attrs { get; protected set; } + public Dictionary Tags { get; protected set; } - public bool HasAttr(string attrName) + public bool HasTag(string attrName) { - return Attrs != null && Attrs.ContainsKey(attrName); + return Tags != null && Tags.ContainsKey(attrName); } - public string GetAttr(string attrName) + public string GetTag(string attrName) { - return Attrs != null && Attrs.TryGetValue(attrName, out var value) ? value : null; + return Tags != null && Tags.TryGetValue(attrName, out var value) ? value : null; } public virtual void PreCompile() { } diff --git a/src/Luban.Job.Common/Source/Defs/TTypeTemplateCommonExtends.cs b/src/Luban.Job.Common/Source/Defs/TTypeTemplateCommonExtends.cs index 69d9dee..7842fd0 100644 --- a/src/Luban.Job.Common/Source/Defs/TTypeTemplateCommonExtends.cs +++ b/src/Luban.Job.Common/Source/Defs/TTypeTemplateCommonExtends.cs @@ -163,14 +163,14 @@ namespace Luban.Job.Common.Defs return type.Apply(LuaConstValueVisitor.Ins, value); } - public static bool HasAttr(dynamic obj, string attrName) + public static bool HasTag(dynamic obj, string attrName) { - return obj.HasAttr(attrName); + return obj.HasTag(attrName); } - public static string GetAttr(dynamic obj, string attrName) + public static string GetTag(dynamic obj, string attrName) { - return obj.GetAttr(attrName); + return obj.GetTag(attrName); } } } diff --git a/src/Luban.Job.Common/Source/RawDefs/Bean.cs b/src/Luban.Job.Common/Source/RawDefs/Bean.cs index 6d63595..27a6ae9 100644 --- a/src/Luban.Job.Common/Source/RawDefs/Bean.cs +++ b/src/Luban.Job.Common/Source/RawDefs/Bean.cs @@ -20,7 +20,7 @@ namespace Luban.Job.Common.RawDefs public string Comment { get; set; } - public string Attrs { get; set; } + public string Tags { get; set; } public List Fields { get; set; } = new List(); } diff --git a/src/Luban.Job.Common/Source/RawDefs/Field.cs b/src/Luban.Job.Common/Source/RawDefs/Field.cs index 2789b5c..fc233a7 100644 --- a/src/Luban.Job.Common/Source/RawDefs/Field.cs +++ b/src/Luban.Job.Common/Source/RawDefs/Field.cs @@ -11,6 +11,6 @@ namespace Luban.Job.Common.RawDefs public string Comment { get; set; } - public string Attrs { get; set; } + public string Tags { get; set; } } } diff --git a/src/Luban.Job.Common/Source/RawDefs/PEnum.cs b/src/Luban.Job.Common/Source/RawDefs/PEnum.cs index 045c4c1..fa85657 100644 --- a/src/Luban.Job.Common/Source/RawDefs/PEnum.cs +++ b/src/Luban.Job.Common/Source/RawDefs/PEnum.cs @@ -12,7 +12,7 @@ namespace Luban.Job.Common.RawDefs public string Comment { get; set; } - public string Attrs { get; set; } + public string Tags { get; set; } } public class PEnum @@ -28,7 +28,7 @@ namespace Luban.Job.Common.RawDefs public string Comment { get; set; } - public string Attrs { get; set; } + public string Tags { get; set; } public List Items { get; set; } = new List(); } diff --git a/src/Luban.Job.Common/Source/Types/TType.cs b/src/Luban.Job.Common/Source/Types/TType.cs index 50d194e..6cbd43b 100644 --- a/src/Luban.Job.Common/Source/Types/TType.cs +++ b/src/Luban.Job.Common/Source/Types/TType.cs @@ -12,16 +12,16 @@ namespace Luban.Job.Common.Types IsNullable = isNullable; } - public Dictionary Attrs { get; set; } + public Dictionary Tags { get; set; } - public bool HasAttr(string attrName) + public bool HasTag(string attrName) { - return Attrs != null && Attrs.ContainsKey(attrName); + return Tags != null && Tags.ContainsKey(attrName); } - public string GetAttr(string attrName) + public string GetTag(string attrName) { - return Attrs != null && Attrs.TryGetValue(attrName, out var value) ? value : null; + return Tags != null && Tags.TryGetValue(attrName, out var value) ? value : null; } public abstract bool TryParseFrom(string s); diff --git a/src/Luban.Job.Common/Source/Utils/DefUtil.cs b/src/Luban.Job.Common/Source/Utils/DefUtil.cs index 5d2b671..ccf0390 100644 --- a/src/Luban.Job.Common/Source/Utils/DefUtil.cs +++ b/src/Luban.Job.Common/Source/Utils/DefUtil.cs @@ -12,14 +12,14 @@ namespace Luban.Job.Common.Utils private readonly static char[] s_attrKeyValueSep = new char[] { '=', ':' }; - public static Dictionary ParseAttrs(string attrs) + public static Dictionary ParseAttrs(string tags) { - if (string.IsNullOrWhiteSpace(attrs)) + if (string.IsNullOrWhiteSpace(tags)) { return null; } var am = new Dictionary(); - foreach (var pair in attrs.Split(s_attrSep)) + foreach (var pair in tags.Split(s_attrSep)) { int sepIndex = pair.IndexOfAny(s_attrKeyValueSep); if (sepIndex >= 0)