From 761d885167d1ea94db18c5798fe7746a954d0b55 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 3 Nov 2017 20:25:21 +0300 Subject: [PATCH 01/24] Add Favourite Beatmaps section in UserProfileOverlay --- .../API/Requests/GetUserBeatmapsRequest.cs | 30 +++++ .../Beatmaps/PaginatedBeatmapContainer.cs | 70 +++++++++++ .../Profile/Sections/BeatmapsSection.cs | 11 ++ .../Profile/Sections/HistoricalSection.cs | 2 +- .../Profile/Sections/PaginatedContainer.cs | 109 +++++++++++++++++ .../Sections/Ranks/PaginatedScoreContainer.cs | 111 +++--------------- .../Overlays/Profile/Sections/RanksSection.cs | 4 +- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 3 + 9 files changed, 242 insertions(+), 100 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs create mode 100644 osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs create mode 100644 osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs new file mode 100644 index 0000000000..8c243f899b --- /dev/null +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -0,0 +1,30 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests +{ + public class GetUserBeatmapsRequest : APIRequest> + { + private readonly long userId; + private readonly BeatmapSetType type; + private readonly int offset; + + public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0) + { + this.userId = userId; + this.type = type; + this.offset = offset; + } + + protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().ToLower()}?offset={offset}"; + } + + public enum BeatmapSetType + { + Most_Played, + Favourite, + Ranked_And_Approved + } +} diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs new file mode 100644 index 0000000000..1a1442979f --- /dev/null +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -0,0 +1,70 @@ +// 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.Configuration; +using osu.Framework.Graphics; +using osu.Game.Online.API.Requests; +using osu.Game.Overlays.Direct; +using osu.Game.Users; +using System.Linq; + +namespace osu.Game.Overlays.Profile.Sections.Beatmaps +{ + public class PaginatedBeatmapContainer : PaginatedContainer + { + private const float panel_padding = 10f; + + private readonly BeatmapSetType type; + private string header; + + private DirectPanel playing; + + public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, string header, string missing) + : base(user, header, missing) + { + this.type = type; + this.header = header; + + ItemsPerPage = 6; + + ItemsContainer.Spacing = new Vector2(panel_padding); + ItemsContainer.Margin = new MarginPadding { Bottom = panel_padding }; + } + + protected override void ShowMore() + { + base.ShowMore(); + + var req = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage); + + req.Success += sets => + { + ShowMoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0); + ShowMoreLoading.Hide(); + + if (!sets.Any()) return; + + MissingText.Hide(); + + foreach (var s in sets) + { + var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets)) { Width = 400 }; + ItemsContainer.Add(panel); + + panel.PreviewPlaying.ValueChanged += newValue => + { + if (newValue) + { + if (playing != null && playing != panel) + playing.PreviewPlaying.Value = false; + playing = panel; + } + }; + } + }; + + Api.Queue(req); + } + } +} diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 1c39223e6f..48c8c69922 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Online.API.Requests; +using osu.Game.Overlays.Profile.Sections.Beatmaps; + namespace osu.Game.Overlays.Profile.Sections { public class BeatmapsSection : ProfileSection @@ -8,5 +11,13 @@ namespace osu.Game.Overlays.Profile.Sections public override string Title => "Beatmaps"; public override string Identifier => "beatmaps"; + + public BeatmapsSection() + { + Children = new[] + { + new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps", "None... yet."), + }; + } } } diff --git a/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs b/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs index d25407f4a3..a4d043d20a 100644 --- a/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs +++ b/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs @@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Profile.Sections public HistoricalSection() { - Child = new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)"); + Child = new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)", "No performance records. :("); } } } diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs new file mode 100644 index 0000000000..d0ccf6af41 --- /dev/null +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -0,0 +1,109 @@ +// 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.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; +using osu.Game.Rulesets; +using osu.Game.Users; + +namespace osu.Game.Overlays.Profile.Sections +{ + public class PaginatedContainer : FillFlowContainer + { + protected readonly FillFlowContainer ItemsContainer; + protected readonly OsuHoverContainer ShowMoreButton; + protected readonly LoadingAnimation ShowMoreLoading; + protected readonly OsuSpriteText MissingText; + + protected int VisiblePages; + protected int ItemsPerPage; + + protected readonly Bindable User = new Bindable(); + + protected APIAccess Api; + protected RulesetStore Rulesets; + + public PaginatedContainer(Bindable user, string header, string missing) + { + User.BindTo(user); + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + + Children = new Drawable[] + { + new OsuSpriteText + { + TextSize = 15, + Text = header, + Font = "Exo2.0-RegularItalic", + Margin = new MarginPadding { Top = 10, Bottom = 10 }, + }, + ItemsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + ShowMoreButton = new OsuHoverContainer + { + Alpha = 0, + Action = ShowMore, + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Child = new OsuSpriteText + { + TextSize = 14, + Text = "show more", + } + }, + ShowMoreLoading = new LoadingAnimation + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Size = new Vector2(14), + }, + MissingText = new OsuSpriteText + { + TextSize = 14, + Text = missing + }, + }; + } + + [BackgroundDependencyLoader] + private void load(APIAccess api, RulesetStore rulesets) + { + Api = api; + Rulesets = rulesets; + + User.ValueChanged += onUserChanged; + User.TriggerChange(); + } + + private void onUserChanged(User newUser) + { + VisiblePages = 0; + ItemsContainer.Clear(); + ShowMoreButton.Hide(); + MissingText.Show(); + + if (newUser != null) + ShowMore(); + } + + protected virtual void ShowMore() + { + ShowMoreLoading.Show(); + ShowMoreButton.Hide(); + } + } +} diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 060bb03014..4c2bea4554 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -1,130 +1,49 @@ // 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.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Rulesets; using osu.Game.Users; using System; using System.Linq; namespace osu.Game.Overlays.Profile.Sections.Ranks { - public class PaginatedScoreContainer : FillFlowContainer + public class PaginatedScoreContainer : PaginatedContainer { - private readonly FillFlowContainer scoreContainer; - private readonly OsuSpriteText missing; - private readonly OsuHoverContainer showMoreButton; - private readonly LoadingAnimation showMoreLoading; - private readonly bool includeWeight; private readonly ScoreType type; - private int visiblePages; - private readonly Bindable user = new Bindable(); - - private RulesetStore rulesets; - private APIAccess api; - - public PaginatedScoreContainer(ScoreType type, Bindable user, string header, bool includeWeight = false) + public PaginatedScoreContainer(ScoreType type, Bindable user, string header, string missing, bool includeWeight = false) + : base(user, header, missing) { this.type = type; this.includeWeight = includeWeight; - this.user.BindTo(user); - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; + ItemsPerPage = 5; - Children = new Drawable[] - { - new OsuSpriteText - { - TextSize = 15, - Text = header, - Font = "Exo2.0-RegularItalic", - Margin = new MarginPadding { Top = 10, Bottom = 10 }, - }, - scoreContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - }, - showMoreButton = new OsuHoverContainer - { - Alpha = 0, - Action = showMore, - AutoSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Child = new OsuSpriteText - { - TextSize = 14, - Text = "show more", - } - }, - showMoreLoading = new LoadingAnimation - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Size = new Vector2(14), - }, - missing = new OsuSpriteText - { - TextSize = 14, - Text = type == ScoreType.Recent ? "No performance records. :(" : "No awesome performance records yet. :(", - }, - }; + ItemsContainer.Direction = FillDirection.Vertical; } - [BackgroundDependencyLoader] - private void load(APIAccess api, RulesetStore rulesets) + protected override void ShowMore() { - this.api = api; - this.rulesets = rulesets; + base.ShowMore(); - user.ValueChanged += user_ValueChanged; - user.TriggerChange(); - } - - private void user_ValueChanged(User newUser) - { - visiblePages = 0; - scoreContainer.Clear(); - showMoreButton.Hide(); - missing.Show(); - - if (newUser != null) - showMore(); - } - - private void showMore() - { - var req = new GetUserScoresRequest(user.Value.Id, type, visiblePages++ * 5); - - showMoreLoading.Show(); - showMoreButton.Hide(); + var req = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage); req.Success += scores => { foreach (var s in scores) - s.ApplyRuleset(rulesets.GetRuleset(s.OnlineRulesetID)); + s.ApplyRuleset(Rulesets.GetRuleset(s.OnlineRulesetID)); - showMoreButton.FadeTo(scores.Count == 5 ? 1 : 0); - showMoreLoading.Hide(); + ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0); + ShowMoreLoading.Hide(); if (!scores.Any()) return; - missing.Hide(); + MissingText.Hide(); foreach (OnlineScore score in scores) { @@ -133,7 +52,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks switch (type) { default: - drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null); + drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null); break; case ScoreType.Recent: drawableScore = new DrawableTotalScore(score); @@ -143,11 +62,11 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks drawableScore.RelativeSizeAxes = Axes.X; drawableScore.Height = 60; - scoreContainer.Add(drawableScore); + ItemsContainer.Add(drawableScore); } }; - api.Queue(req); + Api.Queue(req); } } } diff --git a/osu.Game/Overlays/Profile/Sections/RanksSection.cs b/osu.Game/Overlays/Profile/Sections/RanksSection.cs index 553691ef77..7691100d7a 100644 --- a/osu.Game/Overlays/Profile/Sections/RanksSection.cs +++ b/osu.Game/Overlays/Profile/Sections/RanksSection.cs @@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections { Children = new[] { - new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", true), - new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks"), + new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :(", true), + new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", "No awesome performance records yet. :("), }; } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 5032f2d55b..66d8071dd0 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -96,7 +96,7 @@ namespace osu.Game.Overlays new RanksSection(), //new MedalsSection(), new HistoricalSection(), - //new BeatmapsSection(), + new BeatmapsSection(), //new KudosuSection() }; tabs = new ProfileTabControl diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index db27c77188..2388ec4cc2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -279,6 +279,9 @@ + + + From 48c39b1d19ec9ffb2362641e48dd03f155b49268 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 4 Nov 2017 00:53:58 +0300 Subject: [PATCH 02/24] Add "Ranked & Approved Beatmaps" section --- osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 48c8c69922..708487b8e2 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -17,6 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections Children = new[] { new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps", "None... yet."), + new PaginatedBeatmapContainer(BeatmapSetType.Ranked_And_Approved, User, "Ranked & Approved Beatmaps", "None... yet."), }; } } From 729777a7e0d38e815291d51cb19fa405cc55bacd Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 4 Nov 2017 18:38:02 +0300 Subject: [PATCH 03/24] Remove useless variable --- .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 1a1442979f..f15798864f 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps private const float panel_padding = 10f; private readonly BeatmapSetType type; - private string header; private DirectPanel playing; @@ -24,7 +23,6 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps : base(user, header, missing) { this.type = type; - this.header = header; ItemsPerPage = 6; From ebaef864324c2f630443124c20fa8748ebf486ca Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 6 Nov 2017 21:28:01 +0300 Subject: [PATCH 04/24] Fix hard crash when opening beatmap with zero playcount in beatmap overlay --- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index 9402ed82f4..e22ec3c70c 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -29,7 +29,10 @@ namespace osu.Game.Overlays.BeatmapSet if (value == beatmap) return; beatmap = value; - var rate = (float)beatmap.OnlineInfo.PassCount / beatmap.OnlineInfo.PlayCount; + int passCount = beatmap.OnlineInfo.PassCount; + int playCount = beatmap.OnlineInfo.PlayCount; + + var rate = (playCount != 0) ? (float)passCount / playCount : 0; successPercent.Text = rate.ToString("P0"); successRate.Length = rate; percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic); From b8b5c67cd2502bbe25a3b90f8f5b501d4274aa5c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 6 Nov 2017 21:46:28 +0300 Subject: [PATCH 05/24] Apply suggestion concerning the BeatmapSetType enum --- .../API/Requests/GetUserBeatmapsRequest.cs | 22 ++++++++++++++----- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 2 +- .../Profile/Sections/BeatmapsSection.cs | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 8c243f899b..7ad3c32bed 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -8,23 +8,35 @@ namespace osu.Game.Online.API.Requests public class GetUserBeatmapsRequest : APIRequest> { private readonly long userId; - private readonly BeatmapSetType type; private readonly int offset; + private readonly string type; public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0) { this.userId = userId; - this.type = type; this.offset = offset; + + switch (type) + { + case BeatmapSetType.Favourite: + this.type = type.ToString().ToLower(); + break; + case BeatmapSetType.MostPlayed: + this.type = "most_played"; + break; + case BeatmapSetType.RankedAndApproved: + this.type = "ranked_and_approved"; + break; + } } - protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().ToLower()}?offset={offset}"; + protected override string Target => $@"users/{userId}/beatmapsets/{type}?offset={offset}"; } public enum BeatmapSetType { - Most_Played, + MostPlayed, Favourite, - Ranked_And_Approved + RankedAndApproved } } diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index e22ec3c70c..6df31b9f85 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet int passCount = beatmap.OnlineInfo.PassCount; int playCount = beatmap.OnlineInfo.PlayCount; - var rate = (playCount != 0) ? (float)passCount / playCount : 0; + var rate = playCount != 0 ? (float)passCount / playCount : 0; successPercent.Text = rate.ToString("P0"); successRate.Length = rate; percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic); diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 708487b8e2..f55de9b83f 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections Children = new[] { new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps", "None... yet."), - new PaginatedBeatmapContainer(BeatmapSetType.Ranked_And_Approved, User, "Ranked & Approved Beatmaps", "None... yet."), + new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps", "None... yet."), }; } } From 5d846bff7baf34c03dec78c1305775fa3e760563 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 6 Nov 2017 22:05:04 +0300 Subject: [PATCH 06/24] Add (temporarily?) subrequest for each item to provide correct beatmap information --- .../Beatmaps/PaginatedBeatmapContainer.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index f15798864f..9b623a3db9 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -47,18 +47,24 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps foreach (var s in sets) { - var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets)) { Width = 400 }; - ItemsContainer.Add(panel); - - panel.PreviewPlaying.ValueChanged += newValue => + var subReq = new GetBeatmapSetRequest(s.OnlineBeatmapSetID.Value); + subReq.Success += b => { - if (newValue) + var panel = new DirectGridPanel(b.ToBeatmapSet(Rulesets)) { Width = 400 }; + ItemsContainer.Add(panel); + + panel.PreviewPlaying.ValueChanged += newValue => { - if (playing != null && playing != panel) - playing.PreviewPlaying.Value = false; - playing = panel; - } + if (newValue) + { + if (playing != null && playing != panel) + playing.PreviewPlaying.Value = false; + playing = panel; + } + }; }; + + Api.Queue(subReq); } }; From a12052ac51b11cb623a3362fcbfb4e4db1e7f908 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 6 Nov 2017 22:18:37 +0300 Subject: [PATCH 07/24] CI fix --- .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 9b623a3db9..2ac7a29177 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -47,6 +47,9 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps foreach (var s in sets) { + if (!s.OnlineBeatmapSetID.HasValue) + continue; + var subReq = new GetBeatmapSetRequest(s.OnlineBeatmapSetID.Value); subReq.Success += b => { From a46dbee5325e0c98f5e2aa8d43dc9964c562db6d Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 12:38:10 +0300 Subject: [PATCH 08/24] Add Humanizer package --- .../API/Requests/GetUserBeatmapsRequest.cs | 19 ++------- osu.Game/osu.Game.csproj | 3 ++ osu.Game/packages.config | 42 +++++++++++++++++++ 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 7ad3c32bed..66b2cae892 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Humanizer; using System.Collections.Generic; namespace osu.Game.Online.API.Requests @@ -9,28 +10,16 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; private readonly int offset; - private readonly string type; + private readonly BeatmapSetType type; public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0) { this.userId = userId; this.offset = offset; - - switch (type) - { - case BeatmapSetType.Favourite: - this.type = type.ToString().ToLower(); - break; - case BeatmapSetType.MostPlayed: - this.type = "most_played"; - break; - case BeatmapSetType.RankedAndApproved: - this.type = "ranked_and_approved"; - break; - } + this.type = type; } - protected override string Target => $@"users/{userId}/beatmapsets/{type}?offset={offset}"; + protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}"; } public enum BeatmapSetType diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2388ec4cc2..ef2e573443 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -88,6 +88,9 @@ $(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll True + + ..\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll + $(SolutionDir)\packages\Microsoft.Data.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll diff --git a/osu.Game/packages.config b/osu.Game/packages.config index ae7b74ef16..02ace918de 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -5,6 +5,48 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From edeeefea3b85808bc48e41456e226d213a46eb48 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 8 Nov 2017 20:42:24 +0300 Subject: [PATCH 09/24] Fix missing text has been shown before api request has been completed --- .../Sections/Beatmaps/PaginatedBeatmapContainer.cs | 8 +++++--- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 4 ++-- .../Profile/Sections/Ranks/PaginatedScoreContainer.cs | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 2ac7a29177..2607585573 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -41,9 +41,11 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps ShowMoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0); ShowMoreLoading.Hide(); - if (!sets.Any()) return; - - MissingText.Hide(); + if (!sets.Any()) + { + MissingText.Show(); + return; + } foreach (var s in sets) { diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index d0ccf6af41..b75d1bc4d6 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -74,7 +74,8 @@ namespace osu.Game.Overlays.Profile.Sections MissingText = new OsuSpriteText { TextSize = 14, - Text = missing + Text = missing, + Alpha = 0, }, }; } @@ -94,7 +95,6 @@ namespace osu.Game.Overlays.Profile.Sections VisiblePages = 0; ItemsContainer.Clear(); ShowMoreButton.Hide(); - MissingText.Show(); if (newUser != null) ShowMore(); diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 4c2bea4554..eab708f978 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -41,7 +41,11 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0); ShowMoreLoading.Hide(); - if (!scores.Any()) return; + if (!scores.Any()) + { + MissingText.Show(); + return; + } MissingText.Hide(); From c9353e37950ca5268d6f2ffa26495d0a3b49fc3b Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 9 Nov 2017 15:49:17 +0300 Subject: [PATCH 10/24] Fix humanizer package path --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ab8112504d..97d2879ae0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -89,7 +89,7 @@ True - ..\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll + $(SolutionDir)\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll $(SolutionDir)\packages\Microsoft.Data.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll From a9b58a2ad24d3e08b43628c691c459091e0946a5 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 9 Nov 2017 17:12:06 +0300 Subject: [PATCH 11/24] Drawable score visual improvements --- .../Ranks/DrawablePerformanceScore.cs | 2 +- .../Profile/Sections/Ranks/DrawableScore.cs | 142 +++++++++++++----- .../Sections/Ranks/DrawableTotalScore.cs | 2 +- .../Sections/Ranks/PaginatedScoreContainer.cs | 3 - osu.Game/Overlays/UserProfileOverlay.cs | 2 +- 5 files changed, 110 insertions(+), 41 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs index 0380b6c4b7..e6ba5b26ac 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks } [BackgroundDependencyLoader] - private new void load(OsuColour colour) + private void load(OsuColour colour) { double pp = Score.PP ?? 0; Stats.Add(new OsuSpriteText diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs index 91f5650b92..4fc15a202b 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Select.Leaderboards; @@ -15,66 +14,113 @@ using System.Linq; using osu.Framework.Localisation; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; +using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Input; +using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Profile.Sections.Ranks { public abstract class DrawableScore : Container { + private const int fade_duration = 200; + protected readonly FillFlowContainer Stats; private readonly FillFlowContainer metadata; private readonly ModContainer modContainer; protected readonly Score Score; + private readonly Box underscoreLine; + private readonly Box coloredBackground; + private readonly Container background; protected DrawableScore(Score score) { Score = score; + RelativeSizeAxes = Axes.X; + Height = 60; Children = new Drawable[] { - new DrawableRank(score.Rank) + background = new Container { - RelativeSizeAxes = Axes.Y, - Width = 60, - FillMode = FillMode.Fit, - }, - Stats = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Direction = FillDirection.Vertical, - }, - metadata = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding { Left = 70 }, - Direction = FillDirection.Vertical, - Child = new OsuSpriteText + RelativeSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 3, + Alpha = 0, + EdgeEffect = new EdgeEffectParameters { - Text = score.Date.LocalDateTime.ToShortDateString(), - TextSize = 11, - Colour = OsuColour.Gray(0xAA), - Depth = -1, + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0f, 1f), + Radius = 1f, + Colour = Color4.Black.Opacity(0.2f), }, + Child = coloredBackground = new Box { RelativeSizeAxes = Axes.Both } }, - modContainer = new ModContainer + new Container { - AutoSizeAxes = Axes.Y, - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Width = 60, - Margin = new MarginPadding { Right = 150 } - } + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Width = 0.97f, + Children = new Drawable[] + { + underscoreLine = new Box + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = 1, + }, + new DrawableRank(score.Rank) + { + RelativeSizeAxes = Axes.Y, + Width = 60, + FillMode = FillMode.Fit, + }, + Stats = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Direction = FillDirection.Vertical, + }, + metadata = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding { Left = 70 }, + Direction = FillDirection.Vertical, + Child = new OsuSpriteText + { + Text = score.Date.LocalDateTime.ToShortDateString(), + TextSize = 11, + Colour = OsuColour.Gray(0xAA), + Depth = -1, + }, + }, + modContainer = new ModContainer + { + AutoSizeAxes = Axes.Y, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Width = 60, + Margin = new MarginPadding { Right = 160 } + } + } + }, }; } [BackgroundDependencyLoader(true)] private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) { + coloredBackground.Colour = underscoreLine.Colour = colour.Gray4; + Stats.Add(new OsuSpriteText { Text = $"accuracy: {Score.Accuracy:P2}", @@ -86,7 +132,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Depth = -1, }); - metadata.Add(new OsuHoverContainer + metadata.Add(new MetadataContainer(Score.Beatmap.Metadata.Title, Score.Beatmap.Metadata.Artist) { AutoSizeAxes = Axes.Both, Action = () => @@ -126,6 +172,22 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks }); } + protected override bool OnClick(InputState state) => true; + + protected override bool OnHover(InputState state) + { + background.FadeIn(fade_duration, Easing.OutQuint); + underscoreLine.FadeOut(fade_duration, Easing.OutQuint); + return true; + } + + protected override void OnHoverLost(InputState state) + { + background.FadeOut(fade_duration, Easing.OutQuint); + underscoreLine.FadeIn(fade_duration, Easing.OutQuint); + base.OnHoverLost(state); + } + private class ModContainer : FlowContainer { protected override IEnumerable ComputeLayoutPositions() @@ -135,5 +197,15 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks yield return new Vector2(DrawWidth * i * (count == 1 ? 0 : 1f / (count - 1)), 0); } } + + private class MetadataContainer : OsuHoverContainer, IHasTooltip + { + public string TooltipText { get; set; } + + public MetadataContainer(string title, string artist) + { + TooltipText = $"{artist} - {title}"; + } + } } } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs index 7aa9d75f02..537b208b39 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks } [BackgroundDependencyLoader] - private new void load() + private void load() { Stats.Add(new OsuSpriteText { diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 060bb03014..bab78b52fd 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -140,9 +140,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks break; } - drawableScore.RelativeSizeAxes = Axes.X; - drawableScore.Height = 60; - scoreContainer.Add(drawableScore); } }; diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 5032f2d55b..32c8a83b02 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -91,7 +91,7 @@ namespace osu.Game.Overlays sections = new ProfileSection[] { - new AboutSection(), + //new AboutSection(), //new RecentSection(), new RanksSection(), //new MedalsSection(), From ae9b7518e00bc3018577327079b0eabd603ee63a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 Nov 2017 21:07:14 +0900 Subject: [PATCH 12/24] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 36fad894f0..47aabeaee5 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 36fad894f0657d0fdc998ffd3f2f3fa87e45d67d +Subproject commit 47aabeaee5a8d85a0e6769fd601736f8dc1eb051 From 11077546d1404ae28c51358dde32fbbbc9e43945 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 Nov 2017 15:59:11 +0900 Subject: [PATCH 13/24] Load logo async --- osu.Game/Screens/OsuScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 3dd175ca88..25c159ed40 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -118,7 +118,7 @@ namespace osu.Game.Screens } if ((logo = lastOsu?.logo) == null) - AddInternal(logo = new OsuLogo()); + LoadComponentAsync(logo = new OsuLogo(), AddInternal); base.OnEntering(last); From ec758379659e83226a63b747173e2cd17fc03205 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 13 Nov 2017 05:04:21 +0300 Subject: [PATCH 14/24] Replay speed setting visual improvements --- .../Play/ReplaySettings/PlaybackSettings.cs | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index bf2909b8ab..8aaf5b5711 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -3,6 +3,9 @@ using osu.Framework.Timing; using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.ReplaySettings { @@ -13,19 +16,43 @@ namespace osu.Game.Screens.Play.ReplaySettings public IAdjustableClock AdjustableClock { set; get; } private readonly ReplaySliderBar sliderbar; + private readonly OsuSpriteText multiplierText; public PlaybackSettings() { - Child = sliderbar = new ReplaySliderBar + Children = new Drawable[] { - LabelText = "Playback speed", - Bindable = new BindableDouble(1) + new Container { - Default = 1, - MinValue = 0.5, - MaxValue = 2, - Precision = 0.01, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "Playback speed", + }, + multiplierText = new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = "1x", + Font = @"Exo2.0-Bold", + } + }, }, + sliderbar = new ReplaySliderBar + { + Bindable = new BindableDouble(1) + { + Default = 1, + MinValue = 0.5, + MaxValue = 2, + Precision = 0.01, + }, + } }; } @@ -37,7 +64,11 @@ namespace osu.Game.Screens.Play.ReplaySettings return; var clockRate = AdjustableClock.Rate; - sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier; + sliderbar.Bindable.ValueChanged += rateMultiplier => + { + AdjustableClock.Rate = clockRate * rateMultiplier; + multiplierText.Text = $"{rateMultiplier}x"; + }; } } } From 89e9f847532d0a8283fada2f568d49b616574a2d Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 13 Nov 2017 05:52:05 +0300 Subject: [PATCH 15/24] Add padding to the text container --- .../Screens/Play/ReplaySettings/PlaybackSettings.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 8aaf5b5711..71526d72ef 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -11,6 +11,8 @@ namespace osu.Game.Screens.Play.ReplaySettings { public class PlaybackSettings : ReplayGroup { + private const int padding = 10; + protected override string Title => @"playback"; public IAdjustableClock AdjustableClock { set; get; } @@ -26,6 +28,7 @@ namespace osu.Game.Screens.Play.ReplaySettings { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = padding }, Children = new Drawable[] { new OsuSpriteText @@ -54,6 +57,8 @@ namespace osu.Game.Screens.Play.ReplaySettings }, } }; + + sliderbar.Bindable.ValueChanged += rateMultiplier => multiplierText.Text = $"{rateMultiplier}x"; } protected override void LoadComplete() @@ -64,11 +69,7 @@ namespace osu.Game.Screens.Play.ReplaySettings return; var clockRate = AdjustableClock.Rate; - sliderbar.Bindable.ValueChanged += rateMultiplier => - { - AdjustableClock.Rate = clockRate * rateMultiplier; - multiplierText.Text = $"{rateMultiplier}x"; - }; + sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier; } } } From 51adea2a604350e7b66f7dad4c70406a57308ae4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 13 Nov 2017 05:58:19 +0300 Subject: [PATCH 16/24] Convert text to a local variable --- osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 71526d72ef..3109552532 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -18,10 +18,11 @@ namespace osu.Game.Screens.Play.ReplaySettings public IAdjustableClock AdjustableClock { set; get; } private readonly ReplaySliderBar sliderbar; - private readonly OsuSpriteText multiplierText; public PlaybackSettings() { + OsuSpriteText multiplierText; + Children = new Drawable[] { new Container From e006090c5b26bfc26c9569b2eeaaaabaabf3cff5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Nov 2017 13:13:43 +0900 Subject: [PATCH 17/24] Fix SpriteIcon loading textures on the update thread --- osu.Game/Graphics/SpriteIcon.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index d4f9127d54..ca108bfa7a 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -57,11 +57,6 @@ namespace osu.Game.Graphics private void load(FontStore store) { this.store = store; - } - - protected override void LoadComplete() - { - base.LoadComplete(); updateTexture(); } From 8adf0a6db32ede8350df91963cf67d50818f0283 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Nov 2017 13:58:44 +0900 Subject: [PATCH 18/24] Null-check in disposal of DatabasedKeyBindingInputManager --- osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs b/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs index 6dedf7385b..bae14fc1dc 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs @@ -51,7 +51,9 @@ namespace osu.Game.Input.Bindings protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - store.KeyBindingChanged -= ReloadMappings; + + if (store != null) + store.KeyBindingChanged -= ReloadMappings; } protected override void ReloadMappings() => KeyBindings = store.Query(ruleset?.ID, variant).ToList(); From ae8407a3f370d5c7df52c90d54f2b71ff98c36cf Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Nov 2017 14:00:35 +0900 Subject: [PATCH 19/24] Fix nested hitobject judgements not being removed --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 1 + osu.Game/Rulesets/UI/RulesetContainer.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 091af04106..941cedca3f 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -212,6 +212,7 @@ namespace osu.Game.Rulesets.Objects.Drawables nestedHitObjects = new List>(); h.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j); + h.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(d, j); nestedHitObjects.Add(h); } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 36dce7218d..278814ea7e 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -242,7 +242,7 @@ namespace osu.Game.Rulesets.UI OnJudgement?.Invoke(j); }; - drawableObject.OnJudgementRemoved += (d, j) => { OnJudgementRemoved?.Invoke(j); }; + drawableObject.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(j); Playfield.Add(drawableObject); } From 0cec51110acbb2aa61cdd49489f0e3b5f5f50ceb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Nov 2017 17:52:16 +0900 Subject: [PATCH 20/24] Fix replay clock always running 1 frame behind * Fixes swells never completing. * Fixes forward playback missing notes every now and then. * Probably more stuff. --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 0419070b42..ddce60d819 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -148,6 +148,7 @@ namespace osu.Game.Rulesets.UI } clock.CurrentTime = newTime.Value; + Clock.ProcessFrame(); } requireMoreUpdateLoops = clock.CurrentTime != parentClock.CurrentTime; From 49a5af60e2fdfe15e60fa69feaf0cc5a03a1e1f5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Nov 2017 18:43:05 +0900 Subject: [PATCH 21/24] Fix multiple order-of-execution issues with osu! logo Also sets better defaults. --- osu.Game/Screens/Loader.cs | 7 +------ osu.Game/Screens/Menu/Intro.cs | 2 -- osu.Game/Screens/Menu/MainMenu.cs | 3 --- osu.Game/Screens/Menu/OsuLogo.cs | 24 ++++++++++++++++++++++++ osu.Game/Screens/OsuScreen.cs | 19 +++++++++++-------- osu.Game/Screens/Play/PlayerLoader.cs | 1 - osu.Game/Screens/Select/SongSelect.cs | 2 -- 7 files changed, 36 insertions(+), 22 deletions(-) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 3afaa02824..ca541ea552 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -24,7 +24,6 @@ namespace osu.Game.Screens { base.LogoArriving(logo, resuming); - logo.RelativePositionAxes = Axes.None; logo.Triangles = false; logo.Origin = Anchor.BottomRight; logo.Anchor = Anchor.BottomRight; @@ -47,11 +46,7 @@ namespace osu.Game.Screens protected override void LogoSuspending(OsuLogo logo) { base.LogoSuspending(logo); - logo.FadeOut(100).OnComplete(l => - { - l.Anchor = Anchor.TopLeft; - l.Origin = Anchor.Centre; - }); + logo.FadeOut(100); } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 0445733b23..0cb343c1ac 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -127,8 +127,6 @@ namespace osu.Game.Screens.Menu if (!resuming) { - logo.Triangles = true; - logo.ScaleTo(1); logo.FadeIn(); logo.PlayIntro(); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index b0170edfe1..90f68ba9f1 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -112,9 +112,6 @@ namespace osu.Game.Screens.Menu buttons.SetOsuLogo(logo); - logo.Triangles = true; - logo.Ripple = false; - logo.FadeColour(Color4.White, 100, Easing.OutQuint); logo.FadeIn(100, Easing.OutQuint); diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index dccb910d86..fb8e755b61 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -221,6 +221,30 @@ namespace osu.Game.Screens.Menu }; } + /// + /// Schedule a new extenral animation. Handled queueing and finishing previous animations in a sane way. + /// + /// The animation to be performed + /// If true, the new animation is delayed until all previous transforms finish. If false, existing transformed are cleared. + internal void AppendAnimatingAction(Action action, bool waitForPrevious) + { + Action runnableAction = () => + { + if (waitForPrevious) + this.DelayUntilTransformsFinished().Schedule(action); + else + { + ClearTransforms(); + action(); + } + }; + + if (IsLoaded) + runnableAction(); + else + Schedule(() => runnableAction()); + } + [BackgroundDependencyLoader] private void load(TextureStore textures, AudioManager audio) { diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 25c159ed40..f5ff9ea036 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens protected override void OnResuming(Screen last) { base.OnResuming(last); - logo.DelayUntilTransformsFinished().Schedule(() => LogoArriving(logo, true)); + logo.AppendAnimatingAction(() => LogoArriving(logo, true), true); sampleExit?.Play(); } @@ -118,11 +118,11 @@ namespace osu.Game.Screens } if ((logo = lastOsu?.logo) == null) - LoadComponentAsync(logo = new OsuLogo(), AddInternal); + LoadComponentAsync(logo = new OsuLogo { Alpha = 0 }, AddInternal); + + logo.AppendAnimatingAction(() => LogoArriving(logo, false), true); base.OnEntering(last); - - logo.DelayUntilTransformsFinished().Schedule(() => LogoArriving(logo, false)); } protected override bool OnExiting(Screen next) @@ -155,12 +155,16 @@ namespace osu.Game.Screens { logo.Action = null; logo.FadeOut(300, Easing.OutQuint); + logo.Anchor = Anchor.TopLeft; + logo.Origin = Anchor.Centre; + logo.RelativePositionAxes = Axes.None; + logo.Triangles = true; + logo.Ripple = true; } private void onExitingLogo() { - logo.ClearTransforms(); - LogoExiting(logo); + logo.AppendAnimatingAction(() => { LogoExiting(logo); }, false); } /// @@ -172,8 +176,7 @@ namespace osu.Game.Screens private void onSuspendingLogo() { - logo.ClearTransforms(); - LogoSuspending(logo); + logo.AppendAnimatingAction(() => { LogoSuspending(logo); }, false); } /// diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 53a2dcc41f..de67bef004 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -99,7 +99,6 @@ namespace osu.Game.Screens.Play { base.LogoArriving(logo, resuming); - logo.ClearTransforms(targetMember: nameof(Position)); logo.RelativePositionAxes = Axes.Both; logo.ScaleTo(new Vector2(0.15f), 300, Easing.In); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 121a53f699..5500d06136 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -315,9 +315,7 @@ namespace osu.Game.Screens.Select { base.LogoArriving(logo, resuming); - logo.ClearTransforms(); logo.RelativePositionAxes = Axes.Both; - Vector2 position = new Vector2(0.95f, 0.96f); if (logo.Alpha > 0.8f) From 495155874cf7fa4e4d0d7cb749c09fabd2799529 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Nov 2017 19:02:53 +0900 Subject: [PATCH 22/24] Make sure that the clock is only updated once per time value --- osu-framework | 2 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 47aabeaee5..81a3551886 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 47aabeaee5a8d85a0e6769fd601736f8dc1eb051 +Subproject commit 81a35518860cc533c4bf55b407c4e63d47ad11ce diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index ddce60d819..8c4d6de1fe 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -76,6 +76,8 @@ namespace osu.Game.Rulesets.UI #region Clock control + protected override bool ShouldProcessClock => false; // We handle processing the clock ourselves + private ManualClock clock; private IFrameBasedClock parentClock; @@ -148,10 +150,15 @@ namespace osu.Game.Rulesets.UI } clock.CurrentTime = newTime.Value; - Clock.ProcessFrame(); } requireMoreUpdateLoops = clock.CurrentTime != parentClock.CurrentTime; + + // The manual clock time has changed in the above code. The framed clock now needs to be updated + // to ensure that the its time is valid for our children before input is processed + Clock.ProcessFrame(); + + // Process input base.Update(); } From a2cb9d4086a70f72c735d942b9756d2d4a11cb19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Nov 2017 19:43:00 +0900 Subject: [PATCH 23/24] Fix audio not playing during player loading Regression due to changed audio initialisation logic. --- osu.Game/Screens/Play/Player.cs | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 59d56a5a44..675d20fe63 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -144,22 +144,6 @@ namespace osu.Game.Screens.Play userAudioOffset.ValueChanged += v => offsetClock.Offset = v; userAudioOffset.TriggerChange(); - Task.Run(() => - { - adjustableSourceClock.Reset(); - - // this is temporary until we have blocking (async.Wait()) audio component methods. - // then we can call ResetAsync().Wait() or the blocking version above. - while (adjustableSourceClock.IsRunning) - Thread.Sleep(1); - - Schedule(() => - { - decoupledClock.ChangeSource(adjustableSourceClock); - applyRateFromMods(); - }); - }); - Children = new Drawable[] { storyboardContainer = new Container @@ -329,10 +313,26 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - this.Delay(750).Schedule(() => + Task.Run(() => { - if (!pauseContainer.IsPaused) - decoupledClock.Start(); + adjustableSourceClock.Reset(); + + // this is temporary until we have blocking (async.Wait()) audio component methods. + // then we can call ResetAsync().Wait() or the blocking version above. + while (adjustableSourceClock.IsRunning) + Thread.Sleep(1); + + Schedule(() => + { + decoupledClock.ChangeSource(adjustableSourceClock); + applyRateFromMods(); + + this.Delay(750).Schedule(() => + { + if (!pauseContainer.IsPaused) + decoupledClock.Start(); + }); + }); }); pauseContainer.Alpha = 0; From 952530e1a8fe6cb2235263584ce38a8a026f68e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Nov 2017 20:03:58 +0900 Subject: [PATCH 24/24] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 81a3551886..c95b9350ed 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 81a35518860cc533c4bf55b407c4e63d47ad11ce +Subproject commit c95b9350edb6305cfefdf08f902f6f73d336736b