DR -> DR SDK #16

Merged
shenjackyuanjie merged 41 commits from feature/dr-sdk into main 2023-05-03 00:40:53 +08:00
3 changed files with 4 additions and 22 deletions
Showing only changes of commit 90313dd714 - Show all commits

View File

@ -154,6 +154,7 @@ class _DR_runtime(Options):
def load_mods(self) -> None:
mod_list = self.find_mods()
def find_mods(self) -> List[str]:
mods = []
paths = Path(self.mod_path).iterdir()
@ -168,6 +169,9 @@ class _DR_runtime(Options):
elif mod_path.suffix in ('.pyz', '.zip'): # 处理压缩包 mod
if importlib.util.find_spec(mod_path.name) is not None:
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
print(f'importing mod {mod_path=} {mod_path.stem}')
if importlib.util.find_spec(mod_path.stem) is not None:
@ -175,7 +179,6 @@ class _DR_runtime(Options):
except ImportError:
print(f'ImportError when loading mod {mod_path}')
traceback.print_exc()
self.DR_Mod_List = [(mod, Version('0.0.0-unloaded')) for mod in mods]
return mods

View File

@ -36,7 +36,6 @@ from Difficult_Rocket.client.fps.fps_log import FpsLogger
from Difficult_Rocket.client.guis.widgets import InputBox
from Difficult_Rocket.exception.command import CommandError
from Difficult_Rocket.exception.language import LanguageNotFound
from Difficult_Rocket.client.render.sr1_ship import SR1ShipRender
from Difficult_Rocket.client.screen import DRScreen, DRDEBUGScreen
@ -202,7 +201,6 @@ class ClientWindow(Window):
# TODO 读取配置文件,加载不同的屏幕,解耦
self.screen_list.append(DRDEBUGScreen(self))
self.screen_list.append(DRScreen(self))
self.screen_list.append(SR1ShipRender(self))
def load_fonts(self) -> None:
fonts_folder_path = self.main_config['runtime']['fonts_folder']

View File

@ -4,22 +4,3 @@
# 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)
"""
一些重置用函数
"""