DR -> DR SDK #16
@ -154,6 +154,7 @@ class _DR_runtime(Options):
|
|||||||
def load_mods(self) -> None:
|
def load_mods(self) -> None:
|
||||||
mod_list = self.find_mods()
|
mod_list = self.find_mods()
|
||||||
|
|
||||||
|
|
||||||
def find_mods(self) -> List[str]:
|
def find_mods(self) -> List[str]:
|
||||||
mods = []
|
mods = []
|
||||||
paths = Path(self.mod_path).iterdir()
|
paths = Path(self.mod_path).iterdir()
|
||||||
@ -168,6 +169,9 @@ class _DR_runtime(Options):
|
|||||||
elif mod_path.suffix in ('.pyz', '.zip'): # 处理压缩包 mod
|
elif mod_path.suffix in ('.pyz', '.zip'): # 处理压缩包 mod
|
||||||
if importlib.util.find_spec(mod_path.name) is not None:
|
if importlib.util.find_spec(mod_path.name) is not None:
|
||||||
mods.append(mod_path.name)
|
mods.append(mod_path.name)
|
||||||
|
elif mod_path.suffix == '.pyd': # pyd 扩展 mod
|
||||||
|
if importlib.util.find_spec(mod_path.name) is not None:
|
||||||
|
mods.append(mod_path.name)
|
||||||
elif mod_path.suffix == '.py': # 处理单文件 mod
|
elif mod_path.suffix == '.py': # 处理单文件 mod
|
||||||
print(f'importing mod {mod_path=} {mod_path.stem}')
|
print(f'importing mod {mod_path=} {mod_path.stem}')
|
||||||
if importlib.util.find_spec(mod_path.stem) is not None:
|
if importlib.util.find_spec(mod_path.stem) is not None:
|
||||||
@ -175,7 +179,6 @@ class _DR_runtime(Options):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
print(f'ImportError when loading mod {mod_path}')
|
print(f'ImportError when loading mod {mod_path}')
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
self.DR_Mod_List = [(mod, Version('0.0.0-unloaded')) for mod in mods]
|
|
||||||
return mods
|
return mods
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ from Difficult_Rocket.client.fps.fps_log import FpsLogger
|
|||||||
from Difficult_Rocket.client.guis.widgets import InputBox
|
from Difficult_Rocket.client.guis.widgets import InputBox
|
||||||
from Difficult_Rocket.exception.command import CommandError
|
from Difficult_Rocket.exception.command import CommandError
|
||||||
from Difficult_Rocket.exception.language import LanguageNotFound
|
from Difficult_Rocket.exception.language import LanguageNotFound
|
||||||
from Difficult_Rocket.client.render.sr1_ship import SR1ShipRender
|
|
||||||
from Difficult_Rocket.client.screen import DRScreen, DRDEBUGScreen
|
from Difficult_Rocket.client.screen import DRScreen, DRDEBUGScreen
|
||||||
|
|
||||||
|
|
||||||
@ -202,7 +201,6 @@ class ClientWindow(Window):
|
|||||||
# TODO 读取配置文件,加载不同的屏幕,解耦
|
# TODO 读取配置文件,加载不同的屏幕,解耦
|
||||||
self.screen_list.append(DRDEBUGScreen(self))
|
self.screen_list.append(DRDEBUGScreen(self))
|
||||||
self.screen_list.append(DRScreen(self))
|
self.screen_list.append(DRScreen(self))
|
||||||
self.screen_list.append(SR1ShipRender(self))
|
|
||||||
|
|
||||||
def load_fonts(self) -> None:
|
def load_fonts(self) -> None:
|
||||||
fonts_folder_path = self.main_config['runtime']['fonts_folder']
|
fonts_folder_path = self.main_config['runtime']['fonts_folder']
|
||||||
|
@ -4,22 +4,3 @@
|
|||||||
# All rights reserved
|
# All rights reserved
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
# system function
|
|
||||||
from typing import Tuple, List
|
|
||||||
|
|
||||||
# from libs
|
|
||||||
from MCDR.version import Version
|
|
||||||
|
|
||||||
# from DR
|
|
||||||
from Difficult_Rocket.api.mod import ModInfo
|
|
||||||
from Difficult_Rocket import DR_runtime, Options
|
|
||||||
|
|
||||||
"""
|
|
||||||
mod系统参数
|
|
||||||
"""
|
|
||||||
MOD_loader_version = "0.1.0.0" # mod系统版本 版本号遵守 semver ++
|
|
||||||
semver_loader_version = Version(MOD_loader_version)
|
|
||||||
|
|
||||||
"""
|
|
||||||
一些重置用函数
|
|
||||||
"""
|
|
||||||
|
Loading…
Reference in New Issue
Block a user