拆分hook

This commit is contained in:
kuangshen04 2024-03-05 20:28:32 +08:00
parent 8c7ee66011
commit f1ea8d710e
2 changed files with 15 additions and 12 deletions

View File

@ -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) {

View File

@ -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) {