Fix: acquire_lang_checked() stuck game launch

This commit is contained in:
LmeSzinc 2023-09-15 23:53:14 +08:00
parent c7d09043c2
commit bc5e7f887d
2 changed files with 19 additions and 4 deletions

View File

@ -58,17 +58,29 @@ class MainPage(ModuleBase):
return server.lang
def handle_lang_check(self, page: Page):
"""
Args:
page:
Returns:
bool: If checked
"""
if MainPage._lang_checked:
return
return False
if page != page_main:
return
return False
self.check_lang_from_map_plane()
MainPage._lang_checked = True
return True
def acquire_lang_checked(self):
"""
Returns:
bool: If checked
"""
if MainPage._lang_checked:
return
return False
logger.info('acquire_lang_checked')
try:
@ -78,3 +90,4 @@ class MainPage(ModuleBase):
raise ScriptError
self.handle_lang_check(page=page_main)
return True

View File

@ -153,8 +153,10 @@ class UI(PopupHandler, MainPage):
bool: If UI switched.
"""
logger.hr("UI ensure")
self.acquire_lang_checked()
self.ui_get_current_page(skip_first_screenshot=skip_first_screenshot)
if self.acquire_lang_checked():
self.ui_get_current_page(skip_first_screenshot=skip_first_screenshot)
if self.ui_current == destination:
logger.info("Already at %s" % destination)
return False