1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-09 18:39:04 +08:00

Fix: ensure project should use index instead of name

This commit is contained in:
sui-feng-cb 2025-10-12 16:14:27 +08:00
parent c35ddd87cd
commit 2426c6895c
2 changed files with 6 additions and 2 deletions

View File

@ -265,6 +265,7 @@ class Island(IslandUI):
self.device.sleep(sleep) self.device.sleep(sleep)
def ensure_project(self, project: IslandProject, trial=7, skip_first_screenshot=True): def ensure_project(self, project: IslandProject, trial=7, skip_first_screenshot=True):
logger.hr('Project ensure')
for _ in range(trial): for _ in range(trial):
if skip_first_screenshot: if skip_first_screenshot:
skip_first_screenshot = False skip_first_screenshot = False
@ -313,14 +314,15 @@ class Island(IslandUI):
end = True end = True
proj_config = self.island_project_config(proj) proj_config = self.island_project_config(proj)
for button, option in zip(proj.slot_buttons.buttons, proj_config): for button, option, index in zip(
proj.slot_buttons.buttons, proj_config, range(len(proj_config))):
if option is None: if option is None:
continue continue
if self.project_receive(button): if self.project_receive(button):
self.island_select_role() self.island_select_role()
if self.island_select_product(option): if self.island_select_product(option):
self.island_product_confirm() self.island_product_confirm()
if not end or option != proj_config[-1]: if not end or index != len(proj_config) - 1:
self.ensure_project(proj) self.ensure_project(proj)
timeout.reset() timeout.reset()

View File

@ -98,6 +98,8 @@ class IslandProject:
return True return True
def __str__(self):
return self.name
class ItemNameOcr(Ocr): class ItemNameOcr(Ocr):
def after_process(self, result): def after_process(self, result):