1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-18 17:25:22 +00:00

perf(popup): improve reward handle stability

This commit is contained in:
YoursFunny 2023-11-04 16:09:29 +08:00
parent 0551207714
commit 61fa6ad28b
Signed by: YoursFunny
GPG Key ID: 207EDC3CD5B40F9C

View File

@ -27,7 +27,7 @@ class PopupHandler(ModuleBase):
return False return False
def handle_reward(self, interval=5) -> bool: def handle_reward(self) -> bool:
""" """
Args: Args:
interval: interval:
@ -35,13 +35,11 @@ class PopupHandler(ModuleBase):
Returns: Returns:
If handled. If handled.
""" """
if self.appear_then_click(GET_REWARD, interval=interval): if self.appear(GET_REWARD) or self.match_color(GET_REWARD, threshold=30):
timer = Timer(0.2).start()
while 1: while 1:
if timer.reached_and_reset():
self.device.screenshot() self.device.screenshot()
if self.appear(GET_REWARD): if self.appear(GET_REWARD) or self.match_color(GET_REWARD, threshold=30):
self.device.click(GET_REWARD) self.click_with_interval(GET_REWARD, interval=0.5)
else: else:
break break
return True return True