jong/src/game/hand.rs

30 lines
584 B
Rust
Raw Normal View History

2026-01-12 01:54:59 -08:00
use bevy::prelude::*;
2026-01-12 21:57:08 -08:00
use crate::{
2026-01-13 00:01:38 -08:00
game::{player::Player /* wall::WallTiles */},
2026-01-12 21:57:08 -08:00
tiles::Tile,
};
2026-01-12 01:54:59 -08:00
#[derive(Component)]
pub struct Hand;
2026-01-13 00:01:38 -08:00
// #[derive(Component, Default)]
// enum SortHand {
// #[default]
// Unsorted,
// Sort,
// Manual,
// }
2026-01-12 21:57:08 -08:00
pub(crate) fn sort_hands(
2026-01-12 01:54:59 -08:00
tiles: Populated<&Tile>,
2026-01-13 00:01:38 -08:00
mut hands: Populated<&mut Children, (With<Player>, Changed<Hand>)>,
2026-01-12 01:54:59 -08:00
) -> Result {
2026-01-13 00:01:38 -08:00
for mut hand in hands {
hand.sort_unstable_by_key(|e| tiles.get(*e).unwrap().suit);
debug!("sorted: {hand:?}")
2026-01-12 21:57:08 -08:00
}
trace!("sort_hands");
2026-01-12 01:54:59 -08:00
Ok(())
}