修改了构建脚本
准备实现ship
This commit is contained in:
parent
5d059d9cb8
commit
3bfcdd9feb
@ -8,6 +8,8 @@ if ("38" -notin $args -and "39" -notin $args -and "310" -notin $args -and "311"
|
||||
$do = 1
|
||||
}
|
||||
|
||||
cargo fmt
|
||||
|
||||
if ($do -or "38" -in $args) {
|
||||
python3.8 setup.py build
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ pub mod part_list {
|
||||
// use quick_xml::de::from_str;
|
||||
use serde_xml_rs::from_str;
|
||||
|
||||
use crate::types::sr1::{SR1PartAttr, SR1PartList, SR1PartType, SR1PartTypeData};
|
||||
use crate::types::sr1::{SR1PartAttr, SR1PartList, SR1PartType};
|
||||
use crate::types::sr1::{SR1PartListTrait, SR1PartTypeData};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct RawPartList {
|
||||
@ -325,6 +326,10 @@ pub mod part_list {
|
||||
}
|
||||
|
||||
impl RawPartList {
|
||||
pub fn new(parts: Vec<RawPart>) -> Self {
|
||||
RawPartList { part_types: parts }
|
||||
}
|
||||
|
||||
pub fn list_print(&self) -> () {
|
||||
for part_data in self.part_types.iter() {
|
||||
println!("{:?}\n", part_data);
|
||||
@ -339,11 +344,25 @@ pub mod part_list {
|
||||
}
|
||||
SR1PartList {
|
||||
types: part_list,
|
||||
name: name.unwrap_or("".to_string()),
|
||||
name: name.unwrap_or("NewPartList".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SR1PartListTrait for RawPartList {
|
||||
fn to_sr_part_list(&self, name: Option<String>) -> SR1PartList {
|
||||
let mut types: Vec<SR1PartType> = Vec::new();
|
||||
for part_data in self.part_types.iter() {
|
||||
types.push(part_data.to_sr_part_type());
|
||||
}
|
||||
SR1PartList::part_types_new(types, name)
|
||||
}
|
||||
|
||||
fn to_raw_part_list(&self) -> RawPartList {
|
||||
return self.clone();
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn read_part_list(file_name: String) -> Option<RawPartList> {
|
||||
let part_list_file = fs::read_to_string(file_name.to_string());
|
||||
|
@ -195,6 +195,11 @@ pub mod sr1 {
|
||||
fn to_raw_part_type(&self) -> RawPartType;
|
||||
}
|
||||
|
||||
pub trait SR1PartListTrait {
|
||||
fn to_sr_part_list(&self, name: Option<String>) -> SR1PartList;
|
||||
fn to_raw_part_list(&self) -> RawPartList;
|
||||
}
|
||||
|
||||
impl SR1PartList {
|
||||
#[inline]
|
||||
pub fn new(name: String, types: Vec<SR1PartType>) -> Self {
|
||||
@ -202,15 +207,7 @@ pub mod sr1 {
|
||||
}
|
||||
|
||||
pub fn part_types_new(part_types: Vec<SR1PartType>, name: Option<String>) -> Self {
|
||||
let mut types: Vec<SR1PartType> = Vec::new();
|
||||
let name = match name {
|
||||
Some(name) => name,
|
||||
None => "NewPartList".to_string(),
|
||||
};
|
||||
for part_type in part_types {
|
||||
types.insert(0, part_type);
|
||||
}
|
||||
SR1PartList::new(name, types)
|
||||
SR1PartList::new(name.unwrap_or("NewPartList".to_string()), part_types)
|
||||
}
|
||||
|
||||
pub fn insert_part(&mut self, part: SR1PartType) -> () {
|
||||
@ -218,6 +215,26 @@ pub mod sr1 {
|
||||
}
|
||||
}
|
||||
|
||||
impl SR1PartListTrait for SR1PartList {
|
||||
fn to_sr_part_list(&self, name: Option<String>) -> SR1PartList {
|
||||
return if let Some(name) = name {
|
||||
let mut dupe = self.clone();
|
||||
dupe.name = name;
|
||||
dupe
|
||||
} else {
|
||||
self.clone()
|
||||
};
|
||||
}
|
||||
|
||||
fn to_raw_part_list(&self) -> RawPartList {
|
||||
let mut types: Vec<RawPartType> = Vec::new();
|
||||
for part_type in self.types {
|
||||
types.insert(0, part_type.to_raw_part_type());
|
||||
}
|
||||
RawPartList::new(types)
|
||||
}
|
||||
}
|
||||
|
||||
impl SR1PartTypeData for SR1PartType {
|
||||
fn to_sr_part_type(&self) -> SR1PartType {
|
||||
self.clone()
|
||||
@ -345,6 +362,14 @@ pub mod sr1 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SR1Ship {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub connections: Vec<String>,
|
||||
pub lift_off: bool,
|
||||
pub touch_ground: bool,
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
|
@ -20,7 +20,7 @@ Set-Location ../../..
|
||||
$arg = @()
|
||||
# 输出配置
|
||||
$arg += @("--standalone")
|
||||
$arg += @("--output-dir=build/nuitka-win1")
|
||||
$arg += @("--output-dir=build/nuitka-win")
|
||||
$arg += @("--company-name=tool-shenjack-workshop")
|
||||
$arg += @("--product-name=Difficult-Rocket")
|
||||
$arg += @("--product-version=$env:DR_version")
|
||||
@ -51,7 +51,7 @@ $out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds
|
||||
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s
|
||||
Write-Output $start_time $end_time
|
||||
Write-Output "--clang --msvc=latest --lto=no and $args"
|
||||
Copy-Item .\libs\pyglet\ .\build\nuitka-win\DR.dist -Recurse
|
||||
#Copy-Item .\libs\pyglet\ .\build\nuitka-win\DR.dist -Recurse
|
||||
# --include-data-dir=./libs/pyglet=./pyglet
|
||||
# --run
|
||||
# --disable-ccache
|
||||
|
Loading…
Reference in New Issue
Block a user