1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 11:15:13 +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
def handle_reward(self, interval=5) -> bool:
def handle_reward(self) -> bool:
"""
Args:
interval:
@ -35,15 +35,13 @@ class PopupHandler(ModuleBase):
Returns:
If handled.
"""
if self.appear_then_click(GET_REWARD, interval=interval):
timer = Timer(0.2).start()
if self.appear(GET_REWARD) or self.match_color(GET_REWARD, threshold=30):
while 1:
if timer.reached_and_reset():
self.device.screenshot()
if self.appear(GET_REWARD):
self.device.click(GET_REWARD)
else:
break
self.device.screenshot()
if self.appear(GET_REWARD) or self.match_color(GET_REWARD, threshold=30):
self.click_with_interval(GET_REWARD, interval=0.5)
else:
break
return True
return False