From 63fbf1e4866cf65c576b90e9e708bbcaa243164e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 10 May 2024 11:30:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E4=BB=BB=E5=8A=A1=E6=A0=8F=E4=B8=AD?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=AF=E5=8A=A8=E5=92=8C=E9=99=84=E5=8A=A0?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 ++++++ src/debug.ts | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/package.json b/package.json index 2e24f3b..ab82176 100644 --- a/package.json +++ b/package.json @@ -286,6 +286,12 @@ "ignoreSync": true, "pattern": "(^.*[\\\\/]Editor.exe$)|(^$)" }, + "Y3-Helper.ShowStatusBarItem": { + "title": "显示状态栏按钮", + "description": "在状态栏中显示“启动”和“附加”按钮", + "type": "boolean", + "default": true + }, "Y3-Helper.editorTablceDataExcelFolder": { "title": "存放物编数据的Excel表格所在的文件夹的相对路径", "description": "注意:Execl表中的物编数据会按此相对路径下的importRules.mjs代码所实现的导入规则来导入,生成Excel物编数据模板时也会生成到此文件夹下", diff --git a/src/debug.ts b/src/debug.ts index f6e521d..dbdd6d4 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -41,6 +41,31 @@ export function init(context: vscode.ExtensionContext) { env.onDidChange(() => { update_debugger_path(); }); + + let launch = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); + launch.text = '✨启动'; + launch.tooltip = '启动游戏并附加调试器'; + launch.command = 'y3-helper.launchGameAndAttach'; + + let attach = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); + attach.text = '💡附加'; + attach.tooltip = '附加调试器'; + attach.command = 'y3-helper.attach'; + + function update_items() { + if (vscode.workspace.getConfiguration('Y3-Helper').get('ShowStatusBarItem')) { + launch.show(); + attach.show(); + } else { + launch.hide(); + attach.hide(); + } + } + + update_items(); + vscode.workspace.onDidChangeConfiguration(() => { + update_items(); + }); } export async function attach() {