mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-21 16:28:17 +00:00
Fix: Lang check failed due to popup
This commit is contained in:
parent
fcb81bde46
commit
6acd64a1f4
@ -64,6 +64,7 @@ class MainPage(PopupHandler):
|
||||
plane: MapPlane = KEYWORDS_MAP_PLANE.Herta_ParlorCar
|
||||
|
||||
_lang_checked = False
|
||||
_lang_check_success = True
|
||||
|
||||
def update_plane(self, lang=None) -> MapPlane | None:
|
||||
"""
|
||||
@ -108,6 +109,8 @@ class MainPage(PopupHandler):
|
||||
if lang_unknown or lang != server.lang:
|
||||
self.config.Emulator_GameLanguage = lang
|
||||
server.set_lang(lang)
|
||||
MainPage._lang_checked = True
|
||||
MainPage._lang_check_success = True
|
||||
return lang
|
||||
|
||||
if lang_unknown:
|
||||
@ -115,6 +118,8 @@ class MainPage(PopupHandler):
|
||||
raise RequestHumanTakeover
|
||||
else:
|
||||
logger.warning(f'Cannot detect in-game text language, assume current lang={server.lang} is correct')
|
||||
MainPage._lang_checked = True
|
||||
MainPage._lang_check_success = False
|
||||
return server.lang
|
||||
|
||||
def handle_lang_check(self, page: Page):
|
||||
@ -131,7 +136,6 @@ class MainPage(PopupHandler):
|
||||
return False
|
||||
|
||||
self.check_lang_from_map_plane()
|
||||
MainPage._lang_checked = True
|
||||
return True
|
||||
|
||||
def acquire_lang_checked(self):
|
||||
|
@ -72,8 +72,16 @@ class PopupHandler(ModuleBase):
|
||||
If handled.
|
||||
"""
|
||||
if self.appear_then_click(MONTHLY_CARD_REWARD, interval=interval):
|
||||
# Language check at the first login of the day may fail due to popups
|
||||
# Retry later
|
||||
from tasks.base.main_page import MainPage
|
||||
if not MainPage._lang_check_success:
|
||||
MainPage._lang_checked = False
|
||||
return True
|
||||
if self.appear_then_click(MONTHLY_CARD_GET_ITEM, interval=interval):
|
||||
from tasks.base.main_page import MainPage
|
||||
if not MainPage._lang_check_success:
|
||||
MainPage._lang_checked = False
|
||||
return True
|
||||
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user