Split serialization components into a submodule
This commit is contained in:
parent
53eac9d710
commit
fe31fdaa13
@ -1,4 +1,6 @@
|
|||||||
|
// ! The `C` in `ECS`
|
||||||
mod enums;
|
mod enums;
|
||||||
|
mod serialize;
|
||||||
mod tags;
|
mod tags;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -10,6 +12,7 @@ use ::specs::prelude::*;
|
|||||||
use ::specs::saveload::{ConvertSaveload, Marker};
|
use ::specs::saveload::{ConvertSaveload, Marker};
|
||||||
use ::specs_derive::*;
|
use ::specs_derive::*;
|
||||||
pub use enums::*;
|
pub use enums::*;
|
||||||
|
pub use serialize::*;
|
||||||
pub use tags::*;
|
pub use tags::*;
|
||||||
|
|
||||||
use crate::gamesystem::attr_bonus;
|
use crate::gamesystem::attr_bonus;
|
||||||
@ -379,19 +382,3 @@ pub struct SpawnParticleBurst {
|
|||||||
pub color: RGB,
|
pub color: RGB,
|
||||||
pub lifetime_ms: f32,
|
pub lifetime_ms: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serialization helper code. We need to implement ConvertSaveLoad for each type that contains an
|
|
||||||
// Entity.
|
|
||||||
|
|
||||||
pub struct SerializeMe;
|
|
||||||
|
|
||||||
// Special component that exists to help serialize the game data
|
|
||||||
#[derive(Component, Serialize, Deserialize, Clone)]
|
|
||||||
pub struct SerializationHelper {
|
|
||||||
pub map: crate::map::Map,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Serialize, Deserialize, Clone)]
|
|
||||||
pub struct DMSerializationHelper {
|
|
||||||
pub map: crate::map::MasterDungeonMap,
|
|
||||||
}
|
|
||||||
|
20
src/components/serialize.rs
Normal file
20
src/components/serialize.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
use crate::map::{Map, MasterDungeonMap};
|
||||||
|
use ::serde::{Deserialize, Serialize};
|
||||||
|
use ::specs::prelude::*;
|
||||||
|
use ::specs_derive::*;
|
||||||
|
|
||||||
|
// Serialization helper code. We need to implement ConvertSaveLoad for each type that contains an
|
||||||
|
// Entity.
|
||||||
|
|
||||||
|
pub struct SerializeMe;
|
||||||
|
|
||||||
|
// Special component that exists to help serialize the game data
|
||||||
|
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct SerializationHelper {
|
||||||
|
pub map: Map,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct DMSerializationHelper {
|
||||||
|
pub map: MasterDungeonMap,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user