Skip to content

Commit

Permalink
Merge pull request #415 from searica/SyncEvents
Browse files Browse the repository at this point in the history
OnConfigurationWindowClosed Event
  • Loading branch information
MSchmoecker authored Nov 12, 2023
2 parents 71ba37a + 2343bf7 commit 231bd2f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion 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 Expand Up @@ -875,7 +890,7 @@ private void InvokeOnConfigurationSynchronized(bool initial, HashSet<string> plu
}

/// <summary>
/// Safely invoke the <see cref="OnConfigurationSynchronized"/> event
/// Safely invoke the <see cref="OnSyncingConfiguration"/> event
/// </summary>
private void InvokeOnSyncingConfiguration()
{
Expand Down

0 comments on commit 231bd2f

Please sign in to comment.