diff --git a/Difficult_Rocket/api/types/__init__.py b/Difficult_Rocket/api/types/__init__.py index 8456aff..a92164a 100644 --- a/Difficult_Rocket/api/types/__init__.py +++ b/Difficult_Rocket/api/types/__init__.py @@ -12,12 +12,15 @@ from Difficult_Rocket.utils.options import (Options, OptionNotFound, get_type_hints_) -from libs.MCDR.version import Version +from libs.MCDR.version import (Version, + VersionRequirement, + VersionParsingError) __all__ = [ # main class 'Options', 'Version', + 'VersionRequirement', # data class 'FontData', @@ -27,6 +30,7 @@ __all__ = [ 'OptionsError', 'OptionNameNotDefined', 'OptionNotFound', + 'VersionParsingError', # other 'get_type_hints_', diff --git a/configs/main.toml b/configs/main.toml index e9a4ce7..db6190b 100644 --- a/configs/main.toml +++ b/configs/main.toml @@ -7,8 +7,8 @@ fonts_folder = "libs/fonts" [window] style = "None" -width = 1968 -height = 1363 +width = 1265 +height = 759 visible = true gui_scale = 1 caption = "Difficult Rocket v{DR_version}" diff --git a/docs/src/change_log/dr_game.md b/docs/src/change_log/dr_game.md index 6871cb2..72bda9b 100644 --- a/docs/src/change_log/dr_game.md +++ b/docs/src/change_log/dr_game.md @@ -3,7 +3,19 @@ - 最新版本号 - DR game: 0.3.1.1 - - DR rs: 0.2.15.1 + - DR rs: 0.2.15.2 + +## DR rs 0.2.15.2 + +### Add + +- `SR1PartData_rs` + - `get_id -> IdType` + - `get_x -> f64` + - `get_y -> f64` + - `get_activate -> bool` + - `get_angle_v -> f64` + - `get_explode -> bool` ## DR rs 0.2.15.1 diff --git a/mods/dr_game/Difficult_Rocket_rs/__init__.py b/mods/dr_game/Difficult_Rocket_rs/__init__.py index f6f9840..7ec6efa 100644 --- a/mods/dr_game/Difficult_Rocket_rs/__init__.py +++ b/mods/dr_game/Difficult_Rocket_rs/__init__.py @@ -6,15 +6,14 @@ from .lib import * -from typing import TYPE_CHECKING, Dict, Tuple, Optional, List, Tuple +from typing import TYPE_CHECKING, Dict, Tuple, Optional, List if TYPE_CHECKING: - from pyglet.window import Window - - - def test_call(py_obj) -> bool: ... - + def test_call(py_obj) -> bool: + """ 这里展示的代码实际上就是实际的等效实现 """ + py_obj.draw() + return True def get_version_str() -> str: ... @@ -64,19 +63,31 @@ if TYPE_CHECKING: """ 用于从 rust 中读取 SR1PartData (其实好像也没啥用哈) """ @property + def id(self) -> int: ... + @property def part_type_id(self) -> str: ... @property def pos(self) -> Tuple[float, float]: ... @property + def x(self) -> float: ... + @property + def y(self) -> float: ... + @property + def activate(self) -> bool: ... + @property def angle(self) -> float: ... @property + def angle_v(self) -> float: ... + @property + def explode(self) -> bool: ... + @property def flip_x(self) -> bool: ... @property def flip_y(self) -> bool: ... class SaveStatus_rs: def __init__(self, save_default: Optional[bool] = False) -> None: ... - + class SR1Ship_rs: """ 用于高效且省内存的读取 SR1Ship """ def __init__(self, file_path = './configs/dock1.xml', part_list = './configs/PartList.xml', ship_name = 'NewShip'): ... @@ -95,10 +106,10 @@ if TYPE_CHECKING: def connection(self) -> List[Tuple[int, int, int, int]]: ... """获取所有连接信息""" def get_part_box(self, part_id: int) -> Optional[Tuple[Tuple[int, int], Tuple[int, int]]]: ... - def as_dict(self) -> Dict[int, List[Tuple[SR1PartType_rs, SR1PartData]]]: + def as_dict(self) -> Dict[int, List[Tuple[SR1PartType_rs, SR1PartData_rs]]]: """用于返回一个包含所有已连接零件的字典""" def save(self, file_path: str, save_status: Optional[SaveStatus_rs] = None) -> None: ... - + class Console_rs: def __init__(self) -> None: ... def start(self) -> None: ... diff --git a/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs b/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs index 3c3f3db..61d62a7 100644 --- a/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs +++ b/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs @@ -24,7 +24,7 @@ enum LoadState { } #[pyfunction] -fn get_version_str() -> String { "0.2.15.1".to_string() } +fn get_version_str() -> String { "0.2.15.2".to_string() } #[pyfunction] fn test_call(py_obj: &PyAny) -> PyResult { diff --git a/mods/dr_game/Difficult_Rocket_rs/src/src/python.rs b/mods/dr_game/Difficult_Rocket_rs/src/src/python.rs index 3377cd6..825af9a 100644 --- a/mods/dr_game/Difficult_Rocket_rs/src/src/python.rs +++ b/mods/dr_game/Difficult_Rocket_rs/src/src/python.rs @@ -97,7 +97,7 @@ pub mod data { fn get_part_type(&self, name: String) -> Option { let part_type = self.data.get_part_type(&name); - part_type.map(|part_type| PySR1PartType::new(part_type)) + part_type.map(PySR1PartType::new) } } @@ -113,15 +113,33 @@ pub mod data { #[pymethods] impl PySR1PartData { + #[getter] + fn get_id(&self) -> IdType { self.data.id } + #[getter] fn get_part_type_id(&self) -> String { self.data.part_type_id.clone() } #[getter] fn get_pos(&self) -> (f64, f64) { (self.data.x, self.data.y) } + #[getter] + fn get_x(&self) -> f64 { self.data.x } + + #[getter] + fn get_y(&self) -> f64 { self.data.y } + + #[getter] + fn get_activate(&self) -> bool { self.data.active } + #[getter] fn get_angle(&self) -> f64 { self.data.angle } + #[getter] + fn get_angle_v(&self) -> f64 { self.data.angle_v } + + #[getter] + fn get_explode(&self) -> bool { self.data.explode } + #[getter] fn get_flip_x(&self) -> bool { self.data.flip_x } diff --git a/mods/dr_game/__init__.py b/mods/dr_game/__init__.py index 9f9aa7f..0930f3a 100644 --- a/mods/dr_game/__init__.py +++ b/mods/dr_game/__init__.py @@ -17,7 +17,7 @@ from Difficult_Rocket.api.mod import ModInfo from Difficult_Rocket.client import ClientWindow from Difficult_Rocket.api.types import Options, Version -DR_rust_version = Version("0.2.15.1") # DR_mod 的 Rust 编写部分的兼容版本 +DR_rust_version = Version("0.2.15.2") # DR_mod 的 Rust 编写部分的兼容版本 logger = logging.getLogger('client.dr_game')