解耦 DR SDK 和 DR
This commit is contained in:
parent
79f0cfceaf
commit
2b0bb89b0b
@ -12,11 +12,13 @@ gitee: @shenjackyuanjie
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# import ctypes
|
# import ctypes
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
import importlib
|
||||||
import traceback
|
import traceback
|
||||||
import contextlib
|
import contextlib
|
||||||
from typing import Optional
|
from typing import Optional, List, Tuple
|
||||||
|
|
||||||
from Difficult_Rocket.api.types import Options
|
from Difficult_Rocket.api.types import Options
|
||||||
|
|
||||||
@ -24,10 +26,14 @@ from libs.MCDR.version import Version
|
|||||||
|
|
||||||
game_version = Version("0.7.2.1") # 游戏版本
|
game_version = Version("0.7.2.1") # 游戏版本
|
||||||
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
|
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 版本
|
Api_version = Version("0.0.2.0") # API 版本
|
||||||
__version__ = game_version
|
__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: int = 14
|
||||||
"""
|
"""
|
||||||
long_version: 一个用于标记内部协议的整数
|
long_version: 一个用于标记内部协议的整数
|
||||||
@ -64,10 +70,10 @@ class _DR_option(Options):
|
|||||||
report_translate_not_found: bool = True
|
report_translate_not_found: bool = True
|
||||||
use_multiprocess: bool = False
|
use_multiprocess: bool = False
|
||||||
DR_rust_available: bool = False
|
DR_rust_available: bool = False
|
||||||
use_DR_rust: bool = True
|
|
||||||
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
|
||||||
debugging: bool = False
|
debugging: bool = False
|
||||||
@ -113,11 +119,13 @@ class _DR_runtime(Options):
|
|||||||
DR_version: Version = game_version # DR SDK 版本
|
DR_version: Version = game_version # DR SDK 版本
|
||||||
Build_version: Version = build_version # DR 构建 版本
|
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_version: Version = DR_rust_version # 后面要去掉的 DR_rs 版本
|
||||||
DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本
|
DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本
|
||||||
|
|
||||||
API_version: Version = Api_version # DR SDK API 版本
|
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表
|
||||||
DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑)
|
|
||||||
|
|
||||||
# run status
|
# run status
|
||||||
running: bool = False
|
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'
|
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'
|
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')
|
f'Builtin version {relationship} than true version')
|
||||||
|
self.find_mods()
|
||||||
|
|
||||||
|
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:
|
||||||
import rtoml
|
import rtoml
|
||||||
self.language = rtoml.load(f)['runtime']['language']
|
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()
|
DR_option = _DR_option()
|
||||||
|
@ -39,7 +39,7 @@ ForceRequire = bool
|
|||||||
|
|
||||||
|
|
||||||
# TODO 完善中
|
# TODO 完善中
|
||||||
class MODInfo(Serializable):
|
class MODInfo(Options):
|
||||||
"""
|
"""
|
||||||
加载mod时候的参数
|
加载mod时候的参数
|
||||||
"""
|
"""
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Difficult Rocket
|
# Difficult Rocket Mod
|
||||||
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
||||||
# All rights reserved
|
# 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")
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user