spawn each player and hand
This commit is contained in:
parent
50fd406dbf
commit
f6bd7fd6f7
3 changed files with 79 additions and 75 deletions
|
|
@ -228,6 +228,8 @@ fn view_hand(
|
|||
// trace!("view_hand");
|
||||
if let Some(view) = stdb.db().view_player_hand().iter().next() {
|
||||
let mut view = view.tiles.iter().map(Tile::from).collect::<Vec<_>>();
|
||||
// view.sort();
|
||||
debug!("view: {view:?}");
|
||||
|
||||
let tiles = tiles
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ pub(crate) fn render(
|
|||
// // trace!("arg!");
|
||||
// }
|
||||
|
||||
// FIXME we don't care about other players atm
|
||||
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
|
||||
pub(crate) fn render_hands(
|
||||
mut commands: Commands,
|
||||
|
|
@ -124,7 +125,7 @@ pub(crate) fn render_hands(
|
|||
main_player: Single<(&Player, Entity /* , &Wind */), With<MainPlayer>>,
|
||||
curr_player: Single<Entity, With<CurrentPlayer>>,
|
||||
players: Query<(&Player, Entity, &Children)>,
|
||||
hands: Query<(&Children, Entity), (With<Hand>, Without<Player>)>,
|
||||
hands: Query<(&Children, Entity), With<Hand>>,
|
||||
// drawn_tile: Single<Entity, With<Drawn>>,
|
||||
) -> Result {
|
||||
let mut frame = tui.get_frame();
|
||||
|
|
@ -132,10 +133,10 @@ pub(crate) fn render_hands(
|
|||
|
||||
for (hand, hand_ent) in hands {
|
||||
// debug!("{hand:?}");
|
||||
let (player, player_ent, _) = players
|
||||
.iter()
|
||||
.find(|(_, e, c)| c.contains(&hand_ent))
|
||||
.unwrap();
|
||||
// let (player, player_ent, _) = players
|
||||
// .iter()
|
||||
// .find(|(_, e, c)| c.contains(&hand_ent))
|
||||
// .unwrap();
|
||||
let hand: Vec<_> = hand
|
||||
.iter()
|
||||
.map(|entity| -> Result<_> {
|
||||
|
|
@ -147,7 +148,8 @@ pub(crate) fn render_hands(
|
|||
})
|
||||
.collect::<Result<_>>()?;
|
||||
|
||||
if player == main_player.0 {
|
||||
let (player, player_ent) = *main_player;
|
||||
// if player == main_player.0 {
|
||||
// split main box into thirds
|
||||
let mut this_hand = layouts.this_hand;
|
||||
// let this_drawer = drawn_tile..is_some_and(|dt| dt.0 == player);
|
||||
|
|
@ -214,13 +216,13 @@ pub(crate) fn render_hands(
|
|||
// frame.render_widget(widget, area);
|
||||
// }
|
||||
// TODO draw melds
|
||||
} else {
|
||||
// } else {
|
||||
// match mainplayer.1.relate(wind) {
|
||||
// jong::game::round::WindRelation::Shimocha => todo!(),
|
||||
// jong::game::round::WindRelation::Toimen => todo!(),
|
||||
// jong::game::round::WindRelation::Kamicha => todo!(),
|
||||
// }
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue