work on lobby ui

This commit is contained in:
2026-09-17 15:59:47 -05:00
parent b041075c09
commit df95653b86
5 changed files with 605 additions and 43 deletions
+29
View File
@@ -0,0 +1,29 @@
use bevy::prelude::*;
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::ResourceInspectorPlugin};
use crate::lobby::LobbyUiState;
/// Whether the debug inspector is currently shown.
#[derive(Resource, Debug, Default)]
pub struct InspectorEnabled(bool);
pub struct DebugInspectorPlugin;
impl Plugin for DebugInspectorPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<InspectorEnabled>()
.add_plugins(EguiPlugin::default())
.add_plugins(
ResourceInspectorPlugin::<LobbyUiState>::new()
.run_if(|enabled: Res<InspectorEnabled>| enabled.0),
)
.add_systems(Update, toggle_inspector);
}
}
fn toggle_inspector(keys: Res<ButtonInput<KeyCode>>, mut enabled: ResMut<InspectorEnabled>) {
if keys.just_pressed(KeyCode::F1) {
enabled.0 = !enabled.0;
info!("lobby ui inspector toggled {}", if enabled.0 { "on" } else { "off" });
}
}