mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 08:37:42 +00:00
Fix: Starting from cloud main page
This commit is contained in:
parent
60cee618a7
commit
a8fa072aab
@ -57,6 +57,11 @@ class UI(MainPage):
|
|||||||
def rotation_check():
|
def rotation_check():
|
||||||
self.device.get_orientation()
|
self.device.get_orientation()
|
||||||
|
|
||||||
|
@run_once
|
||||||
|
def cloud_login():
|
||||||
|
from tasks.login.login import Login
|
||||||
|
Login(config=self.config, device=self.device).cloud_login()
|
||||||
|
|
||||||
timeout = Timer(10, count=20).start()
|
timeout = Timer(10, count=20).start()
|
||||||
while 1:
|
while 1:
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
@ -101,6 +106,7 @@ class UI(MainPage):
|
|||||||
app_check()
|
app_check()
|
||||||
minicap_check()
|
minicap_check()
|
||||||
rotation_check()
|
rotation_check()
|
||||||
|
cloud_login()
|
||||||
|
|
||||||
# Unknown page, need manual switching
|
# Unknown page, need manual switching
|
||||||
logger.warning("Unknown ui page")
|
logger.warning("Unknown ui page")
|
||||||
|
@ -367,6 +367,31 @@ class LoginAndroidCloud(ModuleBase):
|
|||||||
logger.error('Failed to enter cloud game after 3 trials')
|
logger.error('Failed to enter cloud game after 3 trials')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_in_cloud_page(self):
|
||||||
|
if self.appear(XPath.START_GAME):
|
||||||
|
logger.info('Cloud game is in main page')
|
||||||
|
return True
|
||||||
|
elif self.appear(XPath.FLOAT_DELAY):
|
||||||
|
logger.info('Cloud game is in game with float window expanded')
|
||||||
|
return True
|
||||||
|
elif self.appear(XPath.POPUP_CONFIRM):
|
||||||
|
logger.info('Cloud game have a popup')
|
||||||
|
return True
|
||||||
|
|
||||||
|
logger.info('Not in cloud page')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def cloud_login(self):
|
||||||
|
if not self.config.is_cloud_game:
|
||||||
|
return False
|
||||||
|
|
||||||
|
self.device.dump_hierarchy()
|
||||||
|
if self.is_in_cloud_page():
|
||||||
|
self.cloud_ensure_ingame()
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def cloud_keep_alive(self):
|
def cloud_keep_alive(self):
|
||||||
"""
|
"""
|
||||||
Randomly do something to prevent being kicked
|
Randomly do something to prevent being kicked
|
||||||
|
@ -91,7 +91,7 @@ class Login(UI, LoginAndroidCloud):
|
|||||||
self.cloud_ensure_ingame()
|
self.cloud_ensure_ingame()
|
||||||
else:
|
else:
|
||||||
self.device.app_start()
|
self.device.app_start()
|
||||||
self.handle_app_login()
|
self.handle_app_login()
|
||||||
|
|
||||||
def app_restart(self):
|
def app_restart(self):
|
||||||
logger.hr('App restart')
|
logger.hr('App restart')
|
||||||
@ -100,7 +100,7 @@ class Login(UI, LoginAndroidCloud):
|
|||||||
self.cloud_ensure_ingame()
|
self.cloud_ensure_ingame()
|
||||||
else:
|
else:
|
||||||
self.device.app_start()
|
self.device.app_start()
|
||||||
self.handle_app_login()
|
self.handle_app_login()
|
||||||
self.config.task_delay(server_update=True)
|
self.config.task_delay(server_update=True)
|
||||||
|
|
||||||
def cloud_start(self):
|
def cloud_start(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user