Trait 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.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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§