(stash) render other players
This commit is contained in:
parent
33cb9c7f97
commit
cc07cc89c6
10 changed files with 249 additions and 14 deletions
|
|
@ -6,7 +6,7 @@ use bevy_spacetimedb::{
|
|||
|
||||
use jong_db::{
|
||||
self, DbConnection, LobbyTableAccess, PlayerHand, PlayerTableAccess, RemoteTables,
|
||||
ViewHandTableAccess as _,
|
||||
ViewClosedHandsTableAccess, ViewHandTableAccess as _,
|
||||
};
|
||||
use jong_db::{add_bot, set_ready};
|
||||
use jong_types::*;
|
||||
|
|
@ -27,7 +27,10 @@ impl Plugin for Riichi {
|
|||
.add_table(RemoteTables::player)
|
||||
.add_table(RemoteTables::lobby)
|
||||
// TODO check bevy_spacetimedb PR status
|
||||
.add_view_with_pk(RemoteTables::view_hand, |p| p.id);
|
||||
.add_view_with_pk(RemoteTables::view_hand, |p| p.id)
|
||||
.add_view_with_pk(RemoteTables::view_closed_hands, |p| {
|
||||
PlayerOrBot::from(&p.player)
|
||||
});
|
||||
let plugins =
|
||||
if let Some(token) = creds_store().load().expect("i/o error loading credentials") {
|
||||
// FIXME patch plugin so this takes Option?
|
||||
|
|
@ -91,8 +94,9 @@ fn subscriptions(stdb: SpacetimeDB, mut commands: Commands) {
|
|||
),
|
||||
"SELECT l.* FROM lobby l JOIN player p ON l.id = p.lobby_id".to_string(),
|
||||
"SELECT c.* FROM player_clock c JOIN player p ON c.player_id = p.id".to_string(),
|
||||
"SELECT * FROM view_hand".to_string(),
|
||||
"SELECT b.* FROM bot b JOIN lobby l ON l.id = b.lobby_id".to_string(),
|
||||
"SELECT * FROM view_hand".to_string(),
|
||||
"SELECT * FROM view_closed_hands".to_string(),
|
||||
]);
|
||||
|
||||
while let Ok(event) = recv.recv() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue