From 7ab86a2f144d14b4e7fac7aeb65d1f69eaf747d3 Mon Sep 17 00:00:00 2001 From: POLAR me Date: Fri, 27 Dec 2024 00:28:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor(module):=20=E6=96=B0=E5=A2=9E=20appear?= =?UTF-8?q?=5Fthen=5Fclick=5Fnocheck=20=E6=96=B9=E6=B3=95=E5=B9=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B2=B9=E4=BA=95=E6=A8=A1=E5=9D=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ModuleBase 类中添加appear_then_click_nocheck,进行点击后不检查 - 修改 oilkeep 模块使用 appear_then_click_nocheck --- module/base/base.py | 12 ++++++++++++ module/oilkeep/oilkeep.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/module/base/base.py b/module/base/base.py index b671fda64..cbacf7589 100644 --- a/module/base/base.py +++ b/module/base/base.py @@ -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: diff --git a/module/oilkeep/oilkeep.py b/module/oilkeep/oilkeep.py index 84d2db4ef..d214e3296 100644 --- a/module/oilkeep/oilkeep.py +++ b/module/oilkeep/oilkeep.py @@ -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