1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 22:05:12 +00:00

feat: exit AAS & emulator

This commit is contained in:
RedDeadDepresso 2024-01-06 00:11:18 +00:00
parent 524f15e2bf
commit 517c0f1033
7 changed files with 20 additions and 12 deletions

View File

@ -13,4 +13,7 @@ class CTkAddButton(customtkinter.CTkFrame):
def set_button(self, value): def set_button(self, value):
self.option_menu.set("") self.option_menu.set("")
self.button.configure(text=value) self.button.configure(text=value)
def configure(self, *args, **kwargs):
self.button.configure(*args, **kwargs)

View File

@ -233,17 +233,19 @@ class AzurLaneAutoScript:
del_cached_property(self, 'config') del_cached_property(self, 'config')
continue continue
elif method == 'exit_aas': elif method == 'exit_aas':
self.config.Optimization_WhenTaskQueueEmpty = 'goto_main'
self.exit_aas() self.exit_aas()
release_resources() exit(1)
self.device.release_during_wait() elif method == 'exit_emulator':
if not self.wait_until(task.next_run): self.config.Optimization_WhenTaskQueueEmpty = 'goto_main'
del_cached_property(self, 'config') self.exit_emulator()
continue exit(1) # stops AAS from restarting emulator
elif method == 'exit_aas_emulator': elif method == 'exit_aas_emulator':
self.exit_emulator() self.exit_emulator()
self.exit_aas() self.exit_aas()
exit(0) exit(1)
elif method == 'shutdown': elif method == 'shutdown':
self.config.Optimization_WhenTaskQueueEmpty = 'goto_main'
self.shutdown() self.shutdown()
release_resources() release_resources()
self.device.release_during_wait() self.device.release_during_wait()
@ -338,7 +340,7 @@ class AzurLaneAutoScript:
from module.device.platform.platform_windows import PlatformWindows from module.device.platform.platform_windows import PlatformWindows
PlatformWindows(self.config).emulator_stop() PlatformWindows(self.config).emulator_stop()
except: except:
logger.error("Failed to stop emulator. It may be due to a lack of administrator privileges or incorrect input in Emulator Settings.") logger.error("Failed to stop emulator. It may be due to a lack of administrator privileges.")
def exit_aas(self): def exit_aas(self):
if self.operating_system != 'Windows': if self.operating_system != 'Windows':
@ -352,7 +354,7 @@ class AzurLaneAutoScript:
def shutdown(self): def shutdown(self):
if self.operating_system not in ["Windows", "Linux", "Darwin"]: if self.operating_system not in ["Windows", "Linux", "Darwin"]:
logger.info("Shutdown set during wait but operating system not supported") logger.error("Shutdown set during wait but operating system not supported")
else: else:
logger.info('Shutdown during wait') logger.info('Shutdown during wait')
try: try:

View File

@ -130,6 +130,7 @@
"goto_main", "goto_main",
"close_game", "close_game",
"exit_aas", "exit_aas",
"exit_emulator",
"exit_aas_emulator", "exit_aas_emulator",
"shutdown" "shutdown"
] ]

View File

@ -71,7 +71,7 @@ Optimization:
CombatScreenshotInterval: 1.0 CombatScreenshotInterval: 1.0
WhenTaskQueueEmpty: WhenTaskQueueEmpty:
value: goto_main value: goto_main
option: [ stay_there, goto_main, close_game, exit_aas, exit_aas_emulator, shutdown ] option: [ stay_there, goto_main, close_game, exit_aas, exit_emulator, exit_aas_emulator, shutdown ]
# ==================== Daily ==================== # ==================== Daily ====================

View File

@ -37,7 +37,7 @@ class GeneratedConfig:
# Group `Optimization` # Group `Optimization`
Optimization_ScreenshotInterval = 0.3 Optimization_ScreenshotInterval = 0.3
Optimization_CombatScreenshotInterval = 1.0 Optimization_CombatScreenshotInterval = 1.0
Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game, exit_aas, exit_aas_emulator, shutdown Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game, exit_aas, exit_emulator, exit_aas_emulator, shutdown
# Group `Cafe` # Group `Cafe`
Cafe_Reward = True Cafe_Reward = True

View File

@ -221,11 +221,12 @@
}, },
"WhenTaskQueueEmpty": { "WhenTaskQueueEmpty": {
"name": "When Task Queue is Empty", "name": "When Task Queue is Empty",
"help": "Close AL when there are no pending tasks, can help reduce CPU", "help": "Close Blue Archive when there are no pending tasks, can help reduce CPU.\nExit AAS, emulator and shutdown should be set while AAS is running tasks otherwise it won't start.\nExit AAS and emulator are only available on Windows.\nExit emulator is only possible if instance name and emulator path follow the same auto-filled values according to 'Serial' in Emulator Settings",
"stay_there": "Stay There", "stay_there": "Stay There",
"goto_main": "Goto Main Page", "goto_main": "Goto Main Page",
"close_game": "Close Game", "close_game": "Close Game",
"exit_aas": "Exit AAS", "exit_aas": "Exit AAS",
"exit_emulator": "Exit Emulator",
"exit_aas_emulator": "Exit AAS & Emulator", "exit_aas_emulator": "Exit AAS & Emulator",
"shutdown": "Shutdown" "shutdown": "Shutdown"
} }

View File

@ -226,6 +226,7 @@
"goto_main": "前往主界面", "goto_main": "前往主界面",
"close_game": "关闭游戏", "close_game": "关闭游戏",
"exit_aas": "exit_aas", "exit_aas": "exit_aas",
"exit_emulator": "exit_emulator",
"exit_aas_emulator": "exit_aas_emulator", "exit_aas_emulator": "exit_aas_emulator",
"shutdown": "shutdown" "shutdown": "shutdown"
} }