public ProcessMonitor(string processName) { OSCManager.Initialize("255.255.255.255", 19876); OSCManager.ListenToAddress("/unity/client/restart", OnRestartClient); _processName = processName; _monitorThread = new Thread(new ThreadStart(MonitorThreadProc)) { Name = "Monitor Thread" }; _monitorThread.Start(); }
// Use this for initialization void Start() { DontDestroyOnLoad(gameObject); OSCManager.Initialize("239.1.2.3"); OSCManager.ListenToAddress("/unity/server/status", OnServerStatus); OSCManager.ListenToAddress("/unity/server/show/loadScene", OnLoadScene); OSCManager.ListenToAddress("/unity/server/show/showObject", OnShowHideObject); OSCManager.ListenToAddress("/unity/server/show/hideObject", OnShowHideObject); try { _clientConfig = JsonUtility.FromJson <ClientConfig>(System.IO.File.ReadAllText("client_config.json")); } catch (System.Exception ex) { _clientConfig = new ClientConfig(); _clientConfig.id = "-2"; Debug.LogError(ex.ToString()); } }
// Use this for initialization void Start() { _knownClients = new Dictionary <int, ClientInfo>(); SharedLogger.ListenToMessages(LogMessageHandler); OSCManager.Initialize("239.1.2.3"); OSCManager.ListenToAddress("/unity/client/show/join", OnJoinShow); OSCManager.ListenToAddress("/unity/client/status", OnClientStatus); OSCManager.ListenToAddress("/unity/client/restarting", OnClientRestarting); if (Debug.isDebugBuild && File.Exists("show_debug.json")) { LoadJSON(File.ReadAllText("show_debug.json")); } else if (!string.IsNullOrEmpty(JSON_URL)) { StartCoroutine(FetchShowScript()); } }
void Show_ExecuteStep() { // Reset stop conditions _timerSeconds = -1; _waitingForGesture = null; _waitingForTrigger = null; // Grab the next step EventGroup step = _theShow.eventGroups[_theShow.currentEventGroupIndex++]; string stepName = string.Format("([0]){1}", _theShow.currentEventGroupIndex, step.name); Debug.Log("Executing step: " + stepName); if (ShowStep_Name != null) { ShowStep_Name.text = stepName; } // Execute the event actions foreach (Event evt in step.events) { if (!Show_DoEvent(evt)) { return; // Event wants to not continue this script path. } } // If this step doesn't have a stop condition, execute the next step if (step.stopCondition == null) { Show_ExecuteStep(); } else { if (ShowStep_StopCondition != null) { ShowStep_StopCondition.text = step.stopCondition.type; } switch (step.stopCondition.type) { case "trigger": _waitingForTrigger = step.stopCondition.arg1; SetSecondaryShowText(_waitingForTrigger); break; case "timer": _timerSeconds = ParseTimer(step.stopCondition.arg1); _timerMarker = System.DateTime.Now; break; case "gesture": _waitingForGesture = step.stopCondition.arg1; SetSecondaryShowText(_waitingForGesture); break; case "oscMessage": _waitingForOSCMessage = step.stopCondition.arg1; SetSecondaryShowText(_waitingForOSCMessage); OSCManager.ListenToAddress(_waitingForOSCMessage, OnOSCMessage); break; default: Debug.LogError("Unknown stop condition type: " + step.stopCondition.type); break; } } }