feat: Load hard-coded savegame file (#37)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::prelude::*;
|
||||
use crate::{features::savegame::messages::SavegameLoadMessage, prelude::*};
|
||||
|
||||
pub struct StartScreenPlugin;
|
||||
|
||||
@@ -120,6 +120,7 @@ fn menu(
|
||||
(&Interaction, &ButtonType, &mut BackgroundColor),
|
||||
(Changed<Interaction>, With<Button>),
|
||||
>,
|
||||
mut load_messages: MessageWriter<SavegameLoadMessage>,
|
||||
) {
|
||||
for (interaction, button_type, mut color) in &mut interaction_query {
|
||||
match *interaction {
|
||||
@@ -127,6 +128,11 @@ fn menu(
|
||||
*color = PRESSED_BUTTON.into();
|
||||
|
||||
match button_type {
|
||||
ButtonType::LoadGame => {
|
||||
commands.insert_resource(SavegamePath::new("savegame.json"));
|
||||
next_state.set(AppState::GameScreen);
|
||||
load_messages.write(SavegameLoadMessage);
|
||||
}
|
||||
ButtonType::NewGame => {
|
||||
commands.insert_resource(SavegamePath::new("savegame.json"));
|
||||
next_state.set(AppState::GameScreen);
|
||||
|
||||
Reference in New Issue
Block a user