diff --git a/module/alas.py b/module/alas.py index 4894732..f767ea3 100644 --- a/module/alas.py +++ b/module/alas.py @@ -237,6 +237,27 @@ class AzurLaneAutoScript: if not self.wait_until(task.next_run): del_cached_property(self, 'config') continue + elif method == 'close_emulator': + logger.info('Close emulator during wait') + self.run('stop') + release_resources() + self.device.release_during_wait() + # 关闭模拟器 + try: + self.device.emulator_stop() + logger.info('Emulator stopped successfully') + except Exception as e: + logger.warning(f'Failed to stop emulator: {e}') + if not self.wait_until(task.next_run): + del_cached_property(self, 'config') + del_cached_property(self, 'device') + continue + # 重新启动模拟器 + if task.command != 'Restart': + self.config.task_call('Restart') + del_cached_property(self, 'config') + del_cached_property(self, 'device') + continue elif method == 'exit_aas': if abs(task.next_run - datetime.now()) >= timedelta(minutes=2): # ensure tactical challenge is fully ran self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 493592e..218dee8 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -131,6 +131,7 @@ "stay_there", "goto_main", "close_game", + "close_emulator", "exit_aas", "exit_emulator", "exit_aas_emulator", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index e5c2523..cb1f80e 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -71,7 +71,7 @@ Optimization: CombatScreenshotInterval: 1.0 WhenTaskQueueEmpty: value: goto_main - option: [ stay_there, goto_main, close_game, exit_aas, exit_emulator, exit_aas_emulator, shutdown ] + option: [ stay_there, goto_main, close_game, close_emulator, exit_aas, exit_emulator, exit_aas_emulator, shutdown ] # ==================== Daily ==================== diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 79e8ef0..294a721 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -37,7 +37,7 @@ class GeneratedConfig: # Group `Optimization` Optimization_ScreenshotInterval = 0.3 Optimization_CombatScreenshotInterval = 1.0 - Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game, exit_aas, exit_emulator, exit_aas_emulator, shutdown + Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game, close_emulator, exit_aas, exit_emulator, exit_aas_emulator, shutdown # Group `Cafe` Cafe_Reward = True diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 092fa54..3779f7a 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -232,6 +232,7 @@ "stay_there": "Stay There", "goto_main": "Goto Main Page", "close_game": "Close Game", + "close_emulator": "Close Emulator", "exit_aas": "Exit AAS", "exit_emulator": "Exit Emulator", "exit_aas_emulator": "Exit AAS & Emulator", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index fd43a21..7a02680 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -232,6 +232,7 @@ "stay_there": "停在原处", "goto_main": "前往主界面", "close_game": "关闭游戏", + "close_emulator": "关闭模拟器", "exit_aas": "关闭 AAS", "exit_emulator": "关闭模拟器", "exit_aas_emulator": "关闭 AAS 和模拟器",