DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

9ea199d89a222d99f027cb9d8b4d3b11e4c1065f — Jonni Liljamo 1 year, 7 months ago 6abc7f2
feat(client): show amount left on supply piles

* also removes piles from dev details
M client/src/plugins/game/card/mod.rs => client/src/plugins/game/card/mod.rs +1 -1
@@ 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>,
}

M client/src/plugins/game/supply/mod.rs => client/src/plugins/game/supply/mod.rs +19 -2
@@ 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);

M client/src/plugins/game/ui/mod.rs => client/src/plugins/game/ui/mod.rs +0 -12
@@ 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));
                        });
                }
            });
        });
}