mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 13:17:00 +08:00
Upd: island ui_additional
This commit is contained in:
@@ -2,8 +2,8 @@ from module.base.timer import Timer
|
||||
from module.handler.assets import MAINTENANCE_ANNOUNCE, USE_DATA_KEY_NOTIFIED
|
||||
from module.island.assets import *
|
||||
from module.logger import logger
|
||||
from module.ui.assets import DORMMENU_GOTO_ISLAND, SHOP_BACK_ARROW
|
||||
from module.ui.page import page_dormmenu, page_island, page_island_phone
|
||||
from module.ui.assets import SHOP_BACK_ARROW
|
||||
from module.ui.page import page_island_phone
|
||||
from module.ui.ui import UI
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class IslandUI(UI):
|
||||
skip_first_screenshot=True
|
||||
)
|
||||
|
||||
def ui_ensure_management_page(self, skip_first_screenshot=True):
|
||||
def ui_ensure_management_page(self):
|
||||
"""
|
||||
Pages:
|
||||
in: page_island_phone or product page
|
||||
@@ -97,12 +97,7 @@ class IslandUI(UI):
|
||||
logger.info('UI ensure management page')
|
||||
self.interval_clear(ISLAND_MANAGEMENT_CHECK)
|
||||
confirm_timer = Timer(1, count=2).start()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
if self.island_in_management():
|
||||
if confirm_timer.reached():
|
||||
break
|
||||
@@ -121,38 +116,25 @@ class IslandUI(UI):
|
||||
return True
|
||||
return False
|
||||
|
||||
def handle_island_ui_additional(self, skip_first_screenshot=True):
|
||||
if not self.appear(MAINTENANCE_ANNOUNCE, offset=(100, 50)):
|
||||
return False
|
||||
def ui_additional(self, get_ship=True):
|
||||
# notify in page_dormmenu
|
||||
if self.appear(MAINTENANCE_ANNOUNCE, offset=(100, 50)):
|
||||
for _ in self.loop():
|
||||
enabled = self.image_color_count(
|
||||
USE_DATA_KEY_NOTIFIED, color=(140, 207, 66), threshold=180, count=10)
|
||||
if enabled:
|
||||
break
|
||||
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
if self.appear(MAINTENANCE_ANNOUNCE, offset=(100, 50), interval=5):
|
||||
self.device.click(USE_DATA_KEY_NOTIFIED)
|
||||
continue
|
||||
|
||||
enabled = self.image_color_count(
|
||||
USE_DATA_KEY_NOTIFIED, color=(140, 207, 66), threshold=180, count=10)
|
||||
if enabled:
|
||||
break
|
||||
|
||||
if self.appear(MAINTENANCE_ANNOUNCE, offset=(100, 50), interval=5):
|
||||
self.device.click(USE_DATA_KEY_NOTIFIED)
|
||||
continue
|
||||
|
||||
self.interval_clear(MAINTENANCE_ANNOUNCE)
|
||||
self.appear_then_click(MAINTENANCE_ANNOUNCE, offset=(100, 50), interval=2)
|
||||
return True
|
||||
|
||||
def ui_goto_island(self):
|
||||
if self.ui_get_current_page() in [page_island, page_island_phone]:
|
||||
logger.info(f'Already at {self.ui_current}')
|
||||
self.interval_clear(MAINTENANCE_ANNOUNCE)
|
||||
self.appear_then_click(MAINTENANCE_ANNOUNCE, offset=(100, 50), interval=2)
|
||||
return True
|
||||
|
||||
# info in page_island
|
||||
if self.appear_then_click(ISLAND_INFO_EXIT, offset=(30, 30), interval=3):
|
||||
return True
|
||||
|
||||
self.ui_ensure(page_dormmenu)
|
||||
self.ui_click(click_button=DORMMENU_GOTO_ISLAND,
|
||||
check_button=page_island.check_button,
|
||||
additional=self.handle_island_ui_additional,
|
||||
offset=(30, 30),
|
||||
retry_wait=2,
|
||||
skip_first_screenshot=True)
|
||||
return super().ui_additional(get_ship=False)
|
||||
|
||||
Reference in New Issue
Block a user