private void CreateClientWorker() { if (currentClientWorker != null) { Destroy(currentClientWorker); } currentClientWorker = Instantiate(clientWorkerPrefab, transform.position, Quaternion.identity); workerConnector = currentClientWorker.GetComponent <WorkerConnector>(); tileProvider = workerConnector as ITileProvider; connectionController = currentClientWorker.GetComponent <ConnectionController>(); connectionController.InformOfUI(screenUIController); }
public void ExtractPlayerConnectionPort_finds_port_regardless_of_position_in_file() { const string validPort = "5555"; // First start with a single line. var exampleFile = string.Format(CorrectTemplate, validPort); Assert.AreEqual(ushort.Parse(validPort), WorkerConnector.ExtractPlayerConnectionPort(exampleFile)); // Put something in front. exampleFile = $"Something in front!\n{exampleFile}"; Assert.AreEqual(ushort.Parse(validPort), WorkerConnector.ExtractPlayerConnectionPort(exampleFile)); // Put something behind. exampleFile = $"{exampleFile}\nSomething behind!"; Assert.AreEqual(ushort.Parse(validPort), WorkerConnector.ExtractPlayerConnectionPort(exampleFile)); }
public void Add(WorkerConnector builder) { _connectors.Add(builder); }
private void Start() { clientWorkerConnector = gameObject.GetComponent <WorkerConnector>(); connectButton = screenUIController.ConnectScreen.GetComponentInChildren <Animator>(); }
public void ExtractPlayerConnectionPort_throws_exception_if_invalid_port(string port, Type exceptionType) { var file = string.Format(CorrectTemplate, port); Assert.Throws(exceptionType, () => WorkerConnector.ExtractPlayerConnectionPort(file)); }
public void ExtractPlayerConnectionPort_throws_exception_if_no_match() { var noPortHere = "There isn't a port here.\nYou really shouldn't even bother looking."; Assert.Throws <Exception>(() => WorkerConnector.ExtractPlayerConnectionPort(noPortHere)); }