DR rs 0.2.21.0

This commit is contained in:
shenjack 2023-08-08 21:34:20 +08:00
parent e658fa3188
commit 47d2629610
Signed by: shenjack
GPG Key ID: 7B1134A979775551
8 changed files with 51 additions and 5 deletions

View File

@ -3,7 +3,20 @@
- 最新版本号
- DR game: 0.3.2.0
- DR rs: 0.2.20.2
- DR rs: 0.2.21.0
## 20230808 DR rs 0.2.21.0
### Add
- 在 `__init__.py` 里添加了
- `sprite`
- `type`
- 的导出 (实际上就是 typing)
- `SR1PartType_rs`
- 添加了 `type` getter
摸鱼真开心
## 20230724 DR rs 0.2.20.2

View File

@ -60,6 +60,10 @@ if TYPE_CHECKING:
def description(self) -> str:
""" 零件的描述 """
@property
def sprite(self) -> str:
""" 零件的贴图 """
@property
def mass(self) -> float:
""" 零件的质量 """
@ -80,6 +84,10 @@ if TYPE_CHECKING:
def hidden(self) -> bool:
""" 零件是否隐藏 """
@property
def type(self):
""" 零件的类型 """
class SR1PartList_rs: # NOQA
""" 用于从 rust 中读取 SR1PartList """

View File

@ -12,7 +12,7 @@ package_path = 'Difficult_Rocket_rs'
setup(
name='Difficult_Rocket_rs',
version="0.2.18.0",
version="0.2.21.0",
author='shenjackyuanjie',
author_email='3695888@qq.com',
rust_extensions=[RustExtension(target="Difficult_Rocket_rs.Difficult_Rocket_rs",

View File

@ -24,7 +24,7 @@ enum LoadState {
}
#[pyfunction]
fn get_version_str() -> String { "0.2.20.2".to_string() }
fn get_version_str() -> String { "0.2.21.0".to_string() }
#[pyfunction]
fn test_call(py_obj: &PyAny) -> PyResult<bool> {

View File

@ -76,6 +76,9 @@ pub mod data {
#[getter]
fn get_hidden(&self) -> bool { self.data.hidden }
#[getter]
fn get_type(&self) -> String { self.data.p_type.into() }
}
impl PySR1PartType {

View File

@ -41,6 +41,27 @@ pub mod part_list {
lander,
}
impl Into<String> for SR1PartTypeEnum {
fn into(self) -> String {
match self {
SR1PartTypeEnum::pod => "pod".to_string(),
SR1PartTypeEnum::detacher => "detacher".to_string(),
SR1PartTypeEnum::wheel => "wheel".to_string(),
SR1PartTypeEnum::fuselage => "fuselage".to_string(),
SR1PartTypeEnum::strut => "strut".to_string(),
SR1PartTypeEnum::tank => "tank".to_string(),
SR1PartTypeEnum::engine => "engine".to_string(),
SR1PartTypeEnum::parachute => "parachute".to_string(),
SR1PartTypeEnum::nosecone => "nosecone".to_string(),
SR1PartTypeEnum::rcs => "rcs".to_string(),
SR1PartTypeEnum::solar => "solar".to_string(),
SR1PartTypeEnum::dockconnector => "dockconnector".to_string(),
SR1PartTypeEnum::dockport => "dockport".to_string(),
SR1PartTypeEnum::lander => "lander".to_string(),
}
}
}
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
pub enum Location {
Top,

View File

@ -16,7 +16,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.20.2") # DR_mod 的 Rust 编写部分的兼容版本
DR_rust_version = Version("0.2.21.0") # DR_mod 的 Rust 编写部分的兼容版本
logger = logging.getLogger('client.dr_game')

View File

@ -169,7 +169,8 @@ class SR1ShipRender(BaseScreen):
part_group = Group(2, parent=self.part_group)
batch = []
for p_type, p_data in parts:
part_sprite = Sprite(img=self.textures.get_texture(map_ptype_textures(p_data.part_type_id)),
sprite_name = self.part_list_rs.get_part_type(p_data.part_type_id).sprite
part_sprite = Sprite(img=self.textures.get_texture(sprite_name),
x=p_data.x * 60, y=p_data.y * 60, z=random.random(),
batch=self.main_batch, group=part_group)
part_sprite.rotation = p_data.angle_r