change singleton to global

This commit is contained in:
Jonas Zeunert
2021-03-07 16:24:04 +01:00
parent 6450ee22dc
commit 62bdd68c5a
12 changed files with 25 additions and 28 deletions

View File

@@ -7,6 +7,8 @@ from factories.GameFactory import GameFactory
import asyncio
import logging
networking = None
def main():
args = parseCommandLine()
logging.basicConfig(filename='log.txt', level=logging.INFO)
@@ -29,11 +31,12 @@ def defaultOutputServerAddress():
def defaultInputServerAddress():
return config.SOCKET_PATH + config.INPUT_SOCKET_NAME
def createGame(args):
print(args)
NetworkFactory.createNetwork(args.OutputServerAddress, args.InputServerAddress)
gameFactory = GameFactory()
game = gameFactory.createGame()
global networking
networking = NetworkFactory.createNetwork(args.OutputServerAddress, args.InputServerAddress)
game = GameFactory().createGame()
return game
if __name__ == '__main__':