public void startClients() { if (clientsSwitch.GetComponent <Toggle>().isOn) { if (androidDevice) { clientsServiceName = BufferServicesControllerInterface.startClients(); GameObject.Find("ClientsNotifications").GetComponent <Text>().text = clientsServiceName; } GameObject.Find("ClientsButtonText").GetComponent <Text>().text = "Stop Clients"; StartCoroutine(getAllThreads()); } }
public IEnumerator startServerAndAllClients() { if (androidDevice) { //Start Server Debug.Log("Started: " + BufferServicesControllerInterface.startServer()); yield return(new WaitForSeconds(10)); //These waits are for the Services to have time to pass around their intents //Start Clients Debug.Log("Started: " + BufferServicesControllerInterface.startClients()); yield return(new WaitForSeconds(1)); //Start FilePlayback client string[] result = BufferServicesControllerInterface.getAllThreadsNamesAndIDs(); while (result.Length == 0) //Wait until the ClientsService updates the controller with all the available threads { yield return(new WaitForSeconds(1)); result = BufferServicesControllerInterface.getAllThreadsNamesAndIDs(); } for (int i = 0; i < result.Length; ++i) { if (result[i].Split(':')[1] == "File Playback") { Debug.Log("Starting FilePlayback"); threadID = int.Parse(result[i].Split(':')[0]); BufferServicesControllerInterface.startThread(threadID); } } yield return(new WaitForSeconds(1)); //Start the internal buffer client GameObject.Find("Sphere").GetComponent <MovingWithAlphaLatEvents>().initializeBuffer(); } }