Skip to content

Commit

Permalink
为多开支持做准备
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Sep 26, 2024
1 parent f663100 commit a5482e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ class Helper {
}, async (progress) => {
let gameLauncher = new GameLauncher();
let suc = await gameLauncher.launch({
"lua_wait_debugger": true,
luaArgs: {
"lua_wait_debugger": true,
},
});
if (!suc) {
return;
Expand Down
20 changes: 15 additions & 5 deletions src/launchGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { env } from './env';
import { runShell } from './runShell';
import * as y3 from 'y3-helper';

interface LaunchOptions {
luaArgs?: {[key: string]: string|number|boolean};
multi?: number[];
}

export class GameLauncher {
private async runPlugin() {
try {
Expand All @@ -20,7 +25,7 @@ export class GameLauncher {
return true;
}

public async launch(luaArgs?: {[key: string]: string|number|boolean}): Promise<boolean> {
public async launch(options?: LaunchOptions): Promise<boolean> {
await env.editorReady(true);
await env.mapReady(true);
let projectUri = env.projectUri;
Expand All @@ -42,13 +47,18 @@ export class GameLauncher {

let args = [];
args.push('type@editor_game');
args.push('subtype@editor_game');
if (options?.multi) {
args.push('subtype@editor_multi_game');
args.push('role_ids@' + options.multi.join('#'));
} else {
args.push('subtype@editor_game');
}
args.push('release@true');
args.push('editor_map_path@' + projectUri.fsPath);
args.push('lua_dummy@sp ce');
if (luaArgs) {
for (let key in luaArgs) {
args.push(key + "@" + luaArgs[key].toString());
if (options?.luaArgs) {
for (let key in options.luaArgs) {
args.push(key + "@" + options.luaArgs[key].toString());
}
}
await runShell(
Expand Down

0 comments on commit a5482e6

Please sign in to comment.