Skip to content

Commit

Permalink
使用命令行传递参数
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Mar 18, 2024
1 parent a4bee4c commit 5e034aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ class Helper {
location: vscode.ProgressLocation.Window,
}, async (progress) => {
let gameLauncher = new GameLauncher(this.env);
let suc = gameLauncher.launch();
let suc = gameLauncher.launch({
"lua_wait_debugger": true,
});
if (!suc) {
return;
}
Expand Down
14 changes: 12 additions & 2 deletions src/launchGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class GameLauncher {
this.env = env;
}

public async launch(): Promise<boolean> {
public async launch(luaArgs?: {[key: string]: string|number|boolean}): Promise<boolean> {
await this.env.waitReady();
let projectUri = this.env.projectUri;
let editorExeUri = this.env.editorExeUri;
Expand All @@ -22,14 +22,24 @@ export class GameLauncher {
vscode.window.showErrorMessage("未找到编辑器!");
return false;
}
let args = [];
args.push('type@editor_game');
args.push('subtype@editor_game');
args.push('release@true');
args.push('editor_map_path@' + projectUri.fsPath);
if (luaArgs) {
for (let key in luaArgs) {
args.push(key + "@" + luaArgs[key].toString());
}
}
await runShell(
"启动游戏",
editorExeUri.fsPath,
[
"--dx11",
"--console",
"--start=Python",
"--python-args=type@editor_game,subtype@editor_game,release@true,editor_map_path@" + projectUri.fsPath,
"--python-args=" + args.join(","),
"--plugin-config=Plugins-PyQt",
"--python-debug=1",
],
Expand Down

0 comments on commit 5e034aa

Please sign in to comment.