@@ 104,7 104,7 @@ impl Default for VisualCardBundle {
pub struct VisualCardData {
font_normal: Handle<TextMeshFont>,
font_medium: Handle<TextMeshFont>,
- font_bold: Handle<TextMeshFont>,
+ pub font_bold: Handle<TextMeshFont>,
mesh: Handle<Mesh>,
card_background: Handle<StandardMaterial>,
}
@@ 9,6 9,7 @@
use bevy::prelude::*;
use bevy_mod_picking::prelude::*;
use bevy_rapier3d::prelude::*;
+use bevy_text_mesh::prelude::*;
use crate::{
api::game::{Action, Command},
@@ 18,7 19,7 @@ use crate::{
};
use super::{
- card::{visual_card_kind, ClickedCard, VisualCard, VisualCardBundle},
+ card::{visual_card_kind, ClickedCard, VisualCard, VisualCardBundle, VisualCardData},
GameData,
};
@@ 47,6 48,7 @@ fn spawn_supply_piles(
game_data: Res<GameData>,
mut psp_ev_w: EventWriter<PositionSupplyPilesEvent>,
pile_query: Query<Entity, With<visual_card_kind::Supply>>,
+ card_data: Res<VisualCardData>,
) {
let Some(status) = &game_data.game_status else {
warn!("game_status was none");
@@ 77,7 79,22 @@ fn spawn_supply_piles(
|_over, transform| {
transform.translation.y -= 0.1;
},
- ));
+ )).with_children(|parent| {
+ parent.spawn(TextMeshBundle {
+ text_mesh: TextMesh {
+ text: format!("left: {}", pile.amount),
+ style: TextMeshStyle {
+ font: card_data.font_bold.clone(),
+ font_size: SizeUnit::NonStandard(7.),
+ color: Color::rgb(1., 1., 1.),
+ ..Default::default()
+ },
+ ..Default::default()
+ },
+ transform: Transform::from_xyz(-0.25, -0.725, 0.),
+ ..Default::default()
+ });
+ });
}
psp_ev_w.send(PositionSupplyPilesEvent);
@@ 375,18 375,6 @@ pub fn dev_details_ui(
ui.label(format!("State: {:?}", game.state));
});
-
- egui::CollapsingHeader::new("Supply Piles")
- .default_open(false)
- .show(ui, |ui| {
- for pile in &status.supply_piles {
- egui::CollapsingHeader::new(&pile.card.name)
- .default_open(true)
- .show(ui, |ui| {
- ui.label(format!("Amount: {}", pile.amount));
- });
- }
- });
});
}