Skip to content

Commit

Permalink
call OnStart function of events when they are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Oct 1, 2024
1 parent cbd99bd commit 7260619
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public override void UpdateTick()
}
catch (Exception e)
{
//Global.logger.Error(e);
Global.logger.Error(e, "Error updating LoL game event");
}
}

Expand Down
19 changes: 10 additions & 9 deletions Project-Aurora/Project-Aurora/Profiles/LightingStateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public sealed class LightingStateManager : IDisposable
private Application? _currentEvent;
public Application CurrentEvent => _currentEvent ?? DesktopProfile;

private readonly List<LightEvent> _startedEvents = [];
private readonly List<LightEvent> _updatedEvents = [];
private readonly List<ILightEvent> _startedEvents = [];
private readonly List<ILightEvent> _updatedEvents = [];

private Dictionary<string, string> EventProcesses { get; } = new();
private Dictionary<Regex, string> EventTitles { get; } = new();
Expand Down Expand Up @@ -417,18 +417,13 @@ private void UpdateIdleEffects(EffectFrame newFrame)
UpdateEvent(_idleE, newFrame);
}

private void UpdateEvent(LightEvent @event, EffectFrame frame)
private void UpdateEvent(ILightEvent @event, EffectFrame frame)
{
StartEvent(@event);
@event.UpdateLights(frame);
}

private void UpdateEvent(Application @event, EffectFrame frame)
{
@event.UpdateLights(frame);
}

private void StartEvent(LightEvent @event)
private void StartEvent(ILightEvent @event)
{
_updatedEvents.Add(@event);

Expand Down Expand Up @@ -520,11 +515,17 @@ private void Update()
}

foreach (var @event in GetOverlayActiveProfiles())
{
StartEvent(@event);
@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))
{
StartEvent(profile);
profile.UpdateOverlayLights(newFrame);
}

if (Global.Configuration.IdleType != IdleEffects.None)
{
Expand Down

0 comments on commit 7260619

Please sign in to comment.