refactor(module): 新增 appear_then_click_nocheck 方法并调整油井模块逻辑

- 在 ModuleBase 类中添加appear_then_click_nocheck,进行点击后不检查
- 修改 oilkeep 模块使用 appear_then_click_nocheck
This commit is contained in:
POLAR me 2024-12-27 00:28:16 +08:00
parent 628814c4b6
commit 7ab86a2f14
2 changed files with 13 additions and 1 deletions

View File

@ -220,6 +220,18 @@ class ModuleBase:
self.device.click(button)
return appear
def appear_then_click_nocheck(self, button, ctrlcheck=False,screenshot=False, genre='items', offset=0, interval=0, similarity=0.85,
threshold=30):
button = self.ensure_button(button)
appear = self.appear(button, offset=offset, interval=interval, similarity=similarity, threshold=threshold)
if appear:
if screenshot:
self.device.sleep(self.config.WAIT_BEFORE_SAVING_SCREEN_SHOT)
self.device.screenshot()
self.device.save_screenshot(genre=genre)
self.device.click(button,control_check=ctrlcheck)
return appear
def wait_until_appear(self, button, offset=0, skip_first_screenshot=False):
while 1:
if skip_first_screenshot:

View File

@ -56,7 +56,7 @@ class Oilkeep(UI):
if self.appear_then_click(MAIL_OIL, offset=(30, 30), interval=3):
logger.info('MAIL_OIL entered')
continue
if mail_oil_add_count <= oil_add_need-1 and self.appear_then_click(MAIL_OIL_ADD, offset=(30, 30), interval=3):
if mail_oil_add_count <= oil_add_need-1 and self.appear_then_click_nocheck(MAIL_OIL_ADD, offset=(30, 30), interval=3):
mail_oil_add_count += 1
logger.info('MAIL_OIL_ADD')
continue