protected override void Dispose(bool disposing) { //transfer settings to other maps in this set if (dirty) { BeatmapManager.Beatmaps.FindAll(b => b.ContainingFolder == BeatmapManager.Current.ContainingFolder).ForEach(b => { b.DisableSamples = checkboxHitsounds.Checked; b.DisableSkin = checkboxSkin.Checked; b.DisableStoryboard = checkboxStoryboard.Checked; if (ConfigManager.sVideo && GameBase.Mode != OsuModes.Edit && !GameBase.TestMode) { b.DisableVideo = BeatmapManager.Current.DisableVideo; } b.DimLevel = (int)backgroundTransparency.Current; }); } spriteManager.Dispose(); backgroundTransparency.Dispose(); base.Dispose(disposing); if (skinChanged) { TextureManager.ClearBeatmapCache(true); Player.Retrying = false; //force the Player instance into non-retry mode to ensure skin is reloaded. } if (samplesetChanged) { AudioEngine.ClearBeatmapCache(); } //restore settings to defaults EventManager.ShowStoryboard = true; EventManager.ShowVideo = ConfigManager.sVideo; SkinManager.IgnoreBeatmapSkin = false; AudioEngine.IgnoreBeatmapSamples = false; EventManager.UserDimLevel = 30; }
internal bool LoadFile(Beatmap beatmap, bool warnOnLostChanges, bool clearCache) { FinishBreakDrag(); changeManager.FinishAction(); if (warnOnLostChanges && CheckForChanges()) { DialogResult r = NotificationManager.MessageBox(LocalisationManager.GetString(OsuString.Editor_FileOperations_RevertFileToLastSavedState), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); switch (r) { case DialogResult.Cancel: return(false); case DialogResult.No: return(false); } } GameBase.SetTitle(Path.GetFileName(beatmap.Filename)); Instance.SelectNone(); changeManager.IgnorePush = true; SkinManager.ResetColoursToSkin(); if (clearCache) { TextureManager.ClearBeatmapCache(true); } AudioEngine.LoadAudio(beatmap, false, false); ChangeAudioRate(100); EventManager.ShowVideo = ConfigManager.sEditorVideo; bool existingMap; try { hitObjectManager.SetBeatmap(beatmap, Mods.None); existingMap = hitObjectManager.LoadWithEvents(); } catch (OsuFileUnreadableException) { GameBase.ChangeModeInstant(OsuModes.SelectEdit, true); changeManager.IgnorePush = false; return(false); } if (Compose != null) { if (beatmap.PlayMode != LoadedMode) { GameBase.ChangeMode(OsuModes.Edit, true); changeManager.IgnorePush = false; return(false); } } eventManager = hitObjectManager.eventManager; eventManager.spriteManagerBGWide.EnableProfiling = true; eventManager.spriteManagerBG.EnableProfiling = true; eventManager.spriteManagerFG.EnableProfiling = true; changeManager.RefreshManagers(); if (!existingMap || beatmap.Creator.Length == 0) { if (Compose != null) { Compose.ChangeAltDistance(ConfigManager.sDistanceSpacing.Default); } ShowSongSetup(false); } beatmap.BeatmapVersion = Beatmap.BEATMAP_VERSION; hitObjectManager.UpdateSlidersAll(false); if (Design != null) { Design.Reset(); } if (currentMode != null) { currentMode.Enter(); } changeManager.HistoryClear(); if (aiMod != null) { aiMod.Run(); } //New map is being loaded- remove invalid breaks BreakDirty = true; CheckInvalidBreaks = true; UpdateBreaks(true, true, false, false); GameBase.EditorControl.LoadMenu(); changeManager.Dirty = false; changeManager.IgnorePush = false; return(true); }