mirror of
https://github.com/sui-feng-cb/AzurLaneAutoScript1.git
synced 2026-07-21 05:31:54 +08:00
Refactor: replace independent scheduled DowntimeFetch task with on-demand auto-fetch
This commit is contained in:
24
alas.py
24
alas.py
@@ -15,7 +15,6 @@ from module.logger import logger
|
||||
from module.notify import handle_notify
|
||||
|
||||
RESTART_SENSITIVE_TASKS = ['OpsiObscure', 'OpsiAbyssal', 'OpsiCrossMonth']
|
||||
DEVICE_FREE_TASKS = 'DowntimeFetch'
|
||||
|
||||
|
||||
class AzurLaneAutoScript:
|
||||
@@ -199,10 +198,6 @@ class AzurLaneAutoScript:
|
||||
LoginHandler(self.config, device=self.device).app_start()
|
||||
UI(self.config, device=self.device).ui_goto_main()
|
||||
|
||||
def downtime_fetch(self):
|
||||
from module.smart_mgmt.downtime_fetch import DowntimeFetch
|
||||
DowntimeFetch(config=self.config).run()
|
||||
|
||||
def research(self):
|
||||
from module.research.research import RewardResearch
|
||||
RewardResearch(config=self.config, device=self.device).run()
|
||||
@@ -465,6 +460,10 @@ class AzurLaneAutoScript:
|
||||
from module.daemon.benchmark import run_benchmark
|
||||
run_benchmark(config=self.config)
|
||||
|
||||
def downtime_fetch(self):
|
||||
from module.smart_mgmt.downtime_fetch import run_downtime_fetch
|
||||
run_downtime_fetch(config=self.config)
|
||||
|
||||
def game_manager(self):
|
||||
from module.daemon.game_manager import GameManager
|
||||
GameManager(config=self.config, device=self.device, task="GameManager").run()
|
||||
@@ -575,8 +574,9 @@ class AzurLaneAutoScript:
|
||||
self.config.task_call('Restart')
|
||||
# Get task
|
||||
task = self.get_next_task()
|
||||
# Network-only tasks skip device init and screenshot
|
||||
device_free_task = task == DEVICE_FREE_TASKS
|
||||
# Init device and change server
|
||||
_ = self.device
|
||||
self.device.config = self.config
|
||||
# Skip first restart
|
||||
if task == 'Restart' and self.is_first_task:
|
||||
logger.info('Skip task `Restart` at scheduler start')
|
||||
@@ -586,14 +586,10 @@ class AzurLaneAutoScript:
|
||||
|
||||
# Run
|
||||
logger.info(f'Scheduler: Start task `{task}`')
|
||||
# Init device and change server
|
||||
if not device_free_task:
|
||||
_ = self.device
|
||||
self.device.config = self.config
|
||||
self.device.stuck_record_clear()
|
||||
self.device.click_record_clear()
|
||||
self.device.stuck_record_clear()
|
||||
self.device.click_record_clear()
|
||||
logger.hr(task, level=0)
|
||||
success = self.run(inflection.underscore(task), skip_first_screenshot=device_free_task)
|
||||
success = self.run(inflection.underscore(task))
|
||||
logger.info(f'Scheduler: End task `{task}`')
|
||||
self.is_first_task = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user