dr rs 0.2.15.2

This commit is contained in:
shenjack 2023-07-11 00:16:38 +08:00
parent ddf10cccf1
commit 83b45f85fb
7 changed files with 61 additions and 16 deletions

View File

@ -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_',

View File

@ -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}"

View File

@ -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

View File

@ -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: ...

View File

@ -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<bool> {

View File

@ -97,7 +97,7 @@ pub mod data {
fn get_part_type(&self, name: String) -> Option<PySR1PartType> {
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 }

View File

@ -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')