mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
Opt: Reduce ocr in goto_entry
This commit is contained in:
parent
818b196e45
commit
c033d3b60d
@ -132,16 +132,18 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
||||
return remain
|
||||
for group in self._iter_groups():
|
||||
self.goto_group(group)
|
||||
insight = False
|
||||
for assignment in self._iter_entries():
|
||||
if assignment in self.dispatched:
|
||||
continue
|
||||
logger.hr('Assignment all', level=2)
|
||||
logger.info(f'Check assignment all: {assignment}')
|
||||
self.goto_entry(assignment)
|
||||
self.goto_entry(assignment, insight)
|
||||
status = self._check_assignment_status()
|
||||
if status == AssignmentStatus.CLAIMABLE:
|
||||
self.claim(assignment, None, should_redispatch=False)
|
||||
remain += 1
|
||||
insight = True # Order of entries change after claiming
|
||||
continue
|
||||
if status == AssignmentStatus.DISPATCHED:
|
||||
self.dispatched[assignment] = datetime.now() + \
|
||||
@ -191,12 +193,14 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
||||
if not isinstance(group, AssignmentEventGroup):
|
||||
continue
|
||||
self.goto_group(group)
|
||||
insight = False
|
||||
for assignment in self._iter_entries():
|
||||
if assignment in self.dispatched:
|
||||
continue
|
||||
logger.hr('Assignment event', level=2)
|
||||
logger.info(f'Check assignment event: {assignment}')
|
||||
self.goto_entry(assignment)
|
||||
self.goto_entry(assignment, insight)
|
||||
insight = True
|
||||
status = self._check_assignment_status()
|
||||
# Should only be dispatchable or locked after _check_all
|
||||
if status == AssignmentStatus.DISPATCHABLE:
|
||||
|
@ -140,10 +140,11 @@ class AssignmentUI(UI):
|
||||
if ASSIGNMENT_GROUP_SWITCH.set(group, self):
|
||||
self._wait_until_entry_loaded()
|
||||
|
||||
def goto_entry(self, entry: AssignmentEntry):
|
||||
def goto_entry(self, entry: AssignmentEntry, insight: bool = True):
|
||||
"""
|
||||
Args:
|
||||
entry (AssignmentEntry):
|
||||
insight (bool): skip ocr to save time if insight is False
|
||||
|
||||
Examples:
|
||||
self = AssignmentUI('src')
|
||||
@ -160,7 +161,7 @@ class AssignmentUI(UI):
|
||||
raise ScriptError(err_msg)
|
||||
else:
|
||||
self.goto_group(entry.group)
|
||||
ASSIGNMENT_ENTRY_LIST.select_row(entry, self)
|
||||
ASSIGNMENT_ENTRY_LIST.select_row(entry, self, insight=insight)
|
||||
|
||||
def _wait_until_group_loaded(self):
|
||||
skip_first_screenshot = True
|
||||
|
Loading…
Reference in New Issue
Block a user