From f1ea8d710edf2f304778b88b847b1fce67b26e38 Mon Sep 17 00:00:00 2001 From: kuangshen04 <2832899707@qq.com> Date: Tue, 5 Mar 2024 20:28:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/game/index.js | 12 +----------- noname/library/index.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/noname/game/index.js b/noname/game/index.js index a6856e3ec..5407f0c13 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -5932,17 +5932,7 @@ export class Game extends Uninstantable { if (!event.forced && !event.fakeforce && get.noSelected()) confirm += 'c'; if (event.isMine()) game.Check.confirm(event, confirm); - game.callHook("checkEnd", [event]); - - if (event.isMine() && confirm.includes('o') - && auto && (auto_confirm || skillinfo.direct) && !_status.touchnocheck - && !_status.mousedown && (!_status.mousedragging || !_status.mouseleft)) { - if (ui.confirm) ui.confirm.close(); - if (event.skillDialog === true) event.skillDialog = false; - ui.click.ok(); - _status.mousedragging = null; - if (skillinfo.preservecancel) ui.create.confirm('c'); - } + game.callHook("checkEnd", [event, { ok, auto, auto_confirm }]); // if (ui.confirm && ui.confirm.lastChild.link == 'cancel') { // if (_status.event.type == 'phase' && !_status.event.skill) { diff --git a/noname/library/index.js b/noname/library/index.js index 672760fc5..4f9813f6b 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -332,7 +332,20 @@ export class Library extends Uninstantable { }], //game.check checkBegin: [], - checkEnd: [], + checkEnd: [ + function autoConfirm(event, { ok, auto, auto_confirm }) { + if (!event.isMine()) return; + const skillinfo = get.info(event.skill) || {}; + if (ok && auto && (auto_confirm || skillinfo.direct) && !_status.touchnocheck + && !_status.mousedown && (!_status.mousedragging || !_status.mouseleft)) { + if (ui.confirm) ui.confirm.close(); + if (event.skillDialog === true) event.skillDialog = false; + ui.click.ok(); + _status.mousedragging = null; + if (skillinfo.preservecancel) ui.create.confirm('c'); + } + } + ], checkButton: [], checkCard: [ function updateTempname(card, event) {