From 90313dd71439161544e87df01b28d923656b7fc7 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 23 Apr 2023 20:55:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=A7=A3=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Difficult_Rocket/__init__.py | 5 ++++- Difficult_Rocket/client/__init__.py | 2 -- Difficult_Rocket/mod/__init__.py | 19 ------------------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/Difficult_Rocket/__init__.py b/Difficult_Rocket/__init__.py index f89707e..f70e048 100644 --- a/Difficult_Rocket/__init__.py +++ b/Difficult_Rocket/__init__.py @@ -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 diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index a893c84..a352836 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -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'] diff --git a/Difficult_Rocket/mod/__init__.py b/Difficult_Rocket/mod/__init__.py index 5333e93..95b52bb 100644 --- a/Difficult_Rocket/mod/__init__.py +++ b/Difficult_Rocket/mod/__init__.py @@ -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) - -""" -一些重置用函数 -"""