feat: Add keybind for shop (#34)
This commit is contained in:
@@ -48,7 +48,7 @@ fn setup(mut commands: Commands) {
|
||||
padding: UiRect::all(px(10)),
|
||||
..default()
|
||||
},
|
||||
|color| text("Shop", 16.0, color)
|
||||
|color| text("Shop [P]", 16.0, color)
|
||||
),
|
||||
button(
|
||||
inventory::components::ButtonType::InventoryOpen,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::features::{
|
||||
phase::messages::{NextPhaseMessage, PhaseTimerPauseMessage},
|
||||
pom::messages::InvalidMoveMessage,
|
||||
shop::ui::open_shop,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use bevy::input::mouse::MouseButton;
|
||||
@@ -28,6 +29,8 @@ impl Plugin for InputPlugin {
|
||||
|
||||
app.add_message::<NextPhaseMessage>();
|
||||
app.add_systems(Update, next_phase.run_if(in_state(AppState::GameScreen)));
|
||||
|
||||
app.add_systems(Update, shop_keybind.run_if(in_state(AppState::GameScreen)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,3 +138,14 @@ fn next_phase(mut messages: MessageWriter<NextPhaseMessage>, keys: Res<ButtonInp
|
||||
messages.write(NextPhaseMessage);
|
||||
}
|
||||
}
|
||||
|
||||
fn shop_keybind(
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
mut commands: Commands,
|
||||
game_config: Res<GameConfig>,
|
||||
asset_server: Res<AssetServer>,
|
||||
) {
|
||||
if keys.just_pressed(KeyCode::KeyP) {
|
||||
open_shop(&mut commands, &game_config, &asset_server);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user