mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 00:52:22 +00:00
commit
0e1b6578eb
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 12 KiB |
@ -47,10 +47,10 @@ OCR_ASSIGNMENT_LIMIT = ButtonWrapper(
|
|||||||
name='OCR_ASSIGNMENT_LIMIT',
|
name='OCR_ASSIGNMENT_LIMIT',
|
||||||
share=Button(
|
share=Button(
|
||||||
file='./assets/share/assignment/ui/OCR_ASSIGNMENT_LIMIT.png',
|
file='./assets/share/assignment/ui/OCR_ASSIGNMENT_LIMIT.png',
|
||||||
area=(1095, 82, 1180, 125),
|
area=(1095, 95, 1180, 119),
|
||||||
search=(1075, 62, 1200, 145),
|
search=(1075, 75, 1200, 139),
|
||||||
color=(41, 44, 50),
|
color=(51, 54, 60),
|
||||||
button=(1095, 82, 1180, 125),
|
button=(1095, 95, 1180, 119),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
OCR_ASSIGNMENT_LIST = ButtonWrapper(
|
OCR_ASSIGNMENT_LIST = ButtonWrapper(
|
||||||
|
@ -13,6 +13,7 @@ from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
|||||||
|
|
||||||
class UI(PopupHandler):
|
class UI(PopupHandler):
|
||||||
ui_current: Page
|
ui_current: Page
|
||||||
|
ui_main_confirm_timer = Timer(0.2, count=0)
|
||||||
|
|
||||||
def ui_page_appear(self, page):
|
def ui_page_appear(self, page):
|
||||||
"""
|
"""
|
||||||
@ -112,6 +113,8 @@ class UI(PopupHandler):
|
|||||||
# Destination page
|
# Destination page
|
||||||
if self.ui_page_appear(destination):
|
if self.ui_page_appear(destination):
|
||||||
logger.info(f'Page arrive: {destination}')
|
logger.info(f'Page arrive: {destination}')
|
||||||
|
if self.ui_page_confirm(destination):
|
||||||
|
logger.info(f'Page arrive confirm {destination}')
|
||||||
break
|
break
|
||||||
|
|
||||||
# Other pages
|
# Other pages
|
||||||
@ -121,6 +124,8 @@ class UI(PopupHandler):
|
|||||||
continue
|
continue
|
||||||
if self.appear(page.check_button, interval=5):
|
if self.appear(page.check_button, interval=5):
|
||||||
logger.info(f'Page switch: {page} -> {page.parent}')
|
logger.info(f'Page switch: {page} -> {page.parent}')
|
||||||
|
if self.ui_page_confirm(page):
|
||||||
|
logger.info(f'Page arrive confirm {page}')
|
||||||
button = page.links[page.parent]
|
button = page.links[page.parent]
|
||||||
self.device.click(button)
|
self.device.click(button)
|
||||||
self.ui_button_interval_reset(button)
|
self.ui_button_interval_reset(button)
|
||||||
@ -287,6 +292,45 @@ class UI(PopupHandler):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _ui_button_confirm(
|
||||||
|
self,
|
||||||
|
button,
|
||||||
|
confirm=Timer(0.1, count=0),
|
||||||
|
timeout=Timer(2, count=6),
|
||||||
|
skip_first_screenshot=True
|
||||||
|
):
|
||||||
|
confirm.reset()
|
||||||
|
timeout.reset()
|
||||||
|
while 1:
|
||||||
|
if skip_first_screenshot:
|
||||||
|
skip_first_screenshot = False
|
||||||
|
else:
|
||||||
|
self.device.screenshot()
|
||||||
|
|
||||||
|
if timeout.reached():
|
||||||
|
logger.warning(f'_ui_button_confirm({button}) timeout')
|
||||||
|
break
|
||||||
|
|
||||||
|
if self.appear(button):
|
||||||
|
if confirm.reached():
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
confirm.reset()
|
||||||
|
|
||||||
|
def ui_page_confirm(self, page):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
page (Page):
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: If handled
|
||||||
|
"""
|
||||||
|
if page == page_main:
|
||||||
|
self._ui_button_confirm(page.check_button)
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def ui_button_interval_reset(self, button):
|
def ui_button_interval_reset(self, button):
|
||||||
"""
|
"""
|
||||||
Reset interval of some button to avoid mistaken clicks
|
Reset interval of some button to avoid mistaken clicks
|
||||||
|
@ -31,6 +31,7 @@ class DailyQuestOcr(Ocr):
|
|||||||
if self.lang == 'ch':
|
if self.lang == 'ch':
|
||||||
result = result.replace("J", "」")
|
result = result.replace("J", "」")
|
||||||
result = result.replace(";", "」")
|
result = result.replace(";", "」")
|
||||||
|
result = result.replace("了", "」")
|
||||||
result = result.replace("宇审", "宇宙")
|
result = result.replace("宇审", "宇宙")
|
||||||
# 进行中」hbadarin
|
# 进行中」hbadarin
|
||||||
if "进行中" in result:
|
if "进行中" in result:
|
||||||
|
Loading…
Reference in New Issue
Block a user