use crate::features::hud::components::{SettingsTimerInput, TimerType}; use crate::features::phase::components::TimerSettings; use crate::features::savegame::ui::spawn_load_popup; use crate::prelude::*; use components::*; use ui::settings::open_settings_menu; pub mod components; pub mod ui; /// Plugin for the main menu screen. pub struct StartScreenPlugin; impl Plugin for StartScreenPlugin { fn build(&self, app: &mut App) { app.init_resource::(); app.add_systems(OnEnter(AppState::StartScreen), setup); app.add_systems(OnExit(AppState::StartScreen), cleanup); app.add_systems( Update, (menu, handle_settings_buttons, update_timer_settings_display) .run_if(in_state(AppState::StartScreen)), ); app.add_systems( PostUpdate, apply_start_screen_settings.run_if(in_state(AppState::GameScreen)), ); } } /// Spawns the main menu UI. fn setup(mut commands: Commands) { commands.spawn(( RootMarker::MainMenu, Node { width: percent(100), height: percent(100), flex_direction: FlexDirection::Column, row_gap: px(10), ..Node::center() }, children![ text("Pomomon Garden", 64.0, Color::WHITE), button( ButtonType::LoadGame, ButtonVariant::Primary, Node { width: px(280), padding: UiRect::all(px(10)), ..default() }, |color| text("Spiel laden", 33.0, color) ), button( ButtonType::NewGame, ButtonVariant::Primary, Node { width: px(280), padding: UiRect::all(px(10)), ..default() }, |color| text("Neues Spiel", 33.0, color) ), button( ButtonType::Settings, ButtonVariant::Secondary, Node { width: px(280), padding: UiRect::all(px(10)), ..default() }, |color| text("Einstellungen", 33.0, color) ), ], )); } /// Handles main menu button interactions. fn menu( mut commands: Commands, mut next_state: ResMut>, mut interaction_query: Query<(&Interaction, &ButtonType), (Changed, With