示例#1
0
    def join(self, client: Client) -> bool:
        if not self.in_lobby:
            return False

        self.guests.append(client)
        client.current_game = self
        return True
示例#2
0
    async def action_create_lobby(cls, _msg,
                                  client: Client) -> Optional[AbstractState]:
        code = client.game_handler.room_code_handler.create_new_game_code()
        game = Game(code, client)

        logging.info(f"Created new lobby, code: {game.code}")
        client.game_handler.add_game(game)
        client.current_game = game
        return HostingLobbyState()