1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-06-29 00:50:42 +08:00

Fix: retry on using data key confirm

This commit is contained in:
LmeSzinc
2026-06-11 22:55:14 +08:00
parent 533979ea4b
commit 44fcd363e9

View File

@@ -203,24 +203,30 @@ class InfoHandler(ModuleBase):
return False return False
if self.appear(USE_DATA_KEY, offset=(20, 20)): if self.appear(USE_DATA_KEY, offset=(20, 20)):
skip_first_screenshot = True # enable USE_DATA_KEY_NOTIFIED
while 1: for _ in self.loop():
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
enabled = self.image_color_count( enabled = self.image_color_count(
USE_DATA_KEY_NOTIFIED, color=(140, 207, 66), threshold=180, count=10) USE_DATA_KEY_NOTIFIED, color=(140, 207, 66), threshold=180, count=10)
if enabled: if enabled:
break break
if self.appear(USE_DATA_KEY, offset=(20, 20), interval=5): if self.appear(USE_DATA_KEY, offset=(20, 20), interval=5):
self.device.click(USE_DATA_KEY_NOTIFIED) self.device.click(USE_DATA_KEY_NOTIFIED)
continue continue
self.config.USE_DATA_KEY = False # Reset on success as task can be stopped before can be recovered self.config.USE_DATA_KEY = False # Reset on success as task can be stopped before can be recovered
return self.handle_popup_confirm('USE_DATA_KEY')
# click confirm
# POPUP_CONFIRM from data key page has minor differece from the standard one
# so we just bind clicking it
self.interval_clear(USE_DATA_KEY, interval=5)
for _ in self.loop():
if not self.appear(USE_DATA_KEY, offset=(20, 20)):
break
if self.appear(USE_DATA_KEY, offset=(20, 20), interval=5):
self.device.click(POPUP_CONFIRM)
continue
return True
return False return False
@@ -242,6 +248,15 @@ class InfoHandler(ModuleBase):
""" """
return self.appear_then_click(GET_SKIN, offset=(20, 20), interval=2) return self.appear_then_click(GET_SKIN, offset=(20, 20), interval=2)
def handle_get_items_small(self):
if self.appear(GET_ITEMS_SMALL1, offset=(-45, -5, 5, 5)):
return GET_ITEMS_SMALL1
if self.appear(GET_ITEMS_SMALL2, offset=(-45, -5, 5, 5)):
return GET_ITEMS_SMALL2
if self.appear(GET_ITEMS_SMALL3, offset=(-45, -5, 5, 5)):
return GET_ITEMS_SMALL3
return False
""" """
Guild popup info Guild popup info
""" """
@@ -553,4 +568,11 @@ class InfoHandler(ModuleBase):
self.wait_until_manjuu_disappear() self.wait_until_manjuu_disappear()
return True return True
else: else:
return False return False
if __name__ == '__main__':
self = InfoHandler('alas')
self.image_file = r'D:\Downloads\589909030-c7431879-3b7d-4b75-972e-c449ad410885.png'
for row in self._story_option_buttons_2():
print(row)