From 655a6776c838f2e772b3ea7d645d556f45e817b5 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 9 Apr 2023 14:06:01 +0800 Subject: [PATCH] add more todo --- libs/Difficult_Rocket_rs/src/src/sr1_data.rs | 9 ++++- libs/Difficult_Rocket_rs/src/src/types.rs | 42 ++++++++++---------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/libs/Difficult_Rocket_rs/src/src/sr1_data.rs b/libs/Difficult_Rocket_rs/src/src/sr1_data.rs index 8a4956d..6d8e76b 100644 --- a/libs/Difficult_Rocket_rs/src/src/sr1_data.rs +++ b/libs/Difficult_Rocket_rs/src/src/sr1_data.rs @@ -378,7 +378,9 @@ pub mod ship { // use quick_xml::de::from_str; use serde_xml_rs::from_str; - use crate::types::sr1::{i8_to_bool, SR1PartDataTrait, SR1ShipTrait}; + use super::part_list::SR1PartTypeEnum; + + use crate::types::sr1::{i8_to_bool, SR1PartDataTrait, SR1PartTypeAttr, SR1ShipTrait}; use crate::types::sr1::{SR1PartData, SR1PartDataAttr, SR1Ship}; #[derive(Debug, Serialize, Deserialize, Clone)] @@ -419,7 +421,7 @@ pub mod ship { pub pod: Option, #[serde(rename = "partType")] - pub part_type: String, + pub part_type: SR1PartTypeEnum, pub id: i64, pub x: f64, pub y: f64, @@ -531,6 +533,9 @@ pub mod ship { impl SR1PartDataTrait for Part { fn to_sr_part_data(&self) -> SR1PartData { + // let attr = match self.part_type { + // + // }; todo!() } diff --git a/libs/Difficult_Rocket_rs/src/src/types.rs b/libs/Difficult_Rocket_rs/src/src/types.rs index 9b98d19..8b105ab 100644 --- a/libs/Difficult_Rocket_rs/src/src/types.rs +++ b/libs/Difficult_Rocket_rs/src/src/types.rs @@ -373,26 +373,6 @@ pub mod sr1 { } } - #[derive(Debug, Clone)] - pub struct SR1PartData { - // 单独的属性 - pub attr: Option, - // 基本状态属性 - pub x: f64, - pub y: f64, - pub id: i64, - pub angle: f64, // 弧度制 - pub angle_v: f64, - // 状态属性 - pub part_type: String, - pub active: bool, - pub editor_angle: i32, - pub flip_x: bool, - pub flip_y: bool, - - pub explode: bool, - } - impl SR1PartDataTrait for SR1PartData { #[inline] fn to_sr_part_data(&self) -> SR1PartData { self.clone() } @@ -482,7 +462,7 @@ pub mod sr1 { tank, engine, pod, - part_type: self.part_type.clone(), + part_type: self.part_type, id: self.id, x: self.x, y: self.y, @@ -505,6 +485,26 @@ pub mod sr1 { } } + #[derive(Debug, Clone)] + pub struct SR1PartData { + // 单独的属性 + pub attr: Option, + // 基本状态属性 + pub x: f64, + pub y: f64, + pub id: i64, + pub angle: f64, // 弧度制 + pub angle_v: f64, + // 状态属性 + pub part_type: SR1PartTypeEnum, + pub active: bool, + pub editor_angle: i32, + pub flip_x: bool, + pub flip_y: bool, + + pub explode: bool, + } + #[derive(Debug, Clone)] pub enum SR1PartDataAttr { Tank {