Trait bevy_yoleck::YoleckExtForApp

source ·
pub trait YoleckExtForApp {
    // Required methods
    fn add_yoleck_entity_type(&mut self, entity_type: YoleckEntityType);
    fn add_yoleck_edit_system<P>(
        &mut self,
        system: impl 'static + IntoSystem<(), (), P>
    );
    fn add_yoleck_entity_upgrade(
        &mut self,
        to_version: usize,
        upgrade_dlg: impl 'static + Send + Sync + Fn(&str, &mut Value)
    );

    // Provided method
    fn add_yoleck_entity_upgrade_for(
        &mut self,
        to_version: usize,
        for_type_name: impl ToString,
        upgrade_dlg: impl 'static + Send + Sync + Fn(&mut Value)
    ) { ... }
}

Required Methods§

source

fn add_yoleck_entity_type(&mut self, entity_type: YoleckEntityType)

Add a type of entity that can be edited in Yoleck’s level editor.

app.add_yoleck_entity_type({
    YoleckEntityType::new("MyEntityType")
        .with::<Component1>()
        .with::<Component2>()
        .with::<Component3>()
});
source

fn add_yoleck_edit_system<P>( &mut self, system: impl 'static + IntoSystem<(), (), P> )

Add a system for editing Yoleck components in the level editor.


app.add_yoleck_edit_system(edit_component1);

fn edit_component1(mut ui: ResMut<YoleckUi>, mut edit: YoleckEdit<&mut Component1>) {
    let Ok(component1) = edit.get_single_mut() else { return };
    // Edit `component1` with the `ui`
}

See YoleckEdit.

source

fn add_yoleck_entity_upgrade( &mut self, to_version: usize, upgrade_dlg: impl 'static + Send + Sync + Fn(&str, &mut Value) )

Register a function that upgrades entities from a previous version of the app format.

This should only be called after adding YoleckEntityUpgradingPlugin. See that plugin’s docs for more info.

Provided Methods§

source

fn add_yoleck_entity_upgrade_for( &mut self, to_version: usize, for_type_name: impl ToString, upgrade_dlg: impl 'static + Send + Sync + Fn(&mut Value) )

Register a function that upgrades entities of a specific type from a previous version of the app format.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl YoleckExtForApp for App

source§

fn add_yoleck_entity_type(&mut self, entity_type: YoleckEntityType)

source§

fn add_yoleck_edit_system<P>( &mut self, system: impl 'static + IntoSystem<(), (), P> )

source§

fn add_yoleck_entity_upgrade( &mut self, to_version: usize, upgrade_dlg: impl 'static + Send + Sync + Fn(&str, &mut Value) )

Implementors§