打牌一条龙优化:将人物挑战完成判断替换为更可靠的模板识别 (#1307)

This commit is contained in:
5117600049
2025-07-08 23:54:49 +08:00
committed by GitHub
parent 420001fd0e
commit 447d905c9f
3 changed files with 8 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -161,9 +161,10 @@ async function isTaskRefreshed(filePath, options = {}) {
// 如果文件不存在创建新文件并返回true(视为需要刷新)
const createResult = await file.writeText(filePath, '');
if (createResult) {
log.info("创建新文件成功");
await isTaskRefreshed(filePath, options = {});
log.info("创建新时间记录文件成功,执行脚本");
return true;
}
else throw new Error(`创建新文件失败`);
}
}
@@ -342,13 +343,13 @@ async function captureAndStoreTexts() {
for (const pos of positions) {
// 创建OCR识别区域
const ocrRo = RecognitionObject.ocr(pos.x, pos.y, width, height); //挑战者名字区域
const ocrRo2 = RecognitionObject.ocr(pos.x, pos.y + 100, width, height); //挑战是否完成
const ocrRo2 = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/completed.png"),pos.x, pos.y + 60, width, height+80);
// 在指定区域进行OCR识别
const result = captureRegion.find(ocrRo);
const result2 = captureRegion.find(ocrRo2);
let res2 = captureRegion.find(ocrRo2);
if (!result.isEmpty() && result.text) {
// 存储识别结果和对应位置
if (result2.text == "追踪") {
if (res2.isExist()) {
log.info(`识别到文本: ${result.text} 位置: (${pos.x}, ${pos.y})`);
textArray.push({
text: result.text.trim(),

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "打牌一条龙",
"version": "1.9.6",
"version": "1.9.7",
"description": "已添加 CD 管理执行完后会检测是否全部挑战成功之后会记录本次时间进入CD如果想要重置请前往assets/weekly.txt中删除内容",
"authors": [
{
@@ -11,4 +11,4 @@
],
"settings_ui": "settings.json",
"main": "main.js"
}
}