/// <inheritdoc /> public void Update(TimeSpan total, TimeSpan elapsed, bool isRunningSlowly) { PreUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); InternalUpdate(total, elapsed, isRunningSlowly); PostUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); }
/// <summary> /// Invokes the Xna PreUpdate event. /// </summary> /// <param name="gameTime"></param> public static void InvokePreUpdate(GameTime gameTime) { var args = new XnaUpdateEventArgs { GameTime = gameTime }; PreUpdate.Invoke(args); }
private void OnTick(object sender, EventArgs args) { preUpdateSubject.OnNext(Unit.Default); PreUpdate?.Invoke(this, EventArgs.Empty); scheduler.Run(); Coroutine.Run(); updateSubject.OnNext(Unit.Default); Update?.Invoke(this, EventArgs.Empty); }
/// <summary> /// 更新组件 /// </summary> public void UpdateComponentUnit(int time, Action <Action <int> > method = default) { CountTime += time;//与主线程的帧率时间保持一致,避更新新过快 IShipDockComponent item; while (CountTime > FrameTimeInScene) { PreUpdate?.Invoke(mUpdateByTicks, false); int compIndex = 0; int max = mUpdateByTicks.Count; for (int i = 0; i < max; i++) { item = default; RefComponentByIndex(i, ref compIndex, ref mUpdateByTicks, ref item); if (item != default) { if (item.IsSceneUpdate) { continue; } if (item.IsSystemChanged) { if (!mDeletdComponents.Contains(item.ID)) { if (method == default) { item.UpdateComponent(time); } else { method.Invoke(item.UpdateComponent); } } item.SystemChecked(); } } } FinalUpdate(time); CountTime -= FrameTimeInScene; } }
public virtual void Update(float deltaTime) { PreUpdate?.Invoke(deltaTime); if (!enabled) { return; } if (IsMouseOver || (!RequireMouseOn && selectedWidgets.Contains(this) && PlayerInput.PrimaryMouseButtonHeld())) { Hovered?.Invoke(); System.Diagnostics.Debug.WriteLine("hovered"); if (RequireMouseOn || PlayerInput.PrimaryMouseButtonDown()) { if ((multiselect && !selectedWidgets.Contains(this)) || selectedWidgets.None()) { selectedWidgets.Add(this); Selected?.Invoke(); } } } else if (selectedWidgets.Contains(this)) { System.Diagnostics.Debug.WriteLine("selectedWidgets.Contains(this) -> remove"); selectedWidgets.Remove(this); Deselected?.Invoke(); } if (IsSelected) { if (PlayerInput.PrimaryMouseButtonDown()) { MouseDown?.Invoke(); } if (PlayerInput.PrimaryMouseButtonHeld()) { MouseHeld?.Invoke(deltaTime); } if (PlayerInput.PrimaryMouseButtonClicked()) { MouseUp?.Invoke(); } } PostUpdate?.Invoke(deltaTime); }
/// <inheritdoc /> public void Update(TimeSpan total, TimeSpan elapsed, bool isRunningSlowly) { PreUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); Mouse.Update(total, elapsed, isRunningSlowly); foreach (Dialog dialog in Dialogs) { dialog.Update(total, elapsed, isRunningSlowly); } foreach (Window window in Windows) { window.Update(total, elapsed, isRunningSlowly); } Dialog.IsShownInCurrentLoopIteration = false; PostUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); }
public virtual void Update(float deltaTime) { PreUpdate?.Invoke(deltaTime); if (!enabled) { return; } if (IsMouseOver || (!RequireMouseOn && selectedWidgets.Contains(this) && PlayerInput.LeftButtonHeld())) { Hovered?.Invoke(); if (RequireMouseOn || PlayerInput.LeftButtonDown()) { if ((multiselect && !selectedWidgets.Contains(this)) || selectedWidgets.None()) { selectedWidgets.Add(this); Selected?.Invoke(); } } } else if (selectedWidgets.Contains(this)) { selectedWidgets.Remove(this); Deselected?.Invoke(); } if (IsSelected) { if (PlayerInput.LeftButtonDown()) { MouseDown?.Invoke(); } if (PlayerInput.LeftButtonHeld()) { MouseHeld?.Invoke(deltaTime); } if (PlayerInput.LeftButtonClicked()) { MouseUp?.Invoke(); } } PostUpdate?.Invoke(deltaTime); }
/// <inheritdoc /> public void Update(TimeSpan total, TimeSpan elapsed, bool isRunningSlowly) { if (!IsVisible) { return; } PreUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); if (!IsLoaded) { Load(); } this.location.X = destination.X; this.location.Y = destination.Y; if (Intersects(Mouse.X, Mouse.Y)) { if (!isMouseIntersectingPrevious) { MouseEnter?.Invoke(this, EventArgs.Empty); } this.isMouseIntersectingPrevious = true; } else { if (isMouseIntersectingPrevious) { MouseLeave?.Invoke(this, EventArgs.Empty); } this.isMouseIntersectingPrevious = false; } InternalUpdate(total, elapsed, isRunningSlowly); PostUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); }
/// <inheritdoc /> public void Update(TimeSpan total, TimeSpan elapsed, bool isRunningSlowly) { if (!IsWithinGameWindow(core.Location.X, core.Location.Y)) { return; } lastLocation = core.Location; PreUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); if (Left == MouseButtonState.Released && leftPrevious == MouseButtonState.Pressed) { ButtonUp?.Invoke(this, new MouseButtonClickEventArgs(X, Y, MouseButton.Left)); } else if (Middle == MouseButtonState.Released && middlePrevious == MouseButtonState.Pressed) { ButtonUp?.Invoke(this, new MouseButtonClickEventArgs(X, Y, MouseButton.Middle)); } else if (Right == MouseButtonState.Released && rightPrevious == MouseButtonState.Pressed) { ButtonUp?.Invoke(this, new MouseButtonClickEventArgs(X, Y, MouseButton.Right)); } else if (X1 == MouseButtonState.Released && x1Previous == MouseButtonState.Pressed) { ButtonUp?.Invoke(this, new MouseButtonClickEventArgs(X, Y, MouseButton.X1)); } else if (X2 == MouseButtonState.Released && x2Previous == MouseButtonState.Pressed) { ButtonUp?.Invoke(this, new MouseButtonClickEventArgs(X, Y, MouseButton.X2)); } leftPrevious = Left; middlePrevious = Middle; rightPrevious = Right; x1Previous = X1; x2Previous = X2; PostUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly)); }
void OnPreUpdate() { PreUpdate?.Invoke(); }
private void Update() { PreUpdate?.Invoke(this, null); UpdatedEvents.Clear(); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed if ((Global.Configuration.time_based_dimming_enabled && Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_start_minute, Global.Configuration.time_based_dimming_end_hour, Global.Configuration.time_based_dimming_end_minute))) { StopUnUpdatedEvents(); return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; // If the current foreground process is excluded from Aurora, disable the lighting manager if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { StopUnUpdatedEvents(); Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var underlay in Underlays) { ILightEvent @event = Events[underlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { UpdateEvent(@event, newFrame); } } } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { UpdateEvent(profile, newFrame); } if (Global.Configuration.OverlaysInPreview || !preview) { // Update any overlays registered in the Overlays array. This includes applications with type set to Overlay and things such as skype overlay foreach (var overlay in Overlays) { ILightEvent @event = Events[overlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { UpdateEvent(@event, newFrame); } } // Update any overlays that are timer-based (e.g. the volume overlay that appears for a few seconds at a time) TimedListObject[] overlay_events = overlays.ToArray(); foreach (TimedListObject evnt in overlay_events) { if ((evnt.item as LightEvent).IsEnabled) { UpdateEvent((evnt.item as LightEvent), newFrame); } } // Update any applications that have overlay layers if that application is open var events = GetOverlayActiveProfiles().ToList(); //Add the Light event that we're previewing to be rendered as an overlay if (preview && Global.Configuration.OverlaysInPreview && !events.Contains(profile)) { events.Add(profile); } foreach (var @event in events) { @event.UpdateOverlayLights(newFrame); } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); StopUnUpdatedEvents(); PostUpdate?.Invoke(this, null); }
private void Update() { PreUpdate?.Invoke(this, null); UpdatedEvents.Clear(); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed if ((Global.Configuration.time_based_dimming_enabled && Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_start_minute, Global.Configuration.time_based_dimming_end_hour, Global.Configuration.time_based_dimming_end_minute))) { StopUnUpdatedEvents(); return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; // If the current foreground process is excluded from Aurora, disable the lighting manager if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { StopUnUpdatedEvents(); Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { UpdateEvent(profile, newFrame); } // Overlay layers if (!preview || Global.Configuration.OverlaysInPreview) { foreach (var @event in GetOverlayActiveProfiles()) { @event.UpdateOverlayLights(newFrame); } //Add the Light event that we're previewing to be rendered as an overlay (assuming it's not already active) if (preview && Global.Configuration.OverlaysInPreview && !GetOverlayActiveProfiles().Contains(profile)) { profile.UpdateOverlayLights(newFrame); } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); StopUnUpdatedEvents(); PostUpdate?.Invoke(this, null); }
private void Update() { PreUpdate?.Invoke(this, null); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed if ((Global.Configuration.time_based_dimming_enabled && Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_start_minute, Global.Configuration.time_based_dimming_end_hour, Global.Configuration.time_based_dimming_end_minute))) { return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var underlay in Underlays) { ILightEvent @event = Events[underlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { @event.UpdateLights(newFrame); } } } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { profile.UpdateLights(newFrame); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var overlay in Overlays) { ILightEvent @event = Events[overlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { @event.UpdateLights(newFrame); } } //Add overlays TimedListObject[] overlay_events = overlays.ToArray(); foreach (TimedListObject evnt in overlay_events) { if ((evnt.item as LightEvent).IsEnabled) { (evnt.item as LightEvent).UpdateLights(newFrame); } } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); PostUpdate?.Invoke(this, null); }
internal void _PreUpdate() => PreUpdate?.Invoke(this);