pub struct MapProject {
pub version: u32,
pub level: Level,
pub tilesets: HashMap<Uuid, Tileset>,
pub sprite_sheets: HashMap<Uuid, SpriteData>,
pub dialogues: HashMap<String, DialogueTree>,
pub entity_type_configs: HashMap<String, EntityTypeConfig>,
}Expand description
A self-contained map project that includes level data and tileset metadata
This format is designed for the editor-to-runtime workflow, embedding all tileset information needed to load and render a level.
§Example JSON
{
"version": 1,
"level": { ... },
"tilesets": { "uuid": { ... } }
}Fields§
§version: u32Format version for future compatibility
level: LevelThe level data
tilesets: HashMap<Uuid, Tileset>Tilesets used by this level, keyed by their UUID
sprite_sheets: HashMap<Uuid, SpriteData>Sprite sheets used by this level, keyed by their UUID
dialogues: HashMap<String, DialogueTree>Dialogue trees used by this level, keyed by their ID
entity_type_configs: HashMap<String, EntityTypeConfig>Entity type component configurations (physics, input, sprite per type)
Implementations§
Source§impl MapProject
impl MapProject
Sourcepub fn new(level: Level, tilesets: Vec<Tileset>) -> MapProject
pub fn new(level: Level, tilesets: Vec<Tileset>) -> MapProject
Create a new map project from a level and its tilesets
Sourcepub fn new_with_sprite_sheets(
level: Level,
tilesets: Vec<Tileset>,
sprite_sheets: Vec<SpriteData>,
) -> MapProject
pub fn new_with_sprite_sheets( level: Level, tilesets: Vec<Tileset>, sprite_sheets: Vec<SpriteData>, ) -> MapProject
Create a new map project with sprite sheets
Sourcepub fn get_entity_type_config(
&self,
type_name: &str,
) -> Option<&EntityTypeConfig>
pub fn get_entity_type_config( &self, type_name: &str, ) -> Option<&EntityTypeConfig>
Get entity type config by type name
Sourcepub fn get_sprite_sheet(&self, id: Uuid) -> Option<&SpriteData>
pub fn get_sprite_sheet(&self, id: Uuid) -> Option<&SpriteData>
Get a sprite sheet by ID
Sourcepub fn sprite_sheet_by_name(&self, name: &str) -> Option<&SpriteData>
pub fn sprite_sheet_by_name(&self, name: &str) -> Option<&SpriteData>
Get a sprite sheet by name
Sourcepub fn sprite_sheet_paths(&self) -> Vec<(Uuid, &str)>
pub fn sprite_sheet_paths(&self) -> Vec<(Uuid, &str)>
Get all sprite sheet image paths
Sourcepub fn get_dialogue(&self, id: &str) -> Option<&DialogueTree>
pub fn get_dialogue(&self, id: &str) -> Option<&DialogueTree>
Get a dialogue tree by ID
Sourcepub fn dialogue_ids(&self) -> impl Iterator<Item = &str>
pub fn dialogue_ids(&self) -> impl Iterator<Item = &str>
Get all dialogue IDs
Sourcepub fn dialogue_by_name(&self, name: &str) -> Option<&DialogueTree>
pub fn dialogue_by_name(&self, name: &str) -> Option<&DialogueTree>
Get a dialogue by name (searches by DialogueTree.name field)
Sourcepub fn get_tileset(&self, id: Uuid) -> Option<&Tileset>
pub fn get_tileset(&self, id: Uuid) -> Option<&Tileset>
Get a tileset by ID
Sourcepub fn used_tileset_ids(&self) -> Vec<Uuid>
pub fn used_tileset_ids(&self) -> Vec<Uuid>
Get all unique tileset IDs used by tile layers in this level
Trait Implementations§
Source§impl Clone for MapProject
impl Clone for MapProject
Source§fn clone(&self) -> MapProject
fn clone(&self) -> MapProject
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MapProject
impl Debug for MapProject
Source§impl<'de> Deserialize<'de> for MapProject
impl<'de> Deserialize<'de> for MapProject
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MapProject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MapProject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for MapProject
impl Serialize for MapProject
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl TypePath for MapProject
impl TypePath for MapProject
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Source§impl VisitAssetDependencies for MapProject
impl VisitAssetDependencies for MapProject
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl Asset for MapProject
Auto Trait Implementations§
impl Freeze for MapProject
impl RefUnwindSafe for MapProject
impl Send for MapProject
impl Sync for MapProject
impl Unpin for MapProject
impl UnwindSafe for MapProject
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more