1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-06-30 01:44:12 +08:00

Opt: Faster war archive list scrolling

This commit is contained in:
LmeSzinc
2026-06-11 23:47:08 +08:00
parent 60d0076fa7
commit 705c0e1fda

View File

@@ -58,6 +58,7 @@ class CampaignBase(CampaignBase_):
Fixed number of scrolls until give up, may need to Fixed number of scrolls until give up, may need to
increase as more war archives campaigns are added increase as more war archives campaigns are added
""" """
loading_checked = False
for _ in range(20): for _ in range(20):
if skip_first_screenshot: if skip_first_screenshot:
skip_first_screenshot = False skip_first_screenshot = False
@@ -71,14 +72,25 @@ class CampaignBase(CampaignBase_):
# before starting next search attempt # before starting next search attempt
while not self.appear(WAR_ARCHIVES_CHECK): while not self.appear(WAR_ARCHIVES_CHECK):
self.ui_ensure(destination=page_archives) self.ui_ensure(destination=page_archives)
loading_checked = False
while not self._archives_loading_complete(): # check entrance first, because game can remember last scrolling position
self.device.screenshot() # if you stays at page_campaign_menu
# and bypass _archives_loading_complete if reached entrance
entrance = self._get_archives_entrance(name) entrance = self._get_archives_entrance(name)
if entrance is not None: if entrance is not None:
return entrance return entrance
if not loading_checked:
# _archives_loading_complete might take 1~2s if archive list is not at top
while not self._archives_loading_complete():
self.device.screenshot()
loading_checked = True
entrance = self._get_archives_entrance(name)
if entrance is not None:
return entrance
if WAR_ARCHIVES_SCROLL.appear(main=self): if WAR_ARCHIVES_SCROLL.appear(main=self):
if WAR_ARCHIVES_SCROLL.at_bottom(main=self): if WAR_ARCHIVES_SCROLL.at_bottom(main=self):
WAR_ARCHIVES_SCROLL.set_top(main=self) WAR_ARCHIVES_SCROLL.set_top(main=self)