From 69db76fc75483dbe402d3aa5d0e20c4e7adf85ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BA=81=E5=8A=A8=E7=9A=84=E6=B0=A8=E6=B0=94?= <131591012+zaodonganqi@users.noreply.github.com> Date: Tue, 3 Mar 2026 21:47:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=8F=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=BD=B1=E5=93=8D=E8=BF=90=E8=A1=8C=20(#2954)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/tool.js | 17 ++++++++++++----- repo/js/WeeklyThousandStarRealm/main.js | 7 ++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/utils/tool.js b/packages/utils/tool.js index 7217ab5c7..96e92a03f 100644 --- a/packages/utils/tool.js +++ b/packages/utils/tool.js @@ -280,7 +280,9 @@ async function waitUntilImgAppear( const start = Date.now(); while (Date.now() - start <= timeout) { - await action(); + if (action) { + await action(); + } const res = await findImg(target, x, y, w, h, interval); if (res) return res; await sleep(interval); @@ -316,7 +318,9 @@ async function waitUntilImgDisappear( const start = Date.now(); while (Date.now() - start <= timeout) { - await action(); + if (action) { + await action(); + } const res = await findImg(target, x, y, w, h, interval); if (!res) return true; await sleep(interval); @@ -352,8 +356,9 @@ async function waitUntilTextAppear( const start = Date.now(); while (Date.now() - start <= attempts * interval) { - await action(); - + if (action) { + await action(); + } const res = await findText(text, x, y, w, h, 1, interval); if (res) return res; @@ -390,7 +395,9 @@ async function waitUntilTextDisappear( const start = Date.now(); while (Date.now() - start <= attempts * interval) { - await action(); + if (action) { + await action(); + } const res = await findText(text, x, y, w, h, 1, interval); // 每次只试 1 次 OCR if (!res) return true; await sleep(interval); diff --git a/repo/js/WeeklyThousandStarRealm/main.js b/repo/js/WeeklyThousandStarRealm/main.js index d8d64db76..7bdfdca6e 100644 --- a/repo/js/WeeklyThousandStarRealm/main.js +++ b/repo/js/WeeklyThousandStarRealm/main.js @@ -3,12 +3,14 @@ import { findTextAndClick, findImgAndClick, waitUntilTextAppear, - waitUntilImgDisappear + waitUntilImgDisappear, + waitUntilImgAppear } from "../../../packages/utils/tool"; import fold_triangle from "assets/fold_triangle.png"; import check_box from "assets/check_box.png"; import exit_room from "assets/exit_room.png"; +import paimon from "../../../packages/assets/imgs/paimon_menu.png"; const duration = 1000; // 默认点击等待延时 @@ -380,6 +382,9 @@ async function exitToTeyvat() { await findTextAndClick("返回", 960, 0, 960, 100); await sleep(duration); await findTextAndClick("确认", 960, 600, 960, 400); + await waitUntilImgAppear(paimon); + // 有镜头拉近动画 + await sleep(duration); } (async function () {