public MapSelection(IMusicCacher musicCacher, IBackgroundCacher backgroundCacher, IGameConfiguration gameConfiguration, IMapsetConfiguration mapsetConfiguration, IMapConfiguration mapConfiguration) { if (musicCacher == null) { throw new ArgumentNullException(nameof(musicCacher)); } if (backgroundCacher == null) { throw new ArgumentNullException(nameof(backgroundCacher)); } if (gameConfiguration == null) { throw new ArgumentNullException(nameof(gameConfiguration)); } this.musicCacher = musicCacher; this.backgroundCacher = backgroundCacher; this.mapsetConfiguration = mapsetConfiguration; this.mapConfiguration = mapConfiguration; // Initial background. bindableBackground.Value = emptyBackground = new MapBackground(null); // Setup music loader musicAgent = new CacherAgent <IMap, IMusicAudio>(musicCacher) { UseDelayedRemove = true, RemoveDelay = 2f, }; musicAgent.OnFinished += (music) => { bindableMusic.Value = music; }; // Setup background loader backgroundAgent = new CacherAgent <IMap, IMapBackground>(backgroundCacher) { UseDelayedRemove = true, RemoveDelay = 2f, }; backgroundAgent.OnFinished += (background) => { bindableBackground.Value = background; }; // Listen to game mode change event from config. gameConfiguration.OnLoad += delegate { // Retrieve initial game mode saved in config. currentMode = gameConfiguration.RulesetMode.Value; }; gameConfiguration.RulesetMode.OnValueChanged += (newMode, oldMode) => { // Only if change of mode if (oldMode != newMode) { currentMode = newMode; // Automatically change to variant playable for this new mode. if (Map.Value != null) { SelectMap(Map.Value.OriginalMap.GetPlayable(newMode)); } } }; }
public ConverterFactory(IMapConfiguration configuration) { this.mapCfg = configuration; }
public ILGeneratorAdapter(IMapConfiguration configuration) { this.mapCfg = configuration; }