mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-26 10:35:03 +08:00
Dev: Accept temporary serial for debugging
This commit is contained in:
@@ -19,18 +19,35 @@ class ModuleBase:
|
|||||||
def __init__(self, config, device=None, task=None):
|
def __init__(self, config, device=None, task=None):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
config (AzurLaneConfig, str): Name of the user config under ./config
|
config (AzurLaneConfig, str):
|
||||||
device (Device): To reuse a device. If None, create a new Device object.
|
Name of the user config under ./config
|
||||||
task (str): Bind a task only for dev purpose. Usually to be None for auto task scheduling.
|
device (Device):
|
||||||
|
To reuse a device.
|
||||||
|
If None, create a new Device object.
|
||||||
|
If str, create a new Device object and use the given device as serial.
|
||||||
|
task (str):
|
||||||
|
Bind a task only for dev purpose. Usually to be None for auto task scheduling.
|
||||||
|
If None, use default configs.
|
||||||
"""
|
"""
|
||||||
if isinstance(config, str):
|
if isinstance(config, AzurLaneConfig):
|
||||||
|
self.config = config
|
||||||
|
elif isinstance(config, str):
|
||||||
self.config = AzurLaneConfig(config, task=task)
|
self.config = AzurLaneConfig(config, task=task)
|
||||||
else:
|
else:
|
||||||
|
logger.warning('Alas ModuleBase received an unknown config, assume it is AzurLaneConfig')
|
||||||
self.config = config
|
self.config = config
|
||||||
if device is not None:
|
|
||||||
|
if isinstance(device, Device):
|
||||||
self.device = device
|
self.device = device
|
||||||
else:
|
elif device is None:
|
||||||
self.device = Device(config=self.config)
|
self.device = Device(config=self.config)
|
||||||
|
elif isinstance(device, str):
|
||||||
|
self.config.override(Emulator_Serial=device)
|
||||||
|
self.device = Device(config=self.config)
|
||||||
|
else:
|
||||||
|
logger.warning('Alas ModuleBase received an unknown device, assume it is Device')
|
||||||
|
self.device = device
|
||||||
|
|
||||||
self.interval_timer = {}
|
self.interval_timer = {}
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|||||||
Reference in New Issue
Block a user