fix: allow close emulator when free

This commit is contained in:
2026-07-06 22:40:57 +08:00
parent 58bd699c3f
commit 7cfd24f042
6 changed files with 26 additions and 2 deletions
+21
View File
@@ -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'
+1
View File
@@ -131,6 +131,7 @@
"stay_there",
"goto_main",
"close_game",
"close_emulator",
"exit_aas",
"exit_emulator",
"exit_aas_emulator",
+1 -1
View File
@@ -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 ====================
+1 -1
View File
@@ -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
+1
View File
@@ -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",
+1
View File
@@ -232,6 +232,7 @@
"stay_there": "停在原处",
"goto_main": "前往主界面",
"close_game": "关闭游戏",
"close_emulator": "关闭模拟器",
"exit_aas": "关闭 AAS",
"exit_emulator": "关闭模拟器",
"exit_aas_emulator": "关闭 AAS 和模拟器",