Add gold to the result message

This commit is contained in:
Joachim Lusiardi 2023-12-21 23:13:13 +01:00
parent 2a86201c3e
commit db96dc5c8a
1 changed files with 7 additions and 5 deletions

View File

@ -120,17 +120,19 @@ fn main() -> Result<()> {
.border_style(Style::default().fg(Color::White))
.border_type(BorderType::Rounded)
.style(Style::default().bg(Color::Black));
let paragraph = match game.get_game_state() {
let mut text = match game.get_game_state() {
GameState::RUNNING => {
Paragraph::new("Quitting is for cowards! You'll better try again!")
"Quitting is for cowards! You'll better try again!".to_string()
}
GameState::LOST => {
Paragraph::new("Sorry, you died in the dungeon. Better luck next time!")
"Sorry, you died in the dungeon. Better luck next time!".to_string()
}
GameState::WON => {
Paragraph::new("Congratulation! You mastered your way through the dungeon and won the game.")
"Congratulation! You mastered your way through the dungeon and won the game.".to_string()
}
}.block(block).wrap(Wrap { trim: true });
};
text += format!("\nYou collected {} gold.", game.get_player().get_gold()).as_str();
let paragraph = Paragraph::new(text).block(block).wrap(Wrap { trim: true });
frame.render_widget(paragraph, area);
});
if event::poll(std::time::Duration::from_millis(16))? {