1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 11:59:24 +08:00

Fix: let all main and event class to inherit old class

This commit is contained in:
LA_DI_DA
2024-05-24 20:59:47 +08:00
parent a168a0ed54
commit ea6ad05290
2 changed files with 23 additions and 1 deletions

View File

@@ -16,6 +16,8 @@ from module.notify import handle_notify
from module.gg_handler.gg_handler import GGHandler from module.gg_handler.gg_handler import GGHandler
g_current_task: str = "" g_current_task: str = ""
g_config: AzurLaneConfig = None
class AzurLaneAutoScript: class AzurLaneAutoScript:
stop_event: threading.Event = None stop_event: threading.Event = None
@@ -545,6 +547,10 @@ class AzurLaneAutoScript:
exit(1) exit(1)
def loop(self): def loop(self):
global g_config
if g_config is not None:
g_config = self.config
self.gg_check() self.gg_check()
logger.set_file_logger(self.config_name) logger.set_file_logger(self.config_name)
logger.info(f'Start scheduler loop: {self.config_name}') logger.info(f'Start scheduler loop: {self.config_name}')

View File

@@ -393,7 +393,23 @@ class DockNew(UI):
continue continue
class Dock(DockOld if globals().get("g_current_task", "") == "GemsFarming" else DockNew): def redirect_inherit_to_old() -> bool:
current_task = globals().get("g_current_task", "")
current_config = globals().get("g_config", None)
if current_task == "GemsFarming":
return True
elif current_task.find("Main") != -1:
return True
elif current_task.find("Event") != -1:
return True
else:
return False
return False
class Dock(DockOld if redirect_inherit_to_old() else DockNew):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if isinstance(self, DockOld): if isinstance(self, DockOld):
logger.info("use DockOld") logger.info("use DockOld")