diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index de3acf7a71..f0279aa2de 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -35,12 +35,15 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); + Set(OsuConfig.MenuVoice, true); + Set(OsuConfig.MenuMusic, true); + Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); - //todo: implement all settings below this line (remove the Disabled set when doing so). + //todo: implement all settings below this line (remove the Disabled set when doing so). Set(OsuConfig.AudioOffset, 0, -500.0, 500.0); Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; @@ -148,8 +151,6 @@ namespace osu.Game.Configuration Set(OsuConfig.YahooIntegration, false).Disabled = true; Set(OsuConfig.ForceFrameFlush, false).Disabled = true; Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true; - Set(OsuConfig.MenuMusic, true).Disabled = true; - Set(OsuConfig.MenuVoice, true).Disabled = true; Set(OsuConfig.RawInput, false).Disabled = true; Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)).Disabled = true; Set(OsuConfig.ShowMenuTips, true).Disabled = true; @@ -179,7 +180,6 @@ namespace osu.Game.Configuration Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? ConfineMouseMode.Fullscreen : ConfineMouseMode.Never).Disabled = true; - GetOriginalBindable(OsuConfig.SavePassword).ValueChanged += delegate { if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); @@ -344,6 +344,5 @@ namespace osu.Game.Configuration Ticker, CompatibilityContext, CanForceOptimusCompatibility, - } } diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index ac926cba0c..92032e5120 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -5,8 +5,10 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; +using osu.Framework.Configuration; using osu.Framework.Screens; using osu.Framework.Graphics; +using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; @@ -56,25 +58,33 @@ namespace osu.Game.Screens.Menu }; } + private Bindable menuVoice; + private Bindable menuMusic; + [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(AudioManager audio, OsuConfigManager config) { - welcome = audio.Sample.Get(@"welcome"); - seeya = audio.Sample.Get(@"seeya"); + menuVoice = config.GetBindable(OsuConfig.MenuVoice); + menuMusic = config.GetBindable(OsuConfig.MenuMusic); bgm = audio.Track.Get(@"circles"); bgm.Looping = true; + + welcome = audio.Sample.Get(@"welcome"); + seeya = audio.Sample.Get(@"seeya"); } protected override void OnEntering(Screen last) { base.OnEntering(last); - welcome.Play(); + if (menuVoice) + welcome.Play(); Scheduler.AddDelayed(delegate { - bgm.Start(); + if (menuMusic) + bgm.Start(); LoadComponentAsync(mainMenu = new MainMenu()); @@ -109,15 +119,17 @@ namespace osu.Game.Screens.Menu if (!(last is MainMenu)) Content.FadeIn(300); + double fadeOutTime = 2000; //we also handle the exit transition. - seeya.Play(); + if (menuVoice) + seeya.Play(); + else + fadeOutTime = 500; - const double fade_out_time = 2000; - - Scheduler.AddDelayed(Exit, fade_out_time); + Scheduler.AddDelayed(Exit, fadeOutTime); //don't want to fade out completely else we will stop running updates and shit will hit the fan. - Game.FadeTo(0.01f, fade_out_time); + Game.FadeTo(0.01f, fadeOutTime); base.OnResuming(last); } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 59528dad91..dc4ec92ee2 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -2,8 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Audio.Track; +using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -15,6 +21,7 @@ using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; using osu.Framework.Input; using OpenTK.Input; +using System.Threading.Tasks; namespace osu.Game.Screens.Menu { @@ -54,11 +61,27 @@ namespace osu.Game.Screens.Menu }; } + private Bindable menuMusic; + private TrackManager trackManager; + private WorkingBeatmap song; + [BackgroundDependencyLoader] - private void load(OsuGame game) + private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) { + menuMusic = config.GetBindable(OsuConfig.MenuMusic); LoadComponentAsync(background); + if (!menuMusic) + { + trackManager = game.Audio.Track; + int choosableBeatmapsetAmmount = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmount > 0) + { + song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]); + Beatmap = song; + } + } + buttons.OnSettings = game.ToggleOptions; preloadSongSelect(); @@ -81,6 +104,17 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); buttons.FadeInFromZero(500); + if (last is Intro && song != null) + { + Task.Run(() => + { + trackManager.SetExclusive(song.Track); + song.Track.Seek(song.Beatmap.Metadata.PreviewTime); + if (song.Beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Track.Length * 0.4f); + song.Track.Start(); + }); + } } protected override void OnSuspending(Screen next)