fix(AutoPlanDomain): 解决原粹树脂识别和按钮点击问题

- 在物理值OCR识别前添加1秒延迟以提高准确性
- 将操作延迟时间从2000毫秒调整为1000毫秒
- 修正增加按钮的坐标和尺寸参数以匹配当前界面布局
- 注释掉衍生裁剪区域的释放操作避免潜在错误
This commit is contained in:
yan
2026-02-15 17:37:54 +08:00
parent c6d3cf68ed
commit 9869a2a513
2 changed files with 8 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ async function autoDomain(autoFight) {
// transientResinUseCount: number;
// /** 使用脆弱树脂次数 */
// fragileResinUseCount: number;
await sleep(1000)
//流程->返回主页 打开地图 返回主页
const physicalOcr = await ocrPhysical(true, true)
config.user.physical.current = physicalOcr.current

View File

@@ -47,7 +47,7 @@ async function ocrPhysical(opToMainUi = false,openMap=false,minPhysical=20,isRes
}
}
log.debug(`===开始识别原粹树脂===`)
let ms = 2000 // 定义操作延迟时间(毫秒)
let ms = 1000 // 定义操作延迟时间(毫秒)
if (opToMainUi) {
await toMainUi(); // 切换到主界面
}
@@ -62,13 +62,14 @@ async function ocrPhysical(opToMainUi = false,openMap=false,minPhysical=20,isRes
let add_buttonJSON = getJsonPath('add_button');
let add_objJson = {
path: `${add_buttonJSON.path}${add_buttonJSON.name}${add_buttonJSON.type}`,
x: 1242,
y: 21,
width: 54,
height: 51,
x: 1373,
y: 22,
width: 52,
height: 49,
}
let templateMatchAddButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync(`${add_objJson.path}`), add_objJson.x, add_objJson.y, add_objJson.width, add_objJson.height);
let regionA = captureGameRegion()
// let deriveCrop = regionA.DeriveCrop(add_objJson.x, add_objJson.y, add_objJson.width, add_objJson.height);
try {
let buttonA = regionA.find(templateMatchAddButtonRo);
@@ -79,6 +80,7 @@ async function ocrPhysical(opToMainUi = false,openMap=false,minPhysical=20,isRes
}
await buttonA.click()
}finally {
// deriveCrop.Dispose()
regionA.Dispose()
}