private void LogStepTimings() { m_StringBuilder.Append("Step Timings,"); for (int i = 0; i < m_TimeTrackingRepo.currentTime.durationsPerStep.Length; ++i) { m_StringBuilder.Append("Step ").Append(i).Append(",").Append(m_TimeTrackingRepo .currentTime.durationsPerStep[i] .ToString(new System.Globalization.CultureInfo("en-US"))).Append(","); } m_StringBuilder.Remove(m_StringBuilder.Length - 1, 1); AciLog.Log("WorkflowManager", m_StringBuilder.ToString()); m_StringBuilder.Clear(); }
public async void SwitchScene(string sceneToUnload, string sceneToLoad) { if (sceneToUnload != null && IsSceneLoaded(sceneToUnload)) { AciLog.Log("SceneService", $"Unloading scene {sceneToUnload}..."); await SceneManager.UnloadSceneAsync(sceneToUnload, UnloadSceneOptions.UnloadAllEmbeddedSceneObjects); } if (sceneToLoad != null && !IsSceneLoaded(sceneToLoad)) { AciLog.Log("SceneService", $"Loading scene {sceneToLoad}..."); await SceneManager.LoadSceneAsync(sceneToLoad, LoadSceneMode.Additive); } }
/// <summary> /// Async network listener loop. /// </summary> /// <param name="token"><see cref="CancellationToken"/> that is used to interrupt listening process.</param> /// <returns></returns> private async Task ReceiveData(CancellationToken token) { using (UdpClient client = new UdpClient(port)) { AciLog.LogFormat(LogType.Log, GetType().ToString(), "Starting to receive data on port {0}.", port); while (!token.IsCancellationRequested) { UdpReceiveResult result = await client.ReceiveAsync(); string data = Encoding.UTF8.GetString(result.Buffer); GetData(data); } AciLog.Log(GetType().ToString(), "Stopped listening for new data."); } m_Running = false; }
/// <summary> /// Initializes the network connection for sending data /// </summary> private void Initialize() { if (ips.Length != ports.Length) { AciLog.LogError(GetType().Name, "IP/Port mismatch. Please check the configuration of the NetworkPublisher."); } _remoteEndPoints = new IPEndPoint[ips.Length]; for (int i = 0; i < ips.Length; ++i) { _remoteEndPoints[i] = new IPEndPoint(IPAddress.Parse(ips[i]), ports[i]); AciLog.Log(GetType().Name, "Sending packages to " + ips[i] + " : " + ports[i]); } _client = new UdpClient(); }
private void LoadScene() { foreach (string sceneToLoad in scenesToLoad) { bool sceneLoaded = false; for (int i = 0; i < SceneManager.sceneCount; ++i) { if (SceneManager.GetSceneAt(i).name == sceneToLoad) { sceneLoaded = true; break; } } if (sceneLoaded) { continue; } AciLog.Log("Bootstrapper", $"Loading scene {sceneToLoad}..."); SceneManager.LoadScene(sceneToLoad, LoadSceneMode.Additive); } }
/// <inheritdoc /> public void StartWork() { // don't bother if started or no workflow loaded if (m_IsRunning || m_CurrentWorkflowData == WorkflowData.Empty) { return; } m_FinalizerTokenSource = new CancellationTokenSource(); m_TimeProvider.paused = false; m_IsRunning = true; m_EventBroker?.Invoke(new WorkflowStartArgs()); m_EventBroker?.Invoke(new WorkflowStepFinalizedArgs() { lastStep = -1, lastDataStep = -1, newStep = m_CurrentStep, newDataStep = m_CurrentDataStep }); m_StepTriggerFactory.Create(m_CurrentWorkflowData.steps[currentDataStep]); AciLog.Log("WorkflowManager", "Started Workflow"); }
private void Start() { AciLog.Log(nameof(UIBootstrapper), $"Starting UI in {mode} mode."); NavigationParameters navigationParameters = new NavigationParameters(); switch (mode) { case "nochat": throw new NotSupportedException("No Chat is no longer supported!"); case "guest": navigationParameters.Add("isGuest", true); m_NavigationService.PushAsync("Idle", navigationParameters, AnimationOptions.Synchronous, false); break; case "kiosk": default: navigationParameters.Add("isGuest", false); m_NavigationService.PushAsync("Idle", navigationParameters, AnimationOptions.Synchronous, false); break; } }
public void ReassignDisplays() { //if display are not dirty or there are not enough displays or cameras if (DontUseMultiDisplay || !dirty || Display.displays.Length == 1 || Camera.allCamerasCount == 1) { return; } //set displays to display and activate Camera.main.targetDisplay = UIDisplay; foreach (Camera cam in Camera.allCameras) { if (Camera.main == cam) { continue; } cam.targetDisplay = ProjectionDisplay; break; } Display.displays[uiDisplay].Activate(); Display.displays[ProjectionDisplay].Activate(); AciLog.Log("DisplayManager", $"Displaying UI on display {UIDisplay} and Projection on display {ProjectionDisplay}."); }
public void SendLog() { AciLog.Log("LogTester", "This is a test message."); }
public override void Handle(EmotionPackage package) { AciLog.Log("MessageHandler", "I handled a message!"); }
/// <inheritdoc /> public async void SetStep(int step) { // don't set step if finalizing if (m_Finalizing) { return; } // buffer the previous step numbers int m_LastStep = m_CurrentStep; int m_LastDataStep = m_CurrentDataStep; // pause the time until we are done switching steps bool pauseState = m_TimeProvider.paused; m_TimeProvider.paused = true; // now advance/move back to the new step Action functor = null; int diff = 0; if (step > m_LastStep) { functor = AdvanceStep; diff = step - m_LastStep; } else if (step < m_LastStep) { functor = RetreatStep; diff = m_LastStep - step; } else { //restore state before attempt m_TimeProvider.paused = pauseState; return; } for (int i = 0; i < diff; ++i) { functor.Invoke(); } // record time for previous step float stepTime = (float)m_TimeProvider.elapsed.TotalSeconds; m_TimeTrackingRepo.currentTime.durationsPerStep[m_LastStep] = stepTime; m_Finalizing = true; // invoke step event m_EventBroker?.Invoke(new WorkflowStepEndedArgs() { lastStep = m_LastStep , lastDataStep = m_LastDataStep , newStep = m_CurrentStep , newDataStep = m_CurrentDataStep , executedRepetitions = m_CurrentRepetition }); try { await WaitForFinalizers(m_FinalizerTokenSource.Token); } catch (TaskCanceledException) { // Cancellation means we ended the workflow(quit), don't finalize m_Finalizing = false; return; } m_Finalizing = false; // stop workflow if we reached the end if (m_CurrentStep >= currentWorkflowData.numTotalSteps) { if (m_LastDataStep != -1) { m_DisposalService.Dispose(m_CurrentWorkflowData.steps[m_LastDataStep].id); } StopWork(); return; } // restore time for current step m_TimeProvider.Reset(false); float currentTime = m_TimeTrackingRepo.currentTime.durationsPerStep[m_CurrentStep]; m_TimeProvider.paused = false; m_TimeProvider.Add(TimeSpan.FromSeconds(currentTime)); LogStepTimings(); AciLog.Log("WorkflowManager", $"Workflow Step, {m_CurrentStep}"); AciLog.Log("WorkflowManager", $"Data Step: {m_CurrentDataStep}"); if (m_LastDataStep != -1) { m_DisposalService.Dispose(m_CurrentWorkflowData.steps[m_LastDataStep].id); } m_StepTriggerFactory.Create(m_CurrentWorkflowData.steps[currentDataStep]); // invoke step event m_EventBroker?.Invoke(new WorkflowStepFinalizedArgs() { lastStep = m_LastStep , lastDataStep = m_LastDataStep , newStep = m_CurrentStep , newDataStep = m_CurrentDataStep , executedRepetitions = m_CurrentRepetition }); }