def __init__(self, mac, ip, port, interface): UDPConnection.__init__(self, mac, ip, port, interface) self.ID = 'server' self.Clients = [] # Le o texto para resposta do comando 'Ajuda' with open('Recursos/Ajuda.txt', 'r') as data_file: self.TextoAjuda = data_file.read() # Gera o mapa fct = MapFactory() with open('Recursos/Mapa.txt', 'r') as data_file: jsonFormatted = json.load(data_file) with open('Recursos/MapaDesign.txt', 'r') as mapDesign: generatedMap = fct.GenerateMap(jsonFormatted, mapDesign.read()) self.GameLogic = Game(generatedMap)
sys.path.insert(0, '../Modelos/') sys.path.insert(0, '../Modelos/Mapa/') from Game import * from Map import * from MapFactory import * import json """ Metodo principal para rodar o cliente """ if __name__ == "__main__": fct = MapFactory() with open('../Recursos/Mapa.txt', 'r') as data_file: jsonFormatted = json.load(data_file) with open('../Recursos/MapaDesign.txt', 'r') as mapDesign: generatedMap = fct.GenerateMap(jsonFormatted, mapDesign.read()) #Teste 1 - CriaJogador print "----- CriaJogador -----" game = Game(generatedMap) print game.CriaJogador("Joao", "127.0.0.1") + "\n" #Teste 2 - Examina print "----- Examina -----" game = Game(generatedMap) game.CriaJogador("Joao", "127.0.0.1") print game.Examina("Joao") + "\n" #Teste 3 - Move print "----- Move -----" game = Game(generatedMap)