bevy_basic_ui/settings/
mod.rs1use bevy::prelude::*;
2use bevy_common_assets::toml::TomlAssetPlugin;
3
4use crate::{systems::despawn_screens, UiState};
5
6use self::{
7 resources::{AllSettings, SettingsVals},
8 systems::{assign_to_resource, init_settings, load_settings_toml, spawn_settings},
9};
10
11pub mod components;
12pub mod events;
13pub mod resources;
14pub mod styles;
15pub mod systems;
16
17pub struct SettingsPlugin;
18
19impl Plugin for SettingsPlugin {
20 fn build(&self, app: &mut App) {
21 app.insert_resource::<SettingsVals>(SettingsVals(vec![]))
22 .add_systems(OnEnter(UiState::Settings), spawn_settings)
23 .add_systems(OnExit(UiState::Settings), despawn_screens)
24 .add_systems(
25 OnEnter(UiState::Splash),
26 (init_settings, assign_to_resource),
27 )
28 .add_systems(Startup, load_settings_toml)
29 .add_plugins(TomlAssetPlugin::<AllSettings>::new(&["settings.toml"]));
30 }
31}