// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // namespace MUnique.OpenMU.GameLogic; /// /// A mediator which notifies about configuration changes for registered instances. /// public interface IConfigurationChangeMediator { /// /// Registers for changes of a configuration object in addition with an actual game logic object. /// /// The type of the configuration. /// The type of the game logic object which might be modified by the changes. /// The configuration object in which the caller is interested in. /// The game logic object which will be provided in the and callbacks. /// The on-change callback. /// The on-delete callback. /// An which is used to dispose the registration. IDisposable RegisterObject(TConfig config, T obj, Func? onChange = null, Func? onDelete = null) where T : class where TConfig : class; /// /// Registers for created configuration objects of a specific type. /// /// The type of the configuration. /// The type of the game logic object which might be modified by the changes. /// The game logic object which will be provided in the callback. /// The on-new-configuration callback. /// An which is used to dispose the registration. IDisposable RegisterForNew(T obj, Func onNewConfig); } /// /// The listener interface for a mediator which notifies about configuration changes for registered instances. /// public interface IConfigurationChangeMediatorListener { /// /// Handles the changed configuration. /// /// The type of the changed configuration object. /// The identifier of the changed configuration object. /// The changed configuration object. ValueTask HandleConfigurationChangedAsync(Type type, Guid id, object configuration); /// /// Handles the added configuration. /// /// The type of the added configuration object. /// The identifier of the added configuration object. /// The added configuration object. ValueTask HandleConfigurationAddedAsync(Type type, Guid id, object configuration); /// /// Handles the removed configuration. /// /// The type of the removed configuration object. /// The identifier of the removed configuration object. ValueTask HandleConfigurationRemovedAsync(Type type, Guid id); }