mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +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
|
plane: MapPlane = KEYWORDS_MAP_PLANE.Herta_ParlorCar
|
||||||
|
|
||||||
_lang_checked = False
|
_lang_checked = False
|
||||||
|
_lang_check_success = True
|
||||||
|
|
||||||
def update_plane(self, lang=None) -> MapPlane | None:
|
def update_plane(self, lang=None) -> MapPlane | None:
|
||||||
"""
|
"""
|
||||||
@ -108,6 +109,8 @@ class MainPage(PopupHandler):
|
|||||||
if lang_unknown or lang != server.lang:
|
if lang_unknown or lang != server.lang:
|
||||||
self.config.Emulator_GameLanguage = lang
|
self.config.Emulator_GameLanguage = lang
|
||||||
server.set_lang(lang)
|
server.set_lang(lang)
|
||||||
|
MainPage._lang_checked = True
|
||||||
|
MainPage._lang_check_success = True
|
||||||
return lang
|
return lang
|
||||||
|
|
||||||
if lang_unknown:
|
if lang_unknown:
|
||||||
@ -115,6 +118,8 @@ class MainPage(PopupHandler):
|
|||||||
raise RequestHumanTakeover
|
raise RequestHumanTakeover
|
||||||
else:
|
else:
|
||||||
logger.warning(f'Cannot detect in-game text language, assume current lang={server.lang} is correct')
|
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
|
return server.lang
|
||||||
|
|
||||||
def handle_lang_check(self, page: Page):
|
def handle_lang_check(self, page: Page):
|
||||||
@ -131,7 +136,6 @@ class MainPage(PopupHandler):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
self.check_lang_from_map_plane()
|
self.check_lang_from_map_plane()
|
||||||
MainPage._lang_checked = True
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def acquire_lang_checked(self):
|
def acquire_lang_checked(self):
|
||||||
|
@ -72,8 +72,16 @@ class PopupHandler(ModuleBase):
|
|||||||
If handled.
|
If handled.
|
||||||
"""
|
"""
|
||||||
if self.appear_then_click(MONTHLY_CARD_REWARD, interval=interval):
|
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
|
return True
|
||||||
if self.appear_then_click(MONTHLY_CARD_GET_ITEM, interval=interval):
|
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 True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user