set player names in graphic mode
This commit is contained in:
		
							
								
								
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					starlette~=0.12.13
 | 
				
			||||||
 | 
					responder~=2.0.5
 | 
				
			||||||
@@ -57,9 +57,11 @@
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            else if (fct == "getHand") {
 | 
					            else if (fct == "getHand") {
 | 
				
			||||||
                window.hand = msg.cards;
 | 
					                window.hand = msg.cards;
 | 
				
			||||||
 | 
					                let player = "{{player}}";
 | 
				
			||||||
                var msg_out = {
 | 
					                var msg_out = {
 | 
				
			||||||
                    type: "message",
 | 
					                    type: "message",
 | 
				
			||||||
                    fct: "requestInit",
 | 
					                    fct: "requestInit",
 | 
				
			||||||
 | 
					                    player: player,
 | 
				
			||||||
                };
 | 
					                };
 | 
				
			||||||
                let t = JSON.stringify(msg_out);
 | 
					                let t = JSON.stringify(msg_out);
 | 
				
			||||||
                window.game_socket.send(t);
 | 
					                window.game_socket.send(t);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,9 +73,10 @@ async def set_trump_color(player, color):
 | 
				
			|||||||
        await the_game.send_page_reload()
 | 
					        await the_game.send_page_reload()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def initGame(ws):
 | 
					async def initGame(player, ws):
 | 
				
			||||||
    p = the_game.players
 | 
					    p = int(player)
 | 
				
			||||||
    n = [x.name for x in p]
 | 
					    players = the_game.players[p:] + the_game.players[:p]
 | 
				
			||||||
 | 
					    n = [x.name for x in players]
 | 
				
			||||||
    msg = {"type": "message", "fct": "startGame", "names": n}
 | 
					    msg = {"type": "message", "fct": "startGame", "names": n}
 | 
				
			||||||
    await ws.send_json(msg)
 | 
					    await ws.send_json(msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -104,7 +105,8 @@ async def ws_handler(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":
 | 
				
			||||||
                await initGame(ws);
 | 
					                player = x['player']
 | 
				
			||||||
 | 
					                await initGame(player, ws);
 | 
				
			||||||
            elif fct == "getHand":
 | 
					            elif fct == "getHand":
 | 
				
			||||||
                player = x['player']
 | 
					                player = x['player']
 | 
				
			||||||
                await getHand(player, ws)
 | 
					                await getHand(player, ws)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user