From 4f8fd20780e4f799438aeb6820f0b7ce418dfc66 Mon Sep 17 00:00:00 2001 From: walon Date: Sun, 12 Dec 2021 13:12:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E8=AF=BB?= =?UTF-8?q?=E5=8F=96excel=E6=A0=87=E9=A2=98=E5=A4=B4=E5=88=97=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E9=81=87=E5=88=B0=E4=B8=8D=E8=AE=A4?= =?UTF-8?q?=E8=AF=86=E7=9A=84=E6=A0=87=E7=AD=BE=EF=BC=8C=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E3=80=82=E5=B0=86=E7=A4=BA=E4=BE=8B=E4=B8=AD?= =?UTF-8?q?=E7=9A=84##+=E5=85=A8=E9=83=A8=E7=BB=9F=E4=B8=80=E6=88=90##var?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 24 +++++----- src/Luban.Common/Source/Utils/FileUtil.cs | 28 ----------- .../Source/DataSources/DataSourceFactory.cs | 4 -- .../Source/DataSources/Excel/SheetLoadUtil.cs | 46 +++++++++++++++++-- .../Source/DataVisitors/ToStringVisitor.cs | 4 -- src/Luban.Job.Cfg/Source/Datas/DText.cs | 4 -- src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs | 11 ----- src/Luban.Job.Cfg/Source/Defs/DefAssembly.cs | 5 -- src/Luban.Job.Cfg/Source/Defs/DefBean.cs | 6 --- src/Luban.Job.Cfg/Source/Defs/DefField.cs | 2 - .../Source/Defs/TableDataInfo.cs | 4 -- .../Source/Utils/DataLoaderUtil.cs | 1 - src/Luban.Job.Cfg/Source/ValidatorContext.cs | 8 ---- .../Source/Validators/PathValidator.cs | 12 ----- .../Source/Validators/RangeValidator.cs | 8 ---- .../Source/Validators/RefValidator.cs | 2 - .../Source/Defs/DefAssemblyBase.cs | 4 -- .../Source/Defs/DefBeanBase.cs | 2 - src/Luban.Job.Common/Source/Utils/DefUtil.cs | 4 -- src/Luban.Job.Proto/Source/Defs/DefProto.cs | 2 - 20 files changed, 54 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index 107bff6..3ebe5e8 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ array与list类型都能表示列表,它们区别在于array生成的代码为 - + @@ -234,7 +234,7 @@ array与list类型都能表示列表,它们区别在于array生成的代码为
##full_nameflagsuniquecommenttags*items
##+namealiasvaluecommenttags
##varnamealiasvaluecommenttags
ItemQualityfalsetrueWHITE0
GREEN绿1
RED2
- + @@ -352,7 +352,7 @@ xml中定义如下 - + @@ -360,7 +360,7 @@ xml中定义如下 - + @@ -625,7 +625,7 @@ xml中定义如下 ### 层级标题头 (hierarchy title) -在多行数据或者深层次嵌套的数据中,如果数据字段较多,填写时不易区分子元素。luban提供层级标题实现深层次的子字段对应。以上面的多行数据列表为例,第一列为##+表示这是个子字段行。 +在多行数据或者深层次嵌套的数据中,如果数据字段较多,填写时不易区分子元素。luban提供层级标题实现深层次的子字段对应。以上面的多行数据列表为例,第一列为##var表示这是个子字段行。 - 普通bean结构的子标题 @@ -644,7 +644,7 @@ xml中定义如下 - + @@ -687,7 +687,7 @@ xml中定义如下 - + @@ -745,7 +745,7 @@ xml中定义如下 - + @@ -753,7 +753,7 @@ xml中定义如下 - + @@ -772,7 +772,7 @@ xml中定义如下 - + @@ -931,11 +931,11 @@ binary格式占空间最小,lua其次,json最大。 ### 自定义代码和数据模板 -[自定义模板](docs/render_template.md) +[自定义模板](https://github.com/focus-creative-games/luban/wiki/render_template) ### 本地化 -支持以下几种本地化机制,详见[本地化](docs/l10n.md) +支持以下几种本地化机制,详见[本地化](https://github.com/focus-creative-games/luban/wiki/l10n) - 静态本地化 - 动态本地化 diff --git a/src/Luban.Common/Source/Utils/FileUtil.cs b/src/Luban.Common/Source/Utils/FileUtil.cs index f3290cc..ea225e6 100644 --- a/src/Luban.Common/Source/Utils/FileUtil.cs +++ b/src/Luban.Common/Source/Utils/FileUtil.cs @@ -23,21 +23,13 @@ namespace Luban.Common.Utils public static string GetFileName(string path) { int index = path.Replace('\\', '/').LastIndexOf('/'); -#if !LUBAN_LITE return index >= 0 ? path[(index + 1)..] : path; -#else - return index >= 0 ? path.Substring(index + 1, path.Length - index - 1) : path; -#endif } public static string GetParent(string path) { int index = path.Replace('\\', '/').LastIndexOf('/'); -#if !LUBAN_LITE return index >= 0 ? path[..index] : "."; -#else - return index >= 0 ? path.Substring(0, index) : "."; -#endif } public static string GetFileNameWithoutExt(string file) @@ -70,11 +62,7 @@ namespace Luban.Common.Utils } var f = new FileInfo(file); string fname = f.Name; -#if !LUBAN_LITE return !fname.StartsWith('.') && !fname.StartsWith('_') && !fname.StartsWith('~'); -#else - return !fname.StartsWith(".") && !fname.StartsWith("_") && !fname.StartsWith("~"); -#endif } [ThreadStatic] @@ -129,7 +117,6 @@ namespace Luban.Common.Utils else { int lastPathSep = url.LastIndexOf('/', sheetSepIndex); -#if !LUBAN_LITE if (lastPathSep >= 0) { return (url[0..(lastPathSep + 1)] + url[(sheetSepIndex + 1)..], url[(lastPathSep + 1)..sheetSepIndex]); @@ -138,16 +125,6 @@ namespace Luban.Common.Utils { return (url[(sheetSepIndex + 1)..], url[(lastPathSep + 1)..sheetSepIndex]); } -#else - if (lastPathSep >= 0) - { - return (url.Substring(0, lastPathSep + 1) + url.Substring(sheetSepIndex + 1), url.Substring(lastPathSep + 1, sheetSepIndex - lastPathSep - 1)); - } - else - { - return (url.Substring(sheetSepIndex + 1), url.Substring(lastPathSep + 1, sheetSepIndex - lastPathSep - 1)); - } -#endif } } @@ -182,12 +159,7 @@ namespace Luban.Common.Utils s_logger.Info("[new] {file}", outputPath); } - -#if !LUBAN_LITE await File.WriteAllBytesAsync(outputPath, content); -#else - await Task.Run(() => File.WriteAllBytes(outputPath, content)); -#endif } public static async Task ReadAllBytesAsync(string file) diff --git a/src/Luban.Job.Cfg/Source/DataSources/DataSourceFactory.cs b/src/Luban.Job.Cfg/Source/DataSources/DataSourceFactory.cs index 4a6caa8..bbe881a 100644 --- a/src/Luban.Job.Cfg/Source/DataSources/DataSourceFactory.cs +++ b/src/Luban.Job.Cfg/Source/DataSources/DataSourceFactory.cs @@ -22,11 +22,7 @@ namespace Luban.Job.Cfg.DataSources { try { -#if !LUBAN_LITE string ext = url.Contains('.') ? Path.GetExtension(url)?[1..] : url; -#else - string ext = url.Contains(".") ? Path.GetExtension(url)?.Substring(1) : url; -#endif AbstractDataSource source; switch (ext) { diff --git a/src/Luban.Job.Cfg/Source/DataSources/Excel/SheetLoadUtil.cs b/src/Luban.Job.Cfg/Source/DataSources/Excel/SheetLoadUtil.cs index 0ada759..61432bf 100644 --- a/src/Luban.Job.Cfg/Source/DataSources/Excel/SheetLoadUtil.cs +++ b/src/Luban.Job.Cfg/Source/DataSources/Excel/SheetLoadUtil.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace Luban.Job.Cfg.DataSources.Excel @@ -31,9 +32,12 @@ namespace Luban.Job.Cfg.DataSources.Excel } } + private static readonly AsyncLocal s_curExcel = new(); + public static IEnumerable LoadRawSheets(string rawUrl, string sheetName, Stream stream) { s_logger.Trace("{filename} {sheet}", rawUrl, sheetName); + s_curExcel.Value = rawUrl; string ext = Path.GetExtension(rawUrl); using (var reader = ext != ".csv" ? ExcelReaderFactory.CreateReader(stream) : ExcelReaderFactory.CreateCsvReader(stream, new ExcelReaderConfiguration() { FallbackEncoding = DetectCsvEncoding(stream) })) { @@ -68,11 +72,48 @@ namespace Luban.Job.Cfg.DataSources.Excel return null; } var cells = ParseRawSheetContent(reader, orientRow, false); + ValidateTitles(cells); var title = ParseTitle(cells, reader.MergeCells, orientRow); cells.RemoveAll(c => IsNotDataRow(c)); return new RawSheet() { Title = title, TableName = tableName, Cells = cells }; } + + private static readonly HashSet s_knownSpecialTags = new HashSet + { + "##var", + "##+", + "##type", + "##desc", + "##comment", + "##column", + "##", + }; + + private static void ValidateTitles(List> rows) + { + foreach (var row in rows) + { + if (row.Count == 0) + { + continue; + } + string rowTag = row[0].Value?.ToString()?.ToLower()?.Trim(); + if (string.IsNullOrEmpty(rowTag)) + { + continue; + } + if (!rowTag.StartsWith("##")) + { + break; + } + if (!s_knownSpecialTags.Contains(rowTag)) + { + DefAssembly.LocalAssebmly?.Agent?.Error("文件:'{0}' 行标签:'{1}' 未知,是否有拼写错误?", s_curExcel.Value, rowTag); + } + } + } + private static bool IsNotDataRow(List row) { if (row.Count == 0) @@ -133,11 +174,7 @@ namespace Luban.Job.Cfg.DataSources.Excel private static bool IsIgnoreTitle(string title) { -#if !LUBAN_LITE return string.IsNullOrEmpty(title) || title.StartsWith('#'); -#else - return string.IsNullOrEmpty(title) || title.StartsWith("#"); -#endif } public static (string Name, Dictionary Tags) ParseNameAndMetaAttrs(string nameAndAttrs) @@ -241,6 +278,7 @@ namespace Luban.Job.Cfg.DataSources.Excel var (titleName, tags) = ParseNameAndMetaAttrs(nameAndAttrs); Title subTitle; + // [field,,,, field] 形成多列字段 if (titleName.StartsWith('[')) { int startIndex = i; diff --git a/src/Luban.Job.Cfg/Source/DataVisitors/ToStringVisitor.cs b/src/Luban.Job.Cfg/Source/DataVisitors/ToStringVisitor.cs index ed6da09..e6402e4 100644 --- a/src/Luban.Job.Cfg/Source/DataVisitors/ToStringVisitor.cs +++ b/src/Luban.Job.Cfg/Source/DataVisitors/ToStringVisitor.cs @@ -11,11 +11,7 @@ namespace Luban.Job.Cfg.DataVisitors public override string Accept(DText type) { -#if !LUBAN_LITE return $"\"{type.Key}#{type.TextOfCurrentAssembly}\""; -#else - return $"\"{type.Key}#{type.RawValue}\""; -#endif } public override string Accept(DBean type) diff --git a/src/Luban.Job.Cfg/Source/Datas/DText.cs b/src/Luban.Job.Cfg/Source/Datas/DText.cs index f2712c2..b13c305 100644 --- a/src/Luban.Job.Cfg/Source/Datas/DText.cs +++ b/src/Luban.Job.Cfg/Source/Datas/DText.cs @@ -1,8 +1,6 @@ using Luban.Job.Cfg.DataVisitors; using Luban.Job.Cfg.Defs; -#if !LUBAN_LITE using Luban.Job.Cfg.l10n; -#endif namespace Luban.Job.Cfg.Datas { @@ -25,7 +23,6 @@ namespace Luban.Job.Cfg.Datas _rawValue = x; } -#if !LUBAN_LITE public string GetText(TextTable stringTable, NotConvertTextSet notConvertKeys) { if (stringTable != null) @@ -50,7 +47,6 @@ namespace Luban.Job.Cfg.Datas return GetText(ass.ExportTextTable, ass.NotConvertTextSet); } } -#endif public override void Apply(IDataActionVisitor visitor, T x) { diff --git a/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs b/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs index 904658b..0b31b6b 100644 --- a/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs +++ b/src/Luban.Job.Cfg/Source/Defs/CfgDefLoader.cs @@ -323,15 +323,8 @@ namespace Luban.Job.Cfg.Defs string valueTypeName = TypeUtil.GetName(table.ValueType); var cb = new CfgBean() { Namespace = valueTypeNamespace, Name = valueTypeName, Comment = "" }; -#if !LUBAN_LITE foreach (var (name, f) in tableDefInfo.FieldInfos) { -#else - foreach (var e in tableDefInfo.FieldInfos) - { - var name = e.Key; - var f = e.Value; -#endif var cf = new CfgField() { Name = name, Id = 0 }; string[] attrs = f.Type.Trim().Split('&').Select(s => s.Trim()).ToArray(); @@ -347,11 +340,7 @@ namespace Luban.Job.Cfg.Defs for (int i = 1; i < attrs.Length; i++) { -#if !LUBAN_LITE var pair = attrs[i].Split('=', 2); -#else - var pair = attrs[i].Split(new char[] { '=' }, 2); -#endif if (pair.Length != 2) { throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{name}' attr:'{attrs[i]}' is invalid!"); diff --git a/src/Luban.Job.Cfg/Source/Defs/DefAssembly.cs b/src/Luban.Job.Cfg/Source/Defs/DefAssembly.cs index 776bcb6..c84e9be 100644 --- a/src/Luban.Job.Cfg/Source/Defs/DefAssembly.cs +++ b/src/Luban.Job.Cfg/Source/Defs/DefAssembly.cs @@ -1,9 +1,7 @@ using Bright.Collections; using Luban.Job.Cfg.Datas; using Luban.Job.Cfg.DataSources; -#if !LUBAN_LITE using Luban.Job.Cfg.l10n; -#endif using Luban.Job.Cfg.RawDefs; using Luban.Job.Cfg.TypeVisitors; using Luban.Job.Common.Defs; @@ -64,7 +62,6 @@ namespace Luban.Job.Cfg.Defs public Dictionary CfgTablesByName = new(); public Dictionary CfgTablesByFullName { get; } = new Dictionary(); -#if !LUBAN_LITE public RawTextTable RawTextTable { get; } = new RawTextTable(); public TextTable ExportTextTable { get; private set; } @@ -79,8 +76,6 @@ namespace Luban.Job.Cfg.Defs NotConvertTextSet = new NotConvertTextSet(); } -#endif - public Patch GetPatch(string name) { return _patches.Find(b => b.Name == name); diff --git a/src/Luban.Job.Cfg/Source/Defs/DefBean.cs b/src/Luban.Job.Cfg/Source/Defs/DefBean.cs index abb92a1..5f1a866 100644 --- a/src/Luban.Job.Cfg/Source/Defs/DefBean.cs +++ b/src/Luban.Job.Cfg/Source/Defs/DefBean.cs @@ -33,7 +33,6 @@ namespace Luban.Job.Cfg.Defs return DeepCompareTypeDefine.Ins.Compare(this, b, new Dictionary(), new HashSet()); } -#if !LUBAN_LITE public override string GoBinImport { get @@ -96,7 +95,6 @@ namespace Luban.Job.Cfg.Defs throw new NotImplementedException(); } } -#endif public DefBean(CfgBean b) : base(b) { @@ -187,11 +185,7 @@ namespace Luban.Job.Cfg.Defs Id = TypeUtil.ComputCfgHashIdByName(FullName); } // 检查别名是否重复 -#if !LUBAN_LITE HashSet nameOrAliasName = cs.Select(b => b.Name).ToHashSet(); -#else - HashSet nameOrAliasName = new HashSet(cs.Select(b => b.Name)); -#endif foreach (DefBean c in cs) { if (!string.IsNullOrWhiteSpace(c.Alias) && !nameOrAliasName.Add(c.Alias)) diff --git a/src/Luban.Job.Cfg/Source/Defs/DefField.cs b/src/Luban.Job.Cfg/Source/Defs/DefField.cs index 30b73e6..e6958ee 100644 --- a/src/Luban.Job.Cfg/Source/Defs/DefField.cs +++ b/src/Luban.Job.Cfg/Source/Defs/DefField.cs @@ -33,7 +33,6 @@ namespace Luban.Job.Cfg.Defs || (CType is TList tl && tl.ElementType.IsBean) || (CType is TMap tm && tm.ValueType.IsBean); -#if !LUBAN_LITE public string CsRefTypeName { get @@ -87,7 +86,6 @@ namespace Luban.Job.Cfg.Defs return $"{RefVarName} : {table.ValueTType.Apply(TypescriptDefineTypeNameVisitor.Ins)}{(IsNullable ? "" : " = undefined!")}"; } } -#endif public string RefVarName => $"{ConventionName}_Ref"; diff --git a/src/Luban.Job.Cfg/Source/Defs/TableDataInfo.cs b/src/Luban.Job.Cfg/Source/Defs/TableDataInfo.cs index bf6d40b..cc55c97 100644 --- a/src/Luban.Job.Cfg/Source/Defs/TableDataInfo.cs +++ b/src/Luban.Job.Cfg/Source/Defs/TableDataInfo.cs @@ -1,7 +1,5 @@ using Luban.Job.Cfg.Datas; using Luban.Job.Cfg.DataSources; -#if !LUBAN_LITE -#endif using Luban.Job.Cfg.RawDefs; using Luban.Job.Cfg.Utils; using System; @@ -37,7 +35,6 @@ namespace Luban.Job.Cfg.Defs private void BuildIndexs() { -#if !LUBAN_LITE List mainRecords = MainRecords; List patchRecords = PatchRecords; @@ -171,7 +168,6 @@ namespace Luban.Job.Cfg.Defs } default: throw new Exception($"unknown mode:{Table.Mode}"); } -#endif } } } diff --git a/src/Luban.Job.Cfg/Source/Utils/DataLoaderUtil.cs b/src/Luban.Job.Cfg/Source/Utils/DataLoaderUtil.cs index 49eaa73..f26487d 100644 --- a/src/Luban.Job.Cfg/Source/Utils/DataLoaderUtil.cs +++ b/src/Luban.Job.Cfg/Source/Utils/DataLoaderUtil.cs @@ -84,7 +84,6 @@ namespace Luban.Job.Cfg.Utils foreach (var file in inputFileInfos) { var actualFile = file.ActualFile; - //s_logger.Info("== get input file:{file} actualFile:{actual}", file, actualFile); tasks.Add(Task.Run(async () => { diff --git a/src/Luban.Job.Cfg/Source/ValidatorContext.cs b/src/Luban.Job.Cfg/Source/ValidatorContext.cs index 3aa45ea..85cfa36 100644 --- a/src/Luban.Job.Cfg/Source/ValidatorContext.cs +++ b/src/Luban.Job.Cfg/Source/ValidatorContext.cs @@ -72,12 +72,10 @@ namespace Luban.Job.Cfg { CurrentVisitor = visitor; visitor.ValidateTable(t, records); -#if !LUBAN_LITE if (this.Assembly.NeedL10nTextTranslate) { ValidateText(t, records); } -#endif } finally { @@ -93,7 +91,6 @@ namespace Luban.Job.Cfg } } -#if !LUBAN_LITE private void ValidateText(DefTable table, List records) { foreach (var r in records) @@ -103,7 +100,6 @@ namespace Luban.Job.Cfg } CurrentVisitor.CurrentValidateRecord = null; } -#endif private async Task ValidatePaths() { @@ -154,11 +150,7 @@ namespace Luban.Job.Cfg { if (ls.All(f => fileNotExistsSet.Contains(f))) { -#if !LUBAN_LITE agent.Error("记录 {0} = {1} (来自文件:{2}) 所引用文件:{3} 不存在", q.DataPath, q.Value, q.Source, string.Join(',', ls)); -#else - agent.Error("记录 {0} = {1} (来自文件:{2}) 所引用文件:{3} 不存在", q.DataPath, q.Value, q.Source, string.Join(",", ls)); -#endif } break; } diff --git a/src/Luban.Job.Cfg/Source/Validators/PathValidator.cs b/src/Luban.Job.Cfg/Source/Validators/PathValidator.cs index 84a9167..bb31604 100644 --- a/src/Luban.Job.Cfg/Source/Validators/PathValidator.cs +++ b/src/Luban.Job.Cfg/Source/Validators/PathValidator.cs @@ -112,11 +112,7 @@ namespace Luban.Job.Cfg.Validators string suffix = groups[2].Value.Substring(1); if (suffix.EndsWith("_C")) { -#if !LUBAN_LITE suffix = suffix[0..^2]; -#else - suffix = suffix.Substring(0, suffix.Length - 2); -#endif } return path.EndsWith(suffix); } @@ -221,17 +217,9 @@ namespace Luban.Job.Cfg.Validators string patType = ss[0]; bool emptyAble = false; -#if !LUBAN_LITE if (patType.EndsWith('?')) -#else - if (patType.EndsWith("?")) -#endif { -#if !LUBAN_LITE patType = patType[0..^1]; -#else - patType = patType.Substring(0, patType.Length - 1); -#endif emptyAble = true; } diff --git a/src/Luban.Job.Cfg/Source/Validators/RangeValidator.cs b/src/Luban.Job.Cfg/Source/Validators/RangeValidator.cs index e6425f4..6b93295 100644 --- a/src/Luban.Job.Cfg/Source/Validators/RangeValidator.cs +++ b/src/Luban.Job.Cfg/Source/Validators/RangeValidator.cs @@ -84,22 +84,14 @@ namespace Luban.Job.Cfg.Validators case '(': _includeMinBound = false; break; default: ThrowError(); break; } -#if !LUBAN_LITE switch (_str[^1]) -#else - switch (_str[_str.Length - 1]) -#endif { case ']': _includeMaxBound = true; break; case ')': _includeMaxBound = false; break; default: ThrowError(); break; } -#if !LUBAN_LITE var pars = _str[1..^1].Split(','); -#else - var pars = _str.Substring(1, _str.Length - 2).Split(','); -#endif if (pars.Length != 2) { ThrowError(); diff --git a/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs b/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs index 41b6441..463476c 100644 --- a/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs +++ b/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs @@ -41,7 +41,6 @@ namespace Luban.Job.Cfg.Validators } var assembly = ctx.Assembly; -#if !LUBAN_LITE foreach (var tableInfo in _compiledTables) { var (defTable, field, zeroAble) = tableInfo; @@ -83,7 +82,6 @@ namespace Luban.Job.Cfg.Validators { assembly.Agent.Error("记录 {0} = {1} (来自文件:{2}) 在引用表:{3} 中不存在", ValidatorContext.CurrentRecordPath, key, source, table.Table.FullName); } -#endif } diff --git a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs index e82b38d..25cb11f 100644 --- a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs @@ -214,11 +214,7 @@ namespace Luban.Job.Common.Defs rawType = DefUtil.TrimBracePairs(rawType); var (type, tags) = DefUtil.ParseType(rawType); -#if !LUBAN_LITE if (type.EndsWith('?')) -#else - if (type.EndsWith("?")) -#endif { if (!SupportNullable) { diff --git a/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs b/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs index 2eea545..81496c2 100644 --- a/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefBeanBase.cs @@ -59,7 +59,6 @@ namespace Luban.Job.Common.Defs } } -#if !LUBAN_LITE public virtual string GoBinImport { get @@ -76,7 +75,6 @@ namespace Luban.Job.Common.Defs return string.Join('\n', imports.Select(im => $"import \"{im}\"")); } } -#endif protected abstract DefFieldBase CreateField(Field f, int idOffset); diff --git a/src/Luban.Job.Common/Source/Utils/DefUtil.cs b/src/Luban.Job.Common/Source/Utils/DefUtil.cs index cb6a032..415f4f2 100644 --- a/src/Luban.Job.Common/Source/Utils/DefUtil.cs +++ b/src/Luban.Job.Common/Source/Utils/DefUtil.cs @@ -248,11 +248,7 @@ namespace Luban.Job.Common.Utils case ELanguage.PYTHON: case ELanguage.RUST: case ELanguage.PROTOBUF: -#if !LUBAN_LITE return System.Web.HttpUtility.HtmlEncode(comment).Replace("\n", "
"); -#else - throw new NotSupportedException(); -#endif default: throw new Exception($"unknown language:{curLan}"); } } diff --git a/src/Luban.Job.Proto/Source/Defs/DefProto.cs b/src/Luban.Job.Proto/Source/Defs/DefProto.cs index 2a8812d..3b2dc66 100644 --- a/src/Luban.Job.Proto/Source/Defs/DefProto.cs +++ b/src/Luban.Job.Proto/Source/Defs/DefProto.cs @@ -24,7 +24,6 @@ namespace Luban.Job.Proto.Defs public List Fields { get; set; } = new List(); -#if !LUBAN_LITE public virtual string GoBinImport { get @@ -41,7 +40,6 @@ namespace Luban.Job.Proto.Defs return string.Join('\n', imports.Select(im => $"import \"{im}\"")); } } -#endif public override void Compile() {
##full_namesepcommentfields
##+nametypegroupcommenttags
##varnametypegroupcommenttags
Rewarditem_idint道具id
countint个数
descstring描述
##+##var 02
##+##var item_idnumdescStage
##+##var namestages
##+##var id
##typeintstringlist,Item
##+##var 02
##+##var item_idnumdesc
##idlans
##typeintmap,string,string
##+ch-znenjpfr
##varch-znenjpfr
1苹果appleaaaaaa
2香蕉bananabbbbbb