From d301ad143596349036fd26ca4f74c48ad1fac2f8 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 16 Nov 2017 20:06:49 +0300 Subject: [PATCH 01/47] Add supporter icon to the user panel --- osu.Game.Tests/Visual/TestCaseUserPanel.cs | 3 +- osu.Game/Users/UserPanel.cs | 70 ++++++++++++++++++---- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/TestCaseUserPanel.cs index 60932f8424..8523a754f8 100644 --- a/osu.Game.Tests/Visual/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/TestCaseUserPanel.cs @@ -36,7 +36,8 @@ namespace osu.Game.Tests.Visual Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", + IsSupporter = true, }) { Width = 300 }, }, }); diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 706ad86bfc..ab4d55027d 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -16,6 +16,7 @@ using osu.Game.Overlays; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Cursor; +using osu.Game.Graphics.Backgrounds; namespace osu.Game.Users { @@ -43,6 +44,8 @@ namespace osu.Game.Users this.user = user; + FillFlowContainer infoContainer; + Height = height - status_height; Masking = true; CornerRadius = 5; @@ -100,7 +103,7 @@ namespace osu.Game.Users TextSize = 18, Font = @"Exo2.0-SemiBoldItalic", }, - new FillFlowContainer + infoContainer = new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -115,16 +118,6 @@ namespace osu.Game.Users Width = 30f, RelativeSizeAxes = Axes.Y, }, - new Container - { - Width = 40f, - RelativeSizeAxes = Axes.Y, - }, - new CircularContainer - { - Width = 20f, - RelativeSizeAxes = Axes.Y, - }, }, }, }, @@ -171,6 +164,13 @@ namespace osu.Game.Users }, }, }; + + if (user.IsSupporter) + infoContainer.Add(new SupporterIcon + { + RelativeSizeAxes = Axes.Y, + Width = 20f, + }); } [BackgroundDependencyLoader(permitNulls: true)] @@ -219,5 +219,53 @@ namespace osu.Game.Users { new OsuMenuItem("View Profile", MenuItemType.Highlighted, ViewProfile), }; + + private class SupporterIcon : CircularContainer + { + private readonly Box background; + + public SupporterIcon() + { + Masking = true; + Children = new Drawable[] + { + new Box { RelativeSizeAxes = Axes.Both }, + new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.8f), + Masking = true, + Children = new Drawable[] + { + background = new Box { RelativeSizeAxes = Axes.Both }, + new Triangles + { + TriangleScale = 0.2f, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + Velocity = 0.3f, + }, + } + }, + new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Icon = FontAwesome.fa_heart, + Scale = new Vector2(0.45f), + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + background.Colour = colours.Pink; + } + } } } From d62da4334eae5a8b710f189bdee3862d6563dfbf Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 17 Nov 2017 12:26:13 +0300 Subject: [PATCH 02/47] Add and place all the bottom bar objects --- .../Edit/Components/BottomBarContainer.cs | 44 +++++++++ .../Edit/Components/PlaybackContainer.cs | 9 ++ .../Edit/Components/TimeInfoContainer.cs | 9 ++ .../Timelines/Summary/SummaryTimeline.cs | 98 ++++++++----------- osu.Game/Screens/Edit/Editor.cs | 40 +++++--- osu.Game/osu.Game.csproj | 3 + 6 files changed, 130 insertions(+), 73 deletions(-) create mode 100644 osu.Game/Screens/Edit/Components/BottomBarContainer.cs create mode 100644 osu.Game/Screens/Edit/Components/PlaybackContainer.cs create mode 100644 osu.Game/Screens/Edit/Components/TimeInfoContainer.cs diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs new file mode 100644 index 0000000000..d1813a9c7b --- /dev/null +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -0,0 +1,44 @@ +// 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; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; + +namespace osu.Game.Screens.Edit.Components +{ + public class BottomBarContainer : Container + { + private const float corner_radius = 5; + private const float contents_padding = 15; + + private readonly Drawable background; + private readonly Container content; + + protected override Container Content => content; + + public BottomBarContainer() + { + Masking = true; + CornerRadius = corner_radius; + + InternalChildren = new[] + { + background = new Box { RelativeSizeAxes = Axes.Both }, + content = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Horizontal = contents_padding }, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + background.Colour = colours.Gray1; + } + } +} diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs new file mode 100644 index 0000000000..aeed10357b --- /dev/null +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Edit.Components +{ + public class PlaybackContainer : BottomBarContainer + { + } +} diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs new file mode 100644 index 0000000000..739a67219d --- /dev/null +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Edit.Components +{ + public class TimeInfoContainer : BottomBarContainer + { + } +} diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs index 4d925f7584..4543679363 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs @@ -16,83 +16,66 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary /// /// The timeline that sits at the bottom of the editor. /// - public class SummaryTimeline : CompositeDrawable + public class SummaryTimeline : BottomBarContainer { - private const float corner_radius = 5; - private const float contents_padding = 15; - public Bindable Beatmap = new Bindable(); - private readonly Drawable background; - private readonly Drawable timelineBar; public SummaryTimeline() { - Masking = true; - CornerRadius = corner_radius; - TimelinePart markerPart, controlPointPart, bookmarkPart, breakPart; - InternalChildren = new[] + Children = new[] { - background = new Box { RelativeSizeAxes = Axes.Both }, - new Container + markerPart = new MarkerPart { RelativeSizeAxes = Axes.Both }, + controlPointPart = new ControlPointPart + { + Anchor = Anchor.Centre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.Both, + Height = 0.35f + }, + bookmarkPart = new BookmarkPart + { + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + Height = 0.35f + }, + timelineBar = new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = contents_padding, Right = contents_padding }, - Children = new[] + Children = new Drawable[] { - markerPart = new MarkerPart { RelativeSizeAxes = Axes.Both }, - controlPointPart = new ControlPointPart + new Circle { - Anchor = Anchor.Centre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.Both, - Height = 0.35f + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreRight, + Size = new Vector2(5) }, - bookmarkPart = new BookmarkPart + new Box { - Anchor = Anchor.Centre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.Both, - Height = 0.35f + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.X, + Height = 1, + EdgeSmoothness = new Vector2(0, 1), }, - timelineBar = new Container + new Circle { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Circle - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreRight, - Size = new Vector2(5) - }, - new Box - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.X, - Height = 1, - EdgeSmoothness = new Vector2(0, 1), - }, - new Circle - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreLeft, - Size = new Vector2(5) - }, - } + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreLeft, + Size = new Vector2(5) }, - breakPart = new BreakPart - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Height = 0.25f - } } + }, + breakPart = new BreakPart + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Height = 0.25f } }; @@ -105,7 +88,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary [BackgroundDependencyLoader] private void load(OsuColour colours) { - background.Colour = colours.Gray1; timelineBar.Colour = colours.Gray5; } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 74e55e58ad..2aef9b11e2 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -17,6 +17,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Edit.Screens; using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Design; +using osu.Game.Screens.Edit.Components; namespace osu.Game.Screens.Edit { @@ -34,7 +35,9 @@ namespace osu.Game.Screens.Edit public Editor() { EditorMenuBar menuBar; + TimeInfoContainer timeInfo; SummaryTimeline timeline; + PlaybackContainer playback; Children = new[] { @@ -84,23 +87,30 @@ namespace osu.Game.Screens.Edit new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 10 }, - Child = new FillFlowContainer + Padding = new MarginPadding { Vertical = 5, Horizontal = 10 }, + Children = new Drawable[] { - Name = "Bottom bar", - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(10, 0), - Children = new[] + timeInfo = new TimeInfoContainer { - timeline = new SummaryTimeline - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Width = 0.65f - } - } + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Width = 0.17f + }, + timeline = new SummaryTimeline + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Width = 0.65f + }, + playback = new PlaybackContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + RelativeSizeAxes = Axes.Both, + Width = 0.17f + }, } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7b479bdba2..63dbb06491 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -294,6 +294,9 @@ + + + From cc04d5bc616f32046d930bf42dca434fdd097c51 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 17 Nov 2017 13:35:41 +0300 Subject: [PATCH 03/47] Add all the objects to the PlaybackContainer --- .../Edit/Components/BottomBarContainer.cs | 4 + .../Edit/Components/PlaybackContainer.cs | 161 ++++++++++++++++++ .../Timelines/Summary/SummaryTimeline.cs | 4 - osu.Game/Screens/Edit/Editor.cs | 2 + 4 files changed, 167 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index d1813a9c7b..b230032937 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -2,9 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; using osu.Game.Graphics; namespace osu.Game.Screens.Edit.Components @@ -14,6 +16,8 @@ namespace osu.Game.Screens.Edit.Components private const float corner_radius = 5; private const float contents_padding = 15; + public Bindable Beatmap = new Bindable(); + private readonly Drawable background; private readonly Container content; diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index aeed10357b..23484464bf 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -1,9 +1,170 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + namespace osu.Game.Screens.Edit.Components { public class PlaybackContainer : BottomBarContainer { + private readonly IconButton playButton; + + private bool lastTrackState; + private Track track => Beatmap.Value.Track; + + public PlaybackContainer() + { + PlaybackTabControl tabs; + + Children = new Drawable[] + { + playButton = new IconButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Scale = new Vector2(1.4f), + IconScale = new Vector2(1.4f), + Icon = FontAwesome.fa_play_circle_o, + Action = play, + Padding = new MarginPadding { Left = 20 } + }, + new OsuSpriteText + { + Origin = Anchor.BottomLeft, + Text = "Playback Speed", + RelativePositionAxes = Axes.Y, + Y = 0.5f, + Padding = new MarginPadding { Left = 45 } + }, + new Container + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + Height = 0.5f, + Padding = new MarginPadding { Left = 45 }, + Child = tabs = new PlaybackTabControl(), + } + }; + + tabs.AddItem(0.25); + tabs.AddItem(0.75); + tabs.AddItem(1); + + tabs.Current.ValueChanged += newValue => track.Tempo.Value = newValue; + } + + private void play() + { + if (track.IsRunning) + track.Stop(); + else + track.Start(); + } + + protected override void Update() + { + base.Update(); + + var currentTrackState = track.IsRunning; + if (currentTrackState == lastTrackState) + return; + + playButton.Icon = currentTrackState ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; + + lastTrackState = currentTrackState; + } + + private class PlaybackTabControl : OsuTabControl + { + protected override TabItem CreateTabItem(double value) => new PlaybackTabItem(value); + + protected override Dropdown CreateDropdown() => null; + + public PlaybackTabControl() + { + RelativeSizeAxes = Axes.Both; + TabContainer.Spacing = new Vector2(20, 0); + } + + public class PlaybackTabItem : TabItem + { + private const float fade_duration = 100; + + private readonly OsuSpriteText text; + private readonly OsuSpriteText textBold; + + public PlaybackTabItem(double value) : base(value) + { + AutoSizeAxes = Axes.X; + RelativeSizeAxes = Axes.Y; + + Children = new Drawable[] + { + text = new OsuSpriteText + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Text = $"{value:P0}", + TextSize = 14, + }, + textBold = new OsuSpriteText + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Text = $"{value:P0}", + TextSize = 14, + Font = @"Exo2.0-Bold", + Alpha = 0, + AlwaysPresent = true, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + text.Colour = colours.Gray5; + } + + protected override bool OnHover(InputState state) + { + if (!Active) + toBold(); + return true; + } + + protected override void OnHoverLost(InputState state) + { + if (!Active) + toNormal(); + } + + private void toBold() + { + text.FadeOut(fade_duration); + textBold.FadeIn(fade_duration); + } + + private void toNormal() + { + text.FadeIn(fade_duration); + textBold.FadeOut(fade_duration); + } + + protected override void OnActivated() => toBold(); + + protected override void OnDeactivated() => toNormal(); + } + } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs index 4543679363..a63d02a0a5 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs @@ -3,11 +3,9 @@ using OpenTK; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; @@ -18,8 +16,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary /// public class SummaryTimeline : BottomBarContainer { - public Bindable Beatmap = new Bindable(); - private readonly Drawable timelineBar; public SummaryTimeline() diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2aef9b11e2..51af6e2f5e 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -117,7 +117,9 @@ namespace osu.Game.Screens.Edit }, }; + timeInfo.Beatmap.BindTo(Beatmap); timeline.Beatmap.BindTo(Beatmap); + playback.Beatmap.BindTo(Beatmap); menuBar.Mode.ValueChanged += onModeChanged; } From 1680c0905fb06f5201561cd8c37dadbb821048a4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 17 Nov 2017 14:02:07 +0300 Subject: [PATCH 04/47] Fix track tempo could be less than 1 on exiting the editor --- osu.Game/Screens/Edit/Editor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 51af6e2f5e..6865debd27 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -166,6 +166,7 @@ namespace osu.Game.Screens.Edit protected override bool OnExiting(Screen next) { Background.FadeColour(Color4.White, 500); + Beatmap.Value.Track.Tempo.Value = 1; Beatmap.Value.Track?.Start(); return base.OnExiting(next); } From 07e0aba01c1aafa7f70c0ba91caba80d9a480e52 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 17 Nov 2017 14:10:13 +0300 Subject: [PATCH 05/47] Remove using --- osu.Game/Screens/Edit/Editor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 6865debd27..fd85db595a 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; -using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; From 7492ab6495204cac230cb7225dbc98bcf4e6327b Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 01:48:50 +0300 Subject: [PATCH 06/47] Use GridContainer to place the bottom bar objects --- osu.Game/Screens/Edit/Editor.cs | 48 +++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index fd85db595a..c94da8c5c5 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -87,30 +87,38 @@ namespace osu.Game.Screens.Edit { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Vertical = 5, Horizontal = 10 }, - Children = new Drawable[] + Child = new GridContainer { - timeInfo = new TimeInfoContainer + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new Dimension[] { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - Width = 0.17f + new Dimension(GridSizeMode.Auto), + new Dimension(GridSizeMode.Relative, 0.67f), + new Dimension(GridSizeMode.Auto), }, - timeline = new SummaryTimeline + Content = new Drawable[][] { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Width = 0.65f - }, - playback = new PlaybackContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - RelativeSizeAxes = Axes.Both, - Width = 0.17f - }, - } + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Right = 10 }, + Child = timeInfo = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, + }, + timeline = new SummaryTimeline + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 10 }, + Child = playback = new PlaybackContainer { RelativeSizeAxes = Axes.Both }, + } + }, + } + }, } } }, From 0b8fed4e5a8e2d1d5b59b77b45a0d0abe7001f3c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 01:51:23 +0300 Subject: [PATCH 07/47] Remove useless Dimention params --- osu.Game/Screens/Edit/Editor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index c94da8c5c5..be6a168982 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -92,9 +92,9 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.Both, ColumnDimensions = new Dimension[] { - new Dimension(GridSizeMode.Auto), + new Dimension(), new Dimension(GridSizeMode.Relative, 0.67f), - new Dimension(GridSizeMode.Auto), + new Dimension(), }, Content = new Drawable[][] { From 58e72631087b491fb04e6dc641568cccb3b8b53f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 03:09:09 +0300 Subject: [PATCH 08/47] CI fixes --- osu.Game/Screens/Edit/Editor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index be6a168982..9093bf5629 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -90,13 +90,13 @@ namespace osu.Game.Screens.Edit Child = new GridContainer { RelativeSizeAxes = Axes.Both, - ColumnDimensions = new Dimension[] + ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.Relative, 0.67f), new Dimension(), }, - Content = new Drawable[][] + Content = new[] { new Drawable[] { @@ -105,7 +105,7 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Right = 10 }, Child = timeInfo = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, - }, + }, timeline = new SummaryTimeline { RelativeSizeAxes = Axes.Both, From 34d8f94f99178ac14c34f7aff5618edcd00bb822 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 08:24:09 +0300 Subject: [PATCH 09/47] Add track timer --- .../Edit/Components/BottomBarContainer.cs | 2 ++ .../Edit/Components/PlaybackContainer.cs | 11 +++--- .../Edit/Components/TimeInfoContainer.cs | 36 +++++++++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index b230032937..d65355b5f4 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -2,6 +2,7 @@ // 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.Graphics.Containers; @@ -17,6 +18,7 @@ namespace osu.Game.Screens.Edit.Components private const float contents_padding = 15; public Bindable Beatmap = new Bindable(); + protected Track Track => Beatmap.Value.Track; private readonly Drawable background; private readonly Container content; diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index 23484464bf..9640d91615 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -19,7 +19,6 @@ namespace osu.Game.Screens.Edit.Components private readonly IconButton playButton; private bool lastTrackState; - private Track track => Beatmap.Value.Track; public PlaybackContainer() { @@ -60,22 +59,22 @@ namespace osu.Game.Screens.Edit.Components tabs.AddItem(0.75); tabs.AddItem(1); - tabs.Current.ValueChanged += newValue => track.Tempo.Value = newValue; + tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue; } private void play() { - if (track.IsRunning) - track.Stop(); + if (Track.IsRunning) + Track.Stop(); else - track.Start(); + Track.Start(); } protected override void Update() { base.Update(); - var currentTrackState = track.IsRunning; + var currentTrackState = Track.IsRunning; if (currentTrackState == lastTrackState) return; diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 739a67219d..4a07ab4434 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -1,9 +1,45 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; +using osu.Game.Graphics.Sprites; +using System; + namespace osu.Game.Screens.Edit.Components { public class TimeInfoContainer : BottomBarContainer { + private const int count_duration = 150; + + private readonly OsuSpriteText trackTimer; + private double savedTime; + + public TimeInfoContainer() + { + Children = new Drawable[] + { + trackTimer = new OsuSpriteText + { + Origin = Anchor.BottomLeft, + RelativePositionAxes = Axes.Y, + TextSize = 22, + FixedWidth = true, + Y = 0.5f, + } + }; + } + + protected override void Update() + { + base.Update(); + + var currentTime = Track.CurrentTime; + + if (savedTime == currentTime) + return; + + trackTimer.Text = TimeSpan.FromMilliseconds(currentTime).ToString(@"mm\:ss\:fff"); + savedTime = currentTime; + } } } From 4ee3a89c129fb4bf64c6cd716e45abe17af7745f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 08:35:00 +0300 Subject: [PATCH 10/47] Remove using --- osu.Game/Screens/Edit/Components/PlaybackContainer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index 9640d91615..a88983e3e4 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -3,7 +3,6 @@ using OpenTK; using osu.Framework.Allocation; -using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; From de4d8eb1965a82d5d59c8bc0d87476cdec03d539 Mon Sep 17 00:00:00 2001 From: Brayzure Date: Sat, 18 Nov 2017 01:28:09 -0500 Subject: [PATCH 11/47] Implement Sudden Death and Perfect - Two additional fail conditions --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 23 ++++++++++++++++++--- osu.Game/Screens/Play/Player.cs | 6 ++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 4dd88600b2..f579b94c69 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -66,6 +66,8 @@ namespace osu.Game.Rulesets.Scoring /// protected virtual bool HasCompleted => false; + public int strictFail = 0; + /// /// Whether this ScoreProcessor has already triggered the failed state. /// @@ -76,6 +78,16 @@ namespace osu.Game.Rulesets.Scoring /// protected virtual bool FailCondition => Health.Value == Health.MinValue; + /// + /// The conditions for failing if the Sudden Death mod is enabled. + /// + protected virtual bool SuddenDeathFailCondition => Combo.Value != HighestCombo.Value; + + /// + /// The conditions for failing if the Perfect mod is enabled. + /// + protected virtual bool PerfectFailCondition => Accuracy.Value != 1; + protected ScoreProcessor() { Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; @@ -121,11 +133,16 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (HasFailed || !FailCondition) + if (HasFailed) return; - if (Failed?.Invoke() != false) - HasFailed = true; + if(FailCondition || + (strictFail==1 && SuddenDeathFailCondition) || + (strictFail==2 && PerfectFailCondition)) + { + if (Failed?.Invoke() != false) + HasFailed = true; + } } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3e57e18963..2603fee769 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -227,6 +227,12 @@ namespace osu.Game.Screens.Play // Bind ScoreProcessor to ourselves scoreProcessor.AllJudged += onCompletion; scoreProcessor.Failed += onFail; + + if (Beatmap.Value.Mods.Value.Any(m => m.Name == "Sudden Death")) + scoreProcessor.strictFail = 1; + + if (Beatmap.Value.Mods.Value.Any(m => m.Name == "Perfect")) + scoreProcessor.strictFail = 2; } private void applyRateFromMods() From ecc2877be6457420e3a978428ffff5949ee5d815 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 20 Nov 2017 09:29:26 +0300 Subject: [PATCH 12/47] Fix possible null and adjust timeline width --- osu.Game/Screens/Edit/Editor.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 9093bf5629..52baadd442 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -93,8 +93,7 @@ namespace osu.Game.Screens.Edit ColumnDimensions = new[] { new Dimension(), - new Dimension(GridSizeMode.Relative, 0.67f), - new Dimension(), + new Dimension(GridSizeMode.Relative, 0.65f), }, Content = new[] { @@ -173,8 +172,11 @@ namespace osu.Game.Screens.Edit protected override bool OnExiting(Screen next) { Background.FadeColour(Color4.White, 500); - Beatmap.Value.Track.Tempo.Value = 1; - Beatmap.Value.Track?.Start(); + if (Beatmap.Value.Track != null) + { + Beatmap.Value.Track.Tempo.Value = 1; + Beatmap.Value.Track.Start(); + } return base.OnExiting(next); } } From da30d76f9b08b1435db366b5b0004cb704fd5f94 Mon Sep 17 00:00:00 2001 From: Brayzure Date: Mon, 20 Nov 2017 02:15:29 -0500 Subject: [PATCH 13/47] Implement Score Processor Mod Interface - Add a delegate whenever we want to register an additional fail condition --- .../Mods/IApplicableToScoreProcessor.cs | 15 +++++++ osu.Game/Rulesets/Mods/ModPerfect.cs | 16 ++++++- osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 15 ++++++- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 43 ++++++++++--------- osu.Game/Screens/Play/Player.cs | 12 ++++-- osu.Game/osu.Game.csproj | 1 + 6 files changed, 74 insertions(+), 28 deletions(-) create mode 100644 osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs diff --git a/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs b/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs new file mode 100644 index 0000000000..db9b713c59 --- /dev/null +++ b/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Mods +{ + /// + /// An interface for mods that make general adjustments to score processor. + /// + public interface IApplicableToScoreProcessor + { + void ApplyToScoreProcessor(ScoreProcessor scoreProcessor); + } +} diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index 082370ea5d..7b79493d65 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -1,12 +1,24 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Rulesets.Scoring; + namespace osu.Game.Rulesets.Mods { - public abstract class ModPerfect : ModSuddenDeath + public abstract class ModPerfect : ModSuddenDeath, IApplicableToScoreProcessor { public override string Name => "Perfect"; public override string ShortenedName => "PF"; public override string Description => "SS or quit."; + + public bool onFailCheck(ScoreProcessor scoreProcessor) + { + return scoreProcessor.Accuracy.Value != 1; + } + + public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) + { + scoreProcessor.FailChecker += onFailCheck; + } } -} \ No newline at end of file +} diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index 999cb40f89..c71442fa28 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -3,10 +3,11 @@ using System; using osu.Game.Graphics; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { - public abstract class ModSuddenDeath : Mod + public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor { public override string Name => "Sudden Death"; public override string ShortenedName => "SD"; @@ -16,5 +17,15 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; + + public bool onFailCheck(ScoreProcessor scoreProcessor) + { + return scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; + } + + public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) + { + scoreProcessor.FailChecker += onFailCheck; + } } -} \ No newline at end of file +} diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index f579b94c69..997dfc2a58 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using System.Collections.Generic; using osu.Framework.Configuration; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; @@ -31,6 +32,11 @@ namespace osu.Game.Rulesets.Scoring /// public event Action NewJudgement; + /// + /// Invoked when we want to check if a failure condition has been fulfilled + /// + public event Func FailChecker; + /// /// The current total score. /// @@ -66,8 +72,6 @@ namespace osu.Game.Rulesets.Scoring /// protected virtual bool HasCompleted => false; - public int strictFail = 0; - /// /// Whether this ScoreProcessor has already triggered the failed state. /// @@ -78,16 +82,6 @@ namespace osu.Game.Rulesets.Scoring /// protected virtual bool FailCondition => Health.Value == Health.MinValue; - /// - /// The conditions for failing if the Sudden Death mod is enabled. - /// - protected virtual bool SuddenDeathFailCondition => Combo.Value != HighestCombo.Value; - - /// - /// The conditions for failing if the Perfect mod is enabled. - /// - protected virtual bool PerfectFailCondition => Accuracy.Value != 1; - protected ScoreProcessor() { Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; @@ -133,16 +127,11 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (HasFailed) + if (HasFailed || !FailCondition) return; - if(FailCondition || - (strictFail==1 && SuddenDeathFailCondition) || - (strictFail==2 && PerfectFailCondition)) - { - if (Failed?.Invoke() != false) - HasFailed = true; - } + if (Failed?.Invoke() != false) + HasFailed = true; } /// @@ -157,6 +146,18 @@ namespace osu.Game.Rulesets.Scoring AllJudged?.Invoke(); } + protected void CheckAlternateFailConditions() + { + if (HasFailed) + return; + + if (FailChecker?.Invoke(this) == true) + { + if (Failed?.Invoke() != false) + HasFailed = true; + } + } + /// /// Retrieve a score populated with data for the current play this processor is responsible for. /// @@ -233,6 +234,8 @@ namespace osu.Game.Rulesets.Scoring OnNewJudgement(judgement); updateScore(); + CheckAlternateFailConditions(); + NotifyNewJudgement(judgement); UpdateFailed(); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2603fee769..0bff13a46a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -228,11 +228,15 @@ namespace osu.Game.Screens.Play scoreProcessor.AllJudged += onCompletion; scoreProcessor.Failed += onFail; - if (Beatmap.Value.Mods.Value.Any(m => m.Name == "Sudden Death")) - scoreProcessor.strictFail = 1; + applyAlternateFailConditions(); + } - if (Beatmap.Value.Mods.Value.Any(m => m.Name == "Perfect")) - scoreProcessor.strictFail = 2; + private void applyAlternateFailConditions() + { + foreach(var mod in Beatmap.Value.Mods.Value.OfType()) + { + mod.ApplyToScoreProcessor(scoreProcessor); + } } private void applyRateFromMods() diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7b479bdba2..5306f0df4a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -294,6 +294,7 @@ + From 6d74fd254c389d71fe2af0c712e3307f2ad92518 Mon Sep 17 00:00:00 2001 From: Brayzure Date: Mon, 20 Nov 2017 20:25:14 -0500 Subject: [PATCH 14/47] Remove Extraneous Using Statement - System.Collections.Generic was leftover from a previous attempt --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 997dfc2a58..c3ae887a9f 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -3,7 +3,6 @@ using System; using System.Diagnostics; -using System.Collections.Generic; using osu.Framework.Configuration; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; From 2b0295ed86660cd9729abfe616e3ad6a24e282c8 Mon Sep 17 00:00:00 2001 From: Brayzure Date: Mon, 20 Nov 2017 20:49:31 -0500 Subject: [PATCH 15/47] Proper Public Method Case - onFailCheck to OnFailCheck --- osu.Game/Rulesets/Mods/ModPerfect.cs | 4 ++-- osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index 7b79493d65..cf7bf141c3 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -11,14 +11,14 @@ namespace osu.Game.Rulesets.Mods public override string ShortenedName => "PF"; public override string Description => "SS or quit."; - public bool onFailCheck(ScoreProcessor scoreProcessor) + public bool OnFailCheck(ScoreProcessor scoreProcessor) { return scoreProcessor.Accuracy.Value != 1; } public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { - scoreProcessor.FailChecker += onFailCheck; + scoreProcessor.FailChecker += OnFailCheck; } } } diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index c71442fa28..6675c41bd4 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -18,14 +18,14 @@ namespace osu.Game.Rulesets.Mods public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; - public bool onFailCheck(ScoreProcessor scoreProcessor) + public bool OnFailCheck(ScoreProcessor scoreProcessor) { return scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; } public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { - scoreProcessor.FailChecker += onFailCheck; + scoreProcessor.FailChecker += OnFailCheck; } } } From 5db2d383ed750e8d273f4dc514ae71e9a5c40d37 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 11:48:27 +0900 Subject: [PATCH 16/47] Remove temporary variable in beatmap background update --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 29a422892f..7ae3f6931e 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -32,9 +32,7 @@ namespace osu.Game.Screens.Backgrounds Schedule(() => { - var newBackground = new BeatmapBackground(beatmap); - - LoadComponentAsync(newBackground, delegate + LoadComponentAsync(new BeatmapBackground(beatmap), b => { float newDepth = 0; if (background != null) @@ -45,8 +43,8 @@ namespace osu.Game.Screens.Backgrounds background.Expire(); } - newBackground.Depth = newDepth; - Add(background = newBackground); + b.Depth = newDepth; + Add(background = b); background.BlurSigma = blurTarget; }); }); From e7654254d2bad68e5423b5ddb00f75d21f3d7ce2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 11:48:49 +0900 Subject: [PATCH 17/47] Remove unused code --- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index e9de3fb672..7b50d36b44 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Linq; using OpenTK; using OpenTK.Graphics; @@ -24,8 +23,6 @@ namespace osu.Game.Screens.Select.Leaderboards { public static readonly float HEIGHT = 60; - public event Action StateChanged; - public readonly int RankPosition; public readonly Score Score; From be9c99ade3dc676d6389a2260dc71cfa5a6ef4f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 11:49:21 +0900 Subject: [PATCH 18/47] Remove AsyncLoadWrapper dependence --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 126 ++++++++++---------- 1 file changed, 66 insertions(+), 60 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 22cb718d0a..c4176be4d9 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select { private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); - private Drawable beatmapInfoContainer; + private Drawable info; public BeatmapInfoWedge() { @@ -65,29 +65,34 @@ namespace osu.Game.Screens.Select public void UpdateBeatmap(WorkingBeatmap beatmap) { - var lastContainer = beatmapInfoContainer; - float newDepth = lastContainer?.Depth + 1 ?? 0; - - Add(beatmapInfoContainer = new AsyncLoadWrapper( - new BufferedWedgeInfo(beatmap) - { - Shear = -Shear, - OnLoadComplete = d => - { - this.FadeIn(250); - - lastContainer?.FadeOut(250); - lastContainer?.Expire(); - } - }) + LoadComponentAsync(new BufferedWedgeInfo(beatmap) { - Depth = newDepth, + Shear = -Shear, + Depth = info?.Depth + 1 ?? 0, + }, newInfo => + { + // ensure we ourselves are visible if not already. + if (!IsPresent) + this.FadeIn(250); + + info?.FadeOut(250); + info?.Expire(); + + Add(info = newInfo); }); } public class BufferedWedgeInfo : BufferedContainer { + private readonly WorkingBeatmap beatmap; + public BufferedWedgeInfo(WorkingBeatmap beatmap) + { + this.beatmap = beatmap; + } + + [BackgroundDependencyLoader] + private void load() { BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); @@ -206,13 +211,13 @@ namespace osu.Game.Screens.Select Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, - }, + }, new OsuSpriteText { Font = @"Exo2.0-Bold", Text = metadata.Author.Username, TextSize = 15, - }, + }, } }, new FillFlowContainer @@ -244,38 +249,39 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both; Children = new Drawable[] { - new SpriteIcon - { - Icon = FontAwesome.fa_square, - Origin = Anchor.Centre, - Colour = new Color4(68, 17, 136, 255), - Rotation = 45, - Size = new Vector2(20), - }, - new SpriteIcon - { - Icon = statistic.Icon, - Origin = Anchor.Centre, - Colour = new Color4(255, 221, 85, 255), - Scale = new Vector2(0.8f), - Size = new Vector2(20), - }, - new OsuSpriteText - { - Margin = new MarginPadding { Left = 13 }, - Font = @"Exo2.0-Bold", - Colour = new Color4(255, 221, 85, 255), - Text = statistic.Content, - TextSize = 17, - Origin = Anchor.CentreLeft - }, + new SpriteIcon + { + Icon = FontAwesome.fa_square, + Origin = Anchor.Centre, + Colour = new Color4(68, 17, 136, 255), + Rotation = 45, + Size = new Vector2(20), + }, + new SpriteIcon + { + Icon = statistic.Icon, + Origin = Anchor.Centre, + Colour = new Color4(255, 221, 85, 255), + Scale = new Vector2(0.8f), + Size = new Vector2(20), + }, + new OsuSpriteText + { + Margin = new MarginPadding { Left = 13 }, + Font = @"Exo2.0-Bold", + Colour = new Color4(255, 221, 85, 255), + Text = statistic.Content, + TextSize = 17, + Origin = Anchor.CentreLeft + }, }; } } private class DifficultyColourBar : DifficultyColouredContainer { - public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap) + public DifficultyColourBar(BeatmapInfo beatmap) + : base(beatmap) { } @@ -286,21 +292,21 @@ namespace osu.Game.Screens.Select 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, - } + 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, + } }; } } From bd616c13070bd2a850b23168a2e4d00b6b8350e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 12:29:46 +0900 Subject: [PATCH 19/47] Simplify some property access --- .../Containers/BeatSyncedContainer.cs | 6 ++--- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 25 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index fb85af12cb..d5d75c9e29 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -45,8 +45,8 @@ namespace osu.Game.Graphics.Containers double currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime; - TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); - EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); + TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); + EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); if (timingPoint.BeatLength == 0) return; @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers return; using (BeginDelayedSequence(-TimeSinceLastBeat, true)) - OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes); + OnNewBeat(beatIndex, timingPoint, effectPoint, track.CurrentAmplitudes); lastBeat = beatIndex; lastTimingPoint = timingPoint; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index c4176be4d9..391cfc20db 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -84,42 +84,43 @@ namespace osu.Game.Screens.Select public class BufferedWedgeInfo : BufferedContainer { - private readonly WorkingBeatmap beatmap; + private readonly WorkingBeatmap working; - public BufferedWedgeInfo(WorkingBeatmap beatmap) + public BufferedWedgeInfo(WorkingBeatmap working) { - this.beatmap = beatmap; + this.working = working; } [BackgroundDependencyLoader] private void load() { - BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); + BeatmapInfo beatmapInfo = working.BeatmapInfo; + BeatmapMetadata metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); + Beatmap beatmap = working.Beatmap; List labels = new List(); - if (beatmap.Beatmap != null) + if (beatmap != null) { - HitObject lastObject = beatmap.Beatmap.HitObjects.LastOrDefault(); + HitObject lastObject = beatmap.HitObjects.LastOrDefault(); double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; labels.Add(new InfoLabel(new BeatmapStatistic { Name = "Length", Icon = FontAwesome.fa_clock_o, - Content = beatmap.Beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), + Content = beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), })); labels.Add(new InfoLabel(new BeatmapStatistic { Name = "BPM", Icon = FontAwesome.fa_circle, - Content = getBPMRange(beatmap.Beatmap), + Content = getBPMRange(beatmap), })); //get statistics from the current ruleset. - labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); + labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s))); } PixelSnapping = true; @@ -145,7 +146,7 @@ namespace osu.Game.Screens.Select Children = new[] { // Zoomed-in and cropped beatmap background - new BeatmapBackgroundSprite(beatmap) + new BeatmapBackgroundSprite(working) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -154,7 +155,7 @@ namespace osu.Game.Screens.Select }, }, }, - new DifficultyColourBar(beatmap.BeatmapInfo) + new DifficultyColourBar(beatmapInfo) { RelativeSizeAxes = Axes.Y, Width = 20, From a2fc5b67eca47975c54d5682eac93d6946d21c14 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 12:30:06 +0900 Subject: [PATCH 20/47] Formatting fix --- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 9c11474f97..c87328d87c 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu }; public override IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] - { + { new BeatmapStatistic { Name = @"Circle count", From 66f72baa39aa9d9eb8baf9d2293c601f5edf4706 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 12:40:05 +0900 Subject: [PATCH 21/47] Avoid LogoVisualisation accessing the track before it's loaded --- osu.Game/Screens/Menu/LogoVisualisation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 3e7662a441..7c1b914bf5 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Menu private void updateAmplitudes() { - var track = beatmap.Value.Track; + var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null; float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; From 553a7947d7a927efca806feca47c29798c6734ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 12:40:19 +0900 Subject: [PATCH 22/47] Remove AsyncLoadWrapper dependence in MusicController --- osu.Game/Overlays/MusicController.cs | 42 +++++++++++++--------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a99ce89a36..4f57ea1bcd 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays private const float bottom_black_area_height = 55; - private Drawable currentBackground; + private Drawable background; private ProgressBar progressBar; private IconButton prevButton; @@ -120,7 +120,7 @@ namespace osu.Game.Overlays }, Children = new[] { - currentBackground = new Background(), + background = new Background(), title = new OsuSpriteText { Origin = Anchor.BottomCentre, @@ -334,6 +334,7 @@ namespace osu.Game.Overlays pendingBeatmapSwitch = Schedule(delegate { + // todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync() Task.Run(() => { if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists @@ -352,29 +353,26 @@ namespace osu.Game.Overlays } }); - playerContainer.Add(new AsyncLoadWrapper(new Background(beatmap) + LoadComponentAsync(new Background(beatmap) { Depth = float.MaxValue }, newBackground => { - OnLoadComplete = newBackground => + switch (direction) { - switch (direction) - { - case TransformDirection.Next: - newBackground.Position = new Vector2(400, 0); - newBackground.MoveToX(0, 500, Easing.OutCubic); - currentBackground.MoveToX(-400, 500, Easing.OutCubic); - break; - case TransformDirection.Prev: - newBackground.Position = new Vector2(-400, 0); - newBackground.MoveToX(0, 500, Easing.OutCubic); - currentBackground.MoveToX(400, 500, Easing.OutCubic); - break; - } - currentBackground.Expire(); - currentBackground = newBackground; + case TransformDirection.Next: + newBackground.Position = new Vector2(400, 0); + newBackground.MoveToX(0, 500, Easing.OutCubic); + background.MoveToX(-400, 500, Easing.OutCubic); + break; + case TransformDirection.Prev: + newBackground.Position = new Vector2(-400, 0); + newBackground.MoveToX(0, 500, Easing.OutCubic); + background.MoveToX(400, 500, Easing.OutCubic); + break; } - }) - { - Depth = float.MaxValue, + + background.Expire(); + background = newBackground; + + playerContainer.Add(newBackground); }); }); } From 1b27ce6198eaa525deb2560ee75f76d7e3d9570d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 17:09:22 +0900 Subject: [PATCH 23/47] Cleanup + renaming --- .../Scoring/TaikoScoreProcessor.cs | 2 +- osu.Game/Rulesets/Mods/ModPerfect.cs | 10 +--------- osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 9 +++------ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 12 ++++++------ 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 0e5df329d8..0048566b15 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring /// /// Taiko fails at the end of the map if the player has not half-filled their HP bar. /// - protected override bool FailCondition => Hits == MaxHits && Health.Value <= 0.5; + protected override bool DefaultFailCondition => Hits == MaxHits && Health.Value <= 0.5; private double hpIncreaseTick; private double hpIncreaseGreat; diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index cf7bf141c3..e7887c8fc4 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -11,14 +11,6 @@ namespace osu.Game.Rulesets.Mods public override string ShortenedName => "PF"; public override string Description => "SS or quit."; - public bool OnFailCheck(ScoreProcessor scoreProcessor) - { - return scoreProcessor.Accuracy.Value != 1; - } - - public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) - { - scoreProcessor.FailChecker += OnFailCheck; - } + protected override bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Accuracy.Value != 1; } } diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index 6675c41bd4..17350fdaa4 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -18,14 +18,11 @@ namespace osu.Game.Rulesets.Mods public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; - public bool OnFailCheck(ScoreProcessor scoreProcessor) + public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { - return scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; + scoreProcessor.FailConditions += FailCondition; } - public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) - { - scoreProcessor.FailChecker += OnFailCheck; - } + protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; } } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index c3ae887a9f..de8a510590 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -32,9 +32,9 @@ namespace osu.Game.Rulesets.Scoring public event Action NewJudgement; /// - /// Invoked when we want to check if a failure condition has been fulfilled + /// Additional conditions on top of that cause a failing state. /// - public event Func FailChecker; + public event Func FailConditions; /// /// The current total score. @@ -77,9 +77,9 @@ namespace osu.Game.Rulesets.Scoring public virtual bool HasFailed { get; private set; } /// - /// The conditions for failing. + /// The default conditions for failing. /// - protected virtual bool FailCondition => Health.Value == Health.MinValue; + protected virtual bool DefaultFailCondition => Health.Value == Health.MinValue; protected ScoreProcessor() { @@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (HasFailed || !FailCondition) + if (HasFailed || !DefaultFailCondition) return; if (Failed?.Invoke() != false) @@ -150,7 +150,7 @@ namespace osu.Game.Rulesets.Scoring if (HasFailed) return; - if (FailChecker?.Invoke(this) == true) + if (FailConditions?.Invoke(this) == true) { if (Failed?.Invoke() != false) HasFailed = true; From 18b9828c49548192048b84b74fcd35b515823c53 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 17:11:07 +0900 Subject: [PATCH 24/47] Merge UpdateFailed and CheckAlternateFailConditions --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index de8a510590..7b26e50dd8 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -126,7 +126,10 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (HasFailed || !DefaultFailCondition) + if (HasFailed) + return; + + if (!DefaultFailCondition && FailConditions?.Invoke(this) != true) return; if (Failed?.Invoke() != false) @@ -145,18 +148,6 @@ namespace osu.Game.Rulesets.Scoring AllJudged?.Invoke(); } - protected void CheckAlternateFailConditions() - { - if (HasFailed) - return; - - if (FailConditions?.Invoke(this) == true) - { - if (Failed?.Invoke() != false) - HasFailed = true; - } - } - /// /// Retrieve a score populated with data for the current play this processor is responsible for. /// @@ -233,8 +224,6 @@ namespace osu.Game.Rulesets.Scoring OnNewJudgement(judgement); updateScore(); - CheckAlternateFailConditions(); - NotifyNewJudgement(judgement); UpdateFailed(); } From fea56322f0aadcdb1b48a82f4836a47d268cd213 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 17:28:51 +0900 Subject: [PATCH 25/47] Fix SD not failing for the first note --- osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index 17350fdaa4..bc42c69cbe 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -23,6 +23,6 @@ namespace osu.Game.Rulesets.Mods scoreProcessor.FailConditions += FailCondition; } - protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; + protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0; } } From c30d31e03746efd290ca09ae82cd0701a3ce2e33 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 17:30:19 +0900 Subject: [PATCH 26/47] Remove extra alternateFailConditions function in Player --- osu.Game/Screens/Play/Player.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0bff13a46a..cd2818398d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -228,15 +228,8 @@ namespace osu.Game.Screens.Play scoreProcessor.AllJudged += onCompletion; scoreProcessor.Failed += onFail; - applyAlternateFailConditions(); - } - - private void applyAlternateFailConditions() - { - foreach(var mod in Beatmap.Value.Mods.Value.OfType()) - { - mod.ApplyToScoreProcessor(scoreProcessor); - } + foreach (var mod in Beatmap.Value.Mods.Value.OfType()) + mod.ApplyToScoreProcessor(scoreProcessor); } private void applyRateFromMods() From 0d1b5ae44f6f64529775d10fdd4adef5f5cf3d17 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 17:51:07 +0900 Subject: [PATCH 27/47] Adjust bottom bar sizing as suggested --- osu.Game/Screens/Edit/Editor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 52baadd442..e2971deb75 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -92,8 +92,9 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { + new Dimension(GridSizeMode.Absolute, 220), new Dimension(), - new Dimension(GridSizeMode.Relative, 0.65f), + new Dimension(GridSizeMode.Absolute, 220) }, Content = new[] { From 217554f587d40582ce51b2c5630c8a0e4402791d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 18:06:24 +0900 Subject: [PATCH 28/47] Remove redundant interface --- osu.Game/Rulesets/Mods/ModPerfect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index e7887c8fc4..59539d2b2c 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -5,7 +5,7 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { - public abstract class ModPerfect : ModSuddenDeath, IApplicableToScoreProcessor + public abstract class ModPerfect : ModSuddenDeath { public override string Name => "Perfect"; public override string ShortenedName => "PF"; From 41498ffad3f6b26b8ceb17696ec970ad8aa044c6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 21 Nov 2017 12:22:19 +0300 Subject: [PATCH 29/47] Apply suggestions --- .../Screens/Edit/Components/PlaybackContainer.cs | 14 +++----------- .../Screens/Edit/Components/TimeInfoContainer.cs | 9 +-------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index a88983e3e4..a7d1db4802 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -17,8 +17,6 @@ namespace osu.Game.Screens.Edit.Components { private readonly IconButton playButton; - private bool lastTrackState; - public PlaybackContainer() { PlaybackTabControl tabs; @@ -32,7 +30,7 @@ namespace osu.Game.Screens.Edit.Components Scale = new Vector2(1.4f), IconScale = new Vector2(1.4f), Icon = FontAwesome.fa_play_circle_o, - Action = play, + Action = playPause, Padding = new MarginPadding { Left = 20 } }, new OsuSpriteText @@ -61,7 +59,7 @@ namespace osu.Game.Screens.Edit.Components tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue; } - private void play() + private void playPause() { if (Track.IsRunning) Track.Stop(); @@ -73,13 +71,7 @@ namespace osu.Game.Screens.Edit.Components { base.Update(); - var currentTrackState = Track.IsRunning; - if (currentTrackState == lastTrackState) - return; - - playButton.Icon = currentTrackState ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; - - lastTrackState = currentTrackState; + playButton.Icon = Track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; } private class PlaybackTabControl : OsuTabControl diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 4a07ab4434..b9b6867ea6 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -12,7 +12,6 @@ namespace osu.Game.Screens.Edit.Components private const int count_duration = 150; private readonly OsuSpriteText trackTimer; - private double savedTime; public TimeInfoContainer() { @@ -33,13 +32,7 @@ namespace osu.Game.Screens.Edit.Components { base.Update(); - var currentTime = Track.CurrentTime; - - if (savedTime == currentTime) - return; - - trackTimer.Text = TimeSpan.FromMilliseconds(currentTime).ToString(@"mm\:ss\:fff"); - savedTime = currentTime; + trackTimer.Text = TimeSpan.FromMilliseconds(Track.CurrentTime).ToString(@"mm\:ss\:fff"); } } } From ca1814eb190c01a703821401a65be4b2a93ab7d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 18:38:54 +0900 Subject: [PATCH 30/47] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 14eb531c00..83925a8407 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 14eb531c0056b8569f21b3571890383ffbea768e +Subproject commit 83925a84072ec9da0d008c82256294b765321c0b From c2fcb2f9c7b31267acd3aadbd1cefa708107e148 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 18:45:12 +0900 Subject: [PATCH 31/47] Fix info wedge not displaying --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 391cfc20db..5ced60a9da 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -43,12 +43,6 @@ namespace osu.Game.Screens.Select }; } - protected override void LoadComplete() - { - base.LoadComplete(); - AlwaysPresent = true; - } - protected override bool BlockPassThroughMouse => false; protected override void PopIn() From aff217cd03a47b7e8245cff3806ea21204145c1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 19:47:12 +0900 Subject: [PATCH 32/47] Fix early access to beatmap in LogoVisualisation Missed this one.. --- osu.Game/Screens/Menu/LogoVisualisation.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 7c1b914bf5..5b86fd6ca3 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -86,11 +86,10 @@ namespace osu.Game.Screens.Menu private void updateAmplitudes() { var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null; + var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null; float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; - var effect = beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current); - for (int i = 0; i < bars_per_visualiser; i++) { if (track?.IsRunning ?? false) From 2603219350db896caf0b0a6b312df6394da3dba7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 22:27:56 +0900 Subject: [PATCH 33/47] Load beatmap carousel panels asynchronously --- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 54 +++++++++---------- osu.Game/Screens/Select/BeatmapCarousel.cs | 13 ++++- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 8a589ccd30..917376969b 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; @@ -28,10 +27,8 @@ namespace osu.Game.Beatmaps.Drawables public Action RestoreHiddenRequested; - private readonly SpriteText title; - private readonly SpriteText artist; - private readonly WorkingBeatmap beatmap; + private readonly FillFlowContainer difficultyIcons; public BeatmapSetHeader(WorkingBeatmap beatmap) @@ -41,6 +38,25 @@ namespace osu.Game.Beatmaps.Drawables this.beatmap = beatmap; + difficultyIcons = new FillFlowContainer + { + Margin = new MarginPadding { Top = 5 }, + AutoSizeAxes = Axes.Both, + }; + } + + protected override void Selected() + { + base.Selected(); + GainedSelection?.Invoke(this); + } + + [BackgroundDependencyLoader] + private void load(LocalisationEngine localisation) + { + if (localisation == null) + throw new ArgumentNullException(nameof(localisation)); + Children = new Drawable[] { new DelayedLoadWrapper( @@ -60,44 +76,26 @@ namespace osu.Game.Beatmaps.Drawables AutoSizeAxes = Axes.Both, Children = new Drawable[] { - title = new OsuSpriteText + new OsuSpriteText { Font = @"Exo2.0-BoldItalic", + Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title), TextSize = 22, Shadow = true, }, - artist = new OsuSpriteText + new OsuSpriteText { Font = @"Exo2.0-SemiBoldItalic", + Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist), TextSize = 17, Shadow = true, }, - difficultyIcons = new FillFlowContainer - { - Margin = new MarginPadding { Top = 5 }, - AutoSizeAxes = Axes.Both, - } + difficultyIcons } } }; } - protected override void Selected() - { - base.Selected(); - GainedSelection?.Invoke(this); - } - - [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) - { - if (localisation == null) - throw new ArgumentNullException(nameof(localisation)); - - title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); - artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); - } - private class PanelBackground : BufferedContainer { public PanelBackground(WorkingBeatmap working) @@ -185,4 +183,4 @@ namespace osu.Game.Beatmaps.Drawables } } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 452f8c484c..b0a636dfb3 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -572,7 +572,18 @@ namespace osu.Game.Screens.Select // Makes sure headers are always _below_ panels, // and depth flows downward. panel.Depth = i + (panel is BeatmapSetHeader ? panels.Count : 0); - scrollableContent.Add(panel); + + switch (panel.LoadState) + { + case LoadState.NotLoaded: + LoadComponentAsync(panel); + break; + case LoadState.Loading: + break; + default: + scrollableContent.Add(panel); + break; + } } } From 5e70b7a9f7633a8dfa3bbb48fa3936560d25db48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 11:50:24 +0900 Subject: [PATCH 34/47] Add async load methods for WorkingBeatmap properties --- osu.Game/Beatmaps/WorkingBeatmap.cs | 38 ++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 1d4ed75688..2a8178882e 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -8,6 +8,7 @@ using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; namespace osu.Game.Beatmaps { @@ -29,10 +30,10 @@ namespace osu.Game.Beatmaps Mods.ValueChanged += mods => applyRateAdjustments(); - beatmap = new Lazy(populateBeatmap); - background = new Lazy(populateBackground); - track = new Lazy(populateTrack); - waveform = new Lazy(populateWaveform); + beatmap = new AsyncLazy(populateBeatmap); + background = new AsyncLazy(populateBackground); + track = new AsyncLazy(populateTrack); + waveform = new AsyncLazy(populateWaveform); } protected abstract Beatmap GetBeatmap(); @@ -41,8 +42,10 @@ namespace osu.Game.Beatmaps protected virtual Waveform GetWaveform() => new Waveform(); public bool BeatmapLoaded => beatmap.IsValueCreated; - public Beatmap Beatmap => beatmap.Value; - private readonly Lazy beatmap; + public Beatmap Beatmap => beatmap.Value.Result; + public async Task GetBeatmapAsync() => await beatmap.Value; + + private readonly AsyncLazy beatmap; private Beatmap populateBeatmap() { @@ -55,14 +58,16 @@ namespace osu.Game.Beatmaps } public bool BackgroundLoaded => background.IsValueCreated; - public Texture Background => background.Value; - private Lazy background; + public Texture Background => background.Value.Result; + public async Task GetBackgroundAsync() => await background.Value; + private AsyncLazy background; private Texture populateBackground() => GetBackground(); public bool TrackLoaded => track.IsValueCreated; - public Track Track => track.Value; - private Lazy track; + public Track Track => track.Value.Result; + public async Task GetTrackAsync() => await track.Value; + private AsyncLazy track; private Track populateTrack() { @@ -73,8 +78,9 @@ namespace osu.Game.Beatmaps } public bool WaveformLoaded => waveform.IsValueCreated; - public Waveform Waveform => waveform.Value; - private readonly Lazy waveform; + public Waveform Waveform => waveform.Value.Result; + public async Task GetWaveformAsync() => await waveform.Value; + private readonly AsyncLazy waveform; private Waveform populateWaveform() => GetWaveform(); @@ -107,5 +113,13 @@ namespace osu.Game.Beatmaps foreach (var mod in Mods.Value.OfType()) mod.ApplyToClock(t); } + + public class AsyncLazy : Lazy> + { + public AsyncLazy(Func valueFactory) + : base(() => Task.Run(valueFactory)) + { + } + } } } From b3b1f2018e46a0123ce932be3c765e4ac55ce0dd Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 21 Nov 2017 15:13:00 +0100 Subject: [PATCH 35/47] Fix osu crashing if a invalid gamerule is given in the game.ini --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e603375e9c..4745733bd9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -109,7 +109,7 @@ namespace osu.Game dependencies.Cache(this); configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); - Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value); + Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; } From 63d366ea4b77941e61dc90abb0aa1748e7dd7e7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 10:54:33 +0900 Subject: [PATCH 36/47] Bindables should be readonly --- osu.Game/Screens/Edit/Components/BottomBarContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index d65355b5f4..0e57407928 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Components private const float corner_radius = 5; private const float contents_padding = 15; - public Bindable Beatmap = new Bindable(); + public readonly Bindable Beatmap = new Bindable(); protected Track Track => Beatmap.Value.Track; private readonly Drawable background; From 461c8e8be0805956eaa4a98c5f8f28512780c394 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 10:55:06 +0900 Subject: [PATCH 37/47] Clean up state change logic --- .../Edit/Components/PlaybackContainer.cs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index a7d1db4802..67478dd94c 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -128,32 +128,25 @@ namespace osu.Game.Screens.Edit.Components protected override bool OnHover(InputState state) { - if (!Active) - toBold(); + updateState(); return true; } protected override void OnHoverLost(InputState state) { - if (!Active) - toNormal(); + updateState(); } - private void toBold() + + private void updateState() { - text.FadeOut(fade_duration); - textBold.FadeIn(fade_duration); + text.FadeTo(Active || IsHovered ? 0 : 1, fade_duration); + textBold.FadeTo(Active || IsHovered ? 1 : 0, fade_duration); } - private void toNormal() - { - text.FadeIn(fade_duration); - textBold.FadeOut(fade_duration); - } + protected override void OnActivated() => updateState(); - protected override void OnActivated() => toBold(); - - protected override void OnDeactivated() => toNormal(); + protected override void OnDeactivated() => updateState(); } } } From c06d6d0bbb86bce8c116d6bf291f61d8b72a6dad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 10:59:31 +0900 Subject: [PATCH 38/47] Rename weird method --- osu.Game/Screens/Edit/Components/PlaybackContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index 67478dd94c..a133c88c84 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Components Scale = new Vector2(1.4f), IconScale = new Vector2(1.4f), Icon = FontAwesome.fa_play_circle_o, - Action = playPause, + Action = togglePause, Padding = new MarginPadding { Left = 20 } }, new OsuSpriteText @@ -59,7 +59,7 @@ namespace osu.Game.Screens.Edit.Components tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue; } - private void playPause() + private void togglePause() { if (Track.IsRunning) Track.Stop(); From 855acc9401c1ae3a36c3fbbe27b7f0d6d054b16e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 11:17:10 +0900 Subject: [PATCH 39/47] Fix leading space before percent sign --- osu.Game/Screens/Edit/Components/PlaybackContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index a133c88c84..0698d874a1 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -104,14 +104,14 @@ namespace osu.Game.Screens.Edit.Components { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Text = $"{value:P0}", + Text = $"{value:0%}", TextSize = 14, }, textBold = new OsuSpriteText { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Text = $"{value:P0}", + Text = $"{value:0%}", TextSize = 14, Font = @"Exo2.0-Bold", Alpha = 0, From ff5404e57f2489d7419ab6b8556796632d838773 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 11:21:48 +0900 Subject: [PATCH 40/47] Remove need for AlwaysPresent Also self-contains the tab options inside the tab control. --- .../Edit/Components/PlaybackContainer.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs index 0698d874a1..746052f2c2 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackContainer.cs @@ -1,12 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; +using System.Linq; using OpenTK; using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -52,10 +56,6 @@ namespace osu.Game.Screens.Edit.Components } }; - tabs.AddItem(0.25); - tabs.AddItem(0.75); - tabs.AddItem(1); - tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue; } @@ -76,6 +76,8 @@ namespace osu.Game.Screens.Edit.Components private class PlaybackTabControl : OsuTabControl { + private static double[] tempo_values = new [] { 0.5, 0.75, 1 }; + protected override TabItem CreateTabItem(double value) => new PlaybackTabItem(value); protected override Dropdown CreateDropdown() => null; @@ -83,7 +85,9 @@ namespace osu.Game.Screens.Edit.Components public PlaybackTabControl() { RelativeSizeAxes = Axes.Both; - TabContainer.Spacing = new Vector2(20, 0); + TabContainer.Spacing = Vector2.Zero; + + tempo_values.ForEach(AddItem); } public class PlaybackTabItem : TabItem @@ -95,8 +99,9 @@ namespace osu.Game.Screens.Edit.Components public PlaybackTabItem(double value) : base(value) { - AutoSizeAxes = Axes.X; - RelativeSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.Both; + + Width = 1f / tempo_values.Length; Children = new Drawable[] { @@ -115,7 +120,6 @@ namespace osu.Game.Screens.Edit.Components TextSize = 14, Font = @"Exo2.0-Bold", Alpha = 0, - AlwaysPresent = true, }, }; } From 0f8499c58027d5e675d85d4e47e487d6bffbd5c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 11:22:46 +0900 Subject: [PATCH 41/47] Rename to PlaybackControl and add a TestCase --- .../Visual/TestCasePlaybackControl.cs | 27 +++++++++++++++++++ osu.Game.Tests/osu.Game.Tests.csproj | 1 + ...laybackContainer.cs => PlaybackControl.cs} | 4 +-- osu.Game/Screens/Edit/Editor.cs | 4 +-- osu.Game/osu.Game.csproj | 2 +- 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCasePlaybackControl.cs rename osu.Game/Screens/Edit/Components/{PlaybackContainer.cs => PlaybackControl.cs} (95%) diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs new file mode 100644 index 0000000000..f5fb4b6032 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Screens.Edit.Components; +using osu.Game.Tests.Beatmaps; +using OpenTK; + +namespace osu.Game.Tests.Visual +{ + public class TestCasePlaybackControl : OsuTestCase + { + public TestCasePlaybackControl() + { + var playback = new PlaybackControl() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(200,100) + }; + playback.Beatmap.Value = new TestWorkingBeatmap(new Beatmap()); + + Add(playback); + } + } +} diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 974bde9319..9bba09b1a7 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -124,6 +124,7 @@ + diff --git a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs similarity index 95% rename from osu.Game/Screens/Edit/Components/PlaybackContainer.cs rename to osu.Game/Screens/Edit/Components/PlaybackControl.cs index 746052f2c2..5017d9e1a4 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackContainer.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -17,11 +17,11 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Components { - public class PlaybackContainer : BottomBarContainer + public class PlaybackControl : BottomBarContainer { private readonly IconButton playButton; - public PlaybackContainer() + public PlaybackControl() { PlaybackTabControl tabs; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index e2971deb75..607ff792d8 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Edit EditorMenuBar menuBar; TimeInfoContainer timeInfo; SummaryTimeline timeline; - PlaybackContainer playback; + PlaybackControl playback; Children = new[] { @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Edit { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 10 }, - Child = playback = new PlaybackContainer { RelativeSizeAxes = Axes.Both }, + Child = playback = new PlaybackControl { RelativeSizeAxes = Axes.Both }, } }, } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 048735358e..0752b31495 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -299,7 +299,7 @@ - + From 27fb5983525c73415a116b93d25cb0dac446ab12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 11:34:54 +0900 Subject: [PATCH 42/47] Update colours to match design --- .../Screens/Edit/Components/PlaybackControl.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 5017d9e1a4..56fca6bf9e 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Linq; using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; @@ -92,7 +93,7 @@ namespace osu.Game.Screens.Edit.Components public class PlaybackTabItem : TabItem { - private const float fade_duration = 100; + private const float fade_duration = 200; private readonly OsuSpriteText text; private readonly OsuSpriteText textBold; @@ -124,10 +125,14 @@ namespace osu.Game.Screens.Edit.Components }; } + private Color4 hoveredColour; + private Color4 normalColour; + [BackgroundDependencyLoader] private void load(OsuColour colours) { - text.Colour = colours.Gray5; + text.Colour = normalColour = colours.YellowDarker; + textBold.Colour = hoveredColour = colours.Yellow; } protected override bool OnHover(InputState state) @@ -144,8 +149,9 @@ namespace osu.Game.Screens.Edit.Components private void updateState() { - text.FadeTo(Active || IsHovered ? 0 : 1, fade_duration); - textBold.FadeTo(Active || IsHovered ? 1 : 0, fade_duration); + text.FadeColour(Active || IsHovered ? hoveredColour : normalColour, fade_duration, Easing.OutQuint); + text.FadeTo(Active ? 0 : 1, fade_duration, Easing.OutQuint); + textBold.FadeTo(Active ? 1 : 0, fade_duration, Easing.OutQuint); } protected override void OnActivated() => updateState(); From e3c5a599b6eba4057385397ba8beb3ff10abafad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 11:36:29 +0900 Subject: [PATCH 43/47] Tidy some regressions --- osu.Game.Tests/Visual/TestCasePlaybackControl.cs | 2 +- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs index f5fb4b6032..bd2b011dbc 100644 --- a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs +++ b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs @@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual { public TestCasePlaybackControl() { - var playback = new PlaybackControl() + var playback = new PlaybackControl { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 56fca6bf9e..bb814a0423 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -11,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; -using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -77,7 +74,7 @@ namespace osu.Game.Screens.Edit.Components private class PlaybackTabControl : OsuTabControl { - private static double[] tempo_values = new [] { 0.5, 0.75, 1 }; + private static readonly double[] tempo_values = { 0.5, 0.75, 1 }; protected override TabItem CreateTabItem(double value) => new PlaybackTabItem(value); From 36d45f633d65e38a0929ed577c8b28ec2786b4f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 11:57:09 +0900 Subject: [PATCH 44/47] Reorder methods --- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index bb814a0423..5ffa66c43e 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -138,11 +138,9 @@ namespace osu.Game.Screens.Edit.Components return true; } - protected override void OnHoverLost(InputState state) - { - updateState(); - } - + protected override void OnHoverLost(InputState state) => updateState(); + protected override void OnActivated() => updateState(); + protected override void OnDeactivated() => updateState(); private void updateState() { @@ -150,10 +148,6 @@ namespace osu.Game.Screens.Edit.Components text.FadeTo(Active ? 0 : 1, fade_duration, Easing.OutQuint); textBold.FadeTo(Active ? 1 : 0, fade_duration, Easing.OutQuint); } - - protected override void OnActivated() => updateState(); - - protected override void OnDeactivated() => updateState(); } } } From 757bb6911e6e7db4e4cbadaec7bb58858afc9780 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 12:06:31 +0900 Subject: [PATCH 45/47] Fix license header from wrong project --- osu.Game.Tests/Visual/TestCasePlaybackControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs index bd2b011dbc..ff59bb7bfd 100644 --- a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs +++ b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Game.Beatmaps; From 782a739370fbe9f02a0ad389397248caaab8bed9 Mon Sep 17 00:00:00 2001 From: Brayzure Date: Tue, 21 Nov 2017 23:00:00 -0500 Subject: [PATCH 46/47] Fix Results Screen After Failing Last Note Fixes a bug where if you failed on the last hitobject, the AllJudged event will have already been invoked. --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 7b26e50dd8..e129a81116 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -224,8 +224,8 @@ namespace osu.Game.Rulesets.Scoring OnNewJudgement(judgement); updateScore(); - NotifyNewJudgement(judgement); UpdateFailed(); + NotifyNewJudgement(judgement); } protected void RemoveJudgement(Judgement judgement) From e5dfe4ff2e3f75da2bc0a878ced26c7d23c4737d Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 22 Nov 2017 11:35:25 +0100 Subject: [PATCH 47/47] Make error more verbose when beatmap import fails (#1537) Add name of beatmap set to error message if import fails --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 006269f186..f461317ce1 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -165,7 +165,7 @@ namespace osu.Game.Beatmaps catch (Exception e) { e = e.InnerException ?? e; - Logger.Error(e, @"Could not import beatmap set"); + Logger.Error(e, $@"Could not import beatmap set ({Path.GetFileName(path)})"); } }