From 0ae7744f6e46b79cbbaa9cbb874fac5d2efdfe97 Mon Sep 17 00:00:00 2001 From: walon Date: Mon, 16 Aug 2021 15:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20db=20typescript=20=E7=94=9F=E6=88=90=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=9C=89=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- .../DbTypescriptCompatibleSerializeVisitor.cs | 4 ++-- src/Luban.Server/Source/Program.cs | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a23d0ef..f7072e2 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Luban适合有以下需求的开发者: - go (1.10+) - lua (5.1+) - js 和 typescript (3.0+) - - python (2.7+ 及 3.0+) + - python (3.0+) - 支持主流引擎和平台 - unity + c# - unity + tolua、xlua @@ -145,7 +145,7 @@ Luban适合有以下需求的开发者: ```C# // 一行代码可以加载所有配置。 cfg.Tables 包含所有表的一个实例字段。 - var tables = new cfg.Tables(file => return new ByteBuf(File.ReadAllBytes("<数据路径>/" + file))); + var tables = new cfg.Tables(file => return new ByteBuf(File.ReadAllBytes(gameConfDir + "/" + file))); // 访问一个单例表 Console.WriteLine(tables.TbGlobal.Name); // 访问普通的 key-value 表 @@ -856,9 +856,9 @@ return ``` -以目录为数据源,递归遍历整个目录树,将每个xml数据当作一个记录读入。 +以目录为数据源,递归遍历整个目录树,将每个yml数据当作一个记录读入。 -其中 1.yaml 文件内容如下 +其中 1.yml 文件内容如下 ```yaml --- x1: true diff --git a/src/Luban.Job.Db/Source/TypeVisitors/DbTypescriptCompatibleSerializeVisitor.cs b/src/Luban.Job.Db/Source/TypeVisitors/DbTypescriptCompatibleSerializeVisitor.cs index dbbff86..13d44c3 100644 --- a/src/Luban.Job.Db/Source/TypeVisitors/DbTypescriptCompatibleSerializeVisitor.cs +++ b/src/Luban.Job.Db/Source/TypeVisitors/DbTypescriptCompatibleSerializeVisitor.cs @@ -52,7 +52,7 @@ namespace Luban.Job.Db.TypeVisitors public override string Accept(TList type, string bufName, string fieldName) { - return $"{{ {bufName}.WriteInt(FieldTag.{type.ElementType.Apply(TagNameVisitor.Ins)}); {bufName}.WriteSize({fieldName}.length); for(let _e of {fieldName}) {{ {BeginSegment(type.ElementType, bufName)} {type.ElementType.Apply(this, bufName, "_e")} {EndSegment(type.ElementType, bufName)} }} }}"; + return $"{{ {bufName}.WriteInt(FieldTag.{type.ElementType.Apply(TagNameVisitor.Ins)}); {bufName}.WriteSize({fieldName}.length); for(let _e of {fieldName}) {{ {BeginSegment(type.ElementType, bufName)} {type.ElementType.Apply(this, bufName, "_e")}; {EndSegment(type.ElementType, bufName)} }} }}"; } public override string Accept(TSet type, string bufName, string fieldName) @@ -62,7 +62,7 @@ namespace Luban.Job.Db.TypeVisitors public override string Accept(TMap type, string bufName, string fieldName) { - return $"{{ {bufName}.WriteInt(FieldTag.{type.KeyType.Apply(TagNameVisitor.Ins)}); {bufName}.WriteInt(FieldTag.{type.ValueType.Apply(TagNameVisitor.Ins)}); {bufName}.WriteSize({fieldName}.length); for(let [_k, _v] of {fieldName}.entries()) {{ {type.KeyType.Apply(this, bufName, "_k")} {BeginSegment(type.ValueType, bufName)} {type.ValueType.Apply(this, bufName, "_v")} {EndSegment(type.ValueType, bufName)} }} }}"; + return $"{{ {bufName}.WriteInt(FieldTag.{type.KeyType.Apply(TagNameVisitor.Ins)}); {bufName}.WriteInt(FieldTag.{type.ValueType.Apply(TagNameVisitor.Ins)}); {bufName}.WriteSize({fieldName}.length); for(let [_k, _v] of {fieldName}.entries()) {{ {type.KeyType.Apply(this, bufName, "_k")}; {BeginSegment(type.ValueType, bufName)} {type.ValueType.Apply(this, bufName, "_v")}; {EndSegment(type.ValueType, bufName)} }} }}"; } } } diff --git a/src/Luban.Server/Source/Program.cs b/src/Luban.Server/Source/Program.cs index 5067245..667d9d3 100644 --- a/src/Luban.Server/Source/Program.cs +++ b/src/Luban.Server/Source/Program.cs @@ -58,8 +58,6 @@ namespace Luban.Server int processorCount = System.Environment.ProcessorCount; ThreadPool.SetMinThreads(Math.Max(4, processorCount), 5); ThreadPool.SetMaxThreads(Math.Max(16, processorCount * 4), 10); - - Thread.CurrentThread.Join(); } }