From befe57e12ef017b9cffdf9bb2a4239b0ae9ecdf1 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 17 Nov 2018 15:23:52 +0300 Subject: [PATCH 01/10] Stop PreviewTrack on Completed event --- osu.Game/Audio/PreviewTrack.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Audio/PreviewTrack.cs b/osu.Game/Audio/PreviewTrack.cs index 3c9122b941..9fe1c3d2eb 100644 --- a/osu.Game/Audio/PreviewTrack.cs +++ b/osu.Game/Audio/PreviewTrack.cs @@ -28,6 +28,7 @@ namespace osu.Game.Audio private void load() { track = GetTrack(); + track.Completed += Stop; } /// @@ -50,15 +51,6 @@ namespace osu.Game.Audio /// public bool IsRunning => track?.IsRunning ?? false; - protected override void Update() - { - base.Update(); - - // Todo: Track currently doesn't signal its completion, so we have to handle it manually - if (hasStarted && track.HasCompleted) - Stop(); - } - private ScheduledDelegate startDelegate; /// From c4fc87b69a6acfaf94afecad4d0f45d3cf0d190c Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 17 Nov 2018 15:39:40 +0300 Subject: [PATCH 02/10] Move to next track on Completed event --- osu.Game/Overlays/MusicController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f282b757cd..790aab16d0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -253,9 +253,6 @@ namespace osu.Game.Overlays progressBar.CurrentTime = track.CurrentTime; playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; - - if (track.HasCompleted && !track.Looping && !beatmap.Disabled && beatmapSets.Any()) - next(); } else { @@ -333,9 +330,13 @@ namespace osu.Game.Overlays direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } + + current.Track.Completed -= currentTrackCompleted; } current = beatmap; + if (current != null) + current.Track.Completed += currentTrackCompleted; progressBar.CurrentTime = 0; @@ -344,6 +345,12 @@ namespace osu.Game.Overlays queuedDirection = null; } + private void currentTrackCompleted() + { + if (!beatmap.Disabled && beatmapSets.Any()) + next(); + } + private ScheduledDelegate pendingBeatmapSwitch; private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) From d3721707fb7bebb3c9d1c0b0f8ab9dc5e2a4645b Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 8 Feb 2019 19:48:56 +0300 Subject: [PATCH 03/10] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 596190fcf7..e87b43ac93 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + From add8b8e9c456bf2684284dc13a4cbd55a5316dcc Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Mon, 25 Feb 2019 09:56:00 +0900 Subject: [PATCH 04/10] Only add Exit button if the GameHost supports it --- osu.Game/Screens/Menu/ButtonSystem.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 2669bb9342..76185e328b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Framework.Logging; +using osu.Framework.Platform; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input; @@ -99,10 +100,6 @@ namespace osu.Game.Screens.Menu buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); - buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); - - buttonArea.AddRange(buttonsPlay); - buttonArea.AddRange(buttonsTopLevel); } [Resolved(CanBeNull = true)] @@ -115,8 +112,14 @@ namespace osu.Game.Screens.Menu private NotificationOverlay notifications { get; set; } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, IdleTracker idleTracker) + private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) { + if (host.CanExit) + buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); + + buttonArea.AddRange(buttonsPlay); + buttonArea.AddRange(buttonsTopLevel); + isIdle.ValueChanged += idle => updateIdleState(idle.NewValue); if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle); From 61be4f26951c051aaafce7fee171c8da0476705e Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Mon, 25 Feb 2019 10:42:36 +0900 Subject: [PATCH 05/10] Conditionally add ExitConfirmOverlay and disable back action --- osu.Game/Screens/Menu/MainMenu.cs | 53 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index d6e3d378e0..315be92141 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -19,6 +19,7 @@ using osu.Game.Screens.Edit; using osu.Game.Screens.Multi; using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; +using osu.Framework.Platform; namespace osu.Game.Screens.Menu { @@ -28,7 +29,7 @@ namespace osu.Game.Screens.Menu public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial; - protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial; + protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit; public override bool AllowExternalScreenChange => true; @@ -36,33 +37,23 @@ namespace osu.Game.Screens.Menu private readonly MenuSideFlashes sideFlashes; + [Resolved] + private GameHost host { get; set; } + protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); public MainMenu() { - InternalChildren = new Drawable[] + sideFlashes = new MenuSideFlashes(); + + buttons = new ButtonSystem { - new ExitConfirmOverlay - { - Action = this.Exit, - }, - new ParallaxContainer - { - ParallaxAmount = 0.01f, - Children = new Drawable[] - { - buttons = new ButtonSystem - { - OnChart = delegate { this.Push(new ChartListing()); }, - OnDirect = delegate {this.Push(new OnlineListing()); }, - OnEdit = delegate {this.Push(new Editor()); }, - OnSolo = onSolo, - OnMulti = delegate {this.Push(new Multiplayer()); }, - OnExit = this.Exit, - } - } - }, - sideFlashes = new MenuSideFlashes(), + OnChart = delegate { this.Push(new ChartListing()); }, + OnDirect = delegate { this.Push(new OnlineListing()); }, + OnEdit = delegate { this.Push(new Editor()); }, + OnSolo = onSolo, + OnMulti = delegate { this.Push(new Multiplayer()); }, + OnExit = this.Exit, }; buttons.StateChanged += state => @@ -83,6 +74,22 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(OsuGame game = null) { + if (host.CanExit) + { + AddInternal(new ExitConfirmOverlay + { + Action = this.Exit, + }); + } + + AddInternal(new ParallaxContainer + { + ParallaxAmount = 0.01f, + Child = buttons, + }); + + AddInternal(sideFlashes); + if (game != null) { buttons.OnSettings = game.ToggleSettings; From ed10024b22ce82bb928db4b265518ee91769b973 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Feb 2019 19:29:09 +0900 Subject: [PATCH 06/10] Fix some formatting / variable naming --- osu.Game/Overlays/MusicController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index c1dd06c36a..7c62ecf27e 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -312,13 +312,13 @@ namespace osu.Game.Overlays private WorkingBeatmap current; private TransformDirection? queuedDirection; - private void beatmapChanged(ValueChangedEvent e) + private void beatmapChanged(ValueChangedEvent beatmap) { TransformDirection direction = TransformDirection.None; if (current != null) { - bool audioEquals = e.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; + bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; if (audioEquals) direction = TransformDirection.None; @@ -331,7 +331,7 @@ namespace osu.Game.Overlays { //figure out the best direction based on order in playlist. var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); - var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != e.NewValue.BeatmapSetInfo?.ID).Count(); + var next = this.beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } @@ -339,7 +339,8 @@ namespace osu.Game.Overlays current.Track.Completed -= currentTrackCompleted; } - current = e.NewValue; + current = beatmap.NewValue; + if (current != null) current.Track.Completed += currentTrackCompleted; From 2fbb0b4e6f69b4d05365dd26725e7a1665b32753 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Feb 2019 19:34:03 +0900 Subject: [PATCH 07/10] Don't use `this` --- 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 7c62ecf27e..6a71e91de9 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -331,7 +331,7 @@ namespace osu.Game.Overlays { //figure out the best direction based on order in playlist. var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); - var next = this.beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); + var next = beatmap.NewValue == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } From 2bd5bb3f69eb62fcba48f26274dd966fdd14d093 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Mon, 25 Feb 2019 21:41:41 +0900 Subject: [PATCH 08/10] Move all MainMenu button creation into load --- osu.Game/Screens/Menu/ButtonSystem.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 76185e328b..42d67ceffc 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -91,15 +91,6 @@ namespace osu.Game.Screens.Menu }); buttonArea.Flow.CentreTarget = iconFacade; - - buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); - buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); - buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); - buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); - - buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); - buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); - buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); } [Resolved(CanBeNull = true)] @@ -114,6 +105,15 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) { + buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); + buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); + buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); + buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); + + buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); + buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); + buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); + if (host.CanExit) buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); From e91c07209ffc948c0934defd23b79afffffcefcd Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Tue, 26 Feb 2019 09:54:42 +0900 Subject: [PATCH 09/10] Move MainMenu initialisation from ctor to load --- osu.Game/Screens/Menu/MainMenu.cs | 57 ++++++++++++++----------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 5aa85b6e71..234fb808c3 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Menu { public class MainMenu : OsuScreen { - private readonly ButtonSystem buttons; + private ButtonSystem buttons; public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial; @@ -35,26 +35,39 @@ namespace osu.Game.Screens.Menu private Screen songSelect; - private readonly MenuSideFlashes sideFlashes; + private MenuSideFlashes sideFlashes; [Resolved] private GameHost host { get; set; } protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); - public MainMenu() + [BackgroundDependencyLoader(true)] + private void load(OsuGame game = null) { - sideFlashes = new MenuSideFlashes(); + if (host.CanExit) + AddInternal(new ExitConfirmOverlay { Action = this.Exit }); - buttons = new ButtonSystem + AddRangeInternal(new Drawable[] { - OnChart = delegate { this.Push(new ChartListing()); }, - OnDirect = delegate { this.Push(new OnlineListing()); }, - OnEdit = delegate { this.Push(new Editor()); }, - OnSolo = onSolo, - OnMulti = delegate { this.Push(new Multiplayer()); }, - OnExit = this.Exit, - }; + new ParallaxContainer + { + ParallaxAmount = 0.01f, + Children = new Drawable[] + { + buttons = new ButtonSystem + { + OnChart = delegate { this.Push(new ChartListing()); }, + OnDirect = delegate { this.Push(new OnlineListing()); }, + OnEdit = delegate { this.Push(new Editor()); }, + OnSolo = onSolo, + OnMulti = delegate { this.Push(new Multiplayer()); }, + OnExit = this.Exit, + } + } + }, + sideFlashes = new MenuSideFlashes(), + }); buttons.StateChanged += state => { @@ -69,26 +82,6 @@ namespace osu.Game.Screens.Menu break; } }; - } - - [BackgroundDependencyLoader(true)] - private void load(OsuGame game = null) - { - if (host.CanExit) - { - AddInternal(new ExitConfirmOverlay - { - Action = this.Exit, - }); - } - - AddInternal(new ParallaxContainer - { - ParallaxAmount = 0.01f, - Child = buttons, - }); - - AddInternal(sideFlashes); if (game != null) { From 8a943a6e6511bb0418030d72b30891a75d2a2e83 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Feb 2019 13:10:07 +0900 Subject: [PATCH 10/10] Fix scores being stored as ints --- osu.Game/Migrations/OsuDbContextModelSnapshot.cs | 4 ++-- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 2 +- osu.Game/Scoring/ScoreInfo.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 2dafedc3ac..4505444d58 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.0-rtm-35687"); + .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -336,7 +336,7 @@ namespace osu.Game.Migrations b.Property("StatisticsJson") .HasColumnName("Statistics"); - b.Property("TotalScore"); + b.Property("TotalScore"); b.Property("UserString") .HasColumnName("User"); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1e7a324acf..5c8ef41b9a 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -168,7 +168,7 @@ namespace osu.Game.Rulesets.Scoring /// public virtual void PopulateScore(ScoreInfo score) { - score.TotalScore = (int)Math.Round(TotalScore.Value); + score.TotalScore = (long)Math.Round(TotalScore.Value); score.Combo = Combo.Value; score.MaxCombo = HighestCombo.Value; score.Accuracy = Math.Round(Accuracy.Value, 4); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index c88fd77eb2..a71ef9d64d 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -25,7 +25,7 @@ namespace osu.Game.Scoring public ScoreRank Rank { get; set; } [JsonProperty("total_score")] - public int TotalScore { get; set; } + public long TotalScore { get; set; } [JsonProperty("accuracy")] [Column(TypeName="DECIMAL(1,4)")]