From 2b0bb89b0bca3ede2f168e8a2faf46ee001c8ff9 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 22 Apr 2023 15:18:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E8=80=A6=20DR=20SDK=20=E5=92=8C=20DR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Difficult_Rocket/__init__.py | 29 ++++++++++++++++++++++++----- Difficult_Rocket/mod/__init__.py | 2 +- mods/builtin/__init__.py | 10 +++++++++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Difficult_Rocket/__init__.py b/Difficult_Rocket/__init__.py index b2348d0..402bb1d 100644 --- a/Difficult_Rocket/__init__.py +++ b/Difficult_Rocket/__init__.py @@ -12,11 +12,13 @@ gitee: @shenjackyuanjie """ # import ctypes +import os import sys import warnings +import importlib import traceback import contextlib -from typing import Optional +from typing import Optional, List, Tuple from Difficult_Rocket.api.types import Options @@ -24,10 +26,14 @@ from libs.MCDR.version import Version game_version = Version("0.7.2.1") # 游戏版本 build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关) -DR_rust_version = Version("0.2.6.1") # DR 的 Rust 编写部分的版本 Api_version = Version("0.0.2.0") # API 版本 __version__ = game_version +# TODO 解耦 DR SDK 与 DR_mod 和 DR_rs +DR_rust_version = Version("0.2.6.1") # DR 的 Rust 编写部分的版本 +# 后面会移除的 DR_rs 相关信息 +# DR_rs和 DR_mod 的部分正在和 DR SDK 解耦 + long_version: int = 14 """ long_version: 一个用于标记内部协议的整数 @@ -64,10 +70,10 @@ class _DR_option(Options): report_translate_not_found: bool = True use_multiprocess: bool = False DR_rust_available: bool = False - use_DR_rust: bool = True use_cProfile: bool = False use_local_logging: bool = False + use_DR_rust: bool = True # tests playing: bool = False debugging: bool = False @@ -113,11 +119,13 @@ class _DR_runtime(Options): DR_version: Version = game_version # DR SDK 版本 Build_version: Version = build_version # DR 构建 版本 + API_version: Version = Api_version # DR SDK API 版本 + DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑) + DR_Rust_version: Version = DR_rust_version # 后面要去掉的 DR_rs 版本 DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本 - API_version: Version = Api_version # DR SDK API 版本 - DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑) + DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 # run status running: bool = False @@ -140,10 +148,21 @@ class _DR_runtime(Options): relationship = 'larger' if self.DR_Rust_version > self.DR_Rust_get_version else 'smaller' warnings.warn(f'DR_rust builtin version is {self.DR_Rust_version} but true version is {get_version_str()}.\n' f'Builtin version {relationship} than true version') + self.find_mods() + + def load_file(self) -> bool: with contextlib.suppress(FileNotFoundError): with open('./configs/main.toml', 'r', encoding='utf-8') as f: import rtoml self.language = rtoml.load(f)['runtime']['language'] + return True + return False + + def load_mods(self) -> None: + mod_list = self.find_mods() + + def find_mods(self) -> List[str]: + ... DR_option = _DR_option() diff --git a/Difficult_Rocket/mod/__init__.py b/Difficult_Rocket/mod/__init__.py index 757a792..2d13830 100644 --- a/Difficult_Rocket/mod/__init__.py +++ b/Difficult_Rocket/mod/__init__.py @@ -39,7 +39,7 @@ ForceRequire = bool # TODO 完善中 -class MODInfo(Serializable): +class MODInfo(Options): """ 加载mod时候的参数 """ diff --git a/mods/builtin/__init__.py b/mods/builtin/__init__.py index e65b6e9..228d181 100644 --- a/mods/builtin/__init__.py +++ b/mods/builtin/__init__.py @@ -1,5 +1,13 @@ # ------------------------------- -# Difficult Rocket +# Difficult Rocket Mod # Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- + +from MCDR.version import Version +from Difficult_Rocket.mod import MODInfo + +INFO = MODInfo( + name="Difficult_Rocket_mod", + version=Version("0.7.2.0") +)