public void setNewServer(IPacmanServer server, string serverUrl) { Console.WriteLine("NEW SERVER"); this.server = server; this.serverUrl = serverUrl; isServerDead = false; }
public FileMovementController(string file, IPacmanServer server, string serverUrl, int delta, int userId) : base(server, serverUrl, delta, userId) { var lines = File.ReadAllLines(file); linesQueue = new Queue <string>(lines); }
public MixedMovementController(string file, Form1 form, IPacmanServer server, string serverUrl, int delta, int userId) : base(server, serverUrl, delta, userId) { fileController = new FileMovementController(file, server, serverUrl, delta, userId); movementController = new MovementController(form, server, serverUrl, delta, userId); currentController = fileController; }
protected AbstractMovementController(IPacmanServer server, string serverUrl, int delta, int userId) { this.userId = userId; this.server = server; this.serverUrl = serverUrl; timer = new Timer(delta) { AutoReset = true }; timer.Elapsed += (sender, args) => NotifyServer(); isServerDead = true; }
private void addClientToServer(IPacmanServer server, int attempted) { try { server.addClient(this); } catch (Exception) { if (attempted <= KeyConfiguration.MAX_ATTEMPTS) { Thread.Sleep(ConnectionLibrary.INTERVAL_RESEND); addClientToServer(server, attempted++); } } }
private void sendKeyToServer(IPacmanServer server, KeyConfiguration.KEYS key, String clientName, int attempt) { try { server.sendKey(keyToSend, pacmanName); } catch (Exception) { if (attempt <= KeyConfiguration.MAX_ATTEMPTS) { Thread.Sleep(ConnectionLibrary.INTERVAL_RESEND); sendKeyToServer(server, key, clientName, attempt++); } } }
public void Start() { new Thread(() => Application.Run(form)).Start(); RegisterTCPChannel(); RegisterClientChannel(); server = GetServerConnection(); var clientInfo = new ClientInfo($"tcp://{clientIP}:{clientPort}"); ClientPuppet.Instance.DoDelay(serverURL); var gameProps = server.RegisterClient(clientInfo); InitializeControllers(gameProps); InitializePuppet(); }
public MovementController(Form1 form, IPacmanServer server, string serverUrl, int delta, int userId) : base(server, serverUrl, delta, userId) { this.form = form; }