From 16e48ed187073b9f77799016005356a3a166e38d Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 5 Nov 2017 16:33:58 +0530 Subject: [PATCH 01/29] Hook up download logic with BeatmapSetOverlay download buttons. - Add noVideo option to DownloadBeatmapSetRequest - Make Download fire an event with new download instead of returning it --- osu.Game/Beatmaps/BeatmapManager.cs | 27 +++++++++---- .../API/Requests/DownloadBeatmapSetRequest.cs | 7 +++- osu.Game/Overlays/BeatmapSet/Header.cs | 40 ++++++++++++++++--- osu.Game/Overlays/BeatmapSetOverlay.cs | 14 ++++++- osu.Game/Overlays/Direct/DirectPanel.cs | 20 +++------- 5 files changed, 78 insertions(+), 30 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index f02a9a176c..e610073300 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -18,6 +18,7 @@ using osu.Framework.Platform; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; using osu.Game.Database; +using osu.Game.Graphics; using osu.Game.IO; using osu.Game.IPC; using osu.Game.Online.API; @@ -52,6 +53,11 @@ namespace osu.Game.Beatmaps /// public event Action BeatmapRestored; + /// + /// Fired when a beatmap download begins. + /// + public event Action BeatmapDownloadBegan; + /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -221,21 +227,29 @@ namespace osu.Game.Beatmaps /// Downloads a beatmap. /// /// The to be downloaded. - /// A new , or an existing one if a download is already in progress. - public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo) + /// Whether the beatmap should be downloaded without video. Defaults to false. + public void Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false) { var existing = GetExistingDownload(beatmapSetInfo); - if (existing != null) return existing; + if (existing != null || api == null) return; - if (api == null) return null; + if (!api.LocalUser.Value.IsSupporter) + { + PostNotification?.Invoke(new SimpleNotification + { + Icon = FontAwesome.fa_superpowers, + Text = "You gotta be a supporter to download for now 'yo" + }); + return; + } ProgressNotification downloadNotification = new ProgressNotification { Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}", }; - var request = new DownloadBeatmapSetRequest(beatmapSetInfo); + var request = new DownloadBeatmapSetRequest(beatmapSetInfo, noVideo); request.DownloadProgressed += progress => { @@ -280,8 +294,7 @@ namespace osu.Game.Beatmaps // don't run in the main api queue as this is a long-running task. Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning); - - return request; + BeatmapDownloadBegan?.Invoke(request); } /// diff --git a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs index 5a9f609bca..cdcc06a65c 100644 --- a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs @@ -12,13 +12,16 @@ namespace osu.Game.Online.API.Requests public Action DownloadProgressed; - public DownloadBeatmapSetRequest(BeatmapSetInfo set) + private readonly bool noVideo; + + public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo) { + this.noVideo = noVideo; BeatmapSet = set; Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total); } - protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download"; + protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}"; } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index d4514cbaed..a9802c8155 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -27,12 +27,17 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Container coverContainer; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; + private readonly Container downloadButtonsContainer; public Details Details; + private BeatmapManager beatmaps; + private DelayedLoadWrapper cover; public readonly BeatmapPicker Picker; + private bool isDownloading => beatmaps.GetExistingDownload(BeatmapSet) != null; + private BeatmapSetInfo beatmapSet; public BeatmapSetInfo BeatmapSet { @@ -162,7 +167,7 @@ namespace osu.Game.Overlays.BeatmapSet Children = new Drawable[] { new FavouriteButton(), - new Container + downloadButtonsContainer = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, @@ -172,7 +177,10 @@ namespace osu.Game.Overlays.BeatmapSet { RelativeSizeAxes = Axes.Both, Alpha = 0f, - Child = new DownloadButton("Download", @""), + Child = new DownloadButton("Download", @"") + { + Action = () => download(false), + }, }, videoButtons = new FillFlowContainer { @@ -181,8 +189,14 @@ namespace osu.Game.Overlays.BeatmapSet Alpha = 0f, Children = new[] { - new DownloadButton("Download", "with Video"), - new DownloadButton("Download", "without Video"), + new DownloadButton("Download", "with Video") + { + Action = () => download(false), + }, + new DownloadButton("Download", "without Video") + { + Action = () => download(true), + }, }, }, }, @@ -220,9 +234,25 @@ namespace osu.Game.Overlays.BeatmapSet } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, BeatmapManager beatmaps) { tabsBg.Colour = colours.Gray3; + this.beatmaps = beatmaps; + } + + private void download(bool video) + { + if (beatmaps.GetExistingDownload(BeatmapSet) != null) + { + downloadButtonsContainer.MoveToX(-5, 50, Easing.OutSine).Then() + .MoveToX(5, 100, Easing.InOutSine).Then() + .MoveToX(-5, 100, Easing.InOutSine).Then() + .MoveToX(0, 50, Easing.InSine).Then(); + + return; + } + + beatmaps.Download(BeatmapSet); } } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index ddd146bcb6..7e80f427de 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -24,11 +24,14 @@ namespace osu.Game.Overlays public const float X_PADDING = 40; public const float RIGHT_WIDTH = 275; + private BeatmapSetInfo currentBeatmap; + private readonly Header header; private readonly Info info; private APIAccess api; private RulesetStore rulesets; + private BeatmapManager manager; // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; @@ -83,10 +86,17 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(APIAccess api, RulesetStore rulesets) + private void load(APIAccess api, RulesetStore rulesets, BeatmapManager manager) { this.api = api; this.rulesets = rulesets; + this.manager = manager; + + manager.BeatmapSetAdded += beatmap => + { + if (beatmap.OnlineBeatmapSetID == currentBeatmap.OnlineBeatmapSetID) + Hide(); + }; } protected override void PopIn() @@ -118,7 +128,7 @@ namespace osu.Game.Overlays public void ShowBeatmapSet(BeatmapSetInfo set) { - header.BeatmapSet = info.BeatmapSet = set; + currentBeatmap = header.BeatmapSet = info.BeatmapSet = set; Show(); } } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index ef89c0022b..702aef7417 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -18,7 +18,6 @@ using osu.Framework.Input; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Framework.Logging; -using osu.Game.Overlays.Notifications; using osu.Game.Online.API.Requests; using osu.Framework.Configuration; using osu.Framework.Audio.Track; @@ -109,6 +108,8 @@ namespace osu.Game.Overlays.Direct if (downloadRequest != null) attachDownload(downloadRequest); + + beatmaps.BeatmapDownloadBegan += attachDownload; } protected override void Update() @@ -151,16 +152,6 @@ namespace osu.Game.Overlays.Direct protected void StartDownload() { - if (!api.LocalUser.Value.IsSupporter) - { - notifications.Post(new SimpleNotification - { - Icon = FontAwesome.fa_superpowers, - Text = "You gotta be a supporter to download for now 'yo" - }); - return; - } - if (beatmaps.GetExistingDownload(SetInfo) != null) { // we already have an active download running. @@ -172,13 +163,14 @@ namespace osu.Game.Overlays.Direct return; } - var request = beatmaps.Download(SetInfo); - - attachDownload(request); + beatmaps.Download(SetInfo); } private void attachDownload(DownloadBeatmapSetRequest request) { + if (request.BeatmapSet.OnlineBeatmapSetID != SetInfo.OnlineBeatmapSetID) + return; + progressBar.FadeIn(400, Easing.OutQuint); progressBar.ResizeHeightTo(4, 400, Easing.OutQuint); From bbe555dc3cd2a19ede0a58a80e171ed4cca22fd8 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 15 Nov 2017 17:49:41 +0530 Subject: [PATCH 02/29] Pass noVideo flag on... --- osu.Game/Overlays/BeatmapSet/Header.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 0cfa7be81a..f9998dcca2 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -228,7 +228,7 @@ namespace osu.Game.Overlays.BeatmapSet this.beatmaps = beatmaps; } - private void download(bool video) + private void download(bool noVideo) { if (beatmaps.GetExistingDownload(BeatmapSet) != null) { @@ -240,7 +240,7 @@ namespace osu.Game.Overlays.BeatmapSet return; } - beatmaps.Download(BeatmapSet); + beatmaps.Download(BeatmapSet, noVideo); } } } From df53b884eabe7025b8e46b879ce76274a6f28b43 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 15 Nov 2017 17:58:02 +0530 Subject: [PATCH 03/29] Removed unused stuff. --- osu.Game/Overlays/BeatmapSet/Header.cs | 2 -- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 -- osu.Game/Overlays/Direct/DirectPanel.cs | 7 +------ 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index f9998dcca2..ed72cf0cc9 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -38,8 +38,6 @@ namespace osu.Game.Overlays.BeatmapSet public readonly BeatmapPicker Picker; - private bool isDownloading => beatmaps.GetExistingDownload(BeatmapSet) != null; - private BeatmapSetInfo beatmapSet; public BeatmapSetInfo BeatmapSet { diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 1173390d57..7ae2d323b8 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -31,7 +31,6 @@ namespace osu.Game.Overlays private APIAccess api; private RulesetStore rulesets; - private BeatmapManager manager; private readonly ScrollContainer scroll; @@ -92,7 +91,6 @@ namespace osu.Game.Overlays { this.api = api; this.rulesets = rulesets; - this.manager = manager; manager.BeatmapSetAdded += beatmap => { diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 702aef7417..d4f4067fca 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -16,7 +16,6 @@ using osu.Game.Graphics.Sprites; using OpenTK.Graphics; using osu.Framework.Input; using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; using osu.Framework.Logging; using osu.Game.Online.API.Requests; using osu.Framework.Configuration; @@ -34,10 +33,8 @@ namespace osu.Game.Overlays.Direct private Container content; - private APIAccess api; private ProgressBar progressBar; private BeatmapManager beatmaps; - private NotificationOverlay notifications; private BeatmapSetOverlay beatmapSetOverlay; public Track Preview => PlayButton.Preview; @@ -70,11 +67,9 @@ namespace osu.Game.Overlays.Direct [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api, BeatmapManager beatmaps, OsuColour colours, NotificationOverlay notifications, BeatmapSetOverlay beatmapSetOverlay) + private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay beatmapSetOverlay) { - this.api = api; this.beatmaps = beatmaps; - this.notifications = notifications; this.beatmapSetOverlay = beatmapSetOverlay; AddInternal(content = new Container From 97c5956083779edfcb8d5c8ac9b5b6e4b5b2bdee Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 16 Nov 2017 15:36:22 +0530 Subject: [PATCH 04/29] Make download buttons disappear instead of closing overlay. - Also unbind event handlers - Remove unused field --- osu.Game/Overlays/BeatmapSet/Header.cs | 15 +++++++++++++++ osu.Game/Overlays/BeatmapSetOverlay.cs | 12 ++---------- osu.Game/Overlays/Direct/DirectPanel.cs | 6 ++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index ed72cf0cc9..27ef6208be 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -51,6 +51,7 @@ namespace osu.Game.Overlays.BeatmapSet title.Text = BeatmapSet.Metadata.Title; artist.Text = BeatmapSet.Metadata.Artist; + downloadButtonsContainer.FadeIn(); noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration); videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration); @@ -224,6 +225,20 @@ namespace osu.Game.Overlays.BeatmapSet { tabsBg.Colour = colours.Gray3; this.beatmaps = beatmaps; + + beatmaps.BeatmapSetAdded += handleBeatmapAdd; + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + beatmaps.BeatmapSetAdded -= handleBeatmapAdd; + } + + private void handleBeatmapAdd(BeatmapSetInfo beatmap) + { + if (beatmap.OnlineBeatmapSetID == BeatmapSet.OnlineBeatmapSetID) + downloadButtonsContainer.FadeOut(transition_duration); } private void download(bool noVideo) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 7ae2d323b8..940ac433fc 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -24,8 +24,6 @@ namespace osu.Game.Overlays public const float X_PADDING = 40; public const float RIGHT_WIDTH = 275; - private BeatmapSetInfo currentBeatmap; - private readonly Header header; private readonly Info info; @@ -87,16 +85,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(APIAccess api, RulesetStore rulesets, BeatmapManager manager) + private void load(APIAccess api, RulesetStore rulesets) { this.api = api; this.rulesets = rulesets; - - manager.BeatmapSetAdded += beatmap => - { - if (beatmap.OnlineBeatmapSetID == currentBeatmap.OnlineBeatmapSetID) - Hide(); - }; } protected override void PopIn() @@ -128,7 +120,7 @@ namespace osu.Game.Overlays public void ShowBeatmapSet(BeatmapSetInfo set) { - currentBeatmap = header.BeatmapSet = info.BeatmapSet = set; + header.BeatmapSet = info.BeatmapSet = set; Show(); scroll.ScrollTo(0); } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index d4f4067fca..b8a8528962 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -107,6 +107,12 @@ namespace osu.Game.Overlays.Direct beatmaps.BeatmapDownloadBegan += attachDownload; } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + beatmaps.BeatmapDownloadBegan -= attachDownload; + } + protected override void Update() { base.Update(); From 87f13688692bce3d25ff9f52e8778b56546103a6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 18:19:35 +0300 Subject: [PATCH 05/29] Add KudosuInfo container in the kudosu section --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 146 ++++++++++++++++++ .../Profile/Sections/KudosuSection.cs | 10 ++ osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 4 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs new file mode 100644 index 0000000000..14d2ef39f8 --- /dev/null +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -0,0 +1,146 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Overlays.Profile.Sections.Kudosu +{ + public class KudosuInfo : Container + { + private const int content_text_size = 19; + + protected readonly Bindable User = new Bindable(); + + public KudosuInfo(Bindable user) + { + User.BindTo(user); + + SubSection total; + SubSection avaliable; + + RelativeSizeAxes = Axes.X; + Height = 130; + Masking = true; + CornerRadius = 3; + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0f, 1f), + Radius = 2.5f, + Colour = Color4.Black.Opacity(0.2f), + }; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.2f) + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] + { + total = new SubSection("Total Kudosu Earned"), + avaliable = new SubSection("Kudosu Avaliable"), + } + } + } + }; + + total.TextFlow.Text = "Based on how much of a contribution the user has made to " + + "beatmap moderation. See this link for more information."; + + avaliable.TextFlow.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get " + + "more attention. This is the number of kudosu you haven't traded in yet."; + + User.ValueChanged += newUser => + { + total.KudosuValue = newUser == null ? 0 : newUser.Kudosu.Total; + avaliable.KudosuValue = newUser == null ? 0 : newUser.Kudosu.Available; + }; + } + + protected override bool OnClick(InputState state) => true; + + private class SubSection : Container + { + public readonly TextFlowContainer TextFlow; + + private readonly OsuSpriteText valueText; + + private int kudosuValue; + public int KudosuValue + { + get { return kudosuValue; } + set + { + if (kudosuValue == value) + return; + kudosuValue = value; + + valueText.Text = kudosuValue.ToString(); + } + } + + public SubSection(string header) + { + RelativeSizeAxes = Axes.Both; + Padding = new MarginPadding { Horizontal = 10, Top = 10 }; + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Text = header + ":", + TextSize = 20, + Font = @"Exo2.0-RegularItalic", + }, + valueText = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Text = "0", + TextSize = 40, + UseFullGlyphHeight = false, + Font = @"Exo2.0-RegularItalic" + } + } + }, + TextFlow = new TextFlowContainer(t => { t.TextSize = 19; }) + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } + } + }; + } + } + } +} diff --git a/osu.Game/Overlays/Profile/Sections/KudosuSection.cs b/osu.Game/Overlays/Profile/Sections/KudosuSection.cs index 3c36368fd7..907c26e5e8 100644 --- a/osu.Game/Overlays/Profile/Sections/KudosuSection.cs +++ b/osu.Game/Overlays/Profile/Sections/KudosuSection.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Overlays.Profile.Sections.Kudosu; + namespace osu.Game.Overlays.Profile.Sections { public class KudosuSection : ProfileSection @@ -8,5 +10,13 @@ namespace osu.Game.Overlays.Profile.Sections public override string Title => "Kudosu!"; public override string Identifier => "kudosu"; + + public KudosuSection() + { + Children = new[] + { + new KudosuInfo(User), + }; + } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index dd31a43290..7374a9aa44 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays //new MedalsSection(), new HistoricalSection(), new BeatmapsSection(), - //new KudosuSection() + new KudosuSection() }; tabs = new ProfileTabControl { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7b479bdba2..b9d8e36ff3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -288,6 +288,7 @@ + From 915ccf3c84b8229b73d2068eecaf39324f348ba6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 18:41:00 +0300 Subject: [PATCH 06/29] Fix some layout issues --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 14d2ef39f8..3fe0bfd9e2 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -17,26 +17,24 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { public class KudosuInfo : Container { - private const int content_text_size = 19; - - protected readonly Bindable User = new Bindable(); + private readonly Bindable user = new Bindable(); public KudosuInfo(Bindable user) { - User.BindTo(user); + this.user.BindTo(user); SubSection total; SubSection avaliable; RelativeSizeAxes = Axes.X; - Height = 130; + AutoSizeAxes = Axes.Y; Masking = true; CornerRadius = 3; EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Offset = new Vector2(0f, 1f), - Radius = 2.5f, + Radius = 3f, Colour = Color4.Black.Opacity(0.2f), }; Children = new Drawable[] @@ -46,18 +44,12 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }, - new GridContainer + total = new SubSection("Total Kudosu Earned"), + avaliable = new SubSection("Kudosu Avaliable") { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new Drawable[] - { - total = new SubSection("Total Kudosu Earned"), - avaliable = new SubSection("Kudosu Avaliable"), - } - } - } + RelativePositionAxes = Axes.X, + X = 0.5f, + }, }; total.TextFlow.Text = "Based on how much of a contribution the user has made to " + @@ -66,7 +58,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu avaliable.TextFlow.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get " + "more attention. This is the number of kudosu you haven't traded in yet."; - User.ValueChanged += newUser => + this.user.ValueChanged += newUser => { total.KudosuValue = newUser == null ? 0 : newUser.Kudosu.Total; avaliable.KudosuValue = newUser == null ? 0 : newUser.Kudosu.Available; @@ -97,8 +89,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu public SubSection(string header) { - RelativeSizeAxes = Axes.Both; - Padding = new MarginPadding { Horizontal = 10, Top = 10 }; + RelativeSizeAxes = Axes.X; + Width = 0.5f; + AutoSizeAxes = Axes.Y; + Padding = new MarginPadding { Horizontal = 10, Top = 10, Bottom = 20 }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Y, From 2ff88c86eafc4509b7b0c1d430a34e1f52fd3c09 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 18 Nov 2017 18:53:21 +0300 Subject: [PATCH 07/29] CI fixes --- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 3fe0bfd9e2..1982059065 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -57,11 +57,11 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu avaliable.TextFlow.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get " + "more attention. This is the number of kudosu you haven't traded in yet."; - + this.user.ValueChanged += newUser => { - total.KudosuValue = newUser == null ? 0 : newUser.Kudosu.Total; - avaliable.KudosuValue = newUser == null ? 0 : newUser.Kudosu.Available; + total.KudosuValue = newUser?.Kudosu.Total ?? 0; + avaliable.KudosuValue = newUser?.Kudosu.Available ?? 0; }; } From 2603219350db896caf0b0a6b312df6394da3dba7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Nov 2017 22:27:56 +0900 Subject: [PATCH 08/29] 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 09/29] 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 63d366ea4b77941e61dc90abb0aa1748e7dd7e7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 10:54:33 +0900 Subject: [PATCH 10/29] 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 11/29] 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 12/29] 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 13/29] 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 14/29] 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 15/29] 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 16/29] 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 17/29] 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 18/29] 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 19/29] 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 20/29] 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 36027f8700f3c9ae9aab3026640c5119a32b477b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 13:54:38 +0900 Subject: [PATCH 21/29] Update readme to mention using visualtests always forever --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ad56178132..ce77e840f6 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ This is still heavily under development and is not intended for end-user use. Th We welcome all contributions, but keep in mind that we already have a lot of the UI designed. If you wish to work on something with the intention on having it included in the official distribution, please open an issue for discussion and we will give you what you need from a design perspective to proceed. If you want to make *changes* to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted. +Please make sure you are familiar with the [development and testing](https://github.com/ppy/osu-framework/wiki/Development-and-Testing) procedure we have setup. New component development, and where possible, bug fixing and debugging existing components **should always be done under VisualTests**. + Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://www.bountysource.com/teams/ppy). If you're unsure of what you can help with, check out the [list of open issues](https://github.com/ppy/osu-framework/issues). Note that while we already have certain standards in place, nothing is set in stone. If you have an issue with the way code is structured; with any libraries we are using; with any processes involved with contributing, *please* bring it up. I welcome all feedback so we can make contributing to this project as pain-free as possible. From 5646ba4b2442c587e5f7e9070b6862d3f50c3175 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 14:04:32 +0900 Subject: [PATCH 22/29] Fix incorrect issues link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce77e840f6..484807d94d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ We welcome all contributions, but keep in mind that we already have a lot of the Please make sure you are familiar with the [development and testing](https://github.com/ppy/osu-framework/wiki/Development-and-Testing) procedure we have setup. New component development, and where possible, bug fixing and debugging existing components **should always be done under VisualTests**. -Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://www.bountysource.com/teams/ppy). If you're unsure of what you can help with, check out the [list of open issues](https://github.com/ppy/osu-framework/issues). +Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://www.bountysource.com/teams/ppy). If you're unsure of what you can help with, check out the [list of open issues](https://github.com/ppy/osu/issues). Note that while we already have certain standards in place, nothing is set in stone. If you have an issue with the way code is structured; with any libraries we are using; with any processes involved with contributing, *please* bring it up. I welcome all feedback so we can make contributing to this project as pain-free as possible. From 7de10a5877ac5a6636475a9389ea02d41577a513 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 22 Nov 2017 18:14:40 +0900 Subject: [PATCH 23/29] Fix invalid cast from noun to verb --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 484807d94d..856536d22d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This is still heavily under development and is not intended for end-user use. Th We welcome all contributions, but keep in mind that we already have a lot of the UI designed. If you wish to work on something with the intention on having it included in the official distribution, please open an issue for discussion and we will give you what you need from a design perspective to proceed. If you want to make *changes* to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted. -Please make sure you are familiar with the [development and testing](https://github.com/ppy/osu-framework/wiki/Development-and-Testing) procedure we have setup. New component development, and where possible, bug fixing and debugging existing components **should always be done under VisualTests**. +Please make sure you are familiar with the [development and testing](https://github.com/ppy/osu-framework/wiki/Development-and-Testing) procedure we have set up. New component development, and where possible, bug fixing and debugging existing components **should always be done under VisualTests**. Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://www.bountysource.com/teams/ppy). If you're unsure of what you can help with, check out the [list of open issues](https://github.com/ppy/osu/issues). From e5dfe4ff2e3f75da2bc0a878ced26c7d23c4737d Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 22 Nov 2017 11:35:25 +0100 Subject: [PATCH 24/29] 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)})"); } } From 0af3aea716cddafb248f3802852fe4c9a95d8e20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Nov 2017 19:38:12 +0900 Subject: [PATCH 25/29] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 83925a8407..c6fd291492 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 83925a84072ec9da0d008c82256294b765321c0b +Subproject commit c6fd2914926f2a6df23eda536c0310f072581b1b From 2ff21bbc6c1caabf2e0e6ad95375d2586fc5ed05 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 17:29:20 +0900 Subject: [PATCH 26/29] Move descriptions to constructor --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 1982059065..975a09fe18 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -23,8 +23,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { this.user.BindTo(user); - SubSection total; - SubSection avaliable; + CountSection total; + CountSection avaliable; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -44,20 +44,20 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }, - total = new SubSection("Total Kudosu Earned"), - avaliable = new SubSection("Kudosu Avaliable") + total = new CountSection( + "Total Kudosu Earned", + "Based on how much of a contribution the user has made to beatmap moderation. See this link for more information." + ), + avaliable = new CountSection( + "Kudosu Avaliable", + "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet." + ) { RelativePositionAxes = Axes.X, X = 0.5f, }, }; - total.TextFlow.Text = "Based on how much of a contribution the user has made to " + - "beatmap moderation. See this link for more information."; - - avaliable.TextFlow.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get " + - "more attention. This is the number of kudosu you haven't traded in yet."; - this.user.ValueChanged += newUser => { total.KudosuValue = newUser?.Kudosu.Total ?? 0; @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu protected override bool OnClick(InputState state) => true; - private class SubSection : Container + private class CountSection : Container { public readonly TextFlowContainer TextFlow; @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } } - public SubSection(string header) + public CountSection(string header, string description) { RelativeSizeAxes = Axes.X; Width = 0.5f; @@ -131,6 +131,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Text = description } } }; From 6d9951d9afdc664dab13bc348296d62aa271b740 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 17:31:43 +0900 Subject: [PATCH 27/29] Use FillFlow rather than manually specifying positions --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 975a09fe18..2639bd7686 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -44,18 +44,22 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }, - total = new CountSection( - "Total Kudosu Earned", - "Based on how much of a contribution the user has made to beatmap moderation. See this link for more information." - ), - avaliable = new CountSection( - "Kudosu Avaliable", - "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet." - ) + new FillFlowContainer { - RelativePositionAxes = Axes.X, - X = 0.5f, - }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new[] + { + total = new CountSection( + "Total Kudosu Earned", + "Based on how much of a contribution the user has made to beatmap moderation. See this link for more information." + ), + avaliable = new CountSection( + "Kudosu Avaliable", + "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet." + ), + } + } }; this.user.ValueChanged += newUser => From 30db2ce18a1f96a728d1591eaf5ef980ae9477e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 17:37:02 +0900 Subject: [PATCH 28/29] Rename KudosuValue to count and remove pointless local storage --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 2639bd7686..4520abdd6d 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -64,8 +64,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu this.user.ValueChanged += newUser => { - total.KudosuValue = newUser?.Kudosu.Total ?? 0; - avaliable.KudosuValue = newUser?.Kudosu.Available ?? 0; + total.Count = newUser?.Kudosu.Total ?? 0; + avaliable.Count = newUser?.Kudosu.Available ?? 0; }; } @@ -77,18 +77,9 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu private readonly OsuSpriteText valueText; - private int kudosuValue; - public int KudosuValue + public int Count { - get { return kudosuValue; } - set - { - if (kudosuValue == value) - return; - kudosuValue = value; - - valueText.Text = kudosuValue.ToString(); - } + set { valueText.Text = value.ToString(); } } public CountSection(string header, string description) From 38f5c55f80d18239ba80dca2dd558b78dcb00d61 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 18:11:35 +0900 Subject: [PATCH 29/29] Remove not-accessed field --- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 4520abdd6d..8a835634b8 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -73,8 +73,6 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu private class CountSection : Container { - public readonly TextFlowContainer TextFlow; - private readonly OsuSpriteText valueText; public int Count @@ -122,7 +120,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } } }, - TextFlow = new TextFlowContainer(t => { t.TextSize = 19; }) + new TextFlowContainer(t => { t.TextSize = 19; }) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y,