import json
import socket
import threading
from Classes.System.GameManager import GameManager

from Classes.System.Network.NetworkManger import NetworkManager
from Classes.System.PlayerManager import Player
from Classes.System.World import World

class Server:

    __address:str
    __tcpPort:str
    __udpPort:str
    __world:World
    __gameManager:GameManager

    networkManager:NetworkManager

    def __init__(self, address:str, tcpPort:str, udpPort:str):
        self.__address = address
        self.__tcpPort = tcpPort
        self.__udpPort = udpPort
        self.__world = World()
        self.__gameManager = GameManager()

        
        self.startServer(self.__gameManager)

    # handles starting the server and assigning socket values to the local reference
    def startServer(self, gameManager:GameManager):
        self.__networkManager = NetworkManager(self.__address, self.__tcpPort, self.__udpPort, gameManager)