/* * This file is part of laurelin_client * Copyright (C) 2023 Jonni Liljamo * * Licensed under GPL-3.0-only. * See LICENSE for licensing information. */ use bevy::prelude::*; use crate::api::game::{Action, Command}; macro_rules! section { ($value:expr, $style:ident) => { TextSection { value: $value, style: $style.clone(), } }; ($value:expr, $style:expr) => { TextSection { value: $value, style: $style, } }; } pub fn action_to_log( action: &Action, (font, font_bold): (Handle, Handle), style: TextStyle, ) -> Vec { match &action.command { Command::InitSupplyPile { card, amount } => { vec![ section!(format!("Created supply pile of "), style), section!(format!("{}", card.name), TextStyle { font: font_bold.clone(), ..style.clone() }), section!(format!(" with "), style), section!(format!("{}", amount), TextStyle { font: font_bold.clone(), ..style.clone() }), section!(format!(" cards."), TextStyle { ..style.clone() }), ] } _ => { vec![ TextSection { value: format!("No log configuration for this command"), style: TextStyle { ..style }, }, ] } } }