mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
Fix: Character selecting in assignment
- https://github.com/LmeSzinc/StarRailCopilot/pull/23#discussion_r1235537186 - https://github.com/LmeSzinc/StarRailCopilot/pull/23#discussion_r1235549827
This commit is contained in:
parent
c2b935f946
commit
e5c57dc9b0
BIN
assets/share/assignment/dispatch/CHARACTER_1_SELECTED.png
Normal file
BIN
assets/share/assignment/dispatch/CHARACTER_1_SELECTED.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
assets/share/assignment/dispatch/CHARACTER_2_SELECTED.png
Normal file
BIN
assets/share/assignment/dispatch/CHARACTER_2_SELECTED.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
@ -33,6 +33,16 @@ CHARACTER_1 = ButtonWrapper(
|
||||
button=(116, 212, 206, 312),
|
||||
),
|
||||
)
|
||||
CHARACTER_1_SELECTED = ButtonWrapper(
|
||||
name='CHARACTER_1_SELECTED',
|
||||
share=Button(
|
||||
file='./assets/share/assignment/dispatch/CHARACTER_1_SELECTED.png',
|
||||
area=(114, 207, 134, 225),
|
||||
search=(94, 187, 154, 245),
|
||||
color=(192, 204, 193),
|
||||
button=(114, 207, 134, 225),
|
||||
),
|
||||
)
|
||||
CHARACTER_2 = ButtonWrapper(
|
||||
name='CHARACTER_2',
|
||||
share=Button(
|
||||
@ -43,6 +53,16 @@ CHARACTER_2 = ButtonWrapper(
|
||||
button=(228, 211, 318, 311),
|
||||
),
|
||||
)
|
||||
CHARACTER_2_SELECTED = ButtonWrapper(
|
||||
name='CHARACTER_2_SELECTED',
|
||||
share=Button(
|
||||
file='./assets/share/assignment/dispatch/CHARACTER_2_SELECTED.png',
|
||||
area=(226, 207, 245, 225),
|
||||
search=(206, 187, 265, 245),
|
||||
color=(179, 194, 187),
|
||||
button=(226, 207, 245, 225),
|
||||
),
|
||||
)
|
||||
CHARACTER_LIST = ButtonWrapper(
|
||||
name='CHARACTER_LIST',
|
||||
cn=Button(
|
||||
|
@ -64,7 +64,6 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
||||
self.dispatched[assignment] = datetime.now() + Duration(
|
||||
OCR_ASSIGNMENT_TIME).ocr_single_line(self.device.image)
|
||||
continue
|
||||
if self.appear(EMPTY_SLOT):
|
||||
if remain > 0:
|
||||
self.dispatch(assignment, duration)
|
||||
remain -= 1
|
||||
@ -99,7 +98,6 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
||||
self.dispatched[assignment] = datetime.now() + Duration(
|
||||
OCR_ASSIGNMENT_TIME).ocr_single_line(self.device.image)
|
||||
continue
|
||||
if self.appear(EMPTY_SLOT):
|
||||
break
|
||||
return remain
|
||||
|
||||
|
@ -47,24 +47,27 @@ class AssignmentDispatch(AssignmentUI):
|
||||
out: CHARACTER_LIST
|
||||
"""
|
||||
skip_first_screenshot = True
|
||||
click_timer = Timer(1, count=3).start()
|
||||
list_timer = Timer(1, count=3)
|
||||
select_timer = Timer(2, count=3)
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
# End
|
||||
if not self.appear(EMPTY_SLOT):
|
||||
logger.info('Assignment slots are all filled')
|
||||
if self.match_template_color(CONFIRM_ASSIGNMENT):
|
||||
logger.info('Characters are all selected')
|
||||
break
|
||||
# Ensure character list
|
||||
if not self.appear(CHARACTER_LIST):
|
||||
if click_timer.reached_and_reset():
|
||||
if list_timer.reached_and_reset():
|
||||
self.device.click(EMPTY_SLOT)
|
||||
continue
|
||||
# Select
|
||||
if click_timer.reached_and_reset():
|
||||
if select_timer.reached_and_reset():
|
||||
if not self.image_color_count(CHARACTER_1_SELECTED, (240, 240, 240)):
|
||||
self.device.click(CHARACTER_1)
|
||||
if not self.image_color_count(CHARACTER_2_SELECTED, (240, 240, 240)):
|
||||
self.device.click(CHARACTER_2)
|
||||
|
||||
def _select_duration(self, duration: int):
|
||||
|
@ -155,10 +155,6 @@ class AssignmentUI(UI):
|
||||
"""
|
||||
Iterate entries from top to bottom
|
||||
"""
|
||||
while 1:
|
||||
ASSIGNMENT_ENTRY_LIST.load_rows(self)
|
||||
ASSIGNMENT_ENTRY_LIST.load_rows(main=self)
|
||||
for button in ASSIGNMENT_ENTRY_LIST.cur_buttons:
|
||||
yield button.matched_keyword
|
||||
ASSIGNMENT_ENTRY_LIST.drag_page('down', self)
|
||||
self.wait_until_stable(ASSIGNMENT_ENTRY_LIST.search_button, timer=Timer(
|
||||
0, count=0), timeout=Timer(1.5, count=5))
|
||||
|
Loading…
Reference in New Issue
Block a user