WARNING WITH BUG [build skip] [page skip]

This commit is contained in:
shenjack 2023-02-25 15:03:11 +08:00
parent 1582d3dad3
commit eed5a7460c
5 changed files with 80 additions and 74 deletions

View File

@ -24,7 +24,7 @@ from libs.MCDR.version import Version
game_version = Version("0.7.1.1") # 游戏版本 game_version = Version("0.7.1.1") # 游戏版本
build_version = Version("1.1.0.0") # 编译文件版本(与游戏本体无关) build_version = Version("1.1.0.0") # 编译文件版本(与游戏本体无关)
DR_rust_version = Version("0.2.5.1") # DR 的 Rust 编写部分的版本 DR_rust_version = Version("0.2.5.2") # DR 的 Rust 编写部分的版本
__version__ = game_version __version__ = game_version
long_version: int = 12 long_version: int = 12

View File

@ -119,10 +119,9 @@ name = "difficult_rocket_rs"
version = "0.2.5" version = "0.2.5"
dependencies = [ dependencies = [
"pyo3", "pyo3",
"quick-xml",
"rapier2d-f64", "rapier2d-f64",
"serde", "serde",
"serde-xml-rs",
"xml-rs",
] ]
[[package]] [[package]]
@ -165,15 +164,6 @@ dependencies = [
"scopeguard", "scopeguard",
] ]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "matrixmultiply" name = "matrixmultiply"
version = "0.3.2" version = "0.3.2"
@ -183,6 +173,12 @@ dependencies = [
"rawpointer", "rawpointer",
] ]
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.7.1" version = "0.7.1"
@ -410,6 +406,16 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "quick-xml"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc053f057dd768a56f62cd7e434c42c831d296968997e9ac1f76ea7c2d14c41"
dependencies = [
"memchr",
"serde",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.23" version = "1.0.23"
@ -491,18 +497,6 @@ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]]
name = "serde-xml-rs"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782"
dependencies = [
"log",
"serde",
"thiserror",
"xml-rs",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.152" version = "1.0.152"
@ -571,26 +565,6 @@ version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5"
[[package]]
name = "thiserror"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.16.0" version = "1.16.0"
@ -690,9 +664,3 @@ name = "windows_x86_64_msvc"
version = "0.42.1" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "xml-rs"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"

View File

@ -17,19 +17,19 @@ opt-level = 3
[profile.release] [profile.release]
codegen-units = 1 codegen-units = 1
#[dependencies.quick-xml] [dependencies.quick-xml]
#version = "0.27.1" version = "0.27.1"
#features = ["serialize"] features = ["serialize"]
[dependencies.serde] [dependencies.serde]
version = "1.0.152" version = "1.0.152"
features = ["derive"] features = ["derive"]
[dependencies.xml-rs] #[dependencies.xml-rs]
version = "0.8.4" #version = "0.8.4"
#
[dependencies.serde-xml-rs] #[dependencies.serde-xml-rs]
version = "0.6.0" #version = "0.6.0"
[dependencies.rapier2d-f64] [dependencies.rapier2d-f64]
version = "0.17.1" version = "0.17.1"

View File

@ -16,7 +16,7 @@ use pyo3::prelude::*;
#[pyfunction] #[pyfunction]
fn get_version_str() -> String { fn get_version_str() -> String {
return String::from("0.2.5.1"); return String::from("0.2.5.2");
} }
#[pyfunction] #[pyfunction]

View File

@ -10,8 +10,11 @@ pub mod part_list {
use std::fs; use std::fs;
use pyo3::prelude::*; use pyo3::prelude::*;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
use serde_xml_rs::{from_str};
use quick_xml::de::from_str;
// use serde_xml_rs::{from_str};
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PartList { pub struct PartList {
@ -64,64 +67,99 @@ pub mod part_list {
#[derive(Debug, Serialize, Deserialize, Copy, Clone)] #[derive(Debug, Serialize, Deserialize, Copy, Clone)]
pub struct Vertex { pub struct Vertex {
pub x: f64, #[serde(rename = "@x")]
pub y: f64 pub x: Option<f64>,
#[serde(rename = "@y")]
pub y: Option<f64>,
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Shape { pub struct Shape {
#[serde(rename = "Vertex")] // #[serde(rename = "Vertex")]
pub vertex: Vec<Vertex>, // pub vertex: Vec<Vertex>,
#[serde(rename = "@sensor")]
pub sensor: Option<bool> pub sensor: Option<bool>
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Copy, Clone)]
pub struct AttachPoint { pub struct AttachPoint {
pub location: Option<Location>, pub location: Option<Location>,
#[serde(rename = "@x")]
pub x: Option<f64>, pub x: Option<f64>,
#[serde(rename = "@y")]
pub y: Option<f64>, pub y: Option<f64>,
#[serde(rename = "breakAngle")] #[serde(rename = "@breakAngle")]
pub break_angle: Option<i32>, pub break_angle: Option<i32>,
#[serde(rename = "breakForce")] #[serde(rename = "@breakForce")]
pub break_force: Option<f64>, pub break_force: Option<f64>,
#[serde(rename = "fuelLine")] #[serde(rename = "@fuelLine")]
pub fuel_line: Option<bool>, pub fuel_line: Option<bool>,
#[serde(rename = "@group")]
pub group: Option<i32>, pub group: Option<i32>,
#[serde(rename = "@order")]
pub order: Option<i32>, pub order: Option<i32>,
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
pub struct AttachPoints { pub struct AttachPoints {
#[serde(rename = "AttachPoint")]
pub points: Vec<AttachPoint>
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PartAttr {
// 单独类型节点
// pub part_attr: Option<Vec<PartAttr>>,
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PartType { pub struct PartType {
// https://docs.rs/quick-xml/latest/quick_xml/de/index.html
// 基本属性
#[serde(rename = "@id")]
pub id: String, pub id: String,
#[serde(rename = "@name")]
pub name: String, pub name: String,
#[serde(rename = "@description")]
pub description: String, pub description: String,
#[serde(rename = "@sprite")]
pub sprite: String, pub sprite: String,
#[serde(rename = "@type")]
pub r#type: PartTypes, pub r#type: PartTypes,
#[serde(rename = "@mass")]
pub mass: f64, pub mass: f64,
#[serde(rename = "@width")]
pub width: u32, pub width: u32,
#[serde(rename = "@height")]
pub height: u32, pub height: u32,
// 可选属性
#[serde(rename = "@friction")]
pub friction: Option<f64>, pub friction: Option<f64>,
#[serde(rename = "@category")]
pub category: Option<Category>, pub category: Option<Category>,
#[serde(rename = "ignoreEditorIntersections")] #[serde(rename = "@ignoreEditorIntersections")]
pub ignore_editor_intersections: Option<bool>, pub ignore_editor_intersections: Option<bool>,
#[serde(rename = "disableEditorRotation")] #[serde(rename = "@disableEditorRotation")]
pub disable_editor_rotation: Option<bool>, pub disable_editor_rotation: Option<bool>,
#[serde(rename = "canExplode")] #[serde(rename = "@canExplode")]
pub can_explode: Option<bool>, pub can_explode: Option<bool>,
#[serde(rename = "coverHeight")] #[serde(rename = "@coverHeight")]
pub cover_height: Option<u32>, pub cover_height: Option<u32>,
#[serde(rename = "sandboxOnly")] #[serde(rename = "@sandboxOnly")]
pub sandbox_only: Option<bool>, pub sandbox_only: Option<bool>,
#[serde(rename = "@drag")]
pub drag: Option<f64>, pub drag: Option<f64>,
#[serde(rename = "@hidden")]
pub hidden: Option<bool>, pub hidden: Option<bool>,
#[serde(rename = "@buoyancy")]
pub buoyancy: Option<f64>, pub buoyancy: Option<f64>,
// 通用属性子节点
#[serde(rename = "Shape")] #[serde(rename = "Shape")]
pub shapes: Option<Vec<Shape>> pub shape: Option<Vec<Shape>>,
#[serde(rename = "AttachPoints")]
attach_points: Option<AttachPoints>,
// #[serde(rename = "$value")]
// pub value: PartAttr,
} }
#[inline] #[inline]