This commit is contained in:
Stefan Rupp 2020-12-06 21:56:16 +01:00
parent 1b9ccc65ab
commit abccd2e51a
3 changed files with 11 additions and 25 deletions

View File

@ -7,26 +7,24 @@
let player = "{{player}}"; let player = "{{player}}";
let c = card.toString(); let c = card.toString();
var msg = { var msg = {
type: "message", type: "message",
fct: "playcard", fct: "playcard",
player: player, player: player,
card: c card: c
}; };
//window.game_socket.send("playcard "+player+":"+card); let t = JSON.stringify(msg);
t = JSON.stringify(msg);
window.game_socket.send(t); window.game_socket.send(t);
} }
function setTrumpColor(color) { function setTrumpColor(color) {
let player = "{{player}}" let player = "{{player}}"
var msg = { var msg = {
type: "message", type: "message",
fct: "setTrumpColor", fct: "setTrumpColor",
player: player, player: player,
color: color color: color
}; };
//window.game_socket.send("setTrumpColor "+player+":"+color) let t = JSON.stringify(msg);
t = JSON.stringify(msg);
window.game_socket.send(t); window.game_socket.send(t);
} }
</script> </script>

View File

@ -7,7 +7,7 @@
<meta name="description" content="pyramid web application"> <meta name="description" content="pyramid web application">
<meta name="author" content="Pylons Project"> <meta name="author" content="Pylons Project">
<title>Free Online Gamblingc</title> <title>Free Online Gambling</title>
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
@ -33,8 +33,6 @@
}; };
socket.onmessage = function(event) { socket.onmessage = function(event) {
//alert(`[message] Data received from server: ${event.data}`);
//if (event.data == "reload") {
let x = JSON.parse(event.data); let x = JSON.parse(event.data);
let fct = x.fct; let fct = x.fct;
if (fct == "reload") { if (fct == "reload") {

View File

@ -88,16 +88,6 @@ async def websocket(ws):
else: else:
print("confused :(") print("confused :(")
# cmd = await ws.receive_text()
# fct, args = cmd.split()
# if fct == "playcard":
# p, c = map(int, args.split(':'))
# await play_card(p, c)
# elif fct == "setTrumpColor":
# player, color = args.split(':')
# await set_trump_color(player, color)
except WebSocketDisconnect: except WebSocketDisconnect:
the_game.websockets.remove(ws) the_game.websockets.remove(ws)