mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-29 05:39:51 +08:00
fix(AutoPlanDomain): 解决原粹树脂识别和按钮点击问题
- 在物理值OCR识别前添加1秒延迟以提高准确性 - 将操作延迟时间从2000毫秒调整为1000毫秒 - 修正增加按钮的坐标和尺寸参数以匹配当前界面布局 - 注释掉衍生裁剪区域的释放操作避免潜在错误
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user