1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-17 00:15:13 +00:00

perf(tc): improve get reward method

This commit is contained in:
YoursFunny 2023-11-20 22:34:01 +08:00
parent 08959e5f1c
commit f7b165f589
Signed by: YoursFunny
GPG Key ID: 207EDC3CD5B40F9C

View File

@ -1,3 +1,4 @@
from module.base.timer import Timer
from module.logger import logger from module.logger import logger
from module.ocr.ocr import DigitCounter from module.ocr.ocr import DigitCounter
from module.ui.switch import Switch from module.ui.switch import Switch
@ -24,19 +25,19 @@ class TacticalChallengeUI(UI):
return True return True
def get_reward(self): def get_reward(self):
if self.match_color(GET_REWARD_DAILY): timer = Timer(10, 10).start()
self.device.click(GET_REWARD_DAILY) while 1:
logger.info('Get tc daily reward') self.device.screenshot()
return True if self.match_color(GOT_REWARD_DAILY) and self.match_color(GOT_REWARD_CREDIT):
if self.match_color(GET_REWARD_CREDIT): return True
self.device.click(GET_REWARD_CREDIT) if self.match_color(GET_REWARD_DAILY):
logger.info('Get tc credit reward') self.device.click(GET_REWARD_DAILY)
return True logger.info('Get daily reward')
if self.match_color(GOT_REWARD_DAILY) and self.match_color(GOT_REWARD_CREDIT): if self.match_color(GET_REWARD_CREDIT):
logger.info('Both tc reward got') self.device.click(GET_REWARD_CREDIT)
return True logger.info('Get credit reward')
if timer.reached():
return False return False
def set_skip(self): def set_skip(self):
""" """