接入luban

This commit is contained in:
2026-02-17 09:07:25 +08:00
parent edab22473a
commit 861a8a9d16
284 changed files with 17677 additions and 848 deletions

View File

@@ -0,0 +1,31 @@
import pb from 'pb';
type BufLoader = (file: string) => Uint8Array;
export class {{__name}} {
{{~ for table in __tables ~}}
private _{{table.name}}: pb.cfg.{{table.name}}
{{~if table.comment != '' ~}}
/**
* {{escape_comment table.comment}}
*/
{{~end~}}
get {{table.name}}(): pb.cfg.{{table.name}} { return this._{{table.name}};}
{{~end~}}
static getTableNames(): string[] {
let names: string[] = [];
{{~for table in __tables ~}}
names.push('{{table.output_data_file}}');
{{~end~}}
return names;
}
constructor(loader: BufLoader) {
let buffer: Uint8Array;
{{~for table in __tables ~}}
buffer = loader('{{table.output_data_file}}');
this._{{table.name}} = pb.cfg.{{table.name}}.decode(buffer, buffer.length);
{{~end~}}
}
}