add more todo

This commit is contained in:
shenjack 2023-04-09 14:06:01 +08:00
parent 1b68335f0e
commit 655a6776c8
2 changed files with 28 additions and 23 deletions

View File

@ -378,7 +378,9 @@ pub mod ship {
// use quick_xml::de::from_str; // use quick_xml::de::from_str;
use serde_xml_rs::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}; use crate::types::sr1::{SR1PartData, SR1PartDataAttr, SR1Ship};
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
@ -419,7 +421,7 @@ pub mod ship {
pub pod: Option<Pod>, pub pod: Option<Pod>,
#[serde(rename = "partType")] #[serde(rename = "partType")]
pub part_type: String, pub part_type: SR1PartTypeEnum,
pub id: i64, pub id: i64,
pub x: f64, pub x: f64,
pub y: f64, pub y: f64,
@ -531,6 +533,9 @@ pub mod ship {
impl SR1PartDataTrait for Part { impl SR1PartDataTrait for Part {
fn to_sr_part_data(&self) -> SR1PartData { fn to_sr_part_data(&self) -> SR1PartData {
// let attr = match self.part_type {
//
// };
todo!() todo!()
} }

View File

@ -373,26 +373,6 @@ pub mod sr1 {
} }
} }
#[derive(Debug, Clone)]
pub struct SR1PartData {
// 单独的属性
pub attr: Option<SR1PartDataAttr>,
// 基本状态属性
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 { impl SR1PartDataTrait for SR1PartData {
#[inline] #[inline]
fn to_sr_part_data(&self) -> SR1PartData { self.clone() } fn to_sr_part_data(&self) -> SR1PartData { self.clone() }
@ -482,7 +462,7 @@ pub mod sr1 {
tank, tank,
engine, engine,
pod, pod,
part_type: self.part_type.clone(), part_type: self.part_type,
id: self.id, id: self.id,
x: self.x, x: self.x,
y: self.y, y: self.y,
@ -505,6 +485,26 @@ pub mod sr1 {
} }
} }
#[derive(Debug, Clone)]
pub struct SR1PartData {
// 单独的属性
pub attr: Option<SR1PartDataAttr>,
// 基本状态属性
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)] #[derive(Debug, Clone)]
pub enum SR1PartDataAttr { pub enum SR1PartDataAttr {
Tank { Tank {