public virtual void Pause() { try { PauseEvent.Set(); //Timer.Change(Timeout.Infinite, Timeout.Infinite); // Wait for any current execution to finish var timeout = Profile.StopTaskTimeout; if (RunEvent.WaitOne(0)) { ServiceProfile.Service.RequestAdditionalTime((int)timeout.TotalMilliseconds); if (RunEvent.WaitOne(timeout)) { LogWarning("still running during Pause process. Wait timer exceeded."); } } State = TaskState.Paused; } catch (Exception e) { LogException(e, "failed Pause process."); } }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { if (Timer != null) { Timer.Dispose(); Timer = null; } if (PauseEvent != null) { PauseEvent.Close(); PauseEvent.Dispose(); PauseEvent = null; } if (RunEvent != null) { RunEvent.Close(); RunEvent.Dispose(); RunEvent = null; } if (UnityFactory != null) { UnityFactory.Container.Dispose(); UnityFactory = null; } } disposed = true; }
private void LogEvent(PauseEvent e) { if (e.LoggingLevel <= LoggingLevel) { Debug.Log(e.Description); } }
public void Unpause() { GetComponent <FloatingIconManager>().SetAllIconsVisible(true); if (TabButtonPanel.activeSelf) { TabButtonPanel.SetActive(false); } if (useGreyscale) { GreyscaleScreen(false); } Crosshair.enabled = true; LockPlayerControls(true, true, false, 3, false); PauseGamePanel.SetActive(false); MainGamePanel.SetActive(true); isPaused = false; if (reallyPause) { foreach (var PauseEvent in PauseEvents) { PauseEvent.OnPauseEvent(false); } Time.timeScale = 1; } }
private void Pause() { _timeScalePrePause = Time.timeScale; _gameStopped = true; Time.timeScale = 0; PauseEvent?.Invoke(); }
public void OnPause(InputAction.CallbackContext context) { if (context.phase == InputActionPhase.Performed) { PauseEvent.Invoke(); } }
public void TogglePause() { _isPaused = !_isPaused; UIManager.Instance.EnablePauseUI(IsPaused); PauseEvent?.Invoke(this, EventArgs.Empty); }
private void Pause(PauseEvent eventInfo) { isPaused = true; if (agnes.isActiveAndEnabled) { agnes.isStopped = true; } }
protected virtual void ExecuteWrapper(object stateInfo) { try { // if already running then do nothing if (RunEvent.WaitOne(0)) { LogWarning("another thread already running."); return; } if (PauseEvent.WaitOne(0)) { LogWarning("service is paused."); return; } var result = Result <string> .Success(); var batch = new RSMDB.BatchHistory { RunStart = DateTime.Now, SystemId = this.ExternalSystem.Id, }; try { RunEvent.Set(); Interlocked.Increment(ref _iterations); LogMessage("executing."); State = TaskState.Running; result = Execute(stateInfo); } finally { State = TaskState.Idle; RunEvent.Reset(); using (var controller = new BatchHistories()) { var text = result != null ? result.Entity : string.Empty; var msg = (result.Succeeded) ? LogMessageDetail(result.ToString(), "completed. {0}", text) : LogErrorDetail(result.ToString(), "execution failed. {0}", text); batch.RunEnd = DateTime.Now; batch.Message = msg; batch.Outcome = (int)result.Outcome; controller.Add(batch); } } } catch (Exception e) { LogException(e, "execution failed."); } }
void onPause(PauseEvent e) { Debug.Log("Pause"); G.Sys.paused = e.pausing; if (e.pausing) { Instantiate(pauseMenuPrefab); } }
void Start() { GlobalTime.Time = 0; timeChangeEvent = new GoToTimeState(); pauseEvent = new PauseEvent(); EventManager.AddTimeChangeInvoker(this); EventManager.AddPauseTimeInvoker(this); }
public virtual void Continue() { try { PauseEvent.Reset(); //Timer.Change(Profile.Schedule.NextDueTime(_iterations), Profile.Schedule.NextInterval()); } catch (Exception e) { LogException(e, "failed Continue process"); } }
protected void Awake() { button = GetComponent <Button>(); if (button == null) { Debug.LogError($"{name} does not have an attached button component!"); } // Register listeners PauseEvent.RegisterListener(GamePaused); }
void OnPause( PauseEvent pe ) { Time.timeScale = (Time.timeScale != 0.0f) ? 0.0f : 1.0f; paused = !paused; if (pe.displayMenu && pe.showMouse) { // don't toggle mouse Screen.showCursor = true; } else if (pe.displayMenu) { toggleMouse (); Screen.showCursor = !Screen.showCursor; } }
/// <summary> /// Handles showing and hiding UI elements /// /// Also re-creates the pause event for future use /// </summary> void Pause() { restart.gameObject.SetActive(paused); pause.gameObject.SetActive(paused); play.gameObject.SetActive(!paused); timeBar.gameObject.SetActive(!paused); paused = !paused; pauseEvent.Invoke(); pauseEvent = new PauseEvent(); EventManager.AddPauseTimeInvoker(this); }
void Start() { instance = this; currentState = States.START; game += Game; pause += Pause; play += Play; backmenu += BackMenu; gameOver += GameOver; exitGame += ExitGame; }
private void Pause(bool state) { paused = state; if (paused) { Time.timeScale = 0; } else { Time.timeScale = 1; } PauseEvent?.Invoke(state); }
void OnPause(PauseEvent pe) { Time.timeScale = (Time.timeScale != 0.0f) ? 0.0f : 1.0f; paused = !paused; if (pe.displayMenu && pe.showMouse) { // don't toggle mouse Screen.showCursor = true; } else if (pe.displayMenu) { toggleMouse(); Screen.showCursor = !Screen.showCursor; } }
public void Pause() { _isPaused = true; Time.timeScale = 0f; PauseEvent?.Invoke(); _UIElements.RemoveAll(x => x.activeSelf == false); foreach (var element in _UIElements) { element.SetActive(false); } _pauseMenuUI.SetActive(true); _background.SetActive(true); }
private void HandlePausing(global::Event e) { Debug.Assert(e.GetType() == typeof(PauseEvent), "Non-PauseEvent in HandlePausing."); PauseEvent pauseEvent = e as PauseEvent; if (pauseEvent.action == PauseEvent.Pause.Pause) { paused = true; Services.Sound.PlayPauseMusic(); } else { paused = false; Services.Sound.ResumeMusic(); } }
public void pause() { lock (EmotionModel.svmFeature) { EmotionModel.svmFeature[0].Value = 0; EmotionModel.svmFeature[1].Value = 1; } // 创建PauseEvent PauseEvent e = (PauseEvent)EventFactory.createMomentEvent(curSession.SessionID, (int)mPlayer.GetPlayTime(), MomentEventType.PAUSE); storeModule.saveMomentEvent(e); // For Debug Console.WriteLine(JsonConvert.SerializeObject(e)); mPlayer.Pause(); isPlaying = false; }
protected void Awake() { PauseEvent.RegisterListener(LogEvent); MenuEvent.RegisterListener(LogEvent); TileSoldEvent.RegisterListener(LogEvent); TileDestroyedEvent.RegisterListener(LogEvent); TileDamageEvent.RegisterListener(LogEvent); TileUpdateEvent.RegisterListener(LogEvent); BaseDamageEvent.RegisterListener(LogEvent); BaseDamageUIEvent.RegisterListener(LogEvent); PurchaseMadeEvent.RegisterListener(LogEvent); PartsChangedUIEvent.RegisterListener(LogEvent); EnemyRecycledEvent.RegisterListener(LogEvent); GameStartEvent.RegisterListener(LogEvent); GameOverEvent.RegisterListener(LogEvent); GameWonEvent.RegisterListener(LogEvent); FastForwardEvent.RegisterListener(LogEvent); }
public static PauseEvent Serdes(PauseEvent e, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } e ??= new PauseEvent(); e.Length = s.UInt8(nameof(Length), e.Length); int zeroes = s.UInt8(null, 0); zeroes += s.UInt8(null, 0); zeroes += s.UInt8(null, 0); zeroes += s.UInt8(null, 0); zeroes += s.UInt16(null, 0); zeroes += s.UInt16(null, 0); s.Assert(zeroes == 0, "PauseEvent: Expected fields 3-8 to be 0"); return(e); }
private void Awake() { // initialize events: if (GameWinEvent == null) { GameWinEvent = new GameWinEvent(); } if (GameLoseEvent == null) { GameLoseEvent = new GameLoseEvent(); } if (PauseEvent == null) { PauseEvent = new PauseEvent(); } if (UnPauseEvent == null) { UnPauseEvent = new UnPauseEvent(); } if (BoostEvent == null) { BoostEvent = new BoostEvent(); } if (ShieldEvent == null) { ShieldEvent = new ShieldEvent(); } if (KnockedOffCarEvent == null) { KnockedOffCarEvent = new KnockedOffCarEvent(); } if (DeterminedClosestCarEvent == null) { DeterminedClosestCarEvent = new DeterminedClosestCarEvent(); } }
private void Revert( CancellationTokenSource tokenSrc, Action <string> UpdateStatus) { while (FilesProcessed.Count > 0) { PauseEvent.WaitOne(); UpdateStatus($"Deleting file: {FilesProcessed[0]}"); File.Delete(FilesProcessed[0]); FilesProcessed.RemoveAt(0); } while (FoldersCreated.Count > 0) { PauseEvent.WaitOne(); UpdateStatus($"Deleting folder: {FoldersCreated[0]}"); Directory.Delete(FoldersCreated[0], true); FoldersCreated.RemoveAt(0); } }
/// <summary> /// 暂停按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pause_Click(object sender, EventArgs e) { if (running) //运行中 { if (pausing) //暂停中 { return; } else { PauseEvent?.Invoke(); pausing = true; pause.Enabled = false; } } else { return; } }
public void HandleGenericEvent(string p_eventname) { switch (p_eventname) { case "PAUSE": GameState.PauseGame(); PauseEvent?.Invoke(); break; case "UNPAUSE": GameState.UnpauseGame(); UnPauseEvent?.Invoke(); break; default: break; } //Set time scale Time.timeScale = GameState.TimeScale; }
void OnPause( PauseEvent pe ) { paused = !paused; displayMenu = (paused && pe.displayMenu); }
public void OnGameEvent(PauseEvent pauseEvent) { // Stop the slow motion to not interfere with the pause state, who will set timescale to 0 StopAllCoroutines(); }
private void Pause(PauseEvent eventInfo) { isPaused = true; }
/// <summary> /// Reciever for sendMessage("OnPause") which brings up the pause menu /// </summary> /// <param name="pe"> A pause event with boring data</param> void OnPause(PauseEvent pe) { paused = !paused; menupaused = (pe.displayMenu && paused) ? true : false; }
void OnPause( PauseEvent pe ) { Time.timeScale = (Time.timeScale != 0.0f) ? 0.0f : 1.0f; paused = !paused; eventPublisher.publish (new ShowMouseEvent (paused)); }
private void Charger_CouplerHPSafetyChaged(object sender, SCAppConstants.CouplerHPSafety e) { try { if (DebugParameter.isPassCouplerHPSafetySignal) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(VehicleChargerModule), Device: DEVICE_NAME, Data: $"pass coupler hp safey signal,flag:{DebugParameter.isPassCouplerHPSafetySignal}"); return; } AUNIT charger = sender as AUNIT; if (charger == null) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(VehicleChargerModule), Device: DEVICE_NAME, Data: $"charger is null"); return; } LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(VehicleChargerModule), Device: DEVICE_NAME, Data: $"Coupler hp safyte has changed,charger id:{charger.UNIT_ID} hp safety:{e}"); var couplers = addressesBLL.cache.LoadCouplerAddresses(charger.UNIT_ID); var vhs = vehicleBLL.cache.loadAllVh(); switch (e) { case SCAppConstants.CouplerHPSafety.NonSafety: lineService.ProcessAlarmReport(charger.UNIT_ID, AlarmBLL.AGVC_CHARGER_HP_NOT_SAFETY, ErrorStatus.ErrSet, $"Coupler position not safety."); break; case SCAppConstants.CouplerHPSafety.Safyte: lineService.ProcessAlarmReport(charger.UNIT_ID, AlarmBLL.AGVC_CHARGER_HP_NOT_SAFETY, ErrorStatus.ErrReset, $"Coupler position not safety."); break; } foreach (var coupler in couplers) { string coupler_adr_id = coupler.ADR_ID; LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(VehicleChargerModule), Device: DEVICE_NAME, Data: $"Coupler hp safyte has changed,coupler adr id:{coupler_adr_id}, start check has vh can pass..."); foreach (var vh in vhs) { if (vh.isTcpIpConnect && (vh.MODE_STATUS == VHModeStatus.AutoRemote || vh.MODE_STATUS == VHModeStatus.AutoCharging || vh.MODE_STATUS == VHModeStatus.AutoCharging) ) { string vh_cur_adr_id = vh.CUR_ADR_ID; bool is_walkable = guideBLL.IsRoadWalkable(coupler_adr_id, vh_cur_adr_id); if (is_walkable) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(VehicleChargerModule), Device: DEVICE_NAME, Data: $"Coupler hp safyte has changed,coupler adr id:{coupler_adr_id} vh current adr:{vh_cur_adr_id}, is walkable start pause/continue action"); string vh_id = vh.VEHICLE_ID; PauseType pauseType = PauseType.Normal; PauseEvent pauseEvent = PauseEvent.Pause; if (e == SCAppConstants.CouplerHPSafety.Safyte) { pauseEvent = PauseEvent.Continue; } else { pauseEvent = PauseEvent.Pause; } //Task.Run(() => //{ // try // { // vehicleService.Send.Pause(vh_id, pauseEvent, pauseType); // } // catch (Exception ex) // { // logger.Error(ex, "Exception:"); // } //}); } } } } } catch (Exception ex) { logger.Error(ex, "Exception:"); } }
/// <summary> /// Reciever for sendMessage("OnPause") which brings up the pause menu /// </summary> /// <param name="pe"> A pause event with boring data</param> void OnPause( PauseEvent pe ) { paused = !paused; menupaused = (pe.displayMenu && paused) ? true : false; }