1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use bevy::prelude::*;
use bevy_lunex::{UiDebugPlugin, UiGenericPlugin, UiSystems};
use components::CustomButtonUi;
use systems::build_button;

use crate::resources::CodexSettings;

pub mod components;
pub mod styles;
pub mod systems;

#[derive(Clone)]
pub struct ButtonPlugin;

impl Plugin for ButtonPlugin {
    fn build(&self, app: &mut App) {
        app.add_plugins((UiGenericPlugin::<CustomButtonUi>::new(),));
        if app.world().resource::<CodexSettings>().debug {
            app.add_plugins(UiDebugPlugin::<CustomButtonUi>::new());
        }
        app.add_systems(Update, build_button.before(UiSystems::Compute));
    }
}