Skip to content

Commit

Permalink
Add configuration window closed event
Browse files Browse the repository at this point in the history
  • Loading branch information
searica committed Nov 8, 2023
1 parent 7dcf675 commit 2343bf7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions JotunnLib/Managers/SynchronizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public class SynchronizationManager : IManager
/// </summary>
public static event Action OnAdminStatusChanged;

/// <summary>
/// Event triggered after the in-game configuration manager window is closed
/// </summary>
public static event Action OnConfigurationWindowClosed;

private static SynchronizationManager _instance;

/// <summary>
Expand Down Expand Up @@ -574,11 +579,21 @@ private void ConfigurationManager_DisplayingWindowChanged(object sender, object

if (!ConfigurationManagerWindowShown)
{
InvokeOnConfigurationWindowClosed();

// After closing the window check for changed configs
SynchronizeChangedConfig();
}
}

/// <summary>
/// Safely invoke the <see cref="OnConfigurationWindowClosed"/> event
/// </summary>
private void InvokeOnConfigurationWindowClosed()
{
OnConfigurationWindowClosed?.SafeInvoke();
}

/// <summary>
/// Initial cache the config values of dependent plugins and register ourself to config change events
/// </summary>
Expand Down

0 comments on commit 2343bf7

Please sign in to comment.