From 2a9f4e6950b2bd8d98c99a5bbc70e95130f48477 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 12:42:42 -0500 Subject: [PATCH 01/31] Get MenuMusic and MenuVoice woking --- osu.Game/Configuration/OsuConfigManager.cs | 5 +- osu.Game/Screens/Menu/Intro.cs | 60 ++++++++++++++++++---- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index e2f33479c0..38fe739a12 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -35,6 +35,9 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); + Set(OsuConfig.MenuVoice, true); + Set(OsuConfig.MenuMusic, true); + Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). @@ -145,8 +148,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; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index ac926cba0c..b65c221fa3 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -1,12 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Threading.Tasks; 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.MathUtils; using osu.Framework.Screens; using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; @@ -56,30 +62,60 @@ namespace osu.Game.Screens.Menu }; } + private Bindable menuVoice; + private Bindable osuBGM; + private BeatmapDatabase beatmaps; + private TrackManager trackManager; + private BeatmapInfo beatmap; + private WorkingBeatmap song; + [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) { + menuVoice = config.GetBindable(OsuConfig.MenuVoice); + osuBGM = config.GetBindable(OsuConfig.MenuMusic); + + if (osuBGM) + { + bgm = audio.Track.Get(@"circles"); + bgm.Looping = true; + } + else + { + this.beatmaps = beatmaps; + trackManager = game.Audio.Track; + beatmap = beatmaps.GetWithChildren(RNG.Next(0, beatmaps.Query().Count() - 1)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap, null); + } + welcome = audio.Sample.Get(@"welcome"); + seeya = audio.Sample.Get(@"seeya"); - bgm = audio.Track.Get(@"circles"); - bgm.Looping = true; } protected override void OnEntering(Screen last) { base.OnEntering(last); - welcome.Play(); - + if(menuVoice) + welcome.Play(); Scheduler.AddDelayed(delegate { - bgm.Start(); + if(osuBGM) + bgm.Start(); LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { + if (!osuBGM) + Task.Run(() => + { + trackManager.SetExclusive(song.Track); + song.Track.Seek(beatmap.Metadata.PreviewTime); + song.Track.Start(); + }); DidLoadMenu = true; Push(mainMenu); }, 2300); @@ -109,15 +145,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); } From 2eb73a7c701d0df5294eda590626507fdc8aa15f Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 12:58:47 -0500 Subject: [PATCH 02/31] More smoothness when MenuMusic is false --- osu.Game/Screens/Menu/Intro.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index b65c221fa3..e42e9ce475 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -104,18 +104,23 @@ namespace osu.Game.Screens.Menu { if(osuBGM) bgm.Start(); + else + { + Task.Run(() => + { + trackManager.SetExclusive(song.Track); + song.Track.Seek(beatmap.Metadata.PreviewTime); + if (beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Track.Length * .4f); + }); + } LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { if (!osuBGM) - Task.Run(() => - { - trackManager.SetExclusive(song.Track); - song.Track.Seek(beatmap.Metadata.PreviewTime); - song.Track.Start(); - }); + Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); }, 2300); From b5fc84087fd0bfc51f9fc2f53c8eae5116d5f97c Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 12:59:15 -0500 Subject: [PATCH 03/31] Show song in MusicController and SongSelect --- osu.Game/Screens/Menu/Intro.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index e42e9ce475..0ec7ed13d3 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -86,6 +86,7 @@ namespace osu.Game.Screens.Menu trackManager = game.Audio.Track; beatmap = beatmaps.GetWithChildren(RNG.Next(0, beatmaps.Query().Count() - 1)).Beatmaps[0]; song = beatmaps.GetWorkingBeatmap(beatmap, null); + Beatmap = song; } welcome = audio.Sample.Get(@"welcome"); From b7d61add45555ce9bcd14722e66da91e9336d86d Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 13:10:59 -0500 Subject: [PATCH 04/31] Cleanup + AppVeyor fixes --- osu.Game/Screens/Menu/Intro.cs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 0ec7ed13d3..faacb04876 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -63,8 +63,7 @@ namespace osu.Game.Screens.Menu } private Bindable menuVoice; - private Bindable osuBGM; - private BeatmapDatabase beatmaps; + private Bindable menuMusic; private TrackManager trackManager; private BeatmapInfo beatmap; private WorkingBeatmap song; @@ -73,24 +72,19 @@ namespace osu.Game.Screens.Menu private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) { menuVoice = config.GetBindable(OsuConfig.MenuVoice); - osuBGM = config.GetBindable(OsuConfig.MenuMusic); - - if (osuBGM) + menuMusic = config.GetBindable(OsuConfig.MenuMusic); + if (!menuMusic) { - bgm = audio.Track.Get(@"circles"); - bgm.Looping = true; - } - else - { - this.beatmaps = beatmaps; trackManager = game.Audio.Track; - beatmap = beatmaps.GetWithChildren(RNG.Next(0, beatmaps.Query().Count() - 1)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap, null); + beatmap = beatmaps.GetWithChildren(RNG.Next(beatmaps.Query().Count() - 1)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap); Beatmap = song; } - welcome = audio.Sample.Get(@"welcome"); + bgm = audio.Track.Get(@"circles"); + bgm.Looping = true; + welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); } @@ -103,7 +97,7 @@ namespace osu.Game.Screens.Menu welcome.Play(); Scheduler.AddDelayed(delegate { - if(osuBGM) + if(menuMusic) bgm.Start(); else { @@ -120,7 +114,7 @@ namespace osu.Game.Screens.Menu Scheduler.AddDelayed(delegate { - if (!osuBGM) + if (!menuMusic) Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); From 984c7092a6b18252993656bde25cf6bd7f939aed Mon Sep 17 00:00:00 2001 From: Javier Flores Date: Fri, 14 Apr 2017 16:33:58 -0500 Subject: [PATCH 05/31] Pls AppVeyor don't die --- osu.Game/Screens/Menu/Intro.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index faacb04876..62fe2431bf 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -95,6 +95,7 @@ namespace osu.Game.Screens.Menu if(menuVoice) welcome.Play(); + Scheduler.AddDelayed(delegate { if(menuMusic) From 2c6327fca9ff5b940b6545a9ecd818e02d6e37fb Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 17:17:51 -0500 Subject: [PATCH 06/31] Build for real this time --- osu.Game/Screens/Menu/Intro.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 62fe2431bf..1fbb9b7197 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Menu if(menuVoice) welcome.Play(); - + Scheduler.AddDelayed(delegate { if(menuMusic) From ca1f89f2cf391599528b0fc1c5cf69e292f63dc6 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 17:48:27 -0500 Subject: [PATCH 07/31] Fix crash when there's no beatmaps --- osu.Game/Screens/Menu/Intro.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 1fbb9b7197..60493ff356 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -67,6 +67,7 @@ namespace osu.Game.Screens.Menu private TrackManager trackManager; private BeatmapInfo beatmap; private WorkingBeatmap song; + private int choosableBeatmapsetAmmout; [BackgroundDependencyLoader] private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) @@ -76,9 +77,13 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { trackManager = game.Audio.Track; - beatmap = beatmaps.GetWithChildren(RNG.Next(beatmaps.Query().Count() - 1)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap); - Beatmap = song; + choosableBeatmapsetAmmout = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmout > 0) + { + beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap); + Beatmap = song; + } } bgm = audio.Track.Get(@"circles"); @@ -100,7 +105,7 @@ namespace osu.Game.Screens.Menu { if(menuMusic) bgm.Start(); - else + else if (song != null) { Task.Run(() => { @@ -115,7 +120,7 @@ namespace osu.Game.Screens.Menu Scheduler.AddDelayed(delegate { - if (!menuMusic) + if (!menuMusic && song != null) Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); From 094a0f9639e2e9ed36426770248b53269f6ddcfc Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:36:23 -0500 Subject: [PATCH 08/31] Move MenuMusic logic to MainMenu --- osu.Game/Screens/Menu/Intro.cs | 23 ------------------- osu.Game/Screens/Menu/MainMenu.cs | 37 ++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 60493ff356..a899e483b4 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -74,17 +74,6 @@ namespace osu.Game.Screens.Menu { menuVoice = config.GetBindable(OsuConfig.MenuVoice); menuMusic = config.GetBindable(OsuConfig.MenuMusic); - if (!menuMusic) - { - trackManager = game.Audio.Track; - choosableBeatmapsetAmmout = beatmaps.Query().Count(); - if (choosableBeatmapsetAmmout > 0) - { - beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap); - Beatmap = song; - } - } bgm = audio.Track.Get(@"circles"); bgm.Looping = true; @@ -105,23 +94,11 @@ namespace osu.Game.Screens.Menu { if(menuMusic) bgm.Start(); - else if (song != null) - { - Task.Run(() => - { - trackManager.SetExclusive(song.Track); - song.Track.Seek(beatmap.Metadata.PreviewTime); - if (beatmap.Metadata.PreviewTime == -1) - song.Track.Seek(song.Track.Length * .4f); - }); - } LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { - if (!menuMusic && song != null) - Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); }, 2300); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 59528dad91..59ba52dc58 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,30 @@ namespace osu.Game.Screens.Menu }; } + private Bindable menuMusic; + private TrackManager trackManager; + private BeatmapInfo beatmap; + private WorkingBeatmap song; + private int choosableBeatmapsetAmmout; + [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; + choosableBeatmapsetAmmout = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmout > 0) + { + beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap); + Beatmap = song; + } + } + buttons.OnSettings = game.ToggleOptions; preloadSongSelect(); @@ -81,6 +107,15 @@ 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(beatmap.Metadata.PreviewTime); + if (beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Track.Length * .4f); + song.Track.Start(); + }); } protected override void OnSuspending(Screen next) From fe35d20defd4249fbacfa7212dd30e9cf8af91b8 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:50:02 -0500 Subject: [PATCH 09/31] Remove not needed stuff (+typo fix) --- osu.Game/Screens/Menu/Intro.cs | 10 +--------- osu.Game/Screens/Menu/MainMenu.cs | 7 +++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index a899e483b4..fe32965e64 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -1,18 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Threading.Tasks; 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.MathUtils; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Game.Beatmaps; using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; @@ -64,13 +60,9 @@ namespace osu.Game.Screens.Menu private Bindable menuVoice; private Bindable menuMusic; - private TrackManager trackManager; - private BeatmapInfo beatmap; - private WorkingBeatmap song; - private int choosableBeatmapsetAmmout; [BackgroundDependencyLoader] - private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) + private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config) { menuVoice = config.GetBindable(OsuConfig.MenuVoice); menuMusic = config.GetBindable(OsuConfig.MenuMusic); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 59ba52dc58..b2bb1ff29c 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -65,7 +65,6 @@ namespace osu.Game.Screens.Menu private TrackManager trackManager; private BeatmapInfo beatmap; private WorkingBeatmap song; - private int choosableBeatmapsetAmmout; [BackgroundDependencyLoader] private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) @@ -76,10 +75,10 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { trackManager = game.Audio.Track; - choosableBeatmapsetAmmout = beatmaps.Query().Count(); - if (choosableBeatmapsetAmmout > 0) + int choosableBeatmapsetAmmount = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmount > 0) { - beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; + beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]; song = beatmaps.GetWorkingBeatmap(beatmap); Beatmap = song; } From 30b7a029dcee4af5fb5fc9f877e219ec4922fc1f Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:57:41 -0500 Subject: [PATCH 10/31] Remove for real this time --- osu.Game/Screens/Menu/Intro.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index fe32965e64..f9b95dd7eb 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu private Bindable menuMusic; [BackgroundDependencyLoader] - private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config) + private void load(AudioManager audio, OsuConfigManager config) { menuVoice = config.GetBindable(OsuConfig.MenuVoice); menuMusic = config.GetBindable(OsuConfig.MenuMusic); From ee659e73073d01b1fcfbc4e57e75cd7fff252d7d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 18:34:27 +0900 Subject: [PATCH 11/31] Fix decimal display of beatmap details being too precise. --- osu.Game/Screens/Select/BeatmapDetails.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a0d15101e0..04f3e89c9b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -49,6 +49,7 @@ namespace osu.Game.Screens.Select set { beatmap = value; + if (beatmap == null) return; description.Text = beatmap.Version; @@ -252,7 +253,7 @@ namespace osu.Game.Screens.Select new Container { RelativeSizeAxes = Axes.X, - Size = new Vector2(1/0.6f, 50), + Size = new Vector2(1 / 0.6f, 50), Children = new[] { retryGraph = new BarGraph @@ -308,7 +309,7 @@ namespace osu.Game.Screens.Select { difficultyValue = value; bar.Length = value / maxValue; - valueText.Text = value.ToString(CultureInfo.InvariantCulture); + valueText.Text = value.ToString("N1", CultureInfo.CurrentCulture); } } @@ -431,4 +432,4 @@ namespace osu.Game.Screens.Select } } } -} \ No newline at end of file +} From 4fa22146b82043a2f14f181af1c0bf9b113b3c43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 18:48:28 +0900 Subject: [PATCH 12/31] Increase safety of score lookups when leaderboard isn't visible. --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 2c51429d4c..02a412685c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using System; using osu.Framework.Allocation; +using osu.Framework.Threading; using osu.Game.Database; using osu.Game.Rulesets.Scoring; using osu.Game.Online.API; @@ -93,13 +94,18 @@ namespace osu.Game.Screens.Select.Leaderboards private BeatmapInfo beatmap; + private ScheduledDelegate pendingBeatmapSwitch; + public BeatmapInfo Beatmap { get { return beatmap; } set { beatmap = value; - Schedule(updateScores); + Scores = null; + + pendingBeatmapSwitch?.Cancel(); + pendingBeatmapSwitch = Schedule(updateScores); } } From d6c5654924f4b88d07a134d17d185fc98064b682 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 18:55:49 +0900 Subject: [PATCH 13/31] Reduce paddings and lock in some fixed heights for BeatmapDetails. --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 8 ++++---- osu.Game/Screens/Select/BeatmapDetails.cs | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index ae117254fa..26ec74e299 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -66,16 +66,16 @@ namespace osu.Game.Screens.Select { Details = new BeatmapDetails { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(5), + RelativeSizeAxes = Axes.X, + Masking = true, + Height = 352, Alpha = 0, }, Leaderboard = new Leaderboard { RelativeSizeAxes = Axes.Both, - } }); } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 04f3e89c9b..462f741dae 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -114,7 +114,6 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Vertical, LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, - Padding = new MarginPadding(10) { Top = 25 }, Children = new [] { description = new MetadataSegment("Description"), @@ -149,8 +148,8 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Spacing = new Vector2(0,10), - Padding = new MarginPadding(15) { Top = 25 }, + Spacing = new Vector2(0,5), + Padding = new MarginPadding(10), Children = new [] { circleSize = new DifficultyRow("Circle Size", 7), From e1a2f1bc7aa7b972a0a7be372e6a4bdbbc373fe6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:17:11 +0900 Subject: [PATCH 14/31] Add beatmap metrics lookup. --- osu.Game/Database/BeatmapMetrics.cs | 3 + .../API/Requests/GetBeatmapDetailsRequest.cs | 61 ++++++++ osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 140 ++++++++++++------ osu.Game/osu.Game.csproj | 1 + 5 files changed, 160 insertions(+), 47 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs diff --git a/osu.Game/Database/BeatmapMetrics.cs b/osu.Game/Database/BeatmapMetrics.cs index 91320110d0..25de0f0a8d 100644 --- a/osu.Game/Database/BeatmapMetrics.cs +++ b/osu.Game/Database/BeatmapMetrics.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using Newtonsoft.Json; namespace osu.Game.Database { @@ -18,11 +19,13 @@ namespace osu.Game.Database /// /// Points of failure on a relative time scale (usually 0..100). /// + [JsonProperty(@"fail")] public IEnumerable Fails { get; set; } /// /// Points of retry on a relative time scale (usually 0..100). /// + [JsonProperty(@"exit")] public IEnumerable Retries { get; set; } } } diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs new file mode 100644 index 0000000000..a3b99331c6 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using Newtonsoft.Json; +using osu.Framework.IO.Network; +using osu.Game.Database; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Online.API.Requests +{ + public class GetBeatmapDeatilsRequest : APIRequest + { + private readonly BeatmapInfo beatmap; + + private string lookupString; + + public GetBeatmapDeatilsRequest(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + } + + protected override WebRequest CreateWebRequest() + { + if (beatmap.OnlineBeatmapID > 0) + lookupString = beatmap.OnlineBeatmapID.ToString(); + else + lookupString = $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; + + var req = base.CreateWebRequest(); + + return req; + } + + protected override string Target => $@"beatmaps/{lookupString}"; + } + + public class GetBeatmapDeatilsResponse : BeatmapMetrics + { + //the online API returns some metrics as a nested object. + [JsonProperty(@"failtimes")] + private BeatmapMetrics failTimes + { + set + { + this.Fails = value.Fails; + this.Retries = value.Retries; + } + } + + //and other metrics in the beatmap set. + [JsonProperty(@"beatmapset")] + private BeatmapMetrics beatmapSet + { + set + { + this.Ratings = value.Ratings; + } + } + } +} diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 26ec74e299..cc22cca8bf 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select { beatmap = value; Leaderboard.Beatmap = beatmap?.BeatmapInfo; - Details.Beatmap = beatmap?.Beatmap.BeatmapInfo; + Details.Beatmap = beatmap?.BeatmapInfo; } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 462f741dae..c5fb5eafaa 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -14,6 +14,10 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using System.Globalization; using System.Linq; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Framework.Threading; +using System; namespace osu.Game.Screens.Select { @@ -39,61 +43,101 @@ namespace osu.Game.Screens.Select private readonly BarGraph retryGraph; private readonly BarGraph failGraph; + private ScheduledDelegate pendingBeatmapSwitch; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { - get - { - return beatmap; - } + get { return beatmap; } set { beatmap = value; - if (beatmap == null) return; - - description.Text = beatmap.Version; - source.Text = beatmap.Metadata.Source; - tags.Text = beatmap.Metadata.Tags; - - circleSize.Value = beatmap.Difficulty.CircleSize; - drainRate.Value = beatmap.Difficulty.DrainRate; - overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; - approachRate.Value = beatmap.Difficulty.ApproachRate; - stars.Value = (float)beatmap.StarDifficulty; - - if (beatmap.Metrics?.Ratings.Any() ?? false) - { - var ratings = beatmap.Metrics.Ratings.ToList(); - ratingsContainer.Show(); - - negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(ratings.Count / 2, ratings.Count / 2).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2).Sum() / ratings.Sum(); - - ratingsGraph.Values = ratings.Select(rating => (float)rating); - } - else - ratingsContainer.Hide(); - - if ((beatmap.Metrics?.Retries.Any() ?? false) && beatmap.Metrics.Fails.Any()) - { - var retries = beatmap.Metrics.Retries; - var fails = beatmap.Metrics.Fails; - retryFailContainer.Show(); - - float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); - failGraph.MaxValue = maxValue; - retryGraph.MaxValue = maxValue; - - failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); - } - else - retryFailContainer.Hide(); + pendingBeatmapSwitch?.Cancel(); + pendingBeatmapSwitch = Schedule(updateStats); } } + private void updateStats() + { + description.Text = beatmap.Version; + source.Text = beatmap.Metadata.Source; + tags.Text = beatmap.Metadata.Tags; + + circleSize.Value = beatmap.Difficulty.CircleSize; + drainRate.Value = beatmap.Difficulty.DrainRate; + overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; + approachRate.Value = beatmap.Difficulty.ApproachRate; + stars.Value = (float)beatmap.StarDifficulty; + + var requestedBeatmap = beatmap; + if (requestedBeatmap.Metrics == null) + { + var lookup = new GetBeatmapDeatilsRequest(requestedBeatmap); + lookup.Success += res => + { + if (beatmap != requestedBeatmap) + //the beatmap has been changed since we started the lookup. + return; + + requestedBeatmap.Metrics = res; + Schedule(() => updateMetrics(res, true)); + }; + lookup.Failure += e => updateMetrics(null, true); + + api.Queue(lookup); + } + + updateMetrics(requestedBeatmap.Metrics, false); + } + + private void updateMetrics(BeatmapMetrics metrics, bool failOnMissing = true) + { + var hasRatings = metrics?.Ratings.Any() ?? false; + var hasRetriesFails = (metrics?.Retries.Any() ?? false) && metrics.Fails.Any(); + + if (hasRatings) + { + var ratings = metrics.Ratings.ToList(); + ratingsContainer.Show(); + + negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(ratings.Count / 2, ratings.Count / 2).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2).Sum() / ratings.Sum(); + + ratingsGraph.Values = ratings.Select(rating => (float)rating); + + ratingsContainer.FadeColour(Color4.White, 500, EasingTypes.Out); + } + else if (failOnMissing) + ratingsGraph.Values = new float[10]; + else + ratingsContainer.FadeColour(Color4.Gray, 500, EasingTypes.Out); + + if (hasRetriesFails) + { + var retries = metrics.Retries; + var fails = metrics.Fails; + retryFailContainer.Show(); + + float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); + failGraph.MaxValue = maxValue; + retryGraph.MaxValue = maxValue; + + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); + + retryFailContainer.FadeColour(Color4.White, 500, EasingTypes.Out); + } + else if (failOnMissing) + { + failGraph.Values = new float[100]; + retryGraph.Values = new float[100]; + } + else + retryFailContainer.FadeColour(Color4.Gray, 500, EasingTypes.Out); + } + public BeatmapDetails() { Children = new Drawable[] @@ -272,9 +316,13 @@ namespace osu.Game.Screens.Select }; } + private APIAccess api; + [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, APIAccess api) { + this.api = api; + description.AccentColour = colour.GrayB; source.AccentColour = colour.GrayB; tags.AccentColour = colour.YellowLight; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c9a3b08713..c32c5112cf 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -179,6 +179,7 @@ + From 6aa6e5eef7b85911c017f0d91e0b4591e8078e9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:25:27 +0900 Subject: [PATCH 15/31] Store and restore the selected details tab at song select. --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++++ .../Screens/Select/BeatmapDetailAreaTabControl.cs | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index d47ed48e99..de3acf7a71 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Configuration; using osu.Framework.Platform; +using osu.Game.Screens.Select; namespace osu.Game.Configuration { @@ -34,6 +35,8 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, 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). @@ -316,6 +319,7 @@ namespace osu.Game.Configuration MenuMusic, MenuVoice, MenuParallax, + BeatmapDetailTab, RawInput, AbsoluteToOsuWindow, ConfineMouse, diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 48a46f0b90..51ec6f7707 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -4,10 +4,12 @@ using System; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -21,15 +23,22 @@ namespace osu.Game.Screens.Select public Action OnFilter; //passed the selected tab and if mods is checked + private Bindable selectedTab; + private void invokeOnFilter() { OnFilter?.Invoke(tabs.Current, modsCheckbox.Current); } [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, OsuConfigManager config) { modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; + + selectedTab = config.GetBindable(OsuConfig.BeatmapDetailTab); + + tabs.Current.BindTo(selectedTab); + tabs.Current.TriggerChange(); } public BeatmapDetailAreaTabControl() @@ -62,8 +71,6 @@ namespace osu.Game.Screens.Select tabs.Current.ValueChanged += item => invokeOnFilter(); modsCheckbox.Current.ValueChanged += item => invokeOnFilter(); - - tabs.Current.Value = BeatmapDetailTab.Global; } } From c55d406b44365cffad15212fc485b94c211774cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:25:35 +0900 Subject: [PATCH 16/31] Fix nullref possibility. --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index c5fb5eafaa..b337e14702 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -60,6 +60,8 @@ namespace osu.Game.Screens.Select private void updateStats() { + if (beatmap == null) return; + description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; tags.Text = beatmap.Metadata.Tags; From 8b048a6706266b2a67eb44d1a90579275f2c8460 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:33:48 +0900 Subject: [PATCH 17/31] Fix typo. --- osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs | 4 ++-- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index a3b99331c6..512938fcf4 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -9,13 +9,13 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Online.API.Requests { - public class GetBeatmapDeatilsRequest : APIRequest + public class GetBeatmapDetailsRequest : APIRequest { private readonly BeatmapInfo beatmap; private string lookupString; - public GetBeatmapDeatilsRequest(BeatmapInfo beatmap) + public GetBeatmapDetailsRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index b337e14702..32e5f2505e 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select var requestedBeatmap = beatmap; if (requestedBeatmap.Metrics == null) { - var lookup = new GetBeatmapDeatilsRequest(requestedBeatmap); + var lookup = new GetBeatmapDetailsRequest(requestedBeatmap); lookup.Success += res => { if (beatmap != requestedBeatmap) From 9670ea9a2aa4dc27e74be470c39fffd9856f0d86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:16:31 +0900 Subject: [PATCH 18/31] CI fixes --- .../API/Requests/GetBeatmapDetailsRequest.cs | 22 ++++--------------- osu.Game/Screens/Select/BeatmapDetails.cs | 5 ++--- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index 512938fcf4..593097f616 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -1,11 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.IO.Network; using osu.Game.Database; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Online.API.Requests { @@ -13,25 +11,13 @@ namespace osu.Game.Online.API.Requests { private readonly BeatmapInfo beatmap; - private string lookupString; + private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; public GetBeatmapDetailsRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; } - protected override WebRequest CreateWebRequest() - { - if (beatmap.OnlineBeatmapID > 0) - lookupString = beatmap.OnlineBeatmapID.ToString(); - else - lookupString = $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; - - var req = base.CreateWebRequest(); - - return req; - } - protected override string Target => $@"beatmaps/{lookupString}"; } @@ -43,8 +29,8 @@ namespace osu.Game.Online.API.Requests { set { - this.Fails = value.Fails; - this.Retries = value.Retries; + Fails = value.Fails; + Retries = value.Retries; } } @@ -54,7 +40,7 @@ namespace osu.Game.Online.API.Requests { set { - this.Ratings = value.Ratings; + Ratings = value.Ratings; } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 32e5f2505e..d217fa66fe 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -17,7 +17,6 @@ using System.Linq; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Framework.Threading; -using System; namespace osu.Game.Screens.Select { @@ -83,9 +82,9 @@ namespace osu.Game.Screens.Select return; requestedBeatmap.Metrics = res; - Schedule(() => updateMetrics(res, true)); + Schedule(() => updateMetrics(res)); }; - lookup.Failure += e => updateMetrics(null, true); + lookup.Failure += e => updateMetrics(null); api.Queue(lookup); } From d84f1f05e2d5faa86245e2343c3d9a3d12be471b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:16:53 +0900 Subject: [PATCH 19/31] Add better commenting for ambiguous parameter --- osu.Game/Screens/Select/BeatmapDetails.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index d217fa66fe..63fdfe3717 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -92,6 +92,11 @@ namespace osu.Game.Screens.Select updateMetrics(requestedBeatmap.Metrics, false); } + /// + /// Update displayed metrics. + /// + /// New metrics to overwrite the existing display. Can be null. + /// Whether to hide the display on null or empty metrics. If false, we will dim as if waiting for further updates. private void updateMetrics(BeatmapMetrics metrics, bool failOnMissing = true) { var hasRatings = metrics?.Ratings.Any() ?? false; From c7b789424be41f8ce225ee792662331c0d15bb5a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:11:36 +0900 Subject: [PATCH 20/31] Update BeatmapInfoWedge design - Adds colour difficulty strip. - Adjusts paddings. - Fixes source/artist confusion. - Double dash to em-dash. --- .../Drawables/DifficultyColouredContainer.cs | 69 +++++++++++++++++ osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 61 +++------------ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 76 ++++++++++++++++--- osu.Game/osu.Game.csproj | 1 + 4 files changed, 144 insertions(+), 63 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs new file mode 100644 index 0000000000..7c0aa49d2a --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -0,0 +1,69 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Database; +using osu.Game.Graphics; +using OpenTK.Graphics; + +namespace osu.Game.Beatmaps.Drawables +{ + internal class DifficultyColouredContainer : Container, IHasAccentColour + { + public Color4 AccentColour { get; set; } + + private readonly BeatmapInfo beatmap; + private OsuColour palette; + + public DifficultyColouredContainer(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + } + + [BackgroundDependencyLoader] + private void load(OsuColour palette) + { + this.palette = palette; + AccentColour = getColour(beatmap); + } + + private enum DifficultyRating + { + Easy, + Normal, + Hard, + Insane, + Expert + } + + private DifficultyRating getDifficultyRating(BeatmapInfo beatmap) + { + var rating = beatmap.StarDifficulty; + + if (rating < 1.5) return DifficultyRating.Easy; + if (rating < 2.25) return DifficultyRating.Normal; + if (rating < 3.75) return DifficultyRating.Hard; + if (rating < 5.25) return DifficultyRating.Insane; + return DifficultyRating.Expert; + } + + private Color4 getColour(BeatmapInfo beatmap) + { + switch (getDifficultyRating(beatmap)) + { + case DifficultyRating.Easy: + return palette.Green; + default: + case DifficultyRating.Normal: + return palette.Yellow; + case DifficultyRating.Hard: + return palette.Pink; + case DifficultyRating.Insane: + return palette.Purple; + case DifficultyRating.Expert: + return palette.Gray0; + } + } + } +} diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 8a9183819c..6b8b267894 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -3,31 +3,28 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; +using System; namespace osu.Game.Beatmaps.Drawables { - internal class DifficultyIcon : Container - { - private readonly BeatmapInfo beatmap; - private OsuColour palette; - public DifficultyIcon(BeatmapInfo beatmap) + internal class DifficultyIcon : DifficultyColouredContainer + { + private BeatmapInfo beatmap; + + public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) { this.beatmap = beatmap; - const float size = 20; - Size = new Vector2(size); + Size = new Vector2(20); } [BackgroundDependencyLoader] - private void load(OsuColour palette) + private void load(OsuColour colours) { - this.palette = palette; - Children = new[] { new TextAwesome @@ -35,7 +32,7 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, TextSize = Size.X, - Colour = getColour(beatmap), + Colour = AccentColour, Icon = FontAwesome.fa_circle }, new TextAwesome @@ -48,43 +45,5 @@ namespace osu.Game.Beatmaps.Drawables } }; } - - private enum DifficultyRating - { - Easy, - Normal, - Hard, - Insane, - Expert - } - - private DifficultyRating getDifficultyRating(BeatmapInfo beatmap) - { - var rating = beatmap.StarDifficulty; - - if (rating < 1.5) return DifficultyRating.Easy; - if (rating < 2.25) return DifficultyRating.Normal; - if (rating < 3.75) return DifficultyRating.Hard; - if (rating < 5.25) return DifficultyRating.Insane; - return DifficultyRating.Expert; - } - - private Color4 getColour(BeatmapInfo beatmap) - { - switch (getDifficultyRating(beatmap)) - { - case DifficultyRating.Easy: - return palette.Green; - default: - case DifficultyRating.Normal: - return palette.Yellow; - case DifficultyRating.Hard: - return palette.Pink; - case DifficultyRating.Insane: - return palette.Purple; - case DifficultyRating.Expert: - return palette.Gray0; - } - } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index a87d5f58a1..60e6221907 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -148,11 +149,16 @@ namespace osu.Game.Screens.Select }, }, }, - // Text for beatmap info + new DifficultyColourBar(beatmap.BeatmapInfo) + { + RelativeSizeAxes = Axes.Y, + Width = 20, + }, new FillFlowContainer { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Name = "Top-aligned metadata", + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, @@ -161,16 +167,32 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = metadata.Artist + " -- " + metadata.Title, + Text = beatmapInfo.Version, + TextSize = 24, + }, + } + }, + new FillFlowContainer + { + Name = "Bottom-aligned metadata", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new OsuSpriteText + { + Font = @"Exo2.0-MediumItalic", + Text = !string.IsNullOrEmpty(metadata.Source) ? metadata.Source + " — " + metadata.Title : metadata.Title, TextSize = 28, - Shadow = true, }, new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = beatmapInfo.Version, + Text = metadata.Artist, TextSize = 17, - Shadow = true, }, new FillFlowContainer { @@ -184,20 +206,18 @@ namespace osu.Game.Screens.Select Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, - Shadow = true, - }, + }, new OsuSpriteText { Font = @"Exo2.0-Bold", Text = metadata.Author, TextSize = 15, - Shadow = true, - }, + }, } }, new FillFlowContainer { - Margin = new MarginPadding { Top = 20 }, + Margin = new MarginPadding { Top = 20, Left = 10 }, Spacing = new Vector2(40, 0), AutoSizeAxes = Axes.Both, Children = labels @@ -256,5 +276,37 @@ namespace osu.Game.Screens.Select }; } } + + private class DifficultyColourBar : DifficultyColouredContainer + { + public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + const float full_opacity_ratio = 0.7f; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = AccentColour, + Width = full_opacity_ratio, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Colour = AccentColour, + Alpha = 0.5f, + X = full_opacity_ratio, + Width = 1 - full_opacity_ratio, + } + }; + } + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c9a3b08713..25df354aea 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -187,6 +187,7 @@ + From 9ecfb4e4bff99cb5af32447ff0a74650e5fd4344 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:22:04 +0900 Subject: [PATCH 21/31] Last CI fix. --- osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index 593097f616..43e14e59de 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using osu.Framework.IO.Network; using osu.Game.Database; namespace osu.Game.Online.API.Requests From 915ff7cba5a7c3f2b8a9b1d2eb3ee3cef1fc021d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 10:04:32 +0900 Subject: [PATCH 22/31] Add parallel compile flag. --- .vscode/tasks.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6918afa620..a745d96a9f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,8 @@ "args": [ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", - "/property:DebugType=portable" + "/property:DebugType=portable", + "/m" ], // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", @@ -27,7 +28,8 @@ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", "/property:DebugType=portable", - "/target:Clean,Build" + "/target:Clean,Build", + "/m" ], // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", From 3c981703304b09fd29516d785fd7e33f286ce5c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 13:45:18 +0900 Subject: [PATCH 23/31] Use method group for MusicController fault. --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 19e742facb..f960d9e0ae 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -294,7 +294,7 @@ namespace osu.Game.Overlays trackManager.SetExclusive(current.Track); current.Track.Start(); beatmapSource.Value = current; - }).ContinueWith(task => Schedule(() => task.ThrowIfFaulted()), TaskContinuationOptions.OnlyOnFaulted); + }).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted); updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } From 2d6fa711d1689ec67ef93ee6d763344596462797 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 13:45:35 +0900 Subject: [PATCH 24/31] Remove unnecessary base.Update() in PlayerInputManager. --- osu.Game/Screens/Play/PlayerInputManager.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 6604dbfc7e..3ac28898a6 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -38,8 +38,6 @@ namespace osu.Game.Screens.Play protected override void Update() { - base.Update(); - if (parentClock == null) return; clock.Rate = parentClock.Rate; From 43d09a97346465582be14dcf740df83cfb3dc8ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:31:25 +0900 Subject: [PATCH 25/31] CI fixes --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 5 ++--- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 6b8b267894..a8b63c2502 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -7,14 +7,13 @@ using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; -using System; namespace osu.Game.Beatmaps.Drawables { internal class DifficultyIcon : DifficultyColouredContainer { - private BeatmapInfo beatmap; + private readonly BeatmapInfo beatmap; public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) { @@ -23,7 +22,7 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { Children = new[] { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 60e6221907..646d468bd0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -284,7 +284,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { const float full_opacity_ratio = 0.7f; From b8bf942860ad2aeb881a44af58a96f6b23aa2288 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 22:11:38 +0900 Subject: [PATCH 26/31] Don't use parallel compiling on non-windows platforms. This currently triggers a unhandled exception in msbuild. --- .vscode/tasks.json | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a745d96a9f..5eaeaa9899 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -10,11 +10,16 @@ "showOutput": "silent", "command": "msbuild", "args": [ - // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", - "/property:DebugType=portable", - "/m" + "/property:DebugType=portable" ], + "windows": { + "args": [ + "/property:GenerateFullPaths=true", + "/property:DebugType=portable", + "/m" //parallel compiling support. doesn't work well with mono atm + ] + }, // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", "isBuildCommand": true @@ -28,9 +33,16 @@ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", "/property:DebugType=portable", - "/target:Clean,Build", - "/m" + "/target:Clean,Build" ], + "windows": { + "args": [ + "/property:GenerateFullPaths=true", + "/property:DebugType=portable", + "/target:Clean,Build", + "/m" //parallel compiling support. doesn't work well with mono atm + ] + }, // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", "isBuildCommand": true From f329587bd43e078907abe47d05de165b0557024a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 25 Apr 2017 08:02:09 +0900 Subject: [PATCH 27/31] Fix mismatched braces. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 646d468bd0..61c1f0cc33 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -206,13 +206,13 @@ namespace osu.Game.Screens.Select Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, - }, + }, new OsuSpriteText { Font = @"Exo2.0-Bold", Text = metadata.Author, TextSize = 15, - }, + }, } }, new FillFlowContainer From b80fa74f47e334ba6bb7c3de7e7540dcb0e03d35 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 11:11:57 +0900 Subject: [PATCH 28/31] Update README. --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 885c7c7722..3306c9ab25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) - - +# osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [osu! on the web](https://osu.ppy.sh) | [dev chat](https://discord.gg/ppy) @@ -12,14 +10,14 @@ This is still heavily under development and is not intended for end-user use. Th # Requirements -- A desktop platform which can compile .NET 4.5. -- Visual Studio or MonoDevelop is recommended. +- A desktop platform which can compile .NET 4.5 (tested on macOS, linux and windows). We recommend using [Visual Studio Code](https://code.visualstudio.com/) (all platforms) or [Visual Studio Community Edition](https://www.visualstudio.com/) (windows only), both of which are free. +- Make sure you initialise and keep submodules up-to-date. # Contributing We welcome all contributions, but keep in mind that we already have a lot of the UI designed. If you wish to work on something with the intention on having it included in the official distribution, please open an issue for discussion and we will give you what you need from a design perspective to proceed. If you want to make *changes* to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted. -Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://goo.gl/nFdoyI). If you're unsure of what you can help with, check out the [list](https://github.com/ppy/osu/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abounty) of available issues with bounty. +Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://www.bountysource.com/teams/ppy). If you're unsure of what you can help with, check out the [list of open issues](https://github.com/ppy/osu-framework/issues). Note that while we already have certain standards in place, nothing is set in stone. If you have an issue with the way code is structured; with any libraries we are using; with any processes involved with contributing, *please* bring it up. I welcome all feedback so we can make contributing to this project as pain-free as possible. From 1df50adc3a0314c6cb67a808d6161bcb7583d6de Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 24 Apr 2017 22:48:25 -0500 Subject: [PATCH 29/31] Post-merge fixes (and CodeFactor fixes) --- osu.Game/Configuration/OsuConfigManager.cs | 9 +++++---- osu.Game/Screens/Menu/Intro.cs | 5 ++--- osu.Game/Screens/Menu/MainMenu.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index de3acf7a71..c4765fb05c 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; @@ -178,8 +181,7 @@ namespace osu.Game.Configuration Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; 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 +346,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 f9b95dd7eb..92032e5120 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -72,19 +72,18 @@ namespace osu.Game.Screens.Menu welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); - } protected override void OnEntering(Screen last) { base.OnEntering(last); - if(menuVoice) + if (menuVoice) welcome.Play(); Scheduler.AddDelayed(delegate { - if(menuMusic) + if (menuMusic) bgm.Start(); LoadComponentAsync(mainMenu = new MainMenu()); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index b2bb1ff29c..32d7835694 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); buttons.FadeInFromZero(500); - if(last is Intro && song != null) + if (last is Intro && song != null) Task.Run(() => { trackManager.SetExclusive(song.Track); From 51c577624bbaf27d114a5ed0b57b058329ca4a60 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 24 Apr 2017 22:59:33 -0500 Subject: [PATCH 30/31] Remove BeatmapInfo field --- osu.Game/Configuration/OsuConfigManager.cs | 4 +--- osu.Game/Screens/Menu/MainMenu.cs | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index c4765fb05c..f0279aa2de 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -151,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; @@ -181,7 +179,7 @@ namespace osu.Game.Configuration Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; 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); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 32d7835694..6c393d7498 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -63,7 +63,6 @@ namespace osu.Game.Screens.Menu private Bindable menuMusic; private TrackManager trackManager; - private BeatmapInfo beatmap; private WorkingBeatmap song; [BackgroundDependencyLoader] @@ -78,8 +77,7 @@ namespace osu.Game.Screens.Menu int choosableBeatmapsetAmmount = beatmaps.Query().Count(); if (choosableBeatmapsetAmmount > 0) { - beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap); + song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]); Beatmap = song; } } @@ -110,8 +108,8 @@ namespace osu.Game.Screens.Menu Task.Run(() => { trackManager.SetExclusive(song.Track); - song.Track.Seek(beatmap.Metadata.PreviewTime); - if (beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Beatmap.Metadata.PreviewTime); + if (song.Beatmap.Metadata.PreviewTime == -1) song.Track.Seek(song.Track.Length * .4f); song.Track.Start(); }); From f93adebc52f933ebed8e3ee102d7f29f2f8c1884 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 13:33:34 +0900 Subject: [PATCH 31/31] Minor style fixes. --- osu.Game/Screens/Menu/MainMenu.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 6c393d7498..dc4ec92ee2 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -105,14 +105,16 @@ 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 * .4f); + song.Track.Seek(song.Track.Length * 0.4f); song.Track.Start(); }); + } } protected override void OnSuspending(Screen next)