mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 22:05:12 +00:00
perf(sweep): simplify sweep num ocr
This commit is contained in:
parent
aa872c890d
commit
4ce8073096
@ -119,18 +119,7 @@ class StageSweep:
|
|||||||
return main.appear(self.skip_skip) or main.appear(self.skip_ok_upper) or main.appear(self.skip_ok_lower)
|
return main.appear(self.skip_skip) or main.appear(self.skip_ok_upper) or main.appear(self.skip_ok_lower)
|
||||||
|
|
||||||
def load_sweep_num(self, main: ModuleBase):
|
def load_sweep_num(self, main: ModuleBase):
|
||||||
timer = Timer(0.5, 2).start()
|
self.current_sweep = self.num.ocr_single_line(main.device.image)
|
||||||
while 1:
|
|
||||||
main.device.screenshot()
|
|
||||||
if not timer.reached_and_reset():
|
|
||||||
continue
|
|
||||||
ocr_result = list(filter(lambda x: x.ocr_text.isdigit(), self.num.detect_and_ocr(main.device.image)))
|
|
||||||
if not ocr_result:
|
|
||||||
logger.warning(f'No valid num in {self.num.name}')
|
|
||||||
continue
|
|
||||||
if len(ocr_result) == 1:
|
|
||||||
self.current_sweep = int(ocr_result[0].ocr_text)
|
|
||||||
return
|
|
||||||
|
|
||||||
def set_sweep_num(self, main: ModuleBase, skip_first_screenshot=True) -> bool:
|
def set_sweep_num(self, main: ModuleBase, skip_first_screenshot=True) -> bool:
|
||||||
num = self.sweep_num
|
num = self.sweep_num
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user