【修复】修复 db typescript 生成代码有编译错误的bug
							parent
							
								
									e278566289
								
							
						
					
					
						commit
						0ae7744f6e
					
				|  | @ -77,7 +77,7 @@ Luban适合有以下需求的开发者: | ||||||
|    - go (1.10+) |    - go (1.10+) | ||||||
|    - lua (5.1+) |    - lua (5.1+) | ||||||
|    - js 和 typescript (3.0+) |    - js 和 typescript (3.0+) | ||||||
|    - python (2.7+ 及 3.0+)   |    - python (3.0+)   | ||||||
| - 支持主流引擎和平台 | - 支持主流引擎和平台 | ||||||
|    - unity + c# |    - unity + c# | ||||||
|    - unity + tolua、xlua |    - unity + tolua、xlua | ||||||
|  | @ -145,7 +145,7 @@ Luban适合有以下需求的开发者: | ||||||
| 
 | 
 | ||||||
|   ```C# |   ```C# | ||||||
|   // 一行代码可以加载所有配置。 cfg.Tables 包含所有表的一个实例字段。 |   // 一行代码可以加载所有配置。 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); |   Console.WriteLine(tables.TbGlobal.Name); | ||||||
|   // 访问普通的 key-value 表 |   // 访问普通的 key-value 表 | ||||||
|  | @ -856,9 +856,9 @@ return | ||||||
|  	 |  	 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| 以目录为数据源,递归遍历整个目录树,将每个xml数据当作一个记录读入。 | 以目录为数据源,递归遍历整个目录树,将每个yml数据当作一个记录读入。 | ||||||
| 
 | 
 | ||||||
| 其中 1.yaml 文件内容如下 | 其中 1.yml 文件内容如下 | ||||||
| ```yaml | ```yaml | ||||||
| --- | --- | ||||||
| x1: true | x1: true | ||||||
|  |  | ||||||
|  | @ -52,7 +52,7 @@ namespace Luban.Job.Db.TypeVisitors | ||||||
| 
 | 
 | ||||||
|         public override string Accept(TList type, string bufName, string fieldName) |         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) |         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) |         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)} }} }}"; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -58,8 +58,6 @@ namespace Luban.Server | ||||||
|             int processorCount = System.Environment.ProcessorCount; |             int processorCount = System.Environment.ProcessorCount; | ||||||
|             ThreadPool.SetMinThreads(Math.Max(4, processorCount), 5); |             ThreadPool.SetMinThreads(Math.Max(4, processorCount), 5); | ||||||
|             ThreadPool.SetMaxThreads(Math.Max(16, processorCount * 4), 10); |             ThreadPool.SetMaxThreads(Math.Max(16, processorCount * 4), 10); | ||||||
| 
 |  | ||||||
|             Thread.CurrentThread.Join(); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue