DR -> DR SDK #16

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

View File

@ -75,26 +75,6 @@ class _DR_option(Options):
# window option # window option
gui_scale: float = 1.0 # default 1.0 2.0 -> 2x 3 -> 3x gui_scale: float = 1.0 # default 1.0 2.0 -> 2x 3 -> 3x
# def init(self, **kwargs):
# try:
# from libs.Difficult_Rocket_rs import test_call, get_version_str
# test_call(self)
# print(f'DR_rust available: {get_version_str()}')
# except ImportError:
# if __name__ != '__main__':
# traceback.print_exc()
# self.DR_rust_available = False
# self.use_DR_rust = self.use_DR_rust and self.DR_rust_available
# self.flush_option()
#
# def test_rust(self):
# if self.DR_rust_available:
# from libs.Difficult_Rocket_rs import part_list_read_test
# part_list_read_test("./configs/PartList.xml")
#
# def draw(self):
# self.DR_rust_available = True
@property @property
def std_font_size(self) -> int: def std_font_size(self) -> int:
return round(12 * self.gui_scale) return round(12 * self.gui_scale)
@ -152,7 +132,11 @@ class _DR_runtime(Options):
def find_mods(self) -> List[str]: def find_mods(self) -> List[str]:
mods = [] mods = []
paths = Path(self.mod_path).iterdir() mod_path = Path(self.mod_path)
if not mod_path.exists():
mod_path.mkdir()
return []
paths = mod_path.iterdir()
sys.path.append(self.mod_path) sys.path.append(self.mod_path)
for mod_path in paths: for mod_path in paths:
try: try:

View File

@ -78,7 +78,7 @@ class Game:
if not mod_path.exists(): if not mod_path.exists():
self.logger.info(tr().main.mod.find.faild.no_mod_folder()) self.logger.info(tr().main.mod.find.faild.no_mod_folder())
return return
paths = Path(DR_runtime.mod_path).iterdir() paths = mod_path.iterdir()
sys.path.append(DR_runtime.mod_path) sys.path.append(DR_runtime.mod_path)
for mod_path in paths: for mod_path in paths:
try: try: