From 0bf02ec4d2a82853b96502e8dc22782afdc677c3 Mon Sep 17 00:00:00 2001 From: shenjack-mac <3695888@qq.com> Date: Sat, 22 Apr 2023 16:35:25 +0800 Subject: [PATCH] add api.mod and update vscode config --- .vscode/settings.json | 3 ++ Difficult_Rocket/api/mod/__init__.py | 65 ++++++++++++++++++++++++++++ Difficult_Rocket/mod/__init__.py | 1 - 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 Difficult_Rocket/api/mod/__init__.py diff --git a/.vscode/settings.json b/.vscode/settings.json index d2b2620..d5f9520 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,8 @@ "rust-analyzer.linkedProjects": [ "libs/Difficult_Rocket_rs/src/Cargo.toml", "libs/pyglet_rs/src/Cargo.toml", + ], + "python.analysis.extraPaths": [ + "./libs" ] } diff --git a/Difficult_Rocket/api/mod/__init__.py b/Difficult_Rocket/api/mod/__init__.py new file mode 100644 index 0000000..bcfaac7 --- /dev/null +++ b/Difficult_Rocket/api/mod/__init__.py @@ -0,0 +1,65 @@ +# ------------------------------- +# Difficult Rocket +# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com +# All rights reserved +# ------------------------------- + +""" +writen by shenjackyuanjie +mail: 3695888@qq.com +github: @shenjackyuanjie +gitee: @shenjackyuanjie +""" + +# system function +from typing import Tuple, List + +# from libs +from MCDR.version import Version + +# from DR +from Difficult_Rocket import DR_runtime, Options + + +""" +加载mod时会更改的参数 +这里的只是范例,实际加载时会根据mod配置修改 +""" + +RequireVersion = Tuple[Version, Version] +# 第一个是最低兼容版本,第二个是最高兼容版本 +# 例如: ("1.0.0", "1.1.0") 表示从1.0.0版本开始兼容,到1.1.0版本结束兼容 +ForceRequire = bool + + +# TODO 完善中 +class MODInfo(Options): + """ + 加载mod时候的参数 + """ + """基本信息""" + name: str # mod 名称 + version: Version # mod 版本 + + """作者、描述""" + writer: str # 作者 + link: str = "" # 作者链接 + description: str = "" # 描述 (务必简洁明了) + info: str = "" # 其他信息 (可以很多很多) + + """版本相关信息""" + DR_version: RequireVersion = (DR_runtime.DR_version, DR_runtime.DR_version) # DR SDK 兼容版本 + DR_Api_version: RequireVersion = (DR_runtime.API_version, DR_runtime.API_version) # DR Api版本 + Mod_Require_version: List[Tuple[str, ForceRequire, RequireVersion]] = [] # mod 依赖版本 + + """mod 状态""" + is_enable: bool = True # 是否启用 + is_loaded: bool = False # 是否加载 + + """mod 配置""" + config: Options = Options() # mod 配置存储 + + +""" +一些重置用函数 +""" diff --git a/Difficult_Rocket/mod/__init__.py b/Difficult_Rocket/mod/__init__.py index 2d13830..a704a24 100644 --- a/Difficult_Rocket/mod/__init__.py +++ b/Difficult_Rocket/mod/__init__.py @@ -16,7 +16,6 @@ from typing import Tuple, List # from libs from MCDR.version import Version -from MCDR.serializer import Serializable # from DR from Difficult_Rocket import DR_runtime, Options