fixed variable errors
This commit is contained in:
@ -6,7 +6,7 @@ import threading
|
||||
from Classes.Game.Player import Player
|
||||
from Classes.System.GameManager import GameManager
|
||||
|
||||
from Classes.System.Network.EventHandler import UDPEventHandler, TCPEventHandler
|
||||
from Classes.System.Network.EventHandler import TCPEventHandler
|
||||
from Classes.System.World import World
|
||||
|
||||
class NetworkManager:
|
||||
@ -84,16 +84,16 @@ class NetworkManager:
|
||||
# if enough users for a round are connected the server has to start the game
|
||||
if user not in self.__gameManager.getPlayers():
|
||||
if messageJson["event"] == "login":
|
||||
self.logger.__gameManager.getLogger().info("user logging in")
|
||||
self.logger.__gameManager.getLogger().info("task passed off to gameManager")
|
||||
self.__gameManager.getLogger().info("user logging in")
|
||||
self.__gameManager.getLogger().info("task passed off to gameManager")
|
||||
user = self.__gameManager.addPlayers(Player(messageJson["username"], messageJson["deck"]), client_socket, client_address)
|
||||
self.__gameManager.getLogger().info(f"connected users {len(self.__gameManager.getPlayers())}")
|
||||
|
||||
self.__gameManager.getLogger().info(f"confirming login for user")
|
||||
self.send({
|
||||
"event":"loginresponse",
|
||||
"id": user["player"].getID(),
|
||||
})
|
||||
"id": user[client_address]["player"].getID(),
|
||||
}, client_address)
|
||||
|
||||
self.__eventHandler[client_address].handleTCPEvents(messageJson, self.__gameManager, client_address)
|
||||
self.__gameManager.getLogger().info(f"Received message from {client_address}: {message}")
|
||||
@ -109,8 +109,8 @@ class NetworkManager:
|
||||
except json.JSONDecodeError as e:
|
||||
self.__gameManager.getLogger().error(f"JSON decoding error receiving data from {client_address}: {e}")
|
||||
|
||||
except Exception as e:
|
||||
self.__gameManager.getLogger().error(f"Error receiving data from {client_address}: {e}")
|
||||
# except Exception as e:
|
||||
# self.__gameManager.getLogger().error(f"UknownError receiving data from {client_address} due to error: {e}")
|
||||
|
||||
def broadcast(self, payload:dict):
|
||||
for user in self.__gameManager.getPlayers().values():
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user