public void startServer() { if (serverSwitch.GetComponent <Toggle>().isOn) { if (androidDevice) { serverServiceName = BufferServicesControllerInterface.startServer(); GameObject.Find("ServerNotifications").GetComponent <Text>().text = serverServiceName; } GameObject.Find("ServerButtonText").GetComponent <Text>().text = "Stop Server"; } }
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(); } }