turn_state logic
This commit is contained in:
parent
f6361b9fa1
commit
1e6a3ca84b
10 changed files with 61 additions and 16 deletions
|
|
@ -23,6 +23,7 @@ pub fn join_or_create_lobby(ctx: &ReducerContext, mut lobby_id: u32) -> Result<(
|
|||
host_player_id: player.id,
|
||||
players: vec![PlayerOrBot::Player { id: player.id }],
|
||||
game_state: GameState::Setup,
|
||||
turn_state: TurnState::None,
|
||||
});
|
||||
info!("created lobby: {:?}", lobby);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ pub fn shuffle_deal(ctx: &ReducerContext, lobby_id: u32) {
|
|||
lobby.game_state = GameState::Deal;
|
||||
let mut lobby = ctx.db.lobby().id().update(lobby);
|
||||
|
||||
|
||||
let tiles = new_shuffled_wall(ctx);
|
||||
ctx.db.wall().insert(Wall {
|
||||
// id: 0,
|
||||
|
|
@ -24,6 +23,7 @@ pub fn shuffle_deal(ctx: &ReducerContext, lobby_id: u32) {
|
|||
deal_hands(ctx, lobby_id);
|
||||
|
||||
lobby.game_state = GameState::Play;
|
||||
lobby.turn_state = TurnState::Tsumo;
|
||||
ctx.db.lobby().id().update(lobby);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ pub struct Lobby {
|
|||
pub players: Vec<PlayerOrBot>,
|
||||
|
||||
pub game_state: GameState,
|
||||
pub turn_state: TurnState,
|
||||
}
|
||||
|
||||
#[table(name = wall)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue