DR_rs 完全解耦 (修复了 mods 路径不存在的情况下会崩溃的bug(指上一个commit

This commit is contained in:
shenjack 2023-05-02 15:50:50 +08:00
parent b3ee143abd
commit b903edebc2
2 changed files with 9 additions and 23 deletions

View File

@ -14,6 +14,7 @@ from pathlib import Path
from typing import Optional, List, Tuple from typing import Optional, List, Tuple
from Difficult_Rocket.api.types import Options from Difficult_Rocket.api.types import Options
from Difficult_Rocket.utils.new_thread import new_thread
from libs.MCDR.version import Version from libs.MCDR.version import Version
@ -22,14 +23,10 @@ build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
Api_version = Version("0.0.2.0") # API 版本 Api_version = Version("0.0.2.0") # API 版本
__version__ = game_version __version__ = game_version
# TODO 解耦 DR SDK 与 DR_mod 和 DR_rs long_version: int = 15
DR_rust_version = Version("0.2.6.2") # DR 的 Rust 编写部分的版本
# 后面会移除的 DR_rs 相关信息
# DR_rs和 DR_mod 的部分正在和 DR SDK 解耦
long_version: int = 14
""" """
long_version: 一个用于标记内部协议的整数 long_version: 一个用于标记内部协议的整数
15: 完全移除 DR_rust 相关内容 解耦完成
14: BaseScreen 的每一个函数都添加了一个参数: window: "ClientWindow" 14: BaseScreen 的每一个函数都添加了一个参数: window: "ClientWindow"
13: DR_runtime 添加 API_version 13: DR_runtime 添加 API_version
12: 去除 DR_runtime global_logger 12: 去除 DR_runtime global_logger
@ -65,7 +62,6 @@ class _DR_option(Options):
DR_rust_available: bool = False DR_rust_available: bool = False
use_cProfile: bool = False use_cProfile: bool = False
use_local_logging: bool = False use_local_logging: bool = False
# use_DR_rust: bool = True
# tests # tests
playing: bool = False playing: bool = False
@ -94,9 +90,6 @@ class _DR_runtime(Options):
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 (name, version) DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 (name, version)
DR_Rust_version: Version = DR_rust_version # 后面要去掉的 DR_rs 版本
DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本
# run status # run status
running: bool = False running: bool = False
start_time_ns: Optional[int] = None start_time_ns: Optional[int] = None
@ -111,15 +104,6 @@ class _DR_runtime(Options):
language: str = 'zh-CN' language: str = 'zh-CN'
default_language: str = 'zh-CN' default_language: str = 'zh-CN'
def init(self, **kwargs) -> None:
with contextlib.suppress(ImportError):
from libs.Difficult_Rocket_rs import get_version_str
self.DR_Rust_get_version = Version(get_version_str())
if self.DR_Rust_get_version != self.DR_Rust_version:
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')
def load_file(self) -> bool: def load_file(self) -> bool:
with contextlib.suppress(FileNotFoundError): with contextlib.suppress(FileNotFoundError):
with open('./configs/main.toml', 'r', encoding='utf-8') as f: with open('./configs/main.toml', 'r', encoding='utf-8') as f:
@ -165,9 +149,6 @@ DR_option = _DR_option()
DR_runtime = _DR_runtime() DR_runtime = _DR_runtime()
if DR_option.playing: if DR_option.playing:
from Difficult_Rocket.utils import new_thread
def think_it(something): def think_it(something):
return something return something

View File

@ -22,17 +22,22 @@
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md) - [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
- Using [SemVer 2.0.0](https://semver.org/) to manage version - Using [SemVer 2.0.0](https://semver.org/) to manage version
## 202305 DR `0.8.0.0` + DR_api `0.1.0.0` ## 202305 DR `0.8.0.0` + DR_api `0.1.0.0` + 15
> 啊哈! mod 加载来啦! > 啊哈! mod 加载来啦!
> 啊啊啊啊啊 大重构 api > 啊啊啊啊啊 大重构 api
### Remove ### Remove
- `game.config` - `game.config`
- 已删除 - 已删除
- Removed - Removed
- `DR_option` & `DR_runtime`
- 完全移除 `DR_rust` 部分
- Completely removed the `DR_rust` part
### Changes ### Changes