wip: game init by server
This commit is contained in:
parent
bcfc488c2e
commit
342fa0cca3
@ -27,6 +27,11 @@
|
|||||||
let t = JSON.stringify(msg);
|
let t = JSON.stringify(msg);
|
||||||
window.game_socket.send(t);
|
window.game_socket.send(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupGame(player_names) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
else if (fct == "startGame") {
|
else if (fct == "startGame") {
|
||||||
let names = msg.names
|
let names = msg.names
|
||||||
setupGame(names)
|
setupGame(names)
|
||||||
|
alert('game is set up')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert('unknown command: '+event.data);
|
alert('unknown command: '+event.data);
|
||||||
@ -55,11 +56,10 @@
|
|||||||
|
|
||||||
socket.onclose = function(event) {
|
socket.onclose = function(event) {
|
||||||
if (event.wasClean) {
|
if (event.wasClean) {
|
||||||
//alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
||||||
|
//alert('closed clean');
|
||||||
} else {
|
} else {
|
||||||
// e.g. server process killed or network down
|
//alert('closed unclean');
|
||||||
// event.code is usually 1006 in this case
|
|
||||||
//alert('[close] Connection died');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,7 +96,9 @@ async def websocket(ws):
|
|||||||
color = x['color']
|
color = x['color']
|
||||||
await set_trump_color(player, color)
|
await set_trump_color(player, color)
|
||||||
elif fct == "requestInit":
|
elif fct == "requestInit":
|
||||||
|
print("before init")
|
||||||
await initGame(ws);
|
await initGame(ws);
|
||||||
|
print("after init")
|
||||||
else:
|
else:
|
||||||
print("confused :(")
|
print("confused :(")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user