From 9bc1eece0a65da71a3a7e99dc780f4f8deea7bd1 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 25 May 2017 02:11:07 +0800 Subject: [PATCH 001/312] Basic section management of userpage. --- osu.Game/Overlays/UserPage/UserPageHeader.cs | 16 ++++++ osu.Game/Overlays/UserPage/UserPageSection.cs | 19 +++++++ osu.Game/Overlays/UserPageOverlay.cs | 54 +++++++++++++++++++ osu.Game/osu.Game.csproj | 3 ++ 4 files changed, 92 insertions(+) create mode 100644 osu.Game/Overlays/UserPage/UserPageHeader.cs create mode 100644 osu.Game/Overlays/UserPage/UserPageSection.cs create mode 100644 osu.Game/Overlays/UserPageOverlay.cs diff --git a/osu.Game/Overlays/UserPage/UserPageHeader.cs b/osu.Game/Overlays/UserPage/UserPageHeader.cs new file mode 100644 index 0000000000..9982d18d07 --- /dev/null +++ b/osu.Game/Overlays/UserPage/UserPageHeader.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Overlays.UserPage +{ + public class UserPageHeader : Container + { + } +} diff --git a/osu.Game/Overlays/UserPage/UserPageSection.cs b/osu.Game/Overlays/UserPage/UserPageSection.cs new file mode 100644 index 0000000000..77202d6aef --- /dev/null +++ b/osu.Game/Overlays/UserPage/UserPageSection.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using osu.Game.Users; + +namespace osu.Game.Overlays.UserPage +{ + public abstract class UserPageSection : Container + { + protected readonly User User; + public abstract string Title { get; } + + protected UserPageSection(User user) + { + User = user; + } + } +} diff --git a/osu.Game/Overlays/UserPageOverlay.cs b/osu.Game/Overlays/UserPageOverlay.cs new file mode 100644 index 0000000000..1e0d672c22 --- /dev/null +++ b/osu.Game/Overlays/UserPageOverlay.cs @@ -0,0 +1,54 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.UserPage; +using osu.Game.Users; + +namespace osu.Game.Overlays +{ + public class UserPageOverlay : FocusedOverlayContainer + { + private readonly User user; + private UserPageSection lastSection; + public UserPageOverlay(User user) + { + this.user = user; + var tab = new OsuTabControl(); + var sections = new UserPageSection[] { }; + var sectionsContainer = new SectionsContainer + { + ExpandableHeader = new UserPageHeader(), + FixedHeader = tab, + Sections = sections + }; + + Add(sectionsContainer); + + sectionsContainer.SelectedSection.ValueChanged += s => + { + if (lastSection != s) + { + lastSection = s as UserPageSection; + tab.Current.Value = lastSection; + } + }; + + tab.Current.ValueChanged += s => + { + if (lastSection != s) + { + lastSection = s; + sectionsContainer.ScrollContainer.ScrollIntoView(lastSection); + } + }; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 98fb4b9707..3e2d86dfaa 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -85,6 +85,9 @@ + + + From 159e8d84c2fed23eeb5377debe90ca8c15c7c91a Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sat, 27 May 2017 23:37:15 +0800 Subject: [PATCH 002/312] Move namespace and make cover background public. --- osu.Game/Users/UserCoverBackground.cs | 26 +++++++++++++++++++ .../UserPage/UserPageHeader.cs | 7 ++++- .../UserPage/UserPageSection.cs | 3 +-- .../{Overlays => Users}/UserPageOverlay.cs | 7 +++-- osu.Game/Users/UserPanel.cs | 20 +------------- osu.Game/osu.Game.csproj | 7 ++--- 6 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 osu.Game/Users/UserCoverBackground.cs rename osu.Game/{Overlays => Users}/UserPage/UserPageHeader.cs (67%) rename osu.Game/{Overlays => Users}/UserPage/UserPageSection.cs (84%) rename osu.Game/{Overlays => Users}/UserPageOverlay.cs (88%) diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs new file mode 100644 index 0000000000..c0f0d09d9d --- /dev/null +++ b/osu.Game/Users/UserCoverBackground.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; + +namespace osu.Game.Users +{ + public class UserCoverBackground : Sprite + { + private readonly User user; + + public UserCoverBackground(User user) + { + this.user = user; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + if (!string.IsNullOrEmpty(user.CoverUrl)) + Texture = textures.Get(user.CoverUrl); + } + } +} diff --git a/osu.Game/Overlays/UserPage/UserPageHeader.cs b/osu.Game/Users/UserPage/UserPageHeader.cs similarity index 67% rename from osu.Game/Overlays/UserPage/UserPageHeader.cs rename to osu.Game/Users/UserPage/UserPageHeader.cs index 9982d18d07..872088fbef 100644 --- a/osu.Game/Overlays/UserPage/UserPageHeader.cs +++ b/osu.Game/Users/UserPage/UserPageHeader.cs @@ -8,9 +8,14 @@ using System.Text; using System.Threading.Tasks; using osu.Framework.Graphics.Containers; -namespace osu.Game.Overlays.UserPage +namespace osu.Game.Users.UserPage { public class UserPageHeader : Container { + private readonly User user; + public UserPageHeader(User user) + { + this.user = user; + } } } diff --git a/osu.Game/Overlays/UserPage/UserPageSection.cs b/osu.Game/Users/UserPage/UserPageSection.cs similarity index 84% rename from osu.Game/Overlays/UserPage/UserPageSection.cs rename to osu.Game/Users/UserPage/UserPageSection.cs index 77202d6aef..cb73218c05 100644 --- a/osu.Game/Overlays/UserPage/UserPageSection.cs +++ b/osu.Game/Users/UserPage/UserPageSection.cs @@ -2,9 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Game.Users; -namespace osu.Game.Overlays.UserPage +namespace osu.Game.Users.UserPage { public abstract class UserPageSection : Container { diff --git a/osu.Game/Overlays/UserPageOverlay.cs b/osu.Game/Users/UserPageOverlay.cs similarity index 88% rename from osu.Game/Overlays/UserPageOverlay.cs rename to osu.Game/Users/UserPageOverlay.cs index 1e0d672c22..c7b49433d7 100644 --- a/osu.Game/Overlays/UserPageOverlay.cs +++ b/osu.Game/Users/UserPageOverlay.cs @@ -9,10 +9,9 @@ using System.Threading.Tasks; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.UserPage; -using osu.Game.Users; +using osu.Game.Users.UserPage; -namespace osu.Game.Overlays +namespace osu.Game.Users { public class UserPageOverlay : FocusedOverlayContainer { @@ -25,7 +24,7 @@ namespace osu.Game.Overlays var sections = new UserPageSection[] { }; var sectionsContainer = new SectionsContainer { - ExpandableHeader = new UserPageHeader(), + ExpandableHeader = new UserPageHeader(user), FixedHeader = tab, Sections = sections }; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index bdfe6d1c8e..0ef56f5060 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -9,7 +9,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -43,7 +42,7 @@ namespace osu.Game.Users Children = new Drawable[] { - new AsyncLoadWrapper(new CoverBackgroundSprite(user) + new AsyncLoadWrapper(new UserCoverBackground(user) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -193,22 +192,5 @@ namespace osu.Game.Users statusMessage.Text = status.Message; } } - - private class CoverBackgroundSprite : Sprite - { - private readonly User user; - - public CoverBackgroundSprite(User user) - { - this.user = user; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - if (!string.IsNullOrEmpty(user.CoverUrl)) - Texture = textures.Get(user.CoverUrl); - } - } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5261219422..049f4e14f3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -85,9 +85,10 @@ - - - + + + + From ab32e962ca90a4a73ce88e7ec9f90f0dd4de7ff8 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sun, 28 May 2017 00:37:55 -0300 Subject: [PATCH 003/312] Make BeatmapOnlineInfo and BeatmapSetOnlineInfo separate classes, -OnlineWorkingBeatmap --- .../Tests/TestCaseDirect.cs | 56 +++++++++---------- osu.Game/Database/BeatmapMetadata.cs | 6 +- osu.Game/Database/BeatmapOnlineInfo.cs | 20 ++----- osu.Game/Database/BeatmapSetInfo.cs | 3 + osu.Game/Database/BeatmapSetOnlineInfo.cs | 38 +++++++++++++ osu.Game/Database/OnlineWorkingBeatmap.cs | 37 ------------ osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 4 +- osu.Game/Overlays/Direct/DirectPanel.cs | 20 ++++++- osu.Game/osu.Game.csproj | 2 +- 10 files changed, 102 insertions(+), 88 deletions(-) create mode 100644 osu.Game/Database/BeatmapSetOnlineInfo.cs delete mode 100644 osu.Game/Database/OnlineWorkingBeatmap.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 4cda14559f..9315e75254 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -48,6 +48,13 @@ namespace osu.Desktop.VisualTests.Tests Author = @"RLC", Source = @"", }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/578332/covers/cover.jpg?1494591390" }, + Preview = @"https://b.ppy.sh/preview/578332.mp3", + PlayCount = 97, + FavouriteCount = 72, + }, Beatmaps = new List { new BeatmapInfo @@ -55,13 +62,6 @@ namespace osu.Desktop.VisualTests.Tests Ruleset = ruleset, StarDifficulty = 5.35f, Metadata = new BeatmapMetadata(), - OnlineInfo = new BeatmapOnlineInfo - { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/578332/covers/cover.jpg?1494591390" }, - Preview = @"https://b.ppy.sh/preview/578332.mp3", - PlayCount = 97, - FavouriteCount = 72, - }, }, }, }, @@ -74,6 +74,13 @@ namespace osu.Desktop.VisualTests.Tests Author = @"Sotarks", Source = @"ぎんぎつね", }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/599627/covers/cover.jpg?1494539318" }, + Preview = @"https//b.ppy.sh/preview/599627.mp3", + PlayCount = 3082, + FavouriteCount = 14, + }, Beatmaps = new List { new BeatmapInfo @@ -81,13 +88,6 @@ namespace osu.Desktop.VisualTests.Tests Ruleset = ruleset, StarDifficulty = 5.81f, Metadata = new BeatmapMetadata(), - OnlineInfo = new BeatmapOnlineInfo - { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/599627/covers/cover.jpg?1494539318" }, - Preview = @"https//b.ppy.sh/preview/599627.mp3", - PlayCount = 3082, - FavouriteCount = 14, - }, }, }, }, @@ -100,6 +100,13 @@ namespace osu.Desktop.VisualTests.Tests Author = @"Cerulean Veyron", Source = @"", }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/513268/covers/cover.jpg?1494502863" }, + Preview = @"https//b.ppy.sh/preview/513268.mp3", + PlayCount = 2762, + FavouriteCount = 15, + }, Beatmaps = new List { new BeatmapInfo @@ -107,13 +114,6 @@ namespace osu.Desktop.VisualTests.Tests Ruleset = ruleset, StarDifficulty = 0.9f, Metadata = new BeatmapMetadata(), - OnlineInfo = new BeatmapOnlineInfo - { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/513268/covers/cover.jpg?1494502863" }, - Preview = @"https//b.ppy.sh/preview/513268.mp3", - PlayCount = 2762, - FavouriteCount = 15, - }, }, new BeatmapInfo { @@ -141,6 +141,13 @@ namespace osu.Desktop.VisualTests.Tests Author = @"[Kamiya]", Source = @"小林さんちのメイドラゴン", }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/586841/covers/cover.jpg?1494052741" }, + Preview = @"https//b.ppy.sh/preview/586841.mp3", + PlayCount = 62317, + FavouriteCount = 161, + }, Beatmaps = new List { new BeatmapInfo @@ -148,13 +155,6 @@ namespace osu.Desktop.VisualTests.Tests Ruleset = ruleset, StarDifficulty = 1.26f, Metadata = new BeatmapMetadata(), - OnlineInfo = new BeatmapOnlineInfo - { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/586841/covers/cover.jpg?1494052741" }, - Preview = @"https//b.ppy.sh/preview/586841.mp3", - PlayCount = 62317, - FavouriteCount = 161, - }, }, new BeatmapInfo { diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Database/BeatmapMetadata.cs index 04700b3caa..a038b9cd19 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Database/BeatmapMetadata.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using Newtonsoft.Json; using SQLite.Net.Attributes; namespace osu.Game.Database @@ -17,7 +18,10 @@ namespace osu.Game.Database public string TitleUnicode { get; set; } public string Artist { get; set; } public string ArtistUnicode { get; set; } + + [JsonProperty(@"creator")] public string Author { get; set; } + public string Source { get; set; } public string Tags { get; set; } public int PreviewTime { get; set; } @@ -35,4 +39,4 @@ namespace osu.Game.Database Tags }.Where(s => !string.IsNullOrEmpty(s)).ToArray(); } -} \ No newline at end of file +} diff --git a/osu.Game/Database/BeatmapOnlineInfo.cs b/osu.Game/Database/BeatmapOnlineInfo.cs index bcb2ef16ac..7740545d6e 100644 --- a/osu.Game/Database/BeatmapOnlineInfo.cs +++ b/osu.Game/Database/BeatmapOnlineInfo.cs @@ -11,28 +11,16 @@ namespace osu.Game.Database /// public class BeatmapOnlineInfo { - /// - /// The different sizes of cover art for this beatmap: cover, cover@2x, card, card@2x, list, list@2x. - /// - [JsonProperty(@"covers")] - public IEnumerable Covers { get; set; } - - /// - /// A small sample clip of this beatmap's song. - /// - [JsonProperty(@"previewUrl")] - public string Preview { get; set; } - /// /// The amount of plays this beatmap has. /// - [JsonProperty(@"play_count")] + [JsonProperty(@"playcount")] public int PlayCount { get; set; } /// - /// The amount of people who have favourited this map. + /// The amount of passes this beatmap has. /// - [JsonProperty(@"favourite_count")] - public int FavouriteCount { get; set; } + [JsonProperty(@"passcount")] + public int PassCount { get; set; } } } diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index 0875d3c01f..cf983d18d7 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -24,6 +24,9 @@ namespace osu.Game.Database [OneToMany(CascadeOperations = CascadeOperation.All)] public List Beatmaps { get; set; } + [Ignore] + public BeatmapSetOnlineInfo OnlineInfo { get; set; } + public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty); [Indexed] diff --git a/osu.Game/Database/BeatmapSetOnlineInfo.cs b/osu.Game/Database/BeatmapSetOnlineInfo.cs new file mode 100644 index 0000000000..b1807868ad --- /dev/null +++ b/osu.Game/Database/BeatmapSetOnlineInfo.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace osu.Game.Database +{ + /// + /// Beatmap set info retrieved for previewing locally without having the set downloaded. + /// + public class BeatmapSetOnlineInfo + { + /// + /// The different sizes of cover art for this beatmap: cover, cover@2x, card, card@2x, list, list@2x. + /// + [JsonProperty(@"covers")] + public IEnumerable Covers { get; set; } + + /// + /// A small sample clip of this beatmap's song. + /// + [JsonProperty(@"previewUrl")] + public string Preview { get; set; } + + /// + /// The amount of plays this set has. + /// + [JsonProperty(@"play_count")] + public int PlayCount { get; set; } + + /// + /// The amount of people who have favourited this map. + /// + [JsonProperty(@"favourite_count")] + public int FavouriteCount { get; set; } + } +} diff --git a/osu.Game/Database/OnlineWorkingBeatmap.cs b/osu.Game/Database/OnlineWorkingBeatmap.cs deleted file mode 100644 index 1465c59434..0000000000 --- a/osu.Game/Database/OnlineWorkingBeatmap.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Linq; -using osu.Framework.Audio.Track; -using osu.Framework.Graphics.Textures; -using osu.Game.Beatmaps; - -namespace osu.Game.Database -{ - internal class OnlineWorkingBeatmap : WorkingBeatmap - { - private readonly TextureStore textures; - private readonly TrackManager tracks; - - public OnlineWorkingBeatmap(BeatmapInfo beatmapInfo, TextureStore textures, TrackManager tracks) : base(beatmapInfo) - { - this.textures = textures; - this.tracks = tracks; - } - - protected override Beatmap GetBeatmap() - { - return new Beatmap(); - } - - protected override Texture GetBackground() - { - return textures.Get(BeatmapInfo.OnlineInfo.Covers.FirstOrDefault()); - } - - protected override Track GetTrack() - { - return tracks.Get(BeatmapInfo.OnlineInfo.Preview); - } - } -} diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 4be68157d7..1301d961f3 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -180,11 +180,11 @@ namespace osu.Game.Overlays.Direct Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding }, Children = new[] { - new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0) + new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0) { Margin = new MarginPadding { Right = 1 }, }, - new Statistic(FontAwesome.fa_heart, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.FavouriteCount ?? 0), + new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), }, }, }; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 48636a5228..aae906a644 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -104,11 +104,11 @@ namespace osu.Game.Overlays.Direct Margin = new MarginPadding { Right = height - vertical_padding * 2 + vertical_padding }, Children = new Drawable[] { - new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0) + new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0) { Margin = new MarginPadding { Right = 1 }, }, - new Statistic(FontAwesome.fa_heart, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.FavouriteCount ?? 0), + new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), new FillFlowContainer { Anchor = Anchor.TopRight, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 8a56cf392e..61cdbf1b4c 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using OpenTK; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -36,7 +37,7 @@ namespace osu.Game.Overlays.Direct protected Drawable GetBackground(TextureStore textures) { - return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null)) + return new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo) { FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), @@ -84,5 +85,22 @@ namespace osu.Game.Overlays.Direct Value = value; } } + + private class BeatmapSetBackgroundSprite : Sprite + { + private readonly BeatmapSetInfo set; + + public BeatmapSetBackgroundSprite(BeatmapSetInfo set) + { + this.set = set; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + if (set.OnlineInfo?.Covers.FirstOrDefault() != null) + Texture = textures.Get(set.OnlineInfo.Covers.First()); + } + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 25b692151f..0481044c3c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -445,11 +445,11 @@ - + From 8745948a01ceb49d34af56f754f6ea72d05e0f08 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sun, 28 May 2017 02:26:25 -0300 Subject: [PATCH 004/312] Basic searching in osu!direct, move BeatmapSetOnlineInfo covers into their own class --- .../Tests/TestCaseDirect.cs | 8 +- osu.Game/Database/BeatmapSetOnlineInfo.cs | 22 ++++- .../API/Requests/GetBeatmapSetsRequest.cs | 86 +++++++++++++++++++ osu.Game/Overlays/Direct/DirectPanel.cs | 4 +- osu.Game/Overlays/Direct/FilterControl.cs | 2 + osu.Game/Overlays/DirectOverlay.cs | 36 +++++++- osu.Game/osu.Game.csproj | 1 + 7 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 9315e75254..0531ab0aaa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -50,7 +50,7 @@ namespace osu.Desktop.VisualTests.Tests }, OnlineInfo = new BeatmapSetOnlineInfo { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/578332/covers/cover.jpg?1494591390" }, + Covers = new BeatmapSetOnlineCovers { Card = @"https://assets.ppy.sh//beatmaps/578332/covers/cover.jpg?1494591390" }, Preview = @"https://b.ppy.sh/preview/578332.mp3", PlayCount = 97, FavouriteCount = 72, @@ -76,7 +76,7 @@ namespace osu.Desktop.VisualTests.Tests }, OnlineInfo = new BeatmapSetOnlineInfo { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/599627/covers/cover.jpg?1494539318" }, + Covers = new BeatmapSetOnlineCovers { Card = @"https://assets.ppy.sh//beatmaps/599627/covers/cover.jpg?1494539318" }, Preview = @"https//b.ppy.sh/preview/599627.mp3", PlayCount = 3082, FavouriteCount = 14, @@ -102,7 +102,7 @@ namespace osu.Desktop.VisualTests.Tests }, OnlineInfo = new BeatmapSetOnlineInfo { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/513268/covers/cover.jpg?1494502863" }, + Covers = new BeatmapSetOnlineCovers { Card = @"https://assets.ppy.sh//beatmaps/513268/covers/cover.jpg?1494502863" }, Preview = @"https//b.ppy.sh/preview/513268.mp3", PlayCount = 2762, FavouriteCount = 15, @@ -143,7 +143,7 @@ namespace osu.Desktop.VisualTests.Tests }, OnlineInfo = new BeatmapSetOnlineInfo { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/586841/covers/cover.jpg?1494052741" }, + Covers = new BeatmapSetOnlineCovers { Card = @"https://assets.ppy.sh//beatmaps/586841/covers/cover.jpg?1494052741" }, Preview = @"https//b.ppy.sh/preview/586841.mp3", PlayCount = 62317, FavouriteCount = 161, diff --git a/osu.Game/Database/BeatmapSetOnlineInfo.cs b/osu.Game/Database/BeatmapSetOnlineInfo.cs index b1807868ad..87859bf761 100644 --- a/osu.Game/Database/BeatmapSetOnlineInfo.cs +++ b/osu.Game/Database/BeatmapSetOnlineInfo.cs @@ -12,10 +12,10 @@ namespace osu.Game.Database public class BeatmapSetOnlineInfo { /// - /// The different sizes of cover art for this beatmap: cover, cover@2x, card, card@2x, list, list@2x. + /// The different sizes of cover art for this beatmap. /// [JsonProperty(@"covers")] - public IEnumerable Covers { get; set; } + public BeatmapSetOnlineCovers Covers { get; set; } /// /// A small sample clip of this beatmap's song. @@ -35,4 +35,22 @@ namespace osu.Game.Database [JsonProperty(@"favourite_count")] public int FavouriteCount { get; set; } } + + public class BeatmapSetOnlineCovers + { + public string Cover { get; set; } + + [JsonProperty(@"cover@2x")] + public string Cover2x { get; set; } + + public string Card { get; set; } + + [JsonProperty(@"card@2x")] + public string Card2x { get; set; } + + public string List { get; set; } + + [JsonProperty(@"list@2x")] + public string List2x { get; set; } + } } diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs new file mode 100644 index 0000000000..5bdf3062cf --- /dev/null +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -0,0 +1,86 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; +using osu.Game.Database; + +namespace osu.Game.Online.API.Requests +{ + public class GetBeatmapSetsRequest : APIRequest> + { + private readonly string query; + + public GetBeatmapSetsRequest(string query) + { + this.query = System.Uri.EscapeDataString(query); + } + + protected override string Target => $@"beatmapsets/search?q={query}"; + } + + public class GetBeatmapSetsResponse : BeatmapMetadata + { + [JsonProperty(@"covers")] + private BeatmapSetOnlineCovers covers { get; set; } + + [JsonProperty(@"previewUrl")] + private string preview { get; set; } + + [JsonProperty(@"play_count")] + private int playCount { get; set; } + + [JsonProperty(@"favourite_count")] + private int favouriteCount { get; set; } + + [JsonProperty(@"beatmaps")] + private IEnumerable beatmaps { get; set; } + + public BeatmapSetInfo ToSetInfo(RulesetDatabase rulesets) + { + return new BeatmapSetInfo + { + Metadata = this, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = covers, + Preview = preview, + PlayCount = playCount, + FavouriteCount = favouriteCount, + }, + Beatmaps = beatmaps.Select(b => b.ToBeatmap(rulesets)).ToList(), + }; + } + + private class GetBeatmapSetsBeatmapResponse : BeatmapMetadata + { + [JsonProperty(@"playcount")] + private int playCount { get; set; } + + [JsonProperty(@"passcount")] + private int passCount { get; set; } + + [JsonProperty(@"mode_int")] + private int ruleset { get; set; } + + [JsonProperty(@"difficulty_rating")] + private double starDifficulty { get; set; } + + public BeatmapInfo ToBeatmap(RulesetDatabase rulesets) + { + return new BeatmapInfo + { + Metadata = this, + Ruleset = rulesets.GetRuleset(ruleset), + StarDifficulty = starDifficulty, + OnlineInfo = new BeatmapOnlineInfo + { + PlayCount = playCount, + PassCount = passCount, + }, + }; + } + } + } +} diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 61cdbf1b4c..cf969df303 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -98,8 +98,8 @@ namespace osu.Game.Overlays.Direct [BackgroundDependencyLoader] private void load(TextureStore textures) { - if (set.OnlineInfo?.Covers.FirstOrDefault() != null) - Texture = textures.Get(set.OnlineInfo.Covers.First()); + if (set.OnlineInfo?.Covers?.Card != null) + Texture = textures.Get(set.OnlineInfo.Covers.Card); } } } diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 735e14b8c1..db2adbb462 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -129,6 +129,8 @@ namespace osu.Game.Overlays.Direct protected override Color4 BackgroundUnfocused => backgroundColour; protected override Color4 BackgroundFocused => backgroundColour; + protected override bool AllowCommit => true; + private Color4 backgroundColour; [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 0930c825b6..9dab21e428 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -13,6 +13,8 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Overlays.Direct; using Container = osu.Framework.Graphics.Containers.Container; @@ -24,6 +26,9 @@ namespace osu.Game.Overlays public static readonly int WIDTH_PADDING = 80; private const float panel_padding = 10f; + private APIAccess api; + private RulesetDatabase rulesets; + private readonly FilterControl filter; private readonly FillFlowContainer resultCountsContainer; private readonly OsuSpriteText resultCountsText; @@ -38,6 +43,17 @@ namespace osu.Game.Overlays if (beatmapSets?.Equals(value) ?? false) return; beatmapSets = value; + if (BeatmapSets == null) + { + foreach (var p in panels.Children) + { + p.FadeOut(200); + p.Expire(); + } + + return; + } + recreatePanels(filter.DisplayStyle.Value); } } @@ -155,14 +171,17 @@ namespace osu.Game.Overlays filter.Search.Exit = Hide; filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; + filter.Search.OnCommit = (sender, text) => updateSets(); filter.DisplayStyle.ValueChanged += recreatePanels; updateResultCounts(); } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, APIAccess api, RulesetDatabase rulesets) { + this.api = api; + this.rulesets = rulesets; resultCountsContainer.Colour = colours.Yellow; } @@ -187,6 +206,21 @@ namespace osu.Game.Overlays panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); } + private GetBeatmapSetsRequest getSetsRequest; + private void updateSets() + { + if (!IsLoaded) return; + + BeatmapSets = null; + getSetsRequest?.Cancel(); + + if (api == null || filter.Search.Text == string.Empty) return; + + getSetsRequest = new GetBeatmapSetsRequest(filter.Search.Text); + getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets)); + api.Queue(getSetsRequest); + } + protected override bool OnFocus(InputState state) { filter.Search.TriggerFocus(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0481044c3c..092e1c0509 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -450,6 +450,7 @@ + From 95cfce29509a25045417df9b4b0a93fa86eefd5d Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sun, 28 May 2017 02:43:37 -0300 Subject: [PATCH 005/312] Rank status filtering --- osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs | 6 ++++-- osu.Game/Overlays/DirectOverlay.cs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs index 5bdf3062cf..ce5c9f0939 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -11,13 +11,15 @@ namespace osu.Game.Online.API.Requests public class GetBeatmapSetsRequest : APIRequest> { private readonly string query; + private readonly RankStatus rankStatus; - public GetBeatmapSetsRequest(string query) + public GetBeatmapSetsRequest(string query, RankStatus rankStatus = RankStatus.Any) { this.query = System.Uri.EscapeDataString(query); + this.rankStatus = rankStatus; } - protected override string Target => $@"beatmapsets/search?q={query}"; + protected override string Target => $@"beatmapsets/search?q={query}&s={(int)rankStatus}"; } public class GetBeatmapSetsResponse : BeatmapMetadata diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 9dab21e428..41b58b7282 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -172,6 +172,7 @@ namespace osu.Game.Overlays filter.Search.Exit = Hide; filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; filter.Search.OnCommit = (sender, text) => updateSets(); + filter.RankStatusDropdown.Current.ValueChanged += rankStatus => updateSets(); filter.DisplayStyle.ValueChanged += recreatePanels; updateResultCounts(); @@ -216,7 +217,7 @@ namespace osu.Game.Overlays if (api == null || filter.Search.Text == string.Empty) return; - getSetsRequest = new GetBeatmapSetsRequest(filter.Search.Text); + getSetsRequest = new GetBeatmapSetsRequest(filter.Search.Text, filter.RankStatusDropdown.Current.Value); getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets)); api.Queue(getSetsRequest); } From 3aa1f35127d18b005bc222a9ebef222ba2bb3e42 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 05:12:11 -0300 Subject: [PATCH 006/312] Basic layout --- .../Tests/TestCaseDrawableRoom.cs | 18 +- .../Tests/TestCaseRoomInspector.cs | 101 ++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Online/Multiplayer/Room.cs | 4 +- .../Overlays/Toolbar/ToolbarModeButton.cs | 2 +- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 6 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 502 ++++++++++++++++++ osu.Game/Users/User.cs | 4 + osu.Game/osu.Game.csproj | 1 + 9 files changed, 632 insertions(+), 7 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs create mode 100644 osu.Game/Screens/Multiplayer/RoomInspector.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index de58323abe..32af330f44 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -38,12 +38,26 @@ namespace osu.Desktop.VisualTests.Tests first.Room.Name.Value = @"Great Room Right Here"; first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }}; first.Room.Status.Value = new RoomStatusOpen(); - first.Room.Beatmap.Value = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }; + first.Room.Beatmap.Value = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + Title = @"Seiryu", + Artist = @"Critical Crystal", + }, + }; second.Room.Name.Value = @"Relax It's The Weekend"; second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }}; second.Room.Status.Value = new RoomStatusPlaying(); - second.Room.Beatmap.Value = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }; + second.Room.Beatmap.Value = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + Title = @"Serendipity", + Artist = @"ZAQ", + }, + }; AddStep(@"change state", () => { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs new file mode 100644 index 0000000000..8ec1f66f8b --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -0,0 +1,101 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Game.Screens.Multiplayer; +using osu.Game.Database; +using osu.Game.Online.Multiplayer; +using osu.Game.Users; +using osu.Framework.Allocation; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseRoomInspector : TestCase + { + public override string Description => @"from the multiplayer lobby"; + + private RulesetDatabase rulesets; + + public override void Reset() + { + base.Reset(); + + var room = new Room(); + room.Name.Value = @"My Awesome Room"; + room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; + room.Status.Value = new RoomStatusOpen(); + room.Beatmap.Value = new BeatmapInfo + { + StarDifficulty = 3.7, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Platina", + Artist = @"Maaya Sakamoto", + Author = @"uwutm8", + }, + }; + room.MaxParticipants.Value = 200; + room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, + new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, + new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, + new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, + new User { Username = @"peppy", Id = 2, GlobalRank = 6251 }}; + + RoomInspector inspector; + Add(inspector = new RoomInspector + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Room = room, + }); + + AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above"); + AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" }}); + AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying()); + AddStep(@"change beatmap", () => room.Beatmap.Value = null); + AddStep(@"change max participants", () => room.MaxParticipants.Value = null); + AddStep(@"change participants", () => room.Participants.Value = new[] + { + new User { Username = @"filsdelama", Id = 2831793, GlobalRank = 8542 }, + new User { Username = @"_index", Id = 652457, GlobalRank = 15024 } + }); + + AddStep(@"change room", () => + { + var newRoom = new Room(); + newRoom.Name.Value = @"My New, Better Than Ever Room"; + newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; + newRoom.Status.Value = new RoomStatusOpen(); + newRoom.Beatmap.Value = new BeatmapInfo + { + StarDifficulty = 7.07, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"xi", + Artist = @"FREEDOM DIVE", + Author = @"Nakagawa-Kanon", + }, + }; + newRoom.MaxParticipants.Value = 10; + newRoom.Participants.Value = new[] + { + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, + new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, + new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + }; + + inspector.Room = newRoom; + }); + } + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 5a532d7234..466c9336f0 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -224,6 +224,7 @@ + diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index c82025f902..fe3378f4a6 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -12,6 +12,8 @@ namespace osu.Game.Online.Multiplayer public Bindable Name = new Bindable(); public Bindable Host = new Bindable(); public Bindable Status = new Bindable(); - public Bindable Beatmap = new Bindable(); + public Bindable Beatmap = new Bindable(); + public Bindable MaxParticipants = new Bindable(); + public Bindable Participants = new Bindable(); } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index dd70289f7d..5f0ab3991d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -55,4 +55,4 @@ namespace osu.Game.Overlays.Toolbar DrawableIcon.TextSize *= 1.4f; } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 7365963085..bbe279946a 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -227,13 +227,13 @@ namespace osu.Game.Screens.Multiplayer d.FadeColour(value.GetAppropriateColour(colours), 100); } - private void displayBeatmap(BeatmapMetadata value) + private void displayBeatmap(BeatmapInfo value) { if (value != null) { - beatmapTitle.Current = localisation.GetUnicodePreference(value.TitleUnicode, value.Title); + beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(value.ArtistUnicode, value.Artist); + beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs new file mode 100644 index 0000000000..1471e2ed26 --- /dev/null +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -0,0 +1,502 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Localisation; +using osu.Game.Beatmaps.Drawables; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Multiplayer; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class RoomInspector : Container + { + private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; + + private readonly FillFlowContainer topFlow; + private readonly Box statusStrip; + private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; + private readonly Sprite cover; + private readonly FillFlowContainer levelRangeContainer; + private readonly ScrollContainer participantsScroll; + private readonly FillFlowContainer participantsFlow; + private readonly Container rulesetContainer; + private readonly Container flagContainer; + + private Bindable nameBind = new Bindable(); + private Bindable hostBind = new Bindable(); + private Bindable statusBind = new Bindable(); + private Bindable beatmapBind = new Bindable(); + private Bindable maxParticipantsBind = new Bindable(); + private Bindable participantsBind = new Bindable(); + + private OsuColour colours; + private LocalisationEngine localisation; + + private Room room; + public Room Room + { + get { return room; } + set + { + if (value == room) return; + room = value; + + nameBind.BindTo(Room.Name); + hostBind.BindTo(Room.Host); + statusBind.BindTo(Room.Status); + beatmapBind.BindTo(Room.Beatmap); + maxParticipantsBind.BindTo(Room.MaxParticipants); + participantsBind.BindTo(Room.Participants); + } + } + + public RoomInspector() + { + Width = 520; + RelativeSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"343138"), + }, + topFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = 200, + Masking = true, + Children = new Drawable[] + { + cover = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(20), + Children = new Drawable[] + { + new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + LayoutDuration = 100, + Children = new[] + { + participants = new OsuSpriteText + { + TextSize = 30, + Font = @"Exo2.0-Bold" + }, + participantsSlash = new OsuSpriteText + { + Text = @"/", + TextSize = 30, + Font = @"Exo2.0-Light" + }, + maxParticipants = new OsuSpriteText + { + TextSize = 30, + Font = @"Exo2.0-Light" + }, + }, + }, + name = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + TextSize = 30, + }, + }, + }, + }, + }, + statusStrip = new Box + { + RelativeSizeAxes = Axes.X, + Height = 5, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"28242d"), + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Padding = content_padding, + Spacing = new Vector2(0f, 5f), + Children = new Drawable[] + { + status = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + LayoutDuration = 100, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + rulesetContainer = new Container + { + Size = new Vector2(30f), + }, + new Container //todo: game type icon + { + Size = new Vector2(30f), + CornerRadius = 15f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"545454"), + }, + }, + }, + new Container + { + AutoSizeAxes = Axes.X, + Height = 30f, + Margin = new MarginPadding { Left = 5 }, + Children = new[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + beatmapTitle = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + }, + beatmapDash = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + }, + beatmapArtist = new OsuSpriteText + { + Font = @"Exo2.0-RegularItalic", + }, + }, + }, + beatmapAuthor = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + TextSize = 14, + }, + }, + }, + }, + }, + }, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = content_padding, + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + Height = 15f, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + flagContainer = new Container + { + Width = 22f, + RelativeSizeAxes = Axes.Y, + }, + new Container + { + Width = 38f, + RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + levelRangeContainer = new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = "Level Range ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + Text = "6251", + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, + }, + }, + }, + }, + }, + participantsScroll = new ScrollContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Top = content_padding.Top, Left = 38, Right = 37 }, + Children = new[] + { + participantsFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + LayoutDuration = 100, + Spacing = new Vector2(5f), + }, + }, + }, + }; + + nameBind.ValueChanged += displayName; + hostBind.ValueChanged += displayUser; + maxParticipantsBind.ValueChanged += displayMaxParticipants; + participantsBind.ValueChanged += displayParticipants; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures, RulesetDatabase rulesets) + { + this.localisation = localisation; + this.colours = colours; + + beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; + host.Colour = colours.Blue; + + cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png"); + + rulesetContainer.Add(new DifficultyIcon(new BeatmapInfo + { + Ruleset = rulesets.GetRuleset(0), + StarDifficulty = 3.7, + }) { Size = new Vector2(30f) }); + + //binded here instead of ctor because dependencies are needed + statusBind.ValueChanged += displayStatus; + beatmapBind.ValueChanged += displayBeatmap; + + statusBind.TriggerChange(); + beatmapBind.TriggerChange(); + } + + protected override void Update() + { + base.Update(); + + participantsScroll.Height = DrawHeight - topFlow.DrawHeight; + } + + private void displayName(string value) + { + name.Text = value; + } + + private void displayUser(User value) + { + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + + private void displayStatus(RoomStatus value) + { + if (value == null) return; + status.Text = value.Message; + + foreach (Drawable d in new Drawable[] { statusStrip, status }) + d.FadeColour(value.GetAppropriateColour(colours), 100); + } + + private void displayBeatmap(BeatmapInfo value) + { + if (value != null) + { + rulesetContainer.FadeIn(100); + rulesetContainer.Children = new[] + { + new DifficultyIcon(value) + { + Size = new Vector2(rulesetContainer.DrawHeight), + } + }; + + beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); + beatmapDash.Text = @" - "; + beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); + beatmapAuthor.Text = $"mapped by {value.Metadata.Author}"; + } + else + { + rulesetContainer.FadeOut(100); + + beatmapTitle.Current = null; + beatmapArtist.Current = null; + + beatmapTitle.Text = "Changing map"; + beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty; + } + } + + private void displayMaxParticipants(int? value) + { + if (value == null) + { + participantsSlash.FadeOut(100); + maxParticipants.FadeOut(100); + } + else + { + participantsSlash.FadeIn(100); + maxParticipants.FadeIn(100); + maxParticipants.Text = value.ToString(); + } + } + + private void displayParticipants(User[] value) + { + participants.Text = value.Length.ToString(); + + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); + + participantsFlow.Children = value.Select(u => new UserTile(u)); + } + + private class UserTile : Container, IHasTooltip + { + private readonly User user; + + public string TooltipText => user.Username; + + public UserTile(User user) + { + this.user = user; + Size = new Vector2(70f); + CornerRadius = 5f; + Masking = true; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"27252d"), + }, + new UpdateableAvatar + { + RelativeSizeAxes = Axes.Both, + User = user, + }, + }; + } + } + } +} diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 93933c8fe9..8c5ab29736 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -22,6 +22,10 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); + public int GlobalRank; + + public int CountryRank; + //public Team Team; [JsonProperty(@"profile_colour")] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0ec0624978..d233d1e28b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -452,6 +452,7 @@ + From 774d37a05897d68fab316f7c3ca322f69e37e10b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 19:13:05 -0300 Subject: [PATCH 007/312] Add transition_duration, remove testing DifficultyIcon --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 1471e2ed26..485ebf63b0 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -25,6 +25,7 @@ namespace osu.Game.Screens.Multiplayer public class RoomInspector : Container { private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; + private const float transition_duration = 100; private readonly FillFlowContainer topFlow; private readonly Box statusStrip; @@ -113,7 +114,7 @@ namespace osu.Game.Screens.Multiplayer Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - LayoutDuration = 100, + LayoutDuration = transition_duration, Children = new[] { participants = new OsuSpriteText @@ -178,7 +179,7 @@ namespace osu.Game.Screens.Multiplayer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - LayoutDuration = 100, + LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { @@ -349,7 +350,7 @@ namespace osu.Game.Screens.Multiplayer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - LayoutDuration = 100, + LayoutDuration = transition_duration, Spacing = new Vector2(5f), }, }, @@ -363,7 +364,7 @@ namespace osu.Game.Screens.Multiplayer } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures, RulesetDatabase rulesets) + private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures) { this.localisation = localisation; this.colours = colours; @@ -373,12 +374,6 @@ namespace osu.Game.Screens.Multiplayer cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png"); - rulesetContainer.Add(new DifficultyIcon(new BeatmapInfo - { - Ruleset = rulesets.GetRuleset(0), - StarDifficulty = 3.7, - }) { Size = new Vector2(30f) }); - //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; beatmapBind.ValueChanged += displayBeatmap; @@ -411,14 +406,14 @@ namespace osu.Game.Screens.Multiplayer status.Text = value.Message; foreach (Drawable d in new Drawable[] { statusStrip, status }) - d.FadeColour(value.GetAppropriateColour(colours), 100); + d.FadeColour(value.GetAppropriateColour(colours), transition_duration); } private void displayBeatmap(BeatmapInfo value) { if (value != null) { - rulesetContainer.FadeIn(100); + rulesetContainer.FadeIn(transition_duration); rulesetContainer.Children = new[] { new DifficultyIcon(value) @@ -434,7 +429,7 @@ namespace osu.Game.Screens.Multiplayer } else { - rulesetContainer.FadeOut(100); + rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; @@ -448,13 +443,13 @@ namespace osu.Game.Screens.Multiplayer { if (value == null) { - participantsSlash.FadeOut(100); - maxParticipants.FadeOut(100); + participantsSlash.FadeOut(transition_duration); + maxParticipants.FadeOut(transition_duration); } else { - participantsSlash.FadeIn(100); - maxParticipants.FadeIn(100); + participantsSlash.FadeIn(transition_duration); + maxParticipants.FadeIn(transition_duration); maxParticipants.Text = value.ToString(); } } From 5d6534031e72cd271cab797d1fae631baecd8627 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 19:35:37 -0300 Subject: [PATCH 008/312] Proper cover loading --- .../Tests/TestCaseRoomInspector.cs | 8 ++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 43 +++++++++++++------ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 8ec1f66f8b..ac685d8b99 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -35,6 +35,10 @@ namespace osu.Desktop.VisualTests.Tests Artist = @"Maaya Sakamoto", Author = @"uwutm8", }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" }, + }, }; room.MaxParticipants.Value = 200; room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, @@ -79,6 +83,10 @@ namespace osu.Desktop.VisualTests.Tests Artist = @"FREEDOM DIVE", Author = @"Nakagawa-Kanon", }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" }, + }, }; newRoom.MaxParticipants.Value = 10; newRoom.Participants.Value = new[] diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 485ebf63b0..4c706cc630 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -27,15 +27,11 @@ namespace osu.Game.Screens.Multiplayer private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; - private readonly FillFlowContainer topFlow; private readonly Box statusStrip; + private readonly Container coverContainer, rulesetContainer, flagContainer; + private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; - private readonly Sprite cover; - private readonly FillFlowContainer levelRangeContainer; private readonly ScrollContainer participantsScroll; - private readonly FillFlowContainer participantsFlow; - private readonly Container rulesetContainer; - private readonly Container flagContainer; private Bindable nameBind = new Bindable(); private Bindable hostBind = new Bindable(); @@ -46,6 +42,7 @@ namespace osu.Game.Screens.Multiplayer private OsuColour colours; private LocalisationEngine localisation; + private TextureStore textures; private Room room; public Room Room @@ -91,11 +88,21 @@ namespace osu.Game.Screens.Multiplayer Masking = true, Children = new Drawable[] { - cover = new Sprite + new Container { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + coverContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + }, }, new Box { @@ -368,12 +375,11 @@ namespace osu.Game.Screens.Multiplayer { this.localisation = localisation; this.colours = colours; + this.textures = textures; beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; host.Colour = colours.Blue; - cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png"); - //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; beatmapBind.ValueChanged += displayBeatmap; @@ -413,6 +419,18 @@ namespace osu.Game.Screens.Multiplayer { if (value != null) { + coverContainer.FadeIn(transition_duration); + coverContainer.Children = new[] + { + new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + }) { RelativeSizeAxes = Axes.Both } + }; + rulesetContainer.FadeIn(transition_duration); rulesetContainer.Children = new[] { @@ -429,6 +447,7 @@ namespace osu.Game.Screens.Multiplayer } else { + coverContainer.FadeOut(transition_duration); rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; From b97691100f94bc9f5ff5c63e7ce307b8577ead15 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 19:53:06 -0300 Subject: [PATCH 009/312] Add ruleset_height to remove magic numbers --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 4c706cc630..7f0cf409d2 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -26,6 +26,7 @@ namespace osu.Game.Screens.Multiplayer { private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; + private const float ruleset_height = 30; private readonly Box statusStrip; private readonly Container coverContainer, rulesetContainer, flagContainer; @@ -192,11 +193,11 @@ namespace osu.Game.Screens.Multiplayer { rulesetContainer = new Container { - Size = new Vector2(30f), + Size = new Vector2(ruleset_height), }, new Container //todo: game type icon { - Size = new Vector2(30f), + Size = new Vector2(ruleset_height), CornerRadius = 15f, Masking = true, Children = new[] @@ -211,7 +212,7 @@ namespace osu.Game.Screens.Multiplayer new Container { AutoSizeAxes = Axes.X, - Height = 30f, + Height = ruleset_height, Margin = new MarginPadding { Left = 5 }, Children = new[] { @@ -436,7 +437,7 @@ namespace osu.Game.Screens.Multiplayer { new DifficultyIcon(value) { - Size = new Vector2(rulesetContainer.DrawHeight), + Size = new Vector2(ruleset_height), } }; From d331aa3b301bb4b374d3663c72587f17566ba42f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 20:02:05 -0300 Subject: [PATCH 010/312] Fix random layout animations when loaded --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 7f0cf409d2..c771777d27 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -185,7 +185,8 @@ namespace osu.Game.Screens.Multiplayer }, new FillFlowContainer { - AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.X, + Height = ruleset_height, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), @@ -212,7 +213,7 @@ namespace osu.Game.Screens.Multiplayer new Container { AutoSizeAxes = Axes.X, - Height = ruleset_height, + RelativeSizeAxes = Axes.Y, Margin = new MarginPadding { Left = 5 }, Children = new[] { @@ -389,9 +390,9 @@ namespace osu.Game.Screens.Multiplayer beatmapBind.TriggerChange(); } - protected override void Update() + protected override void UpdateAfterChildren() { - base.Update(); + base.UpdateAfterChildren(); participantsScroll.Height = DrawHeight - topFlow.DrawHeight; } From 9e01074852a5b4bd78357522e62f797cb3d63b77 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 21:41:20 -0300 Subject: [PATCH 011/312] Add GameType and DrawableGameType --- .../Tests/TestCaseRoomInspector.cs | 3 + osu.Game/Online/Multiplayer/GameType.cs | 127 ++++++++++++++++++ osu.Game/Online/Multiplayer/Room.cs | 1 + .../Screens/Multiplayer/DrawableGameType.cs | 43 ++++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 29 ++-- osu.Game/osu.Game.csproj | 2 + 6 files changed, 193 insertions(+), 12 deletions(-) create mode 100644 osu.Game/Online/Multiplayer/GameType.cs create mode 100644 osu.Game/Screens/Multiplayer/DrawableGameType.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index ac685d8b99..7ec78cd136 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -25,6 +25,7 @@ namespace osu.Desktop.VisualTests.Tests room.Name.Value = @"My Awesome Room"; room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; room.Status.Value = new RoomStatusOpen(); + room.Type.Value = new GameTypeTeamVersus(); room.Beatmap.Value = new BeatmapInfo { StarDifficulty = 3.7, @@ -59,6 +60,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above"); AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" }}); AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying()); + AddStep(@"change type", () => room.Type.Value = new GameTypeTag()); AddStep(@"change beatmap", () => room.Beatmap.Value = null); AddStep(@"change max participants", () => room.MaxParticipants.Value = null); AddStep(@"change participants", () => room.Participants.Value = new[] @@ -73,6 +75,7 @@ namespace osu.Desktop.VisualTests.Tests newRoom.Name.Value = @"My New, Better Than Ever Room"; newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; newRoom.Status.Value = new RoomStatusOpen(); + newRoom.Type.Value = new GameTypeTagTeam(); newRoom.Beatmap.Value = new BeatmapInfo { StarDifficulty = 7.07, diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs new file mode 100644 index 0000000000..0b9633a752 --- /dev/null +++ b/osu.Game/Online/Multiplayer/GameType.cs @@ -0,0 +1,127 @@ +// 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.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; + +namespace osu.Game.Online.Multiplayer +{ + public abstract class GameType + { + public abstract string Name { get; } + public abstract Drawable GetIcon(OsuColour colours, float size); + } + + public class GameTypeTag : GameType + { + public override string Name => "Tag"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_refresh, + TextSize = size, + Colour = colours.Blue, + Shadow = false, + UseFullGlyphHeight = false, + }; + } + } + + public class GameTypeVersus : GameType + { + public override string Name => "Versus"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new VersusRow(colours.Blue, colours.Blue, size * 0.6f) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + } + } + + public class GameTypeTagTeam : GameType + { + public override string Name => "Tag Team"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new VersusRow(colours.Blue, colours.Blue, size * 0.6f) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + } + } + + public class GameTypeTeamVersus : GameType + { + public override string Name => "Team Versus"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(2f), + Children = new[] + { + new VersusRow(colours.Blue, colours.Pink, size * 0.5f), + new VersusRow(colours.Blue, colours.Pink, size * 0.5f), + }, + }; + } + } + + internal class VersusRow : FillFlowContainer + { + public VersusRow(Color4 first, Color4 second, float size) + { + var triangle_size = new Vector2(size); + AutoSizeAxes = Axes.Both; + Spacing = new Vector2(2f, 0f); + + Children = new[] + { + new Container + { + Size = triangle_size, + Colour = first, + Children = new[] + { + new EquilateralTriangle + { + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + Rotation = 90, + EdgeSmoothness = new Vector2(1f), + }, + }, + }, + new Container + { + Size = triangle_size, + Colour = second, + Children = new[] + { + new EquilateralTriangle + { + Anchor = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + Rotation = -90, + EdgeSmoothness = new Vector2(1f), + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index fe3378f4a6..26b9dbc88a 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -12,6 +12,7 @@ namespace osu.Game.Online.Multiplayer public Bindable Name = new Bindable(); public Bindable Host = new Bindable(); public Bindable Status = new Bindable(); + public Bindable Type = new Bindable(); public Bindable Beatmap = new Bindable(); public Bindable MaxParticipants = new Bindable(); public Bindable Participants = new Bindable(); diff --git a/osu.Game/Screens/Multiplayer/DrawableGameType.cs b/osu.Game/Screens/Multiplayer/DrawableGameType.cs new file mode 100644 index 0000000000..6e7458b3dc --- /dev/null +++ b/osu.Game/Screens/Multiplayer/DrawableGameType.cs @@ -0,0 +1,43 @@ +// 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.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Online.Multiplayer; + +namespace osu.Game.Screens.Multiplayer +{ + public class DrawableGameType : CircularContainer, IHasTooltip + { + private readonly GameType type; + + public string TooltipText => type.Name; + + public DrawableGameType(GameType type) + { + this.type = type; + Masking = true; + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"545454"), + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Add(type.GetIcon(colours, Height / 2)); + } + } +} diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index c771777d27..89b71bf9b9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multiplayer private const float ruleset_height = 30; private readonly Box statusStrip; - private readonly Container coverContainer, rulesetContainer, flagContainer; + private readonly Container coverContainer, rulesetContainer, gameTypeContainer, flagContainer; private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; private readonly ScrollContainer participantsScroll; @@ -37,6 +37,7 @@ namespace osu.Game.Screens.Multiplayer private Bindable nameBind = new Bindable(); private Bindable hostBind = new Bindable(); private Bindable statusBind = new Bindable(); + private Bindable typeBind = new Bindable(); private Bindable beatmapBind = new Bindable(); private Bindable maxParticipantsBind = new Bindable(); private Bindable participantsBind = new Bindable(); @@ -57,6 +58,7 @@ namespace osu.Game.Screens.Multiplayer nameBind.BindTo(Room.Name); hostBind.BindTo(Room.Host); statusBind.BindTo(Room.Status); + typeBind.BindTo(Room.Type); beatmapBind.BindTo(Room.Beatmap); maxParticipantsBind.BindTo(Room.MaxParticipants); participantsBind.BindTo(Room.Participants); @@ -196,19 +198,9 @@ namespace osu.Game.Screens.Multiplayer { Size = new Vector2(ruleset_height), }, - new Container //todo: game type icon + gameTypeContainer = new Container { Size = new Vector2(ruleset_height), - CornerRadius = 15f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"545454"), - }, - }, }, new Container { @@ -384,9 +376,11 @@ namespace osu.Game.Screens.Multiplayer //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; + typeBind.ValueChanged += displayGameType; beatmapBind.ValueChanged += displayBeatmap; statusBind.TriggerChange(); + typeBind.TriggerChange(); beatmapBind.TriggerChange(); } @@ -417,6 +411,17 @@ namespace osu.Game.Screens.Multiplayer d.FadeColour(value.GetAppropriateColour(colours), transition_duration); } + private void displayGameType(GameType value) + { + gameTypeContainer.Children = new[] + { + new DrawableGameType(value) + { + Size = new Vector2(ruleset_height), + }, + }; + } + private void displayBeatmap(BeatmapInfo value) { if (value != null) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d233d1e28b..5e673e0477 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -453,6 +453,8 @@ + + From 185a4c4d2e65dbf7c669f2fa5845d875b681ac15 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:00:27 -0300 Subject: [PATCH 012/312] Unused usings --- osu.Game/Screens/Multiplayer/DrawableGameType.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableGameType.cs b/osu.Game/Screens/Multiplayer/DrawableGameType.cs index 6e7458b3dc..ccc98c3ccd 100644 --- a/osu.Game/Screens/Multiplayer/DrawableGameType.cs +++ b/osu.Game/Screens/Multiplayer/DrawableGameType.cs @@ -1,10 +1,7 @@ // 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.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; From 7ba32f20215d6e24132db952e1911e5426c84572 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:11:45 -0300 Subject: [PATCH 013/312] Cleanup --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 89b71bf9b9..6b68c396c9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -196,11 +196,11 @@ namespace osu.Game.Screens.Multiplayer { rulesetContainer = new Container { - Size = new Vector2(ruleset_height), + AutoSizeAxes = Axes.Both, }, gameTypeContainer = new Container { - Size = new Vector2(ruleset_height), + AutoSizeAxes = Axes.Both, }, new Container { @@ -263,7 +263,7 @@ namespace osu.Game.Screens.Multiplayer Width = 22f, RelativeSizeAxes = Axes.Y, }, - new Container + new Container //todo: team banners { Width = 38f, RelativeSizeAxes = Axes.Y, @@ -399,12 +399,17 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + flagContainer.Children = new[] + { + new DrawableFlag(value.Country?.FlagName ?? @"__") + { + RelativeSizeAxes = Axes.Both, + }, + }; } private void displayStatus(RoomStatus value) { - if (value == null) return; status.Text = value.Message; foreach (Drawable d in new Drawable[] { statusStrip, status }) From a483422b44e430162a505c9fcea698a9f94c52c3 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:23:00 -0300 Subject: [PATCH 014/312] CI fixes --- osu.Game/Online/Multiplayer/GameType.cs | 6 ++--- osu.Game/Screens/Multiplayer/RoomInspector.cs | 22 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs index 0b9633a752..2f4c92d289 100644 --- a/osu.Game/Online/Multiplayer/GameType.cs +++ b/osu.Game/Online/Multiplayer/GameType.cs @@ -85,7 +85,7 @@ namespace osu.Game.Online.Multiplayer { public VersusRow(Color4 first, Color4 second, float size) { - var triangle_size = new Vector2(size); + var triangleSize = new Vector2(size); AutoSizeAxes = Axes.Both; Spacing = new Vector2(2f, 0f); @@ -93,7 +93,7 @@ namespace osu.Game.Online.Multiplayer { new Container { - Size = triangle_size, + Size = triangleSize, Colour = first, Children = new[] { @@ -108,7 +108,7 @@ namespace osu.Game.Online.Multiplayer }, new Container { - Size = triangle_size, + Size = triangleSize, Colour = second, Children = new[] { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 6b68c396c9..fc4c1e1159 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Multiplayer { public class RoomInspector : Container { - private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; + private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; private const float ruleset_height = 30; @@ -34,13 +34,13 @@ namespace osu.Game.Screens.Multiplayer private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; private readonly ScrollContainer participantsScroll; - private Bindable nameBind = new Bindable(); - private Bindable hostBind = new Bindable(); - private Bindable statusBind = new Bindable(); - private Bindable typeBind = new Bindable(); - private Bindable beatmapBind = new Bindable(); - private Bindable maxParticipantsBind = new Bindable(); - private Bindable participantsBind = new Bindable(); + private readonly Bindable nameBind = new Bindable(); + private readonly Bindable hostBind = new Bindable(); + private readonly Bindable statusBind = new Bindable(); + private readonly Bindable typeBind = new Bindable(); + private readonly Bindable beatmapBind = new Bindable(); + private readonly Bindable maxParticipantsBind = new Bindable(); + private readonly Bindable participantsBind = new Bindable(); private OsuColour colours; private LocalisationEngine localisation; @@ -176,7 +176,7 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Padding = content_padding, + Padding = contentPadding, Spacing = new Vector2(0f, 5f), Children = new Drawable[] { @@ -247,7 +247,7 @@ namespace osu.Game.Screens.Multiplayer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = content_padding, + Padding = contentPadding, Children = new Drawable[] { new FillFlowContainer @@ -344,7 +344,7 @@ namespace osu.Game.Screens.Multiplayer Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Padding = new MarginPadding { Top = content_padding.Top, Left = 38, Right = 37 }, + Padding = new MarginPadding { Top = contentPadding.Top, Left = 38, Right = 37 }, Children = new[] { participantsFlow = new FillFlowContainer From ecece2bc29f0874ccd5be1d720f37f3140f7949d Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:28:15 -0300 Subject: [PATCH 015/312] "Use" object initializers in visual test --- osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 7ec78cd136..0e3ed7c1a9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - var room = new Room(); + var room = new Room { }; room.Name.Value = @"My Awesome Room"; room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; room.Status.Value = new RoomStatusOpen(); @@ -71,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change room", () => { - var newRoom = new Room(); + var newRoom = new Room { }; newRoom.Name.Value = @"My New, Better Than Ever Room"; newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; newRoom.Status.Value = new RoomStatusOpen(); From e708cdf41a3d1e8be0e2cff41892d752577da097 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:34:02 -0300 Subject: [PATCH 016/312] Level Range -> Range Range, don't use empty object initializers --- osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs | 4 ++-- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 0e3ed7c1a9..7ec78cd136 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - var room = new Room { }; + var room = new Room(); room.Name.Value = @"My Awesome Room"; room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; room.Status.Value = new RoomStatusOpen(); @@ -71,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change room", () => { - var newRoom = new Room { }; + var newRoom = new Room(); newRoom.Name.Value = @"My New, Better Than Ever Room"; newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; newRoom.Status.Value = new RoomStatusOpen(); diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index fc4c1e1159..25a4740698 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -304,7 +304,7 @@ namespace osu.Game.Screens.Multiplayer { new OsuSpriteText { - Text = "Level Range ", + Text = "Rank Range ", TextSize = 14, }, new OsuSpriteText From 212b2c114206628c5030ff214bace924ad30a5bc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 1 Jun 2017 04:45:46 -0300 Subject: [PATCH 017/312] Initial layout and animation --- osu-resources | 2 +- .../Tests/TestCaseMedalOverlay.cs | 28 +++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Overlays/MedalOverlay.cs | 212 ++++++++++++++++++ .../Overlays/MedalSplash/DrawableMedal.cs | 147 ++++++++++++ osu.Game/Users/Medal.cs | 11 + osu.Game/osu.Game.csproj | 3 + 7 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs create mode 100644 osu.Game/Overlays/MedalOverlay.cs create mode 100644 osu.Game/Overlays/MedalSplash/DrawableMedal.cs create mode 100644 osu.Game/Users/Medal.cs diff --git a/osu-resources b/osu-resources index 9f46a456dc..37e9e96d01 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 9f46a456dc3a56dcbff09671a3f588b16a464106 +Subproject commit 37e9e96d011ba7faeb4a302e65fb7bdb4dc16690 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs new file mode 100644 index 0000000000..581675e66a --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Game.Overlays; +using osu.Game.Users; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseMedalOverlay : TestCase + { + public override string Description => @"medal get!"; + + public override void Reset() + { + base.Reset(); + + MedalOverlay overlay; + Add(overlay = new MedalOverlay(new Medal + { + Name = @"Animations", + Description = @"More complex than you think.", + })); + + AddStep(@"show", overlay.Show); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 5a532d7234..52e429efd8 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -224,6 +224,7 @@ + diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs new file mode 100644 index 0000000000..2d2a32fa4f --- /dev/null +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -0,0 +1,212 @@ +// 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.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Sprites; +using osu.Game.Users; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Overlays.MedalSplash; +using osu.Framework.Allocation; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Overlays +{ + public class MedalOverlay : FocusedOverlayContainer + { + public const float DISC_SIZE = 400; + + private const float border_width = 5; + + private readonly Box background; + private readonly FillFlowContainer backgroundStrip; + private readonly BackgroundStrip leftStrip, rightStrip; + private readonly CircularContainer disc; + private readonly Sprite innerSpin, outterSpin; + private readonly DrawableMedal drawableMedal; + + private SampleChannel getSample; + + protected override bool BlockPassThroughKeyboard => true; + + public MedalOverlay(Medal medal) + { + RelativeSizeAxes = Axes.Both; + Alpha = 0f; + + Children = new Drawable[] + { + background = new Box + { + Name = @"dim", + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(60), + }, + outterSpin = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(DISC_SIZE + 500), + Alpha = 0f, + }, + backgroundStrip = new FillFlowContainer + { + Name = @"background strip", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Width = 0f, + Height = border_width, + Alpha = 0f, + Direction = FillDirection.Horizontal, + Children = new[] + { + leftStrip = new BackgroundStrip(0f, 1f), + rightStrip = new BackgroundStrip(1f, 0f), + }, + }, + disc = new CircularContainer + { + Name = @"content", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0f, + Masking = true, + BorderColour = Color4.White, + BorderThickness = border_width, + Size = new Vector2(DISC_SIZE), + Scale = new Vector2(0.8f), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"05262f"), + }, + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 2, + ColourDark = OsuColour.FromHex(@"04222b"), + ColourLight = OsuColour.FromHex(@"052933"), + }, + innerSpin = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1.05f), + Alpha = 0.25f, + }, + drawableMedal = new DrawableMedal(medal) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, TextureStore textures, AudioManager audio) + { + getSample = audio.Sample.Get(@"MedalSplash/medal-get"); + innerSpin.Texture = outterSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); + + disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = colours.Blue.Opacity(0.5f), + Radius = 50, + }; + } + + protected override void PopIn() + { + base.PopIn(); + + FadeIn(200); + background.FlashColour(Color4.White.Opacity(0.25f), 400); + + double duration1 = 400; + double duration2 = 900; + double duration3 = 900; + double duration4 = 1000; + + getSample.Play(); + Delay(200, true); + + innerSpin.Transforms.Add(new TransformRotation + { + StartValue = 0, + EndValue = 359, + StartTime = Clock.TimeInfo.Current, + EndTime = Clock.TimeInfo.Current + 20000, + LoopCount = -1, + }); + + outterSpin.Transforms.Add(new TransformRotation + { + StartValue = 0, + EndValue = 359, + StartTime = Clock.TimeInfo.Current, + EndTime = Clock.TimeInfo.Current + 40000, + LoopCount = -1, + }); + + disc.FadeIn(duration1); + backgroundStrip.FadeIn(duration1); + backgroundStrip.ResizeWidthTo(1f, duration1 * 2, EasingTypes.OutQuint); + outterSpin.FadeTo(0.1f, duration1 * 2); + disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); + + Delay(duration1 + 200, true); + drawableMedal.ChangeState(DrawableMedal.DisplayState.Icon, duration2); + + Delay(duration2, true); + drawableMedal.ChangeState(DrawableMedal.DisplayState.MedalUnlocked, duration3); + + Delay(duration3, true); + drawableMedal.ChangeState(DrawableMedal.DisplayState.Full, duration4); + } + + protected override void PopOut() + { + base.PopOut(); + + FadeOut(200); + } + + private class BackgroundStrip : Container + { + public BackgroundStrip(float start, float end) + { + RelativeSizeAxes = Axes.Both; + Width = 0.5f; + ColourInfo = ColourInfo.GradientHorizontal(Color4.White.Opacity(start), Color4.White.Opacity(end)); + Masking = true; + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + } + }; + } + } + } +} diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs new file mode 100644 index 0000000000..c85adc4f2a --- /dev/null +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -0,0 +1,147 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Overlays.MedalSplash +{ + public class DrawableMedal : Container + { + private const float scale_when_unlocked = 0.76f; + private const float scale_when_full = 0.6f; + + private readonly Container medal; + private readonly Sprite medalGlow; + private readonly OsuSpriteText unlocked, name; + private readonly Paragraph description; + private readonly FillFlowContainer infoFlow; + private readonly IEnumerable descriptionSprites; + + public DrawableMedal(Medal medal) + { + Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); + + Children = new Drawable[] + { + this.medal = new Container + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Alpha = 0f, + Children = new[] + { + medalGlow = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }, + }, + unlocked = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Medal Unlocked".ToUpper(), + TextSize = 24, + Font = @"Exo2.0-Light", + Alpha = 0f, + Scale = new Vector2(1 / scale_when_unlocked), + }, + infoFlow = new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.6f, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 5f), + Children = new Drawable[] + { + name = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = medal.Name, + TextSize = 20, + Font = @"Exo2.0-Bold", + Alpha = 0f, + Scale = new Vector2(1 / scale_when_full), + }, + description = new Paragraph + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 0f, + Scale = new Vector2(1 / scale_when_full), + }, + }, + }, + }; + + descriptionSprites = description.AddText(medal.Description, s => + { + s.Anchor = Anchor.TopCentre; + s.Origin = Anchor.TopCentre; + s.TextSize = 16; + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, TextureStore textures) + { + medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); + + foreach (var s in descriptionSprites) + s.Colour = colours.BlueLight; + + var pos = new Vector2(0f, medal.Size.Y / 2 + 10); + unlocked.Position = pos; + pos.Y += 90; + infoFlow.Position = pos; + } + + public void ChangeState(DisplayState newState, double duration) + { + switch (newState) + { + case DisplayState.Icon: + medal.Scale = Vector2.Zero; + medal.ScaleTo(1, duration, EasingTypes.OutElastic); + medal.FadeInFromZero(duration); + break; + case DisplayState.MedalUnlocked: + ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); + MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); + unlocked.FadeInFromZero(duration); + break; + case DisplayState.Full: + ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); + MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); + name.FadeInFromZero(duration); + description.FadeInFromZero(duration * 2); + break; + } + } + + public enum DisplayState + { + Icon, + MedalUnlocked, + Full, + } + } +} diff --git a/osu.Game/Users/Medal.cs b/osu.Game/Users/Medal.cs new file mode 100644 index 0000000000..5ac6eceddc --- /dev/null +++ b/osu.Game/Users/Medal.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users +{ + public class Medal + { + public string Name { get; set; } + public string Description { get; set; } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0ec0624978..93d0652aa9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -452,6 +452,9 @@ + + + From a42c67ee9787f0336b8a2f40d27e0217c488c56c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 1 Jun 2017 20:54:42 +0300 Subject: [PATCH 018/312] Cancel beatmap random selection --- osu.Game/Screens/Select/BeatmapCarousel.cs | 42 ++++++++++++++++++++-- osu.Game/Screens/Select/Footer.cs | 4 ++- osu.Game/Screens/Select/FooterButton.cs | 16 +++++++-- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 9 ++++- 5 files changed, 65 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 26820fc388..07f6a7e5fd 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -77,8 +77,9 @@ namespace osu.Game.Screens.Select private readonly List panels = new List(); - private BeatmapGroup selectedGroup; + private readonly Stack randomSelectedBeatmaps = new Stack(); + private BeatmapGroup selectedGroup; private BeatmapPanel selectedPanel; public BeatmapCarousel() @@ -172,14 +173,17 @@ namespace osu.Game.Screens.Select public void SelectRandom() { - IEnumerable visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); + randomSelectedBeatmaps.Push(selectedGroup); + + var visibleGroups = getVisibleGroups(); if (!visibleGroups.Any()) return; BeatmapGroup group; + if (randomType == SelectionRandomType.RandomPermutation) { - IEnumerable notSeenGroups = visibleGroups.Except(seenGroups); + var notSeenGroups = visibleGroups.Except(seenGroups); if (!notSeenGroups.Any()) { seenGroups.Clear(); @@ -197,6 +201,38 @@ namespace osu.Game.Screens.Select selectGroup(group, panel); } + public void CancelRandom() + { + if (!randomSelectedBeatmaps.Any()) + return; + + var visibleGroups = getVisibleGroups(); + if (!visibleGroups.Any()) + return; + + // we can avoid selecting deleted beatmaps or beatmaps selected in another gamemode + while (true) + { + if (!randomSelectedBeatmaps.Any()) break; + + if (!visibleGroups.Contains(randomSelectedBeatmaps.FirstOrDefault())) + { + randomSelectedBeatmaps.Pop(); + } + else + { + BeatmapGroup beatmapGroup = randomSelectedBeatmaps.Pop(); + selectGroup(beatmapGroup, beatmapGroup.SelectedPanel); + break; + } + } + } + + private IEnumerable getVisibleGroups() + { + return groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); + } + private FilterCriteria criteria = new FilterCriteria(); private ScheduledDelegate filterTask; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 32e09a5f28..0aa86f4d0d 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -38,12 +38,13 @@ namespace osu.Game.Screens.Select /// Text on the button. /// Colour of the button. /// Hotkey of the button. + /// Forbid you to use hotkey with shift pressed. /// Action the button does. /// /// Higher depth to be put on the left, and lower to be put on the right. /// Notice this is different to ! /// - public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) + public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, bool excludePressWithShift = false, float depth = 0) { var button = new FooterButton { @@ -54,6 +55,7 @@ namespace osu.Game.Screens.Select SelectedColour = colour, DeselectedColour = colour.Opacity(0.5f), Hotkey = hotkey, + ExcludePressWithShift = excludePressWithShift, }; button.Hovered = () => updateModeLight(button); diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 58df409ca1..98a0b41543 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -84,6 +84,7 @@ namespace osu.Game.Screens.Select public Action Hovered; public Action HoverLost; public Key? Hotkey; + public bool ExcludePressWithShift; protected override bool OnHover(InputState state) { @@ -124,8 +125,19 @@ namespace osu.Game.Screens.Select { if (!args.Repeat && args.Key == Hotkey) { - OnClick(state); - return true; + if (ExcludePressWithShift) + { + if (!state.Keyboard.ShiftPressed) + { + OnClick(state); + return true; + } + } + else + { + OnClick(state); + return true; + } } return base.OnKeyDown(state, args); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index f96fbb87cb..0903184b40 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue); + Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, false, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 41fa53e8a3..1451d2e4fd 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Select { if (Footer != null) { - Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2); + Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2, true); Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); @@ -381,6 +381,13 @@ namespace osu.Game.Screens.Select return true; } break; + case Key.F2: + if (state.Keyboard.ShiftPressed) + { + carousel.CancelRandom(); + return true; + } + break; } return base.OnKeyDown(state, args); From 78500eec21b8039ef5b5959a885c26dca55738ef Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 5 Jun 2017 12:24:28 +0300 Subject: [PATCH 019/312] Applied suggested changes --- osu.Game/Screens/Select/BeatmapCarousel.cs | 19 ++++++------------- osu.Game/Screens/Select/Footer.cs | 4 +--- osu.Game/Screens/Select/FooterButton.cs | 16 ++-------------- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 19 +++++++++---------- 5 files changed, 19 insertions(+), 41 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 07f6a7e5fd..88c57853df 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -171,7 +171,7 @@ namespace osu.Game.Screens.Select } while (index != startIndex); } - public void SelectRandom() + public void SelectNextRandom() { randomSelectedBeatmaps.Push(selectedGroup); @@ -201,7 +201,7 @@ namespace osu.Game.Screens.Select selectGroup(group, panel); } - public void CancelRandom() + public void SelectPreviousRandom() { if (!randomSelectedBeatmaps.Any()) return; @@ -210,19 +210,12 @@ namespace osu.Game.Screens.Select if (!visibleGroups.Any()) return; - // we can avoid selecting deleted beatmaps or beatmaps selected in another gamemode - while (true) + while (randomSelectedBeatmaps.Any()) { - if (!randomSelectedBeatmaps.Any()) break; - - if (!visibleGroups.Contains(randomSelectedBeatmaps.FirstOrDefault())) + var group = randomSelectedBeatmaps.Pop(); + if (visibleGroups.Contains(group)) { - randomSelectedBeatmaps.Pop(); - } - else - { - BeatmapGroup beatmapGroup = randomSelectedBeatmaps.Pop(); - selectGroup(beatmapGroup, beatmapGroup.SelectedPanel); + selectGroup(group, group.SelectedPanel); break; } } diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 0aa86f4d0d..32e09a5f28 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -38,13 +38,12 @@ namespace osu.Game.Screens.Select /// Text on the button. /// Colour of the button. /// Hotkey of the button. - /// Forbid you to use hotkey with shift pressed. /// Action the button does. /// /// Higher depth to be put on the left, and lower to be put on the right. /// Notice this is different to ! /// - public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, bool excludePressWithShift = false, float depth = 0) + public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) { var button = new FooterButton { @@ -55,7 +54,6 @@ namespace osu.Game.Screens.Select SelectedColour = colour, DeselectedColour = colour.Opacity(0.5f), Hotkey = hotkey, - ExcludePressWithShift = excludePressWithShift, }; button.Hovered = () => updateModeLight(button); diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 98a0b41543..58df409ca1 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -84,7 +84,6 @@ namespace osu.Game.Screens.Select public Action Hovered; public Action HoverLost; public Key? Hotkey; - public bool ExcludePressWithShift; protected override bool OnHover(InputState state) { @@ -125,19 +124,8 @@ namespace osu.Game.Screens.Select { if (!args.Repeat && args.Key == Hotkey) { - if (ExcludePressWithShift) - { - if (!state.Keyboard.ShiftPressed) - { - OnClick(state); - return true; - } - } - else - { - OnClick(state); - return true; - } + OnClick(state); + return true; } return base.OnKeyDown(state, args); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 0903184b40..f96fbb87cb 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, false, float.MaxValue); + Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 1451d2e4fd..5e6eaadff5 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -154,11 +154,11 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours) + private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input) { if (Footer != null) { - Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2, true); + Footer.AddButton(@"random", colours.Green, () => triggerRandom(input), Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); @@ -209,7 +209,13 @@ namespace osu.Game.Screens.Select OnSelected(); } - public void SelectRandom() => carousel.SelectRandom(); + private void triggerRandom(UserInputManager input) + { + if (input.CurrentState.Keyboard.ShiftPressed) + carousel.SelectPreviousRandom(); + else + carousel.SelectNextRandom(); + } protected abstract void OnSelected(); @@ -381,13 +387,6 @@ namespace osu.Game.Screens.Select return true; } break; - case Key.F2: - if (state.Keyboard.ShiftPressed) - { - carousel.CancelRandom(); - return true; - } - break; } return base.OnKeyDown(state, args); From 1b8ef3bbbdd64f6d9ea17fedfb6be918f09a25f2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 5 Jun 2017 21:04:35 +0800 Subject: [PATCH 020/312] Add test case for UserPage. --- .../Tests/TestCaseUserPage.cs | 38 +++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Users/UserPageOverlay.cs | 2 + 3 files changed, 41 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs new file mode 100644 index 0000000000..24b196f4f3 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Graphics; +using osu.Framework.Testing; +using osu.Game.Overlays; +using osu.Game.Users; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseUserPage : TestCase + { + public override void Reset() + { + base.Reset(); + var userpage = new UserPageOverlay(new User + { + Username = @"peppy", + Id = 2, + Country = new Country { FlagName = @"AU" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" + }) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Width = 800, + Height = 500 + }; + Add(userpage); + AddStep("Toggle", userpage.ToggleVisibility); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 7b7997063b..d5b6b1a91d 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -210,6 +210,7 @@ + diff --git a/osu.Game/Users/UserPageOverlay.cs b/osu.Game/Users/UserPageOverlay.cs index c7b49433d7..c192e95f35 100644 --- a/osu.Game/Users/UserPageOverlay.cs +++ b/osu.Game/Users/UserPageOverlay.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -24,6 +25,7 @@ namespace osu.Game.Users var sections = new UserPageSection[] { }; var sectionsContainer = new SectionsContainer { + RelativeSizeAxes = Axes.Both, ExpandableHeader = new UserPageHeader(user), FixedHeader = tab, Sections = sections From 428b44f7d96ce4cf038fd4a822ab2b1759626b6d Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 5 Jun 2017 21:07:57 +0800 Subject: [PATCH 021/312] UserPage -> Profile. --- ...{TestCaseUserPage.cs => TestCaseUserProfile.cs} | 4 ++-- .../osu.Desktop.VisualTests.csproj | 2 +- .../UserPageHeader.cs => Profile/ProfileHeader.cs} | 2 +- .../ProfileSection.cs} | 6 +++--- .../Users/{UserPageOverlay.cs => UserProfile.cs} | 14 +++++++------- osu.Game/osu.Game.csproj | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseUserPage.cs => TestCaseUserProfile.cs} (87%) rename osu.Game/Users/{UserPage/UserPageHeader.cs => Profile/ProfileHeader.cs} (90%) rename osu.Game/Users/{UserPage/UserPageSection.cs => Profile/ProfileSection.cs} (69%) rename osu.Game/Users/{UserPageOverlay.cs => UserProfile.cs} (76%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs similarity index 87% rename from osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs rename to osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 24b196f4f3..67b89311e6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPage.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -13,12 +13,12 @@ using osu.Game.Users; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseUserPage : TestCase + internal class TestCaseUserProfile : TestCase { public override void Reset() { base.Reset(); - var userpage = new UserPageOverlay(new User + var userpage = new UserProfile(new User { Username = @"peppy", Id = 2, diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index d5b6b1a91d..3886239bf9 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -210,7 +210,7 @@ - + diff --git a/osu.Game/Users/UserPage/UserPageHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs similarity index 90% rename from osu.Game/Users/UserPage/UserPageHeader.cs rename to osu.Game/Users/Profile/ProfileHeader.cs index 872088fbef..5a8d982a11 100644 --- a/osu.Game/Users/UserPage/UserPageHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using osu.Framework.Graphics.Containers; -namespace osu.Game.Users.UserPage +namespace osu.Game.Users.Profile { public class UserPageHeader : Container { diff --git a/osu.Game/Users/UserPage/UserPageSection.cs b/osu.Game/Users/Profile/ProfileSection.cs similarity index 69% rename from osu.Game/Users/UserPage/UserPageSection.cs rename to osu.Game/Users/Profile/ProfileSection.cs index cb73218c05..ce362109cc 100644 --- a/osu.Game/Users/UserPage/UserPageSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -3,14 +3,14 @@ using osu.Framework.Graphics.Containers; -namespace osu.Game.Users.UserPage +namespace osu.Game.Users.Profile { - public abstract class UserPageSection : Container + public abstract class ProfileSection : Container { protected readonly User User; public abstract string Title { get; } - protected UserPageSection(User user) + protected ProfileSection(User user) { User = user; } diff --git a/osu.Game/Users/UserPageOverlay.cs b/osu.Game/Users/UserProfile.cs similarity index 76% rename from osu.Game/Users/UserPageOverlay.cs rename to osu.Game/Users/UserProfile.cs index c192e95f35..497d8e0002 100644 --- a/osu.Game/Users/UserPageOverlay.cs +++ b/osu.Game/Users/UserProfile.cs @@ -10,19 +10,19 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; -using osu.Game.Users.UserPage; +using osu.Game.Users.Profile; namespace osu.Game.Users { - public class UserPageOverlay : FocusedOverlayContainer + public class UserProfile : FocusedOverlayContainer { private readonly User user; - private UserPageSection lastSection; - public UserPageOverlay(User user) + private ProfileSection lastSection; + public UserProfile(User user) { this.user = user; - var tab = new OsuTabControl(); - var sections = new UserPageSection[] { }; + var tab = new OsuTabControl(); + var sections = new ProfileSection[] { }; var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, @@ -37,7 +37,7 @@ namespace osu.Game.Users { if (lastSection != s) { - lastSection = s as UserPageSection; + lastSection = s as ProfileSection; tab.Current.Value = lastSection; } }; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 049f4e14f3..ce5e1b6667 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -86,9 +86,9 @@ - - - + + + From 7d4c5999f663cccc47f84211d7ac58bf838c1bbc Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 5 Jun 2017 21:20:04 +0800 Subject: [PATCH 022/312] Add description in test case. --- osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 67b89311e6..9eea2cbf19 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -15,6 +15,8 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseUserProfile : TestCase { + public override string Description => "Tests user's profile page."; + public override void Reset() { base.Reset(); From a09d873db9c53803eeb2d7d51fd9d860be5a7668 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 6 Jun 2017 11:25:16 +0800 Subject: [PATCH 023/312] Basic member of profile header. --- osu.Game/Users/Profile/ProfileHeader.cs | 76 +++++++++++++++++++++++-- osu.Game/Users/UserProfile.cs | 8 +-- 2 files changed, 74 insertions(+), 10 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 5a8d982a11..03c0d0f656 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -1,21 +1,87 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; namespace osu.Game.Users.Profile { public class UserPageHeader : Container { private readonly User user; + + private const float cover_height = 200, avatar_size = 110, avatar_bottom_position = -20; public UserPageHeader(User user) { this.user = user; + RelativeSizeAxes = Axes.X; + Height = cover_height; + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = cover_height, + Children = new Drawable[] + { + new AsyncLoadWrapper(new UserCoverBackground(user) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(200) + }) { RelativeSizeAxes = Axes.Both }, + new UpdateableAvatar + { + User = user, + Size = new Vector2(avatar_size), + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + X = UserProfile.CONTENT_X_MARGIN, + Y = avatar_bottom_position, + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }, + }, + new Container + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + X = UserProfile.CONTENT_X_MARGIN + avatar_size + 10, + Y = avatar_bottom_position, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = user.Username, + TextSize = 25, + Font = @"Exo2.0-RegularItalic", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Y = -55 + }, + new DrawableFlag(user.Country?.FlagName ?? "__") + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Width = 30, + Height = 20 + } + } + } + } + } + }; } } } diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 497d8e0002..b4a7f7d546 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; @@ -18,6 +13,9 @@ namespace osu.Game.Users { private readonly User user; private ProfileSection lastSection; + + public const float CONTENT_X_MARGIN = 50; + public UserProfile(User user) { this.user = user; From 94b3320e58df6801d1d4ccb2430d3da2388cc5c2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 09:45:12 -0300 Subject: [PATCH 024/312] Center direct panel covers --- osu.Game/Overlays/Direct/DirectPanel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index cf969df303..f7ff88c24a 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -39,6 +39,8 @@ namespace osu.Game.Overlays.Direct { return new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo) { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), }) { RelativeSizeAxes = Axes.Both }; From 9f9107b84748bc95d0cb04a29760461557d7739c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 7 Jun 2017 21:15:43 +0800 Subject: [PATCH 025/312] Add gray background. --- osu.Game/Users/UserProfile.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index b4a7f7d546..95447bfe26 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -3,6 +3,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Users.Profile; @@ -21,6 +23,13 @@ namespace osu.Game.Users this.user = user; var tab = new OsuTabControl(); var sections = new ProfileSection[] { }; + + Add(new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.2f) + }); + var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, @@ -28,7 +37,6 @@ namespace osu.Game.Users FixedHeader = tab, Sections = sections }; - Add(sectionsContainer); sectionsContainer.SelectedSection.ValueChanged += s => From 3ed740676fce10ae90c1508827e150ffdbbf69ed Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 10:19:17 -0300 Subject: [PATCH 026/312] DirectSortCritera -> DirectSortCriteria --- osu.Game/Overlays/Direct/FilterControl.cs | 6 +++--- osu.Game/Overlays/DirectOverlay.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 455d0ab77b..ac9b7b1a1e 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -13,12 +13,12 @@ using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Direct { - public class FilterControl : SearchableListFilterControl + public class FilterControl : SearchableListFilterControl { private FillFlowContainer modeButtons; protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); - protected override DirectSortCritera DefaultTab => DirectSortCritera.Title; + protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Title; protected override Drawable CreateSupplementaryControls() { modeButtons = new FillFlowContainer @@ -94,7 +94,7 @@ namespace osu.Game.Overlays.Direct } } - public enum DirectSortCritera + public enum DirectSortCriteria { Title, Artist, diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index fb33c72b5e..c7c8a1f0ed 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -16,7 +16,7 @@ using osu.Game.Overlays.Direct; using osu.Game.Overlays.SearchableList; using OpenTK.Graphics; -namespace osu.Game.Overlays +namespace osu.Game.Overlaysi { public class DirectOverlay : SearchableListOverlay { @@ -29,7 +29,7 @@ namespace osu.Game.Overlays private readonly OsuSpriteText resultCountsText; private readonly FillFlowContainer panels; - protected override Color4 BackgroundColour => OsuColour.FromHex(@"485e74"); + protected override Color4 BackgroundColour => OsuColour.FromHexi(@"485e74"); protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"465b71"); protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); From f7f4f5e1552e2d52a88c5754685b6262e498a2a4 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 10:40:18 -0300 Subject: [PATCH 027/312] Request sorting, fix VS Code's "refactoring" --- .../Online/API/Requests/GetBeatmapSetsRequest.cs | 13 +++++++++++-- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 11 ++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs index ce5c9f0939..536da0cc1c 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using osu.Game.Database; +using osu.Game.Overlays; +using osu.Game.Overlays.Direct; namespace osu.Game.Online.API.Requests { @@ -12,14 +14,21 @@ namespace osu.Game.Online.API.Requests { private readonly string query; private readonly RankStatus rankStatus; + private readonly DirectSortCriteria sortCriteria; + private readonly SortDirection direction; + private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc"; - public GetBeatmapSetsRequest(string query, RankStatus rankStatus = RankStatus.Any) + public GetBeatmapSetsRequest(string query, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) { this.query = System.Uri.EscapeDataString(query); this.rankStatus = rankStatus; + this.sortCriteria = sortCriteria; + this.direction = direction; + + System.Console.WriteLine(Target); } - protected override string Target => $@"beatmapsets/search?q={query}&s={(int)rankStatus}"; + protected override string Target => $@"beatmapsets/search?q={query}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; } public class GetBeatmapSetsResponse : BeatmapMetadata diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index ac9b7b1a1e..31727e2adc 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Direct private FillFlowContainer modeButtons; protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); - protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Title; + protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Ranked; protected override Drawable CreateSupplementaryControls() { modeButtons = new FillFlowContainer diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index c7c8a1f0ed..c1ef6930b2 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -16,9 +16,9 @@ using osu.Game.Overlays.Direct; using osu.Game.Overlays.SearchableList; using OpenTK.Graphics; -namespace osu.Game.Overlaysi +namespace osu.Game.Overlays { - public class DirectOverlay : SearchableListOverlay + public class DirectOverlay : SearchableListOverlay { private const float panel_padding = 10f; @@ -29,12 +29,12 @@ namespace osu.Game.Overlaysi private readonly OsuSpriteText resultCountsText; private readonly FillFlowContainer panels; - protected override Color4 BackgroundColour => OsuColour.FromHexi(@"485e74"); + protected override Color4 BackgroundColour => OsuColour.FromHex(@"485e74"); protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"465b71"); protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable beatmapSets; public IEnumerable BeatmapSets @@ -117,6 +117,7 @@ namespace osu.Game.Overlaysi Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; Filter.Search.OnCommit = (sender, text) => updateSets(); + Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets(); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => updateSets(); @@ -162,7 +163,7 @@ namespace osu.Game.Overlaysi if (api == null || Filter.Search.Text == string.Empty) return; - getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, Filter.DisplayStyleControl.Dropdown.Current.Value); + getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets)); api.Queue(getSetsRequest); } From 312fd16631559871a425888834c60de79c6e5c2e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 11:00:05 -0300 Subject: [PATCH 028/312] Ruleset filtering --- osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs | 8 ++++---- osu.Game/Overlays/Direct/FilterControl.cs | 6 ++++-- osu.Game/Overlays/DirectOverlay.cs | 7 ++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs index 536da0cc1c..f3f670138a 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -13,22 +13,22 @@ namespace osu.Game.Online.API.Requests public class GetBeatmapSetsRequest : APIRequest> { private readonly string query; + private readonly RulesetInfo ruleset; private readonly RankStatus rankStatus; private readonly DirectSortCriteria sortCriteria; private readonly SortDirection direction; private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc"; - public GetBeatmapSetsRequest(string query, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) + public GetBeatmapSetsRequest(string query, RulesetInfo ruleset, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending) { this.query = System.Uri.EscapeDataString(query); + this.ruleset = ruleset; this.rankStatus = rankStatus; this.sortCriteria = sortCriteria; this.direction = direction; - - System.Console.WriteLine(Target); } - protected override string Target => $@"beatmapsets/search?q={query}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; + protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; } public class GetBeatmapSetsResponse : BeatmapMetadata diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 31727e2adc..b6682a2768 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -10,11 +10,13 @@ using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.SearchableList; +using osu.Game.Rulesets; namespace osu.Game.Overlays.Direct { public class FilterControl : SearchableListFilterControl { + public readonly Bindable Ruleset = new Bindable(); private FillFlowContainer modeButtons; protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); @@ -35,10 +37,10 @@ namespace osu.Game.Overlays.Direct { DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark; - var b = new Bindable(); //backup bindable incase the game is null + Ruleset.BindTo(game?.Ruleset ?? new Bindable()); foreach (var r in rulesets.AllRulesets) { - modeButtons.Add(new RulesetToggleButton(game?.Ruleset ?? b, r)); + modeButtons.Add(new RulesetToggleButton(Ruleset, r)); } } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index c1ef6930b2..a487bc6af3 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -117,6 +117,7 @@ namespace osu.Game.Overlays Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; Filter.Search.OnCommit = (sender, text) => updateSets(); + ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets(); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => updateSets(); @@ -163,7 +164,11 @@ namespace osu.Game.Overlays if (api == null || Filter.Search.Text == string.Empty) return; - getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction + getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, + ((FilterControl)Filter).Ruleset.Value, + Filter.DisplayStyleControl.Dropdown.Current.Value, + Filter.Tabs.Current.Value); //todo: sort direction + getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets)); api.Queue(getSetsRequest); } From e94d98fa841dca86d7b38dd67f02c57e54f304b8 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 7 Jun 2017 22:11:38 +0800 Subject: [PATCH 029/312] Expose header background for SectionsContainer. --- .../Graphics/Containers/SectionsContainer.cs | 24 +++++++++++++++++-- osu.Game/Overlays/SettingsOverlay.cs | 11 ++++----- osu.Game/Users/Profile/ProfileHeader.cs | 6 ++++- osu.Game/Users/UserProfile.cs | 5 ++++ 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 5fdb5e869e..fb88f842bd 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -15,9 +15,9 @@ namespace osu.Game.Graphics.Containers /// public class SectionsContainer : Container { - private Drawable expandableHeader, fixedHeader, footer; + private Drawable expandableHeader, fixedHeader, footer, headerBackground; public readonly ScrollContainer ScrollContainer; - private readonly Container sectionsContainer; + private readonly Container sectionsContainer, headerBackgroundContainer; public Drawable ExpandableHeader { @@ -72,6 +72,22 @@ namespace osu.Game.Graphics.Containers } } + public Drawable HeaderBackground + { + get { return headerBackground; } + set + { + if (value == headerBackground) return; + + headerBackgroundContainer.Clear(); + headerBackground = value; + if (value == null) return; + + headerBackgroundContainer.Add(headerBackground); + lastKnownScroll = float.NaN; + } + } + public Bindable SelectedSection { get; } = new Bindable(); protected virtual Container CreateScrollContentContainer() @@ -120,6 +136,7 @@ namespace osu.Game.Graphics.Containers Masking = false, Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() } }); + Add(headerBackgroundContainer = new Container { RelativeSizeAxes = Axes.X }); originalSectionsMargin = sectionsContainer.Margin; } @@ -150,6 +167,9 @@ namespace osu.Game.Graphics.Containers fixedHeader.Y = -offset + expandableHeader.LayoutSize.Y; } + headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0); + headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0; + Drawable bestMatch = null; float minDiff = float.MaxValue; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 87f6d836af..88a0e26dde 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -151,7 +151,6 @@ namespace osu.Game.Overlays private class SettingsSectionsContainer : SectionsContainer { public SearchContainer SearchContainer; - private readonly Box headerBackground; protected override Container CreateScrollContentContainer() => SearchContainer = new SearchContainer @@ -164,11 +163,11 @@ namespace osu.Game.Overlays public SettingsSectionsContainer() { ScrollContainer.ScrollbarVisible = false; - Add(headerBackground = new Box + HeaderBackground = new Box { Colour = Color4.Black, - RelativeSizeAxes = Axes.X - }); + RelativeSizeAxes = Axes.Both + }; } protected override void UpdateAfterChildren() @@ -176,9 +175,7 @@ namespace osu.Game.Overlays base.UpdateAfterChildren(); // no null check because the usage of this class is strict - headerBackground.Height = ExpandableHeader.LayoutSize.Y + FixedHeader.LayoutSize.Y; - headerBackground.Y = ExpandableHeader.Y; - headerBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f; + HeaderBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f; } } } diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 03c0d0f656..e7a8f45689 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -35,7 +35,11 @@ namespace osu.Game.Users.Profile Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(200) - }) { RelativeSizeAxes = Axes.Both }, + }) + { + Masking = true, + RelativeSizeAxes = Axes.Both + }, new UpdateableAvatar { User = user, diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 95447bfe26..55877f248a 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -35,6 +35,11 @@ namespace osu.Game.Users RelativeSizeAxes = Axes.Both, ExpandableHeader = new UserPageHeader(user), FixedHeader = tab, + HeaderBackground = new Box + { + Colour = OsuColour.Gray(34), + RelativeSizeAxes = Axes.Both + }, Sections = sections }; Add(sectionsContainer); From a4be5c8a785c9af8c91ddbc619d9057682ebe5d5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 11:13:12 -0300 Subject: [PATCH 030/312] Fix being able to start typing something, change other filters, and have the search use the currently typing query --- osu.Game/Overlays/DirectOverlay.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index a487bc6af3..c2c7c0e306 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -116,7 +116,11 @@ namespace osu.Game.Overlays Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; - Filter.Search.OnCommit = (sender, text) => updateSets(); + Filter.Search.OnCommit = (sender, text) => + { + lastQuery = Filter.Search.Text; + updateSets(); + }; ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets(); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; @@ -155,6 +159,7 @@ namespace osu.Game.Overlays } private GetBeatmapSetsRequest getSetsRequest; + private string lastQuery; private void updateSets() { if (!IsLoaded) return; @@ -164,7 +169,7 @@ namespace osu.Game.Overlays if (api == null || Filter.Search.Text == string.Empty) return; - getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, + getSetsRequest = new GetBeatmapSetsRequest(lastQuery, ((FilterControl)Filter).Ruleset.Value, Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction From add08e65ffd7e61084f690f8ecbc74917105bc18 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 11:30:52 -0300 Subject: [PATCH 031/312] Result counts displaying --- osu.Game/Database/BeatmapMetadata.cs | 2 ++ osu.Game/Overlays/DirectOverlay.cs | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Database/BeatmapMetadata.cs index a038b9cd19..ccf1a99c2c 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Database/BeatmapMetadata.cs @@ -23,6 +23,8 @@ namespace osu.Game.Database public string Author { get; set; } public string Source { get; set; } + + [JsonProperty(@"tags")] public string Tags { get; set; } public int PreviewTime { get; set; } public string AudioFile { get; set; } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index c2c7c0e306..5619d567f7 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -165,6 +165,7 @@ namespace osu.Game.Overlays if (!IsLoaded) return; BeatmapSets = null; + ResultAmounts = null; getSetsRequest?.Cancel(); if (api == null || Filter.Search.Text == string.Empty) return; @@ -174,10 +175,29 @@ namespace osu.Game.Overlays Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction - getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets)); + getSetsRequest.Success += r => + { + BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets)); + + var artists = new List(); + var songs = new List(); + var tags = new List(); + foreach (var s in BeatmapSets) + { + artists.Add(s.Metadata.Artist); + songs.Add(s.Metadata.Title); + tags.AddRange(s.Metadata.Tags.Split(' ')); + } + + ResultAmounts = new ResultCounts(distinctCount(artists), + distinctCount(songs), + distinctCount(tags)); + }; api.Queue(getSetsRequest); } + private int distinctCount(List list) => list.Distinct().ToArray().Length; + public class ResultCounts { public readonly int Artists; From ddc4d45ae88b239485218160435a2c377d0fb5d8 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 11:39:04 -0300 Subject: [PATCH 032/312] Unused usings --- osu.Game/Database/BeatmapOnlineInfo.cs | 1 - osu.Game/Database/BeatmapSetOnlineInfo.cs | 1 - osu.Game/Overlays/Direct/DirectGridPanel.cs | 1 - osu.Game/Overlays/Direct/DirectListPanel.cs | 1 - osu.Game/Overlays/Direct/DirectPanel.cs | 1 - osu.Game/Overlays/Direct/FilterControl.cs | 1 - 6 files changed, 6 deletions(-) diff --git a/osu.Game/Database/BeatmapOnlineInfo.cs b/osu.Game/Database/BeatmapOnlineInfo.cs index 7740545d6e..f4e70388f5 100644 --- a/osu.Game/Database/BeatmapOnlineInfo.cs +++ b/osu.Game/Database/BeatmapOnlineInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using System.Collections.Generic; namespace osu.Game.Database { diff --git a/osu.Game/Database/BeatmapSetOnlineInfo.cs b/osu.Game/Database/BeatmapSetOnlineInfo.cs index 87859bf761..28461c0447 100644 --- a/osu.Game/Database/BeatmapSetOnlineInfo.cs +++ b/osu.Game/Database/BeatmapSetOnlineInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using System.Collections.Generic; namespace osu.Game.Database { diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 1301d961f3..4a1fad41d9 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index aae906a644..fc44004df6 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -14,7 +14,6 @@ using osu.Game.Database; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Framework.Graphics.Textures; -using System.Linq; using osu.Framework.Input; namespace osu.Game.Overlays.Direct diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index f7ff88c24a..1c007dd534 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index b6682a2768..ea5936b85a 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.SearchableList; -using osu.Game.Rulesets; namespace osu.Game.Overlays.Direct { From e3cdb9f6fe254f8b57f6df4c5ac7e6423e3a89dd Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 7 Jun 2017 22:49:14 +0800 Subject: [PATCH 033/312] Create section classes. --- osu.Game/Users/Profile/AboutSection.cs | 14 ++++++++++++++ osu.Game/Users/Profile/BeatmapsSection.cs | 14 ++++++++++++++ osu.Game/Users/Profile/HistoricalSection.cs | 14 ++++++++++++++ osu.Game/Users/Profile/KudosuSection.cs | 14 ++++++++++++++ osu.Game/Users/Profile/MedalsSection.cs | 14 ++++++++++++++ osu.Game/Users/Profile/ProfileSection.cs | 2 ++ osu.Game/Users/Profile/RanksSection.cs | 14 ++++++++++++++ osu.Game/Users/Profile/RecentSection.cs | 14 ++++++++++++++ osu.Game/Users/UserProfile.cs | 19 +++++++++++++++++-- osu.Game/osu.Game.csproj | 7 +++++++ 10 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 osu.Game/Users/Profile/AboutSection.cs create mode 100644 osu.Game/Users/Profile/BeatmapsSection.cs create mode 100644 osu.Game/Users/Profile/HistoricalSection.cs create mode 100644 osu.Game/Users/Profile/KudosuSection.cs create mode 100644 osu.Game/Users/Profile/MedalsSection.cs create mode 100644 osu.Game/Users/Profile/RanksSection.cs create mode 100644 osu.Game/Users/Profile/RecentSection.cs diff --git a/osu.Game/Users/Profile/AboutSection.cs b/osu.Game/Users/Profile/AboutSection.cs new file mode 100644 index 0000000000..24a4516441 --- /dev/null +++ b/osu.Game/Users/Profile/AboutSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class AboutSection : ProfileSection + { + public override string Title => "me!"; + + public AboutSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/Profile/BeatmapsSection.cs b/osu.Game/Users/Profile/BeatmapsSection.cs new file mode 100644 index 0000000000..1377702c4b --- /dev/null +++ b/osu.Game/Users/Profile/BeatmapsSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class BeatmapsSection : ProfileSection + { + public override string Title => "Beatmaps"; + + public BeatmapsSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/Profile/HistoricalSection.cs b/osu.Game/Users/Profile/HistoricalSection.cs new file mode 100644 index 0000000000..751f91e5bc --- /dev/null +++ b/osu.Game/Users/Profile/HistoricalSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class HistoricalSection : ProfileSection + { + public override string Title => "Historical"; + + public HistoricalSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/Profile/KudosuSection.cs b/osu.Game/Users/Profile/KudosuSection.cs new file mode 100644 index 0000000000..61986ef5d8 --- /dev/null +++ b/osu.Game/Users/Profile/KudosuSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class KudosuSection : ProfileSection + { + public override string Title => "Kudosu!"; + + public KudosuSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/Profile/MedalsSection.cs b/osu.Game/Users/Profile/MedalsSection.cs new file mode 100644 index 0000000000..581d5e897c --- /dev/null +++ b/osu.Game/Users/Profile/MedalsSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class MedalsSection : ProfileSection + { + public override string Title => "Medals"; + + public MedalsSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index ce362109cc..904b5d77a3 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -14,5 +14,7 @@ namespace osu.Game.Users.Profile { User = user; } + + public override string ToString() => Title; //for tab control } } diff --git a/osu.Game/Users/Profile/RanksSection.cs b/osu.Game/Users/Profile/RanksSection.cs new file mode 100644 index 0000000000..450c1461e0 --- /dev/null +++ b/osu.Game/Users/Profile/RanksSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class RanksSection : ProfileSection + { + public override string Title => "Ranks"; + + public RanksSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/Profile/RecentSection.cs b/osu.Game/Users/Profile/RecentSection.cs new file mode 100644 index 0000000000..5a4e2707f8 --- /dev/null +++ b/osu.Game/Users/Profile/RecentSection.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users.Profile +{ + public class RecentSection : ProfileSection + { + public override string Title => "Recent"; + + public RecentSection(User user) : base(user) + { + } + } +} diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 55877f248a..eaa89ce42c 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.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 osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -21,8 +22,22 @@ namespace osu.Game.Users public UserProfile(User user) { this.user = user; - var tab = new OsuTabControl(); - var sections = new ProfileSection[] { }; + var sections = new ProfileSection[] + { + new AboutSection(user), + new RecentSection(user), + new RanksSection(user), + new MedalsSection(user), + new HistoricalSection(user), + new BeatmapsSection(user), + new KudosuSection(user) + }; + var tab = new OsuTabControl + { + RelativeSizeAxes = Axes.X, + Height = 24 + }; + sections.ForEach(tab.AddItem); Add(new Box { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1e6fd9b6d8..a452192743 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -88,6 +88,13 @@ + + + + + + + From d54100613442034d67cb5fea5770c0d5ed07e4c9 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 12:15:11 -0300 Subject: [PATCH 034/312] Use 2x size covers in list view --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 4a1fad41d9..5a1bb609b2 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, - GetBackground(textures), + GetBackground(textures, false), new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index fc44004df6..c4b941a362 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, - GetBackground(textures), + GetBackground(textures, true), new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 1c007dd534..45ca51b4b0 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -34,9 +34,9 @@ namespace osu.Game.Overlays.Direct return icons; } - protected Drawable GetBackground(TextureStore textures) + protected Drawable GetBackground(TextureStore textures, bool doubleSize) { - return new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo) + return new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo, doubleSize) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -90,17 +90,19 @@ namespace osu.Game.Overlays.Direct private class BeatmapSetBackgroundSprite : Sprite { private readonly BeatmapSetInfo set; + private readonly bool doubleSize; - public BeatmapSetBackgroundSprite(BeatmapSetInfo set) + public BeatmapSetBackgroundSprite(BeatmapSetInfo set, bool doubleSize) { this.set = set; + this.doubleSize = doubleSize; } [BackgroundDependencyLoader] private void load(TextureStore textures) { if (set.OnlineInfo?.Covers?.Card != null) - Texture = textures.Get(set.OnlineInfo.Covers.Card); + Texture = textures.Get(doubleSize ? set.OnlineInfo.Covers.Card2x : set.OnlineInfo.Covers.Card); } } } From 1162df96be1c3a8043ea6803da1f2d8628a2f38f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 8 Jun 2017 05:08:12 -0300 Subject: [PATCH 035/312] Use DelayedLoadWrapper in DirectPanel backgrounds --- osu.Game/Overlays/Direct/DirectPanel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 45ca51b4b0..958fb7ac51 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -36,13 +36,13 @@ namespace osu.Game.Overlays.Direct protected Drawable GetBackground(TextureStore textures, bool doubleSize) { - return new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo, doubleSize) + return new DelayedLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo, doubleSize) { Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), - }) { RelativeSizeAxes = Axes.Both }; + }) { RelativeSizeAxes = Axes.Both, TimeBeforeLoad = 300 }; } public class Statistic : FillFlowContainer From 70e12e5d9bee55bcc9e0382ff5a3440378fd88f0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 8 Jun 2017 06:21:45 -0300 Subject: [PATCH 036/312] Make the header tabs work --- osu.Game/Overlays/Direct/FilterControl.cs | 1 + osu.Game/Overlays/Direct/Header.cs | 6 +++--- osu.Game/Overlays/DirectOverlay.cs | 22 ++++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index ea5936b85a..3667359d94 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -103,5 +103,6 @@ namespace osu.Game.Overlays.Direct Difficulty, Ranked, Rating, + Plays, } } diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index 000ef473cc..4310a9329f 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -30,10 +30,10 @@ namespace osu.Game.Overlays.Direct { Search, [Description("Newest Maps")] - NewestMaps, + NewestMaps = (int)DirectSortCriteria.Ranked, [Description("Top Rated")] - TopRated, + TopRated = (int)DirectSortCriteria.Rating, [Description("Most Played")] - MostPlayed + MostPlayed = (int)DirectSortCriteria.Plays, } } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 5619d567f7..b6c8e30764 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -114,7 +114,15 @@ namespace osu.Game.Overlays }, }; - Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; + Header.Tabs.Current.ValueChanged += tab => + { + if (tab != DirectTab.Search) + { + Filter.Search.Text = lastQuery = string.Empty; + Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value; + updateSets(); + } + }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; Filter.Search.OnCommit = (sender, text) => { @@ -122,7 +130,13 @@ namespace osu.Game.Overlays updateSets(); }; ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); - Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets(); + Filter.Tabs.Current.ValueChanged += sortCriteria => + { + if (Header.Tabs.Current.Value != DirectTab.Search && sortCriteria != (DirectSortCriteria)Header.Tabs.Current.Value) + Header.Tabs.Current.Value = DirectTab.Search; + + updateSets(); + }; Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => updateSets(); @@ -159,7 +173,7 @@ namespace osu.Game.Overlays } private GetBeatmapSetsRequest getSetsRequest; - private string lastQuery; + private string lastQuery = string.Empty; private void updateSets() { if (!IsLoaded) return; @@ -168,7 +182,7 @@ namespace osu.Game.Overlays ResultAmounts = null; getSetsRequest?.Cancel(); - if (api == null || Filter.Search.Text == string.Empty) return; + if (api == null || Filter.Search.Text == string.Empty && Header.Tabs.Current.Value == DirectTab.Search) return; getSetsRequest = new GetBeatmapSetsRequest(lastQuery, ((FilterControl)Filter).Ruleset.Value, From bb103d7878d011f0f43c4adf4c39af863c67db8e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 8 Jun 2017 06:31:37 -0300 Subject: [PATCH 037/312] Fix being able to commit with an empty query and clearing the results --- osu.Game/Overlays/DirectOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index b6c8e30764..5e9cc4076d 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -176,18 +176,18 @@ namespace osu.Game.Overlays private string lastQuery = string.Empty; private void updateSets() { - if (!IsLoaded) return; + if (!IsLoaded || Header.Tabs.Current.Value == DirectTab.Search && Filter.Search.Text == string.Empty) return; BeatmapSets = null; ResultAmounts = null; getSetsRequest?.Cancel(); - if (api == null || Filter.Search.Text == string.Empty && Header.Tabs.Current.Value == DirectTab.Search) return; + if (api == null) return; getSetsRequest = new GetBeatmapSetsRequest(lastQuery, ((FilterControl)Filter).Ruleset.Value, Filter.DisplayStyleControl.Dropdown.Current.Value, - Filter.Tabs.Current.Value); //todo: sort direction + Filter.Tabs.Current.Value); //todo: sort direction (?) getSetsRequest.Success += r => { From 30fe7315ee60fd0483abc824fabe412b7d34b858 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 8 Jun 2017 06:47:21 -0300 Subject: [PATCH 038/312] Small cleanup --- osu.Game/Overlays/DirectOverlay.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 5e9cc4076d..4f5bbca219 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -114,6 +114,11 @@ namespace osu.Game.Overlays }, }; + Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; + ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => updateSets(); + Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) @@ -123,13 +128,13 @@ namespace osu.Game.Overlays updateSets(); } }; - Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; + Filter.Search.OnCommit = (sender, text) => { lastQuery = Filter.Search.Text; updateSets(); }; - ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); + Filter.Tabs.Current.ValueChanged += sortCriteria => { if (Header.Tabs.Current.Value != DirectTab.Search && sortCriteria != (DirectSortCriteria)Header.Tabs.Current.Value) @@ -137,8 +142,6 @@ namespace osu.Game.Overlays updateSets(); }; - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; - Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => updateSets(); updateResultCounts(); } @@ -176,7 +179,7 @@ namespace osu.Game.Overlays private string lastQuery = string.Empty; private void updateSets() { - if (!IsLoaded || Header.Tabs.Current.Value == DirectTab.Search && Filter.Search.Text == string.Empty) return; + if (!IsLoaded || Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || lastQuery == string.Empty)) return; BeatmapSets = null; ResultAmounts = null; From 5033526070bc84db3caab43e324f4555a476b68a Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 13:37:55 +0800 Subject: [PATCH 039/312] Fix depth in SectiondContainer. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index fb88f842bd..99f43abe24 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -134,9 +134,14 @@ namespace osu.Game.Graphics.Containers { RelativeSizeAxes = Axes.Both, Masking = false, - Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() } + Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }, + Depth = float.MaxValue + }); + Add(headerBackgroundContainer = new Container + { + RelativeSizeAxes = Axes.X, + Depth = float.MaxValue / 2 }); - Add(headerBackgroundContainer = new Container { RelativeSizeAxes = Axes.X }); originalSectionsMargin = sectionsContainer.Margin; } From c31dd7a480b437a6fe21eb073652c2190a3d2fa7 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 14:25:23 +0800 Subject: [PATCH 040/312] Set position and color for tab control. --- osu.Game/Users/Profile/ProfileSection.cs | 2 -- osu.Game/Users/UserProfile.cs | 42 +++++++++++++++++++++--- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index 904b5d77a3..ce362109cc 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -14,7 +14,5 @@ namespace osu.Game.Users.Profile { User = user; } - - public override string ToString() => Title; //for tab control } } diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index eaa89ce42c..cde36cbed8 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -16,6 +18,7 @@ namespace osu.Game.Users { private readonly User user; private ProfileSection lastSection; + private readonly ProfileTabControl tabs; public const float CONTENT_X_MARGIN = 50; @@ -32,12 +35,14 @@ namespace osu.Game.Users new BeatmapsSection(user), new KudosuSection(user) }; - var tab = new OsuTabControl + tabs = new ProfileTabControl { RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Height = 24 }; - sections.ForEach(tab.AddItem); + sections.ForEach(tabs.AddItem); Add(new Box { @@ -49,7 +54,7 @@ namespace osu.Game.Users { RelativeSizeAxes = Axes.Both, ExpandableHeader = new UserPageHeader(user), - FixedHeader = tab, + FixedHeader = tabs, HeaderBackground = new Box { Colour = OsuColour.Gray(34), @@ -64,11 +69,11 @@ namespace osu.Game.Users if (lastSection != s) { lastSection = s as ProfileSection; - tab.Current.Value = lastSection; + tabs.Current.Value = lastSection; } }; - tab.Current.ValueChanged += s => + tabs.Current.ValueChanged += s => { if (lastSection != s) { @@ -77,5 +82,32 @@ namespace osu.Game.Users } }; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + tabs.AccentColour = colours.Yellow; + } + + private class ProfileTabControl : OsuTabControl + { + public ProfileTabControl() + { + TabContainer.RelativeSizeAxes &= ~Axes.X; + TabContainer.AutoSizeAxes |= Axes.X; + TabContainer.Anchor |= Anchor.x1; + TabContainer.Origin |= Anchor.x1; + } + + protected override TabItem CreateTabItem(ProfileSection value) => new ProfileTabItem(value); + + private class ProfileTabItem : OsuTabItem + { + public ProfileTabItem(ProfileSection value) : base(value) + { + Text.Text = value.Title; + } + } + } } } From 5a0bd3b695240a21b23828ebc29d1aa40cc54188 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 14:53:00 +0800 Subject: [PATCH 041/312] Set content in profile sections. --- .../Graphics/Containers/SectionsContainer.cs | 5 +-- osu.Game/Users/Profile/AboutSection.cs | 2 +- osu.Game/Users/Profile/BeatmapsSection.cs | 2 +- osu.Game/Users/Profile/HistoricalSection.cs | 2 +- osu.Game/Users/Profile/KudosuSection.cs | 2 +- osu.Game/Users/Profile/MedalsSection.cs | 2 +- osu.Game/Users/Profile/ProfileSection.cs | 31 ++++++++++++++++--- osu.Game/Users/Profile/RanksSection.cs | 2 +- osu.Game/Users/Profile/RecentSection.cs | 2 +- 9 files changed, 37 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 99f43abe24..055e655f6e 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -94,7 +94,8 @@ namespace osu.Game.Graphics.Containers => new FillFlowContainer { Direction = FillDirection.Vertical, - AutoSizeAxes = Axes.Both + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, }; private List sections = new List(); @@ -133,7 +134,7 @@ namespace osu.Game.Graphics.Containers Add(ScrollContainer = new ScrollContainer() { RelativeSizeAxes = Axes.Both, - Masking = false, + Masking = true, Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }, Depth = float.MaxValue }); diff --git a/osu.Game/Users/Profile/AboutSection.cs b/osu.Game/Users/Profile/AboutSection.cs index 24a4516441..b2e5ae1b35 100644 --- a/osu.Game/Users/Profile/AboutSection.cs +++ b/osu.Game/Users/Profile/AboutSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "me!"; - public AboutSection(User user) : base(user) + public AboutSection(User user) { } } diff --git a/osu.Game/Users/Profile/BeatmapsSection.cs b/osu.Game/Users/Profile/BeatmapsSection.cs index 1377702c4b..4068283c73 100644 --- a/osu.Game/Users/Profile/BeatmapsSection.cs +++ b/osu.Game/Users/Profile/BeatmapsSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "Beatmaps"; - public BeatmapsSection(User user) : base(user) + public BeatmapsSection(User user) { } } diff --git a/osu.Game/Users/Profile/HistoricalSection.cs b/osu.Game/Users/Profile/HistoricalSection.cs index 751f91e5bc..12d6d2a409 100644 --- a/osu.Game/Users/Profile/HistoricalSection.cs +++ b/osu.Game/Users/Profile/HistoricalSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "Historical"; - public HistoricalSection(User user) : base(user) + public HistoricalSection(User user) { } } diff --git a/osu.Game/Users/Profile/KudosuSection.cs b/osu.Game/Users/Profile/KudosuSection.cs index 61986ef5d8..312661f676 100644 --- a/osu.Game/Users/Profile/KudosuSection.cs +++ b/osu.Game/Users/Profile/KudosuSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "Kudosu!"; - public KudosuSection(User user) : base(user) + public KudosuSection(User user) { } } diff --git a/osu.Game/Users/Profile/MedalsSection.cs b/osu.Game/Users/Profile/MedalsSection.cs index 581d5e897c..7db8c69222 100644 --- a/osu.Game/Users/Profile/MedalsSection.cs +++ b/osu.Game/Users/Profile/MedalsSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "Medals"; - public MedalsSection(User user) : base(user) + public MedalsSection(User user) { } } diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index ce362109cc..035053463f 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -1,18 +1,41 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; namespace osu.Game.Users.Profile { - public abstract class ProfileSection : Container + public abstract class ProfileSection : FillFlowContainer { - protected readonly User User; public abstract string Title { get; } - protected ProfileSection(User user) + protected ProfileSection() { - User = user; + Margin = new MarginPadding { Horizontal = UserProfile.CONTENT_X_MARGIN }; + Direction = FillDirection.Vertical; + AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.X; + Children = new Drawable[] + { + new OsuSpriteText + { + Text = Title, + TextSize = 16, + Font = @"Exo2.0-RegularItalic", + Margin = new MarginPadding { Vertical = 20 } + }, + new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = OsuColour.Gray(34), + Depth = float.MinValue + } + }; } } } diff --git a/osu.Game/Users/Profile/RanksSection.cs b/osu.Game/Users/Profile/RanksSection.cs index 450c1461e0..1c51866218 100644 --- a/osu.Game/Users/Profile/RanksSection.cs +++ b/osu.Game/Users/Profile/RanksSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "Ranks"; - public RanksSection(User user) : base(user) + public RanksSection(User user) { } } diff --git a/osu.Game/Users/Profile/RecentSection.cs b/osu.Game/Users/Profile/RecentSection.cs index 5a4e2707f8..96cf9d7a24 100644 --- a/osu.Game/Users/Profile/RecentSection.cs +++ b/osu.Game/Users/Profile/RecentSection.cs @@ -7,7 +7,7 @@ namespace osu.Game.Users.Profile { public override string Title => "Recent"; - public RecentSection(User user) : base(user) + public RecentSection(User user) { } } From 8dce52e6a8437a399b29ad9da11a7a5668ebefac Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 14:53:30 +0800 Subject: [PATCH 042/312] Fix incorrect class name. --- osu.Game/Users/Profile/ProfileHeader.cs | 4 ++-- osu.Game/Users/UserProfile.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index e7a8f45689..fcfeb3479e 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -10,12 +10,12 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Users.Profile { - public class UserPageHeader : Container + public class ProfileHeader : Container { private readonly User user; private const float cover_height = 200, avatar_size = 110, avatar_bottom_position = -20; - public UserPageHeader(User user) + public ProfileHeader(User user) { this.user = user; RelativeSizeAxes = Axes.X; diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index cde36cbed8..3c567e9089 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -53,7 +53,7 @@ namespace osu.Game.Users var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, - ExpandableHeader = new UserPageHeader(user), + ExpandableHeader = new ProfileHeader(user), FixedHeader = tabs, HeaderBackground = new Box { From 51107acdffd3978fe73840fdaa137f651de7e561 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 15:22:07 +0800 Subject: [PATCH 043/312] Improve section behaviour. --- osu.Game/Users/Profile/ProfileSection.cs | 26 ++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index 035053463f..d8cc2f4e8c 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.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 OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -13,27 +14,44 @@ namespace osu.Game.Users.Profile { public abstract string Title { get; } + private readonly FillFlowContainer content; + protected override Container Content => content; + protected ProfileSection() { - Margin = new MarginPadding { Horizontal = UserProfile.CONTENT_X_MARGIN }; Direction = FillDirection.Vertical; AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; - Children = new Drawable[] + InternalChildren = new Drawable[] { new OsuSpriteText { Text = Title, TextSize = 16, Font = @"Exo2.0-RegularItalic", - Margin = new MarginPadding { Vertical = 20 } + Margin = new MarginPadding + { + Horizontal = UserProfile.CONTENT_X_MARGIN, + Vertical = 20 + } + }, + content = new FillFlowContainer + { + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding + { + Horizontal = UserProfile.CONTENT_X_MARGIN, + Bottom = 20 + } }, new Box { RelativeSizeAxes = Axes.X, Height = 1, Colour = OsuColour.Gray(34), - Depth = float.MinValue + EdgeSmoothness = new Vector2(1) } }; } From 140c74cd2afdcba4ddeb8505cb74817231155706 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 16:01:16 +0800 Subject: [PATCH 044/312] Use PageTabControl. --- .../Graphics/UserInterface/PageTabControl.cs | 8 +++--- osu.Game/Users/UserProfile.cs | 25 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 8bf455b099..e17281cdc4 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -23,12 +23,14 @@ namespace osu.Game.Graphics.UserInterface Height = 30; } - private class PageTabItem : TabItem + public class PageTabItem : TabItem { private const float transition_duration = 100; private readonly Box box; + protected readonly SpriteText Text; + public override bool Active { get { return base.Active; } @@ -51,12 +53,12 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - new OsuSpriteText + Text = new OsuSpriteText { Margin = new MarginPadding { Top = 8, Bottom = 8 }, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Text = (value as Enum).GetDescription() ?? value.ToString(), + Text = (value as Enum)?.GetDescription() ?? value.ToString(), TextSize = 14, Font = @"Exo2.0-Bold", }, diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 3c567e9089..6bf46e5725 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.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 OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; @@ -83,31 +84,41 @@ namespace osu.Game.Users }; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + private class ProfileTabControl : PageTabControl { - tabs.AccentColour = colours.Yellow; - } + private readonly Box bottom; - private class ProfileTabControl : OsuTabControl - { public ProfileTabControl() { TabContainer.RelativeSizeAxes &= ~Axes.X; TabContainer.AutoSizeAxes |= Axes.X; TabContainer.Anchor |= Anchor.x1; TabContainer.Origin |= Anchor.x1; + Add(bottom = new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + EdgeSmoothness = new Vector2(1) + }); } protected override TabItem CreateTabItem(ProfileSection value) => new ProfileTabItem(value); - private class ProfileTabItem : OsuTabItem + private class ProfileTabItem : PageTabItem { public ProfileTabItem(ProfileSection value) : base(value) { Text.Text = value.Title; } } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + bottom.Colour = colours.Yellow; + } } } } From c60ef2449f26ad633f37e2af5d9468315739ef52 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 16:05:05 +0800 Subject: [PATCH 045/312] Fix initial scroll. --- osu.Game/Users/UserProfile.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 6bf46e5725..5d592a613d 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -76,6 +76,11 @@ namespace osu.Game.Users tabs.Current.ValueChanged += s => { + if (lastSection == null) + { + lastSection = tabs.Current.Value = sections[0]; + return; + } if (lastSection != s) { lastSection = s; From 798d8711b832dbabf4641cdda7cbc06c728d52ce Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 16:24:19 +0800 Subject: [PATCH 046/312] Refactor SectionsContainer to generic. --- .../Graphics/Containers/SectionsContainer.cs | 53 ++++++++----------- osu.Game/Overlays/SettingsOverlay.cs | 10 ++-- osu.Game/Users/UserProfile.cs | 11 ++-- 3 files changed, 33 insertions(+), 41 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 055e655f6e..1b8e9e1f34 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using System.Linq; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -13,11 +12,15 @@ namespace osu.Game.Graphics.Containers /// /// A container that can scroll to each section inside it. /// - public class SectionsContainer : Container + public class SectionsContainer : Container + where T : Drawable { private Drawable expandableHeader, fixedHeader, footer, headerBackground; public readonly ScrollContainer ScrollContainer; - private readonly Container sectionsContainer, headerBackgroundContainer; + private readonly Container headerBackgroundContainer; + private readonly FlowContainer sectionsContainer; + + protected override Container Content => sectionsContainer; public Drawable ExpandableHeader { @@ -26,12 +29,11 @@ namespace osu.Game.Graphics.Containers { if (value == expandableHeader) return; - if (expandableHeader != null) - Remove(expandableHeader); + expandableHeader?.Expire(); expandableHeader = value; if (value == null) return; - Add(expandableHeader); + AddInternal(expandableHeader); lastKnownScroll = float.NaN; } } @@ -43,12 +45,11 @@ namespace osu.Game.Graphics.Containers { if (value == fixedHeader) return; - if (fixedHeader != null) - Remove(fixedHeader); + fixedHeader?.Expire(); fixedHeader = value; if (value == null) return; - Add(fixedHeader); + AddInternal(fixedHeader); lastKnownScroll = float.NaN; } } @@ -88,39 +89,27 @@ namespace osu.Game.Graphics.Containers } } - public Bindable SelectedSection { get; } = new Bindable(); + public Bindable SelectedSection { get; } = new Bindable(); - protected virtual Container CreateScrollContentContainer() - => new FillFlowContainer + protected virtual FlowContainer CreateScrollContentContainer() + => new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; - private List sections = new List(); - public IEnumerable Sections + public override void Add(T drawable) { - get { return sections; } - set - { - foreach (var section in sections) - sectionsContainer.Remove(section); - - sections = value.ToList(); - if (sections.Count == 0) return; - - sectionsContainer.Add(sections); - SelectedSection.Value = sections[0]; - lastKnownScroll = float.NaN; - } + base.Add(drawable); + lastKnownScroll = float.NaN; } private float headerHeight, footerHeight; private readonly MarginPadding originalSectionsMargin; private void updateSectionsMargin() { - if (sections.Count == 0) return; + if (!Children.Any()) return; var newMargin = originalSectionsMargin; newMargin.Top += headerHeight; @@ -131,14 +120,14 @@ namespace osu.Game.Graphics.Containers public SectionsContainer() { - Add(ScrollContainer = new ScrollContainer() + AddInternal(ScrollContainer = new ScrollContainer() { RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }, Depth = float.MaxValue }); - Add(headerBackgroundContainer = new Container + AddInternal(headerBackgroundContainer = new Container { RelativeSizeAxes = Axes.X, Depth = float.MaxValue / 2 @@ -176,10 +165,10 @@ namespace osu.Game.Graphics.Containers headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0); headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0; - Drawable bestMatch = null; + T bestMatch = null; float minDiff = float.MaxValue; - foreach (var section in sections) + foreach (var section in Children) { float diff = Math.Abs(ScrollContainer.GetChildPosInContent(section) - currentScroll); if (diff < minDiff) diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 88a0e26dde..b229a9dfec 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays }, Exit = Hide, }, - Sections = sections, + Children = sections, Footer = new SettingsFooter() }, sidebar = new Sidebar @@ -148,12 +148,12 @@ namespace osu.Game.Overlays base.OnFocus(state); } - private class SettingsSectionsContainer : SectionsContainer + private class SettingsSectionsContainer : SectionsContainer { - public SearchContainer SearchContainer; + public SearchContainer SearchContainer; - protected override Container CreateScrollContentContainer() - => SearchContainer = new SearchContainer + protected override FlowContainer CreateScrollContentContainer() + => SearchContainer = new SearchContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 5d592a613d..27f18a0f14 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.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 System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -51,7 +52,7 @@ namespace osu.Game.Users Colour = OsuColour.Gray(0.2f) }); - var sectionsContainer = new SectionsContainer + var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, ExpandableHeader = new ProfileHeader(user), @@ -61,7 +62,7 @@ namespace osu.Game.Users Colour = OsuColour.Gray(34), RelativeSizeAxes = Axes.Both }, - Sections = sections + Children = sections }; Add(sectionsContainer); @@ -69,7 +70,7 @@ namespace osu.Game.Users { if (lastSection != s) { - lastSection = s as ProfileSection; + lastSection = s; tabs.Current.Value = lastSection; } }; @@ -78,7 +79,9 @@ namespace osu.Game.Users { if (lastSection == null) { - lastSection = tabs.Current.Value = sections[0]; + lastSection = sectionsContainer.Children.FirstOrDefault(); + if (lastSection != null) + tabs.Current.Value = lastSection; return; } if (lastSection != s) From 3945d33adcbd38418abf9d981a64e0ce445bd52a Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 9 Jun 2017 19:04:29 +0800 Subject: [PATCH 047/312] Make OsuTabControl.isEnumType static. --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 4bbae4efd1..6a00e1f55e 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); - private bool isEnumType => typeof(T).IsEnum; + private static bool isEnumType => typeof(T).IsEnum; public OsuTabControl() { From e552c39444c3439f2120d9ba1e5289f71c812902 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 11 Jun 2017 22:04:35 +0300 Subject: [PATCH 048/312] change function to a property --- osu.Game/Screens/Select/BeatmapCarousel.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a268096435..05fb4c48bf 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -171,6 +171,8 @@ namespace osu.Game.Screens.Select } while (index != startIndex); } + private IEnumerable getVisibleGroups() => groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); + public void SelectNextRandom() { randomSelectedBeatmaps.Push(selectedGroup); @@ -221,11 +223,6 @@ namespace osu.Game.Screens.Select } } - private IEnumerable getVisibleGroups() - { - return groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden); - } - private FilterCriteria criteria = new FilterCriteria(); private ScheduledDelegate filterTask; From 915f61a8f723fed578e08ac725c75069fc8666ff Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 12 Jun 2017 14:39:49 +0800 Subject: [PATCH 049/312] Rename to scrollContentContainer. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 1b8e9e1f34..e11a12d2a1 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -18,9 +18,9 @@ namespace osu.Game.Graphics.Containers private Drawable expandableHeader, fixedHeader, footer, headerBackground; public readonly ScrollContainer ScrollContainer; private readonly Container headerBackgroundContainer; - private readonly FlowContainer sectionsContainer; + private readonly FlowContainer scrollContentContainer; - protected override Container Content => sectionsContainer; + protected override Container Content => scrollContentContainer; public Drawable ExpandableHeader { @@ -115,7 +115,7 @@ namespace osu.Game.Graphics.Containers newMargin.Top += headerHeight; newMargin.Bottom += footerHeight; - sectionsContainer.Margin = newMargin; + scrollContentContainer.Margin = newMargin; } public SectionsContainer() @@ -124,7 +124,7 @@ namespace osu.Game.Graphics.Containers { RelativeSizeAxes = Axes.Both, Masking = true, - Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() }, + Children = new Drawable[] { scrollContentContainer = CreateScrollContentContainer() }, Depth = float.MaxValue }); AddInternal(headerBackgroundContainer = new Container @@ -132,7 +132,7 @@ namespace osu.Game.Graphics.Containers RelativeSizeAxes = Axes.X, Depth = float.MaxValue / 2 }); - originalSectionsMargin = sectionsContainer.Margin; + originalSectionsMargin = scrollContentContainer.Margin; } private float lastKnownScroll; From 53da671b60c9443ddc0903143d5a3b4f021272ac Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 12 Jun 2017 14:42:14 +0800 Subject: [PATCH 050/312] Update framework type. --- osu.Game/Users/Profile/ProfileHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index fcfeb3479e..d7b874da07 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -50,7 +50,7 @@ namespace osu.Game.Users.Profile Y = avatar_bottom_position, Masking = true, CornerRadius = 5, - EdgeEffect = new EdgeEffect + EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), From fcd137ced2f1e3305fc03ea2bb8f6a3038a539f9 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 13 Jun 2017 00:51:06 +0800 Subject: [PATCH 051/312] Add OsuTextFlowContainer. --- .../Graphics/Containers/OsuTextFlowContainer.cs | 14 ++++++++++++++ osu.Game/Overlays/Music/PlaylistItem.cs | 11 ++++++----- osu.Game/osu.Game.csproj | 7 ++++--- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 osu.Game/Graphics/Containers/OsuTextFlowContainer.cs diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs new file mode 100644 index 0000000000..06972967be --- /dev/null +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs @@ -0,0 +1,14 @@ +// 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.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Graphics.Containers +{ + public class OsuTextFlowContainer: TextFlowContainer + { + protected override SpriteText CreateSpriteText() => new OsuSpriteText(); + } +} diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 69cb9c3464..0a095327b0 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -2,15 +2,16 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics; -using OpenTK.Graphics; -using osu.Framework.Localisation; -using osu.Framework.Graphics.Sprites; -using System.Collections.Generic; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Music { @@ -77,7 +78,7 @@ namespace osu.Game.Overlays.Music Margin = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Top = 2 }, }, - text = new TextFlowContainer + text = new OsuTextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8aa83a65c6..bfb6f4ec77 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -43,8 +43,8 @@ $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll - $(SolutionDir)\packages\sharpcompress.0.15.2\lib\net45\SharpCompress.dll - $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll + $(SolutionDir)\packages\sharpcompress.0.15.2\lib\net45\SharpCompress.dll + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -75,6 +75,7 @@ + @@ -511,4 +512,4 @@ --> - + \ No newline at end of file From c75e2909ee53679b3990bcffaa0f103ac689f620 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 13 Jun 2017 00:58:32 +0800 Subject: [PATCH 052/312] Expose AddTextAwesome for OsuTextFlowContainer. --- osu.Game/Graphics/Containers/OsuTextFlowContainer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs index 06972967be..7b5da8587f 100644 --- a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE +using System; +using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; @@ -10,5 +12,7 @@ namespace osu.Game.Graphics.Containers public class OsuTextFlowContainer: TextFlowContainer { protected override SpriteText CreateSpriteText() => new OsuSpriteText(); + + public IEnumerable AddTextAwesome(FontAwesome icon, Action creationParameters = null) => AddText(((char)icon).ToString(), creationParameters); } } From 755d2737d0bc1836f3c4acae35bb88962a4edc11 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 13 Jun 2017 02:58:10 +0800 Subject: [PATCH 053/312] Improve OsuTextFlowContainer with framework. --- osu.Game/Graphics/Containers/OsuTextFlowContainer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs index 7b5da8587f..38c1edbc4e 100644 --- a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs @@ -9,8 +9,12 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.Containers { - public class OsuTextFlowContainer: TextFlowContainer + public class OsuTextFlowContainer : TextFlowContainer { + public OsuTextFlowContainer(Action defaultCreationParameters = null) : base(defaultCreationParameters) + { + } + protected override SpriteText CreateSpriteText() => new OsuSpriteText(); public IEnumerable AddTextAwesome(FontAwesome icon, Action creationParameters = null) => AddText(((char)icon).ToString(), creationParameters); From a1c3a456fbd5512bd9748ffab6dd03924860c32f Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 13 Jun 2017 03:31:17 +0800 Subject: [PATCH 054/312] Add placeholder text in profile header. --- osu.Game/Users/Profile/ProfileHeader.cs | 48 ++++++++++++++++++++++++- osu.Game/Users/UserProfile.cs | 4 +-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index d7b874da07..7d3d3a4c28 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; namespace osu.Game.Users.Profile @@ -14,12 +18,14 @@ namespace osu.Game.Users.Profile { private readonly User user; + private readonly OsuTextFlowContainer infoText; + private const float cover_height = 200, avatar_size = 110, avatar_bottom_position = -20; public ProfileHeader(User user) { this.user = user; RelativeSizeAxes = Axes.X; - Height = cover_height; + Height = cover_height + cover_height - UserProfile.TAB_HEIGHT; Children = new Drawable[] { @@ -84,8 +90,48 @@ namespace osu.Game.Users.Profile } } } + }, + infoText = new OsuTextFlowContainer(t => + { + t.TextSize = 12; + t.Alpha = 0.8f; + }) + { + Y = cover_height + 20, + Margin = new MarginPadding { Horizontal = UserProfile.CONTENT_X_MARGIN }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ParagraphSpacing = 1, + //LineSpacing = 0.5f } }; + + Action bold = t => + { + t.Font = @"Exo2.0-Bold"; + t.Alpha = 1; + }; + // placeholder text + infoText.AddTextAwesome(FontAwesome.fa_map_marker); + infoText.AddText(" position "); + infoText.AddTextAwesome(FontAwesome.fa_twitter); + infoText.AddText(" tweet "); + infoText.AddTextAwesome(FontAwesome.fa_heart_o); + infoText.AddText(" favorite "); + infoText.NewParagraph(); + infoText.AddText("0 years old"); + infoText.NewLine(); + infoText.AddText("Commander of "); + infoText.AddText("The Color Scribbles", bold); + infoText.NewParagraph(); + infoText.AddText("Joined since "); + infoText.AddText("June 2017", bold); + infoText.NewLine(); + infoText.AddText("Last seen "); + infoText.AddText("0 minutes ago", bold); + infoText.NewParagraph(); + infoText.AddText("Play with "); + infoText.AddText("Mouse, Keyboard, Tablet", bold); } } } diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 27f18a0f14..bbe73b8124 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -22,7 +22,7 @@ namespace osu.Game.Users private ProfileSection lastSection; private readonly ProfileTabControl tabs; - public const float CONTENT_X_MARGIN = 50; + public const float CONTENT_X_MARGIN = 50, TAB_HEIGHT = 24; public UserProfile(User user) { @@ -42,7 +42,7 @@ namespace osu.Game.Users RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Height = 24 + Height = TAB_HEIGHT }; sections.ForEach(tabs.AddItem); From 3821360942cd33c6dac7e3448610338577df4b0c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 13 Jun 2017 19:43:56 +0800 Subject: [PATCH 055/312] Follow web design more. --- osu.Game/Users/Profile/ProfileHeader.cs | 69 +++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 7d3d3a4c28..9d20ce637c 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -6,6 +6,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; @@ -20,12 +21,12 @@ namespace osu.Game.Users.Profile private readonly OsuTextFlowContainer infoText; - private const float cover_height = 200, avatar_size = 110, avatar_bottom_position = -20; + private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) { this.user = user; RelativeSizeAxes = Axes.X; - Height = cover_height + cover_height - UserProfile.TAB_HEIGHT; + Height = cover_height + info_height - UserProfile.TAB_HEIGHT; Children = new Drawable[] { @@ -46,6 +47,11 @@ namespace osu.Game.Users.Profile Masking = true, RelativeSizeAxes = Axes.Both }, + new Box + { + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) + }, new UpdateableAvatar { User = user, @@ -101,8 +107,63 @@ namespace osu.Game.Users.Profile Margin = new MarginPadding { Horizontal = UserProfile.CONTENT_X_MARGIN }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - ParagraphSpacing = 1, - //LineSpacing = 0.5f + ParagraphSpacing = 1 + }, + new Container + { + X = -UserProfile.CONTENT_X_MARGIN, + RelativeSizeAxes = Axes.Y, + Width = 280, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Y = level_position, + Height = level_height, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black.Opacity(0.5f), + RelativeSizeAxes = Axes.Both + } + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + Y = cover_height, + Anchor = Anchor.TopCentre, + Origin = Anchor.BottomCentre, + Height = cover_height - level_height - level_position - 5, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black.Opacity(0.5f), + RelativeSizeAxes = Axes.Both + } + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Height = info_height - UserProfile.TAB_HEIGHT - 15, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black.Opacity(0.25f), + RelativeSizeAxes = Axes.Both + } + } + } + } } }; From 29578b0fa393fa4a1d25722850ebf2fc3a57528e Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 13 Jun 2017 23:33:39 +0800 Subject: [PATCH 056/312] Update resources. --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index b348c1e540..10fda22522 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit b348c1e540edbb3325a8da9bca452c9dce2938d6 +Subproject commit 10fda22522ffadbdbc43fa0f3683a065e536f7d1 From c35a3e6999812158c1da2c52af594ba691e3d71d Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 14 Jun 2017 12:55:01 +0800 Subject: [PATCH 057/312] Level badge and score region. --- osu.Game/Users/Profile/ProfileHeader.cs | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 9d20ce637c..7cab9fcab0 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -4,11 +4,13 @@ using System; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -20,6 +22,10 @@ namespace osu.Game.Users.Profile private readonly User user; private readonly OsuTextFlowContainer infoText; + private readonly FillFlowContainer scoreText, scoreNumberText; + + private readonly Sprite levelBadge; + private readonly SpriteText levelText; private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) @@ -129,6 +135,20 @@ namespace osu.Game.Users.Profile { Colour = Color4.Black.Opacity(0.5f), RelativeSizeAxes = Axes.Both + }, + levelBadge = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Height = 50, + Width = 50 + }, + levelText = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Y = 11, + TextSize = 18 } } }, @@ -145,6 +165,22 @@ namespace osu.Game.Users.Profile { Colour = Color4.Black.Opacity(0.5f), RelativeSizeAxes = Axes.Both + }, + scoreText = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Padding = new MarginPadding { Horizontal = 20, Vertical = 18 }, + Spacing = new Vector2(0, 2) + }, + scoreNumberText = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Padding = new MarginPadding { Horizontal = 20, Vertical = 18 }, + Spacing = new Vector2(0, 2) } } }, @@ -193,6 +229,44 @@ namespace osu.Game.Users.Profile infoText.NewParagraph(); infoText.AddText("Play with "); infoText.AddText("Mouse, Keyboard, Tablet", bold); + + levelText.Text = "98"; + + scoreText.Add(createScoreText("Ranked Score")); + scoreNumberText.Add(createScoreNumberText("1,870,716,897")); + scoreText.Add(createScoreText("Accuracy")); + scoreNumberText.Add(createScoreNumberText("98.51%")); + scoreText.Add(createScoreText("Play Count")); + scoreNumberText.Add(createScoreNumberText("25,287")); + scoreText.Add(createScoreText("Total Score")); + scoreNumberText.Add(createScoreNumberText("28,444,797,570")); + scoreText.Add(createScoreText("Total Hits")); + scoreNumberText.Add(createScoreNumberText("4,612,765")); + scoreText.Add(createScoreText("Max Combo")); + scoreNumberText.Add(createScoreNumberText("2,056")); + scoreText.Add(createScoreText("Replay Watched")); + scoreNumberText.Add(createScoreNumberText("23")); } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + levelBadge.Texture = textures.Get(@"Profile/levelbadge"); + } + + private OsuSpriteText createScoreText(string text) => new OsuSpriteText + { + TextSize = 14, + Text = text + }; + + private OsuSpriteText createScoreNumberText(string text) => new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Text = text + }; } } From adb4ee809536d5245ab3079dc752463b5a4c4352 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 14 Jun 2017 14:35:47 +0800 Subject: [PATCH 058/312] Grade badges. --- osu.Game/Users/Profile/ProfileHeader.cs | 71 +++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 7cab9fcab0..8d15a47fdf 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -26,6 +26,7 @@ namespace osu.Game.Users.Profile private readonly Sprite levelBadge; private readonly SpriteText levelText; + private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) @@ -181,6 +182,35 @@ namespace osu.Game.Users.Profile Direction = FillDirection.Vertical, Padding = new MarginPadding { Horizontal = 20, Vertical = 18 }, Spacing = new Vector2(0, 2) + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -64, + Spacing = new Vector2(20, 0), + Children = new GradeBadge[] + { + gradeSSPlus = new GradeBadge("SSPlus") { Count = 12 }, + gradeSS = new GradeBadge("SS") { Count = 34 }, + } + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -18, + Spacing = new Vector2(20, 0), + Children = new GradeBadge[] + { + gradeSPlus = new GradeBadge("SPlus") { Count = 567 }, + gradeS = new GradeBadge("S") { Count = 890 }, + gradeA = new GradeBadge("A") { Count = 1234 }, + } } } }, @@ -268,5 +298,46 @@ namespace osu.Game.Users.Profile Origin = Anchor.TopRight, Text = text }; + + private class GradeBadge : Container + { + private const float width = 50; + private readonly string grade; + private readonly Sprite badge; + private readonly SpriteText numberText; + + public int Count + { + set + { + numberText.Text = value.ToString(@"#,#"); + } + } + + public GradeBadge(string grade) + { + this.grade = grade; + Width = width; + Height = 41; + Add(badge = new Sprite + { + Width = width, + Height = 26 + }); + Add(numberText = new SpriteText + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + TextSize = 14, + Font = @"Exo2.0-Bold" + }); + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + badge.Texture = textures.Get($"Grades/{grade}"); + } + } } } From 190de76d9a9709f4d9902d74fb926f2a852c5b4e Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 14 Jun 2017 20:37:07 +0800 Subject: [PATCH 059/312] Add LineGraph. --- osu.Game/Graphics/UserInterface/LineGraph.cs | 62 ++++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 2 files changed, 63 insertions(+) create mode 100644 osu.Game/Graphics/UserInterface/LineGraph.cs diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs new file mode 100644 index 0000000000..36c63eb13c --- /dev/null +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; + +namespace osu.Game.Graphics.UserInterface +{ + public class LineGraph : Container + { + /// + /// Manually set the max value, otherwise will be used. + /// + public float? MaxValue { get; set; } + + /// + /// Manually set the min value, otherwise will be used. + /// + public float? MinValue { get; set; } + + private const float transform_duration = 250; + + /// + /// Hold an empty area if values are less. + /// + public int DefaultValueCount; + + private Path path; + + /// + /// A list of floats decides position of each line node. + /// + public IEnumerable Values + { + set + { + path?.Expire(); + Path localPath = new Path { RelativeSizeAxes = Axes.Both }; //capture a copy to avoid potential change + Add(path = localPath); + + var values = value.ToArray(); + int count = Math.Max(values.Length, DefaultValueCount); + + float max = values.Max(), min = values.Min(); + if (MaxValue > max) max = MaxValue.Value; + if (MinValue < min) min = MinValue.Value; + + for (int i = 0; i < values.Length; i++) + { + float x = (i + count - values.Length) / (float)(count - 1); + float y = (max - values[i]) / (max - min); + Scheduler.AddDelayed(() => localPath.AddVertex(new Vector2(x, y)), x * transform_duration); + } + } + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 88ce5e59dc..0fe30c0abc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -80,6 +80,7 @@ + From 43542fa5b417e978810f0e96ddf456ee12d57255 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 14 Jun 2017 20:39:58 +0800 Subject: [PATCH 060/312] Slightly update design to follow web page. --- osu.Game/Users/Profile/ProfileHeader.cs | 6 +++--- osu.Game/Users/UserProfile.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 8d15a47fdf..f2b82705dd 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -33,7 +33,7 @@ namespace osu.Game.Users.Profile { this.user = user; RelativeSizeAxes = Axes.X; - Height = cover_height + info_height - UserProfile.TAB_HEIGHT; + Height = cover_height + info_height; Children = new Drawable[] { @@ -106,7 +106,7 @@ namespace osu.Game.Users.Profile }, infoText = new OsuTextFlowContainer(t => { - t.TextSize = 12; + t.TextSize = 14; t.Alpha = 0.8f; }) { @@ -219,7 +219,7 @@ namespace osu.Game.Users.Profile RelativeSizeAxes = Axes.X, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Height = info_height - UserProfile.TAB_HEIGHT - 15, + Height = info_height - 15, Children = new Drawable[] { new Box diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index bbe73b8124..27f18a0f14 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -22,7 +22,7 @@ namespace osu.Game.Users private ProfileSection lastSection; private readonly ProfileTabControl tabs; - public const float CONTENT_X_MARGIN = 50, TAB_HEIGHT = 24; + public const float CONTENT_X_MARGIN = 50; public UserProfile(User user) { @@ -42,7 +42,7 @@ namespace osu.Game.Users RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Height = TAB_HEIGHT + Height = 24 }; sections.ForEach(tabs.AddItem); From 443e24716c4f9212d0bdfc2877006b7d0b2dd028 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 14 Jun 2017 22:00:22 +0800 Subject: [PATCH 061/312] Handle relative size at LineGraph level. --- osu.Game/Graphics/UserInterface/LineGraph.cs | 45 ++++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 36c63eb13c..c03be462dc 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -32,6 +32,8 @@ namespace osu.Game.Graphics.UserInterface private Path path; + private float[] values; + /// /// A list of floats decides position of each line node. /// @@ -39,23 +41,38 @@ namespace osu.Game.Graphics.UserInterface { set { - path?.Expire(); - Path localPath = new Path { RelativeSizeAxes = Axes.Both }; //capture a copy to avoid potential change - Add(path = localPath); + values = value.ToArray(); + applyPath(); + } + } - var values = value.ToArray(); - int count = Math.Max(values.Length, DefaultValueCount); + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) + { + if ((invalidation & Invalidation.DrawSize) != 0) + applyPath(); + return base.Invalidate(invalidation, source, shallPropagate); + } - float max = values.Max(), min = values.Min(); - if (MaxValue > max) max = MaxValue.Value; - if (MinValue < min) min = MinValue.Value; + private void applyPath() + { + if (values == null) return; - for (int i = 0; i < values.Length; i++) - { - float x = (i + count - values.Length) / (float)(count - 1); - float y = (max - values[i]) / (max - min); - Scheduler.AddDelayed(() => localPath.AddVertex(new Vector2(x, y)), x * transform_duration); - } + path?.Expire(); + Path localPath = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 }; //capture a copy to avoid potential change + Add(path = localPath); + + int count = Math.Max(values.Length, DefaultValueCount); + + float max = values.Max(), min = values.Min(); + if (MaxValue > max) max = MaxValue.Value; + if (MinValue < min) min = MinValue.Value; + + for (int i = 0; i < values.Length; i++) + { + float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1; + float y = (max - values[i]) / (max - min) * DrawHeight - 1; + // the -1 is for inner offset in path (actually -PathWidth) + localPath.AddVertex(new Vector2(x, y)); } } } From 3b64dfe0fd3e9bbe40aac9b3d23aafdebfd660e0 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 00:46:39 +0800 Subject: [PATCH 062/312] Update transform using masking. --- osu.Game/Graphics/UserInterface/LineGraph.cs | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index c03be462dc..3bc4556a27 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -23,14 +23,15 @@ namespace osu.Game.Graphics.UserInterface /// public float? MinValue { get; set; } - private const float transform_duration = 250; + private const double transform_duration = 500; /// /// Hold an empty area if values are less. /// public int DefaultValueCount; - private Path path; + private readonly Container maskingContainer; + private readonly Path path; private float[] values; @@ -43,9 +44,21 @@ namespace osu.Game.Graphics.UserInterface { values = value.ToArray(); applyPath(); + maskingContainer.Width = 0; + maskingContainer.ResizeWidthTo(1, transform_duration, EasingTypes.OutQuint); } } + public LineGraph() + { + Add(maskingContainer = new Container + { + Masking = true, + RelativeSizeAxes = Axes.Both + }); + maskingContainer.Add(path = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 }); + } + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { if ((invalidation & Invalidation.DrawSize) != 0) @@ -57,10 +70,7 @@ namespace osu.Game.Graphics.UserInterface { if (values == null) return; - path?.Expire(); - Path localPath = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 }; //capture a copy to avoid potential change - Add(path = localPath); - + path.ClearVertices(); int count = Math.Max(values.Length, DefaultValueCount); float max = values.Max(), min = values.Min(); @@ -72,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1; float y = (max - values[i]) / (max - min) * DrawHeight - 1; // the -1 is for inner offset in path (actually -PathWidth) - localPath.AddVertex(new Vector2(x, y)); + path.AddVertex(new Vector2(x, y)); } } } From 53ad7bc8ca1bb2e45ca807fb331fc68e81bfbf58 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 00:48:01 +0800 Subject: [PATCH 063/312] Add RankChart. --- osu.Game/Users/Profile/ProfileHeader.cs | 4 ++ osu.Game/Users/Profile/RankChart.cs | 93 +++++++++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 98 insertions(+) create mode 100644 osu.Game/Users/Profile/RankChart.cs diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index f2b82705dd..7772797750 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -226,6 +226,10 @@ namespace osu.Game.Users.Profile { Colour = Color4.Black.Opacity(0.25f), RelativeSizeAxes = Axes.Both + }, + new RankChart(user) + { + RelativeSizeAxes = Axes.Both } } } diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs new file mode 100644 index 0000000000..9cb11623da --- /dev/null +++ b/osu.Game/Users/Profile/RankChart.cs @@ -0,0 +1,93 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Linq; +using System.Threading.Tasks; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Users.Profile +{ + public class RankChart : Container + { + private readonly SpriteText rank, performance, relative; + private readonly LineGraph graph; + + private readonly int[] ranks, performances; + + public RankChart(User user) + { + Padding = new MarginPadding { Vertical = 10 }; + Children = new Drawable[] + { + rank = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Font = @"Exo2.0-RegularItalic", + TextSize = 25 + }, + relative = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Font = @"Exo2.0-RegularItalic", + Y = 25, + TextSize = 13 + }, + performance = new OsuSpriteText + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Font = @"Exo2.0-RegularItalic", + TextSize = 13 + }, + graph = new LineGraph + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Y = -13, + DefaultValueCount = 90 + } + }; + + //placeholder text + rank.Text = "#12,345"; + relative.Text = $"{user.Country?.FullName} #678"; + performance.Text = "4,567pp"; + ranks = Enumerable.Range(1234, 80).ToArray(); + performances = ranks.Select(x => 6000 - x).ToArray(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + graph.Colour = colours.Yellow; + Task.Factory.StartNew(() => + { + System.Threading.Thread.Sleep(1000); + // put placeholder data here to show the transform + + // use logarithmic coordinates + graph.Values = ranks.Select(x => -(float)Math.Log(x)); + }); + } + + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) + { + if ((invalidation & Invalidation.DrawSize) != 0) + { + graph.Height = DrawHeight - 71; + } + + return base.Invalidate(invalidation, source, shallPropagate); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0fe30c0abc..3b15f6890e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -102,6 +102,7 @@ + From 78669a594187059907a5d97aa7e1592d5317edb3 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 02:17:48 +0800 Subject: [PATCH 064/312] Hover for rank history. --- osu.Game/Graphics/UserInterface/LineGraph.cs | 7 ++ osu.Game/Users/Profile/RankChart.cs | 116 ++++++++++++++++--- 2 files changed, 107 insertions(+), 16 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 3bc4556a27..02e8a8329a 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -23,6 +23,9 @@ namespace osu.Game.Graphics.UserInterface /// public float? MinValue { get; set; } + public float? ActualMaxValue { get; private set; } + public float? ActualMinValue { get; private set; } + private const double transform_duration = 500; /// @@ -40,6 +43,7 @@ namespace osu.Game.Graphics.UserInterface /// public IEnumerable Values { + get { return values; } set { values = value.ToArray(); @@ -77,6 +81,9 @@ namespace osu.Game.Graphics.UserInterface if (MaxValue > max) max = MaxValue.Value; if (MinValue < min) min = MinValue.Value; + ActualMaxValue = max; + ActualMinValue = min; + for (int i = 0; i < values.Length; i++) { float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1; diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs index 9cb11623da..49f67efbdc 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Users/Profile/RankChart.cs @@ -2,12 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -16,24 +19,28 @@ namespace osu.Game.Users.Profile { public class RankChart : Container { - private readonly SpriteText rank, performance, relative; - private readonly LineGraph graph; + private readonly SpriteText rankText, performanceText, relativeText; + private readonly RankChartLineGraph graph; - private readonly int[] ranks, performances; + private int[] ranks, performances; + private int rank, performance, countryRank; + + private readonly User user; public RankChart(User user) { + this.user = user; Padding = new MarginPadding { Vertical = 10 }; Children = new Drawable[] { - rank = new OsuSpriteText + rankText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Font = @"Exo2.0-RegularItalic", TextSize = 25 }, - relative = new OsuSpriteText + relativeText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -41,29 +48,35 @@ namespace osu.Game.Users.Profile Y = 25, TextSize = 13 }, - performance = new OsuSpriteText + performanceText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Font = @"Exo2.0-RegularItalic", TextSize = 13 }, - graph = new LineGraph + graph = new RankChartLineGraph { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, Y = -13, - DefaultValueCount = 90 + DefaultValueCount = 90, + BallRelease = () => + { + rankText.Text = $"#{rank:#,#}"; + performanceText.Text = $"{performance:#,#}pp"; + relativeText.Text = $"{this.user.Country?.FullName} #{countryRank:#,#}"; + }, + BallMove = index => + { + rankText.Text = $"#{ranks[index]:#,#}"; + performanceText.Text = $"{performances[index]:#,#}pp"; + relativeText.Text = index == ranks.Length ? "Now" : $"{ranks.Length - index} days ago"; + //plural should be handled in a general way + } } }; - - //placeholder text - rank.Text = "#12,345"; - relative.Text = $"{user.Country?.FullName} #678"; - performance.Text = "4,567pp"; - ranks = Enumerable.Range(1234, 80).ToArray(); - performances = ranks.Select(x => 6000 - x).ToArray(); } [BackgroundDependencyLoader] @@ -73,10 +86,16 @@ namespace osu.Game.Users.Profile Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(1000); - // put placeholder data here to show the transform + // put placeholder data here to show the transform + rank = 12345; + countryRank = 678; + performance = 4567; + ranks = Enumerable.Range(1234, 80).ToArray(); + performances = ranks.Select(x => 6000 - x).ToArray(); // use logarithmic coordinates graph.Values = ranks.Select(x => -(float)Math.Log(x)); + graph.ResetBall(); }); } @@ -89,5 +108,70 @@ namespace osu.Game.Users.Profile return base.Invalidate(invalidation, source, shallPropagate); } + + private class RankChartLineGraph : LineGraph + { + private readonly CircularContainer ball; + private bool ballShown; + + private const double transform_duration = 100; + + public Action BallMove; + public Action BallRelease; + + public RankChartLineGraph() + { + Add(ball = new CircularContainer + { + Size = new Vector2(8), + Masking = true, + Origin = Anchor.Centre, + Alpha = 0, + RelativePositionAxes = Axes.Both, + Children = new Drawable[] + { + new Box { RelativeSizeAxes = Axes.Both } + } + }); + } + + public void ResetBall() + { + ball.MoveTo(new Vector2(1, ((ActualMaxValue - Values.Last()) / (ActualMaxValue - ActualMinValue)).Value), ballShown ? transform_duration : 0, EasingTypes.OutQuint); + ball.Show(); + BallRelease(); + ballShown = true; + } + + protected override bool OnMouseMove(InputState state) + { + if (ballShown) + { + var values = Values as IList; + var position = ToLocalSpace(state.Mouse.NativeState.Position); + int count = Math.Max(values.Count, DefaultValueCount); + int index = (int)Math.Round(position.X / DrawWidth * (count - 1)); + if (index >= count - values.Count) + { + int i = index + values.Count - count; + float value = values[i]; + float y = ((ActualMaxValue - value) / (ActualMaxValue - ActualMinValue)).Value; + if (Math.Abs(y * DrawHeight - position.Y) <= 8f) + { + ball.MoveTo(new Vector2(index / (float)(count - 1), y), transform_duration, EasingTypes.OutQuint); + BallMove(i); + } + } + } + return base.OnMouseMove(state); + } + + protected override void OnHoverLost(InputState state) + { + if (ballShown) + ResetBall(); + base.OnHoverLost(state); + } + } } } From f7a451ed8221efa1ef2ad4f84b955edfca73ecec Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 02:38:51 +0800 Subject: [PATCH 065/312] Update test case. --- osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 9eea2cbf19..7fc32442f5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Users; @@ -24,17 +25,17 @@ namespace osu.Desktop.VisualTests.Tests { Username = @"peppy", Id = 2, - Country = new Country { FlagName = @"AU" }, + Country = new Country { FullName = @"Australia", FlagName = @"AU" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Width = 800, - Height = 500 + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Horizontal = 50 }, + State = Visibility.Visible }; Add(userpage); - AddStep("Toggle", userpage.ToggleVisibility); } } } From 1737b59d37bf84eabb3d2cadd0baefb484b3a70b Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 07:23:30 +0800 Subject: [PATCH 066/312] Slightly update some sizes. --- osu.Game/Users/Profile/ProfileHeader.cs | 4 ++-- osu.Game/Users/Profile/ProfileSection.cs | 2 +- osu.Game/Users/UserProfile.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 7772797750..34dc2fb593 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -87,7 +87,7 @@ namespace osu.Game.Users.Profile new OsuSpriteText { Text = user.Username, - TextSize = 25, + TextSize = 30, Font = @"Exo2.0-RegularItalic", Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -149,7 +149,7 @@ namespace osu.Game.Users.Profile Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = 11, - TextSize = 18 + TextSize = 20 } } }, diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index d8cc2f4e8c..c6f45403e3 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -27,7 +27,7 @@ namespace osu.Game.Users.Profile new OsuSpriteText { Text = Title, - TextSize = 16, + TextSize = 20, Font = @"Exo2.0-RegularItalic", Margin = new MarginPadding { diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 27f18a0f14..629dbbe5a9 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -42,7 +42,7 @@ namespace osu.Game.Users RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Height = 24 + Height = 30 }; sections.ForEach(tabs.AddItem); From 1d85578bf59a4fe9efed4daa5b5c3e33141fcf42 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 07:29:32 +0800 Subject: [PATCH 067/312] Fix license header. --- osu.Game/Graphics/Containers/OsuTextFlowContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs index 38c1edbc4e..570e682618 100644 --- a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.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 System; using System.Collections.Generic; From b37c3f8ce159a32f07b37e484124a5e72cc31bd0 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 07:58:20 +0800 Subject: [PATCH 068/312] Some CI fixes. --- .../Tests/TestCaseUserProfile.cs | 6 --- osu.Game/Users/Profile/ProfileHeader.cs | 22 +++++------ osu.Game/Users/Profile/RankChart.cs | 37 ++++++++++++------- osu.Game/Users/UserProfile.cs | 3 +- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 7fc32442f5..23091ec35b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -1,15 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Game.Overlays; using osu.Game.Users; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 34dc2fb593..cf294a8863 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -19,7 +19,7 @@ namespace osu.Game.Users.Profile { public class ProfileHeader : Container { - private readonly User user; + //private readonly User user; private readonly OsuTextFlowContainer infoText; private readonly FillFlowContainer scoreText, scoreNumberText; @@ -31,7 +31,7 @@ namespace osu.Game.Users.Profile private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) { - this.user = user; + //this.user = user; RelativeSizeAxes = Axes.X; Height = cover_height + info_height; @@ -191,7 +191,7 @@ namespace osu.Game.Users.Profile Origin = Anchor.BottomCentre, Y = -64, Spacing = new Vector2(20, 0), - Children = new GradeBadge[] + Children = new[] { gradeSSPlus = new GradeBadge("SSPlus") { Count = 12 }, gradeSS = new GradeBadge("SS") { Count = 34 }, @@ -205,7 +205,7 @@ namespace osu.Game.Users.Profile Origin = Anchor.BottomCentre, Y = -18, Spacing = new Vector2(20, 0), - Children = new GradeBadge[] + Children = new[] { gradeSPlus = new GradeBadge("SPlus") { Count = 567 }, gradeS = new GradeBadge("S") { Count = 890 }, @@ -236,13 +236,19 @@ namespace osu.Game.Users.Profile } } }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + levelBadge.Texture = textures.Get(@"Profile/levelbadge"); Action bold = t => { t.Font = @"Exo2.0-Bold"; t.Alpha = 1; }; - // placeholder text + // fill placeholder texts infoText.AddTextAwesome(FontAwesome.fa_map_marker); infoText.AddText(" position "); infoText.AddTextAwesome(FontAwesome.fa_twitter); @@ -282,12 +288,6 @@ namespace osu.Game.Users.Profile scoreNumberText.Add(createScoreNumberText("23")); } - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - levelBadge.Texture = textures.Get(@"Profile/levelbadge"); - } - private OsuSpriteText createScoreText(string text) => new OsuSpriteText { TextSize = 14, diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs index 49f67efbdc..20700a65df 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Users/Profile/RankChart.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using OpenTK; @@ -62,23 +63,27 @@ namespace osu.Game.Users.Profile RelativeSizeAxes = Axes.X, Y = -13, DefaultValueCount = 90, - BallRelease = () => - { - rankText.Text = $"#{rank:#,#}"; - performanceText.Text = $"{performance:#,#}pp"; - relativeText.Text = $"{this.user.Country?.FullName} #{countryRank:#,#}"; - }, - BallMove = index => - { - rankText.Text = $"#{ranks[index]:#,#}"; - performanceText.Text = $"{performances[index]:#,#}pp"; - relativeText.Text = index == ranks.Length ? "Now" : $"{ranks.Length - index} days ago"; - //plural should be handled in a general way - } + BallRelease = updateRankTexts, + BallMove = showHistoryRankTexts } }; } + private void updateRankTexts() + { + rankText.Text = $"#{rank:#,#}"; + performanceText.Text = $"{performance:#,#}pp"; + relativeText.Text = $"{this.user.Country?.FullName} #{countryRank:#,#}"; + } + + private void showHistoryRankTexts(int dayIndex) + { + rankText.Text = $"#{ranks[dayIndex]:#,#}"; + performanceText.Text = $"{performances[dayIndex]:#,#}pp"; + relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; + //plural should be handled in a general way + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -137,6 +142,8 @@ namespace osu.Game.Users.Profile public void ResetBall() { + Trace.Assert(ActualMaxValue.HasValue); + Trace.Assert(ActualMinValue.HasValue); ball.MoveTo(new Vector2(1, ((ActualMaxValue - Values.Last()) / (ActualMaxValue - ActualMinValue)).Value), ballShown ? transform_duration : 0, EasingTypes.OutQuint); ball.Show(); BallRelease(); @@ -147,7 +154,7 @@ namespace osu.Game.Users.Profile { if (ballShown) { - var values = Values as IList; + var values = (IList)Values; var position = ToLocalSpace(state.Mouse.NativeState.Position); int count = Math.Max(values.Count, DefaultValueCount); int index = (int)Math.Round(position.X / DrawWidth * (count - 1)); @@ -155,6 +162,8 @@ namespace osu.Game.Users.Profile { int i = index + values.Count - count; float value = values[i]; + Trace.Assert(ActualMaxValue.HasValue); + Trace.Assert(ActualMinValue.HasValue); float y = ((ActualMaxValue - value) / (ActualMaxValue - ActualMinValue)).Value; if (Math.Abs(y * DrawHeight - position.Y) <= 8f) { diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 629dbbe5a9..2470db1de5 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -20,7 +20,6 @@ namespace osu.Game.Users { private readonly User user; private ProfileSection lastSection; - private readonly ProfileTabControl tabs; public const float CONTENT_X_MARGIN = 50; @@ -37,7 +36,7 @@ namespace osu.Game.Users new BeatmapsSection(user), new KudosuSection(user) }; - tabs = new ProfileTabControl + var tabs = new ProfileTabControl { RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, From 4c8658980b65b0a3b80a7dda613ea6c06450400c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 08:00:15 +0800 Subject: [PATCH 069/312] Remove unused user instance for now. --- osu.Game/Users/Profile/AboutSection.cs | 4 ---- osu.Game/Users/Profile/BeatmapsSection.cs | 4 ---- osu.Game/Users/Profile/HistoricalSection.cs | 4 ---- osu.Game/Users/Profile/KudosuSection.cs | 4 ---- osu.Game/Users/Profile/MedalsSection.cs | 4 ---- osu.Game/Users/Profile/RanksSection.cs | 4 ---- osu.Game/Users/Profile/RecentSection.cs | 4 ---- osu.Game/Users/UserProfile.cs | 16 +++++++--------- 8 files changed, 7 insertions(+), 37 deletions(-) diff --git a/osu.Game/Users/Profile/AboutSection.cs b/osu.Game/Users/Profile/AboutSection.cs index b2e5ae1b35..69ace5fc71 100644 --- a/osu.Game/Users/Profile/AboutSection.cs +++ b/osu.Game/Users/Profile/AboutSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class AboutSection : ProfileSection { public override string Title => "me!"; - - public AboutSection(User user) - { - } } } diff --git a/osu.Game/Users/Profile/BeatmapsSection.cs b/osu.Game/Users/Profile/BeatmapsSection.cs index 4068283c73..a69c65c84a 100644 --- a/osu.Game/Users/Profile/BeatmapsSection.cs +++ b/osu.Game/Users/Profile/BeatmapsSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class BeatmapsSection : ProfileSection { public override string Title => "Beatmaps"; - - public BeatmapsSection(User user) - { - } } } diff --git a/osu.Game/Users/Profile/HistoricalSection.cs b/osu.Game/Users/Profile/HistoricalSection.cs index 12d6d2a409..c5f357d322 100644 --- a/osu.Game/Users/Profile/HistoricalSection.cs +++ b/osu.Game/Users/Profile/HistoricalSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class HistoricalSection : ProfileSection { public override string Title => "Historical"; - - public HistoricalSection(User user) - { - } } } diff --git a/osu.Game/Users/Profile/KudosuSection.cs b/osu.Game/Users/Profile/KudosuSection.cs index 312661f676..b489f6544d 100644 --- a/osu.Game/Users/Profile/KudosuSection.cs +++ b/osu.Game/Users/Profile/KudosuSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class KudosuSection : ProfileSection { public override string Title => "Kudosu!"; - - public KudosuSection(User user) - { - } } } diff --git a/osu.Game/Users/Profile/MedalsSection.cs b/osu.Game/Users/Profile/MedalsSection.cs index 7db8c69222..0a52830340 100644 --- a/osu.Game/Users/Profile/MedalsSection.cs +++ b/osu.Game/Users/Profile/MedalsSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class MedalsSection : ProfileSection { public override string Title => "Medals"; - - public MedalsSection(User user) - { - } } } diff --git a/osu.Game/Users/Profile/RanksSection.cs b/osu.Game/Users/Profile/RanksSection.cs index 1c51866218..65f3f04c1b 100644 --- a/osu.Game/Users/Profile/RanksSection.cs +++ b/osu.Game/Users/Profile/RanksSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class RanksSection : ProfileSection { public override string Title => "Ranks"; - - public RanksSection(User user) - { - } } } diff --git a/osu.Game/Users/Profile/RecentSection.cs b/osu.Game/Users/Profile/RecentSection.cs index 96cf9d7a24..6cd3bf6c49 100644 --- a/osu.Game/Users/Profile/RecentSection.cs +++ b/osu.Game/Users/Profile/RecentSection.cs @@ -6,9 +6,5 @@ namespace osu.Game.Users.Profile public class RecentSection : ProfileSection { public override string Title => "Recent"; - - public RecentSection(User user) - { - } } } diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 2470db1de5..03dce36528 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -18,23 +18,21 @@ namespace osu.Game.Users { public class UserProfile : FocusedOverlayContainer { - private readonly User user; private ProfileSection lastSection; public const float CONTENT_X_MARGIN = 50; public UserProfile(User user) { - this.user = user; var sections = new ProfileSection[] { - new AboutSection(user), - new RecentSection(user), - new RanksSection(user), - new MedalsSection(user), - new HistoricalSection(user), - new BeatmapsSection(user), - new KudosuSection(user) + new AboutSection(), + new RecentSection(), + new RanksSection(), + new MedalsSection(), + new HistoricalSection(), + new BeatmapsSection(), + new KudosuSection() }; var tabs = new ProfileTabControl { From 0c9ccaec953b4dc6219e2ffa4643720a78b0f5a2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 08:27:02 +0800 Subject: [PATCH 070/312] Move placeholder data into load method. --- osu.Game/Users/Profile/ProfileHeader.cs | 18 ++++++++++++------ osu.Game/Users/Profile/RankChart.cs | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index cf294a8863..9ad6a9aad4 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -26,7 +26,7 @@ namespace osu.Game.Users.Profile private readonly Sprite levelBadge; private readonly SpriteText levelText; - private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; + private readonly GradeBadge gradeDoubleSPlus, gradeDoubleS, gradeSPlus, gradeS, gradeA; private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) @@ -193,8 +193,8 @@ namespace osu.Game.Users.Profile Spacing = new Vector2(20, 0), Children = new[] { - gradeSSPlus = new GradeBadge("SSPlus") { Count = 12 }, - gradeSS = new GradeBadge("SS") { Count = 34 }, + gradeDoubleSPlus = new GradeBadge("SSPlus"), + gradeDoubleS = new GradeBadge("SS"), } }, new FillFlowContainer @@ -207,9 +207,9 @@ namespace osu.Game.Users.Profile Spacing = new Vector2(20, 0), Children = new[] { - gradeSPlus = new GradeBadge("SPlus") { Count = 567 }, - gradeS = new GradeBadge("S") { Count = 890 }, - gradeA = new GradeBadge("A") { Count = 1234 }, + gradeSPlus = new GradeBadge("SPlus"), + gradeS = new GradeBadge("S"), + gradeA = new GradeBadge("A"), } } } @@ -286,6 +286,12 @@ namespace osu.Game.Users.Profile scoreNumberText.Add(createScoreNumberText("2,056")); scoreText.Add(createScoreText("Replay Watched")); scoreNumberText.Add(createScoreNumberText("23")); + + gradeDoubleSPlus.Count = 12; + gradeDoubleS.Count = 34; + gradeSPlus.Count = 567; + gradeS.Count = 890; + gradeA.Count = 1234; } private OsuSpriteText createScoreText(string text) => new OsuSpriteText diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs index 20700a65df..2f78c35b5b 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Users/Profile/RankChart.cs @@ -73,7 +73,7 @@ namespace osu.Game.Users.Profile { rankText.Text = $"#{rank:#,#}"; performanceText.Text = $"{performance:#,#}pp"; - relativeText.Text = $"{this.user.Country?.FullName} #{countryRank:#,#}"; + relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,#}"; } private void showHistoryRankTexts(int dayIndex) From 1e0653eff9004a9e359e0d7b5c29e44edf2f36e5 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 09:10:23 +0800 Subject: [PATCH 071/312] Add SS as an acronym. --- osu.Game/Users/Profile/ProfileHeader.cs | 10 +++++----- osu.sln.DotSettings | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 9ad6a9aad4..2a7d99fc22 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -26,7 +26,7 @@ namespace osu.Game.Users.Profile private readonly Sprite levelBadge; private readonly SpriteText levelText; - private readonly GradeBadge gradeDoubleSPlus, gradeDoubleS, gradeSPlus, gradeS, gradeA; + private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) @@ -193,8 +193,8 @@ namespace osu.Game.Users.Profile Spacing = new Vector2(20, 0), Children = new[] { - gradeDoubleSPlus = new GradeBadge("SSPlus"), - gradeDoubleS = new GradeBadge("SS"), + gradeSSPlus = new GradeBadge("SSPlus"), + gradeSS = new GradeBadge("SS"), } }, new FillFlowContainer @@ -287,8 +287,8 @@ namespace osu.Game.Users.Profile scoreText.Add(createScoreText("Replay Watched")); scoreNumberText.Add(createScoreNumberText("23")); - gradeDoubleSPlus.Count = 12; - gradeDoubleS.Count = 34; + gradeSSPlus.Count = 12; + gradeSS.Count = 34; gradeSPlus.Count = 567; gradeS.Count = 890; gradeA.Count = 1234; diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 70bfacd6ef..95c6676455 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -192,6 +192,7 @@ RNG SRGB TK + SS HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> From 5117baae66e0707a2d861f733b420879727ad1ea Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 15 Jun 2017 06:37:20 +0300 Subject: [PATCH 072/312] Make random works with panels too --- osu.Game/Screens/Select/BeatmapCarousel.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 05fb4c48bf..f9064c4963 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select private readonly List panels = new List(); - private readonly Stack randomSelectedBeatmaps = new Stack(); + private readonly Stack> randomSelectedBeatmaps = new Stack>(); private BeatmapGroup selectedGroup; private BeatmapPanel selectedPanel; @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select public void SelectNextRandom() { - randomSelectedBeatmaps.Push(selectedGroup); + randomSelectedBeatmaps.Push(new KeyValuePair(selectedGroup, selectedGroup.SelectedPanel)); var visibleGroups = getVisibleGroups(); if (!visibleGroups.Any()) @@ -214,10 +214,11 @@ namespace osu.Game.Screens.Select while (randomSelectedBeatmaps.Any()) { - var group = randomSelectedBeatmaps.Pop(); + var beatmapCoordinates = randomSelectedBeatmaps.Pop(); + var group = beatmapCoordinates.Key; if (visibleGroups.Contains(group)) { - selectGroup(group, group.SelectedPanel); + selectGroup(group, beatmapCoordinates.Value); break; } } From 74f503874f03a503f5d83c2c719b924d1cc1fb2d Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 16:57:34 +0800 Subject: [PATCH 073/312] Move some sizes as consts. --- osu.Game/Users/Profile/RankChart.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs index 2f78c35b5b..8a9719e254 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Users/Profile/RankChart.cs @@ -26,12 +26,14 @@ namespace osu.Game.Users.Profile private int[] ranks, performances; private int rank, performance, countryRank; + private const float primary_textsize = 25, secondary_textsize = 13, padding = 10; + private readonly User user; public RankChart(User user) { this.user = user; - Padding = new MarginPadding { Vertical = 10 }; + Padding = new MarginPadding { Vertical = padding }; Children = new Drawable[] { rankText = new OsuSpriteText @@ -39,7 +41,7 @@ namespace osu.Game.Users.Profile Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Font = @"Exo2.0-RegularItalic", - TextSize = 25 + TextSize = primary_textsize }, relativeText = new OsuSpriteText { @@ -47,21 +49,21 @@ namespace osu.Game.Users.Profile Origin = Anchor.TopCentre, Font = @"Exo2.0-RegularItalic", Y = 25, - TextSize = 13 + TextSize = secondary_textsize }, performanceText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Font = @"Exo2.0-RegularItalic", - TextSize = 13 + TextSize = secondary_textsize }, graph = new RankChartLineGraph { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, - Y = -13, + Y = -secondary_textsize, DefaultValueCount = 90, BallRelease = updateRankTexts, BallMove = showHistoryRankTexts @@ -108,7 +110,7 @@ namespace osu.Game.Users.Profile { if ((invalidation & Invalidation.DrawSize) != 0) { - graph.Height = DrawHeight - 71; + graph.Height = DrawHeight - padding * 2 - primary_textsize - secondary_textsize * 2; } return base.Invalidate(invalidation, source, shallPropagate); From 13d9f3b9bb3923ace68bda2b070ada27f7bc0c52 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 17:03:33 +0800 Subject: [PATCH 074/312] Move namespace and setup for DI. --- osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs | 3 ++- osu.Game/OsuGame.cs | 3 +++ .../UserProfile.cs => Overlays/UserProfileOverlay.cs} | 8 ++++---- osu.Game/Users/Profile/ProfileHeader.cs | 9 +++++---- osu.Game/Users/Profile/ProfileSection.cs | 5 +++-- osu.Game/osu.Game.csproj | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) rename osu.Game/{Users/UserProfile.cs => Overlays/UserProfileOverlay.cs} (93%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 23091ec35b..6939692bff 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -4,6 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Overlays; using osu.Game.Users; namespace osu.Desktop.VisualTests.Tests @@ -15,7 +16,7 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); - var userpage = new UserProfile(new User + var userpage = new UserProfileOverlay(new User { Username = @"peppy", Id = 2, diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7e5b913d10..62f9164fdd 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -45,6 +45,8 @@ namespace osu.Game private SocialOverlay social; + private UserProfileOverlay userProfile; + private Intro intro { get @@ -171,6 +173,7 @@ namespace osu.Game LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); + LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add); LoadComponentAsync(musicController = new MusicController { diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Overlays/UserProfileOverlay.cs similarity index 93% rename from osu.Game/Users/UserProfile.cs rename to osu.Game/Overlays/UserProfileOverlay.cs index 03dce36528..6bdf847d67 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -6,23 +6,23 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Users; using osu.Game.Users.Profile; -namespace osu.Game.Users +namespace osu.Game.Overlays { - public class UserProfile : FocusedOverlayContainer + public class UserProfileOverlay : WaveOverlayContainer { private ProfileSection lastSection; public const float CONTENT_X_MARGIN = 50; - public UserProfile(User user) + public UserProfileOverlay(User user) { var sections = new ProfileSection[] { diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 2a7d99fc22..43d86950fb 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; namespace osu.Game.Users.Profile { @@ -65,7 +66,7 @@ namespace osu.Game.Users.Profile Size = new Vector2(avatar_size), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - X = UserProfile.CONTENT_X_MARGIN, + X = UserProfileOverlay.CONTENT_X_MARGIN, Y = avatar_bottom_position, Masking = true, CornerRadius = 5, @@ -80,7 +81,7 @@ namespace osu.Game.Users.Profile { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - X = UserProfile.CONTENT_X_MARGIN + avatar_size + 10, + X = UserProfileOverlay.CONTENT_X_MARGIN + avatar_size + 10, Y = avatar_bottom_position, Children = new Drawable[] { @@ -111,14 +112,14 @@ namespace osu.Game.Users.Profile }) { Y = cover_height + 20, - Margin = new MarginPadding { Horizontal = UserProfile.CONTENT_X_MARGIN }, + Margin = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, ParagraphSpacing = 1 }, new Container { - X = -UserProfile.CONTENT_X_MARGIN, + X = -UserProfileOverlay.CONTENT_X_MARGIN, RelativeSizeAxes = Axes.Y, Width = 280, Anchor = Anchor.TopRight, diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index c6f45403e3..723024d6a6 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; namespace osu.Game.Users.Profile { @@ -31,7 +32,7 @@ namespace osu.Game.Users.Profile Font = @"Exo2.0-RegularItalic", Margin = new MarginPadding { - Horizontal = UserProfile.CONTENT_X_MARGIN, + Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 20 } }, @@ -42,7 +43,7 @@ namespace osu.Game.Users.Profile RelativeSizeAxes = Axes.X, Margin = new MarginPadding { - Horizontal = UserProfile.CONTENT_X_MARGIN, + Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Bottom = 20 } }, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3b15f6890e..c554ee751b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -106,7 +106,7 @@ - + From 53bd22cf9c1a0037a50366d23faebd422669df34 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 20:01:46 +0800 Subject: [PATCH 075/312] Update usage design. --- .../Tests/TestCaseUserProfile.cs | 28 +++++++++++++------ osu.Game/Overlays/UserProfileOverlay.cs | 5 +++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 6939692bff..e55d881d93 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -16,21 +16,31 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); - var userpage = new UserProfileOverlay(new User - { - Username = @"peppy", - Id = 2, - Country = new Country { FullName = @"Australia", FlagName = @"AU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" - }) + var profile = new UserProfileOverlay { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 50 }, - State = Visibility.Visible }; - Add(userpage); + Add(profile); + + AddStep("Show ppy", () => profile.ShowUser(new User + { + Username = @"peppy", + Id = 2, + Country = new Country { FullName = @"Australia", FlagName = @"AU" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" + })); + AddStep("Show flyte", () => profile.ShowUser(new User + { + Username = @"flyte", + Id = 3103765, + Country = new Country { FullName = @"Japan", FlagName = @"JP" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" + })); + AddStep("Hide", profile.Hide); + AddStep("Show without reload", profile.Show); } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 6bdf847d67..d0c5726cdc 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -22,8 +22,10 @@ namespace osu.Game.Overlays public const float CONTENT_X_MARGIN = 50; - public UserProfileOverlay(User user) + public void ShowUser(User user) { + Clear(); + lastSection = null; var sections = new ProfileSection[] { new AboutSection(), @@ -87,6 +89,7 @@ namespace osu.Game.Overlays sectionsContainer.ScrollContainer.ScrollIntoView(lastSection); } }; + Show(); } private class ProfileTabControl : PageTabControl From 273e2b4a3ca13c27dc1ac404a5a6429ac05b42d8 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 21:13:40 +0800 Subject: [PATCH 076/312] Fill more json fields. --- .../Online/API/Requests/GetUserRequest.cs | 4 +- osu.Game/Users/User.cs | 79 ++++++++++++++++++- osu.Game/Users/UserStatistics.cs | 64 +++++++++++++++ osu.Game/osu.Game.csproj | 1 + 4 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Users/UserStatistics.cs diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index 2fd1ee5efc..2e3e7b01c8 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -7,9 +7,9 @@ namespace osu.Game.Online.API.Requests { public class GetUserRequest : APIRequest { - private int? userId; + private long? userId; - public GetUserRequest(int? userId = null) + public GetUserRequest(long? userId = null) { this.userId = userId; } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 93933c8fe9..ffe18dcfdb 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.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 System; using Newtonsoft.Json; using osu.Framework.Configuration; @@ -11,17 +12,20 @@ namespace osu.Game.Users [JsonProperty(@"id")] public long Id = 1; + [JsonProperty(@"joinDate")] + public string JoinDate; + [JsonProperty(@"username")] public string Username; - [JsonProperty(@"country_code")] - public string CountryCode; - [JsonProperty(@"country")] public Country Country; public Bindable Status = new Bindable(); + [JsonProperty(@"age")] + public int Age; + //public Team Team; [JsonProperty(@"profile_colour")] @@ -47,5 +51,74 @@ namespace osu.Game.Users [JsonProperty(@"id")] public int? Id; } + + [JsonProperty(@"isAdmin")] + public bool IsAdmin; + + [JsonProperty(@"isSupporter")] + public bool IsSupporter; + + [JsonProperty(@"isGMT")] + public bool IsGMT; + + [JsonProperty(@"isQAT")] + public bool IsQAT; + + [JsonProperty(@"isBNG")] + public bool IsBNG; + + [JsonProperty(@"is_active")] + public bool Active; + + [JsonProperty(@"interests")] + public string Intrerests; + + [JsonProperty(@"occupation")] + public string Occupation; + + [JsonProperty(@"title")] + public string Title; + + [JsonProperty(@"location")] + public string Location; + + [JsonProperty(@"lastvisit")] + public DateTimeOffset LastVisit; + + [JsonProperty(@"twitter")] + public string Twitter; + + [JsonProperty(@"lastfm")] + public string Lastfm; + + [JsonProperty(@"skype")] + public string Skype; + + [JsonProperty(@"website")] + public string Website; + + [JsonProperty(@"playstyle")] + public string[] PlayStyle; + + [JsonProperty(@"playmode")] + public string PlayMode; + + [JsonProperty(@"profileOrder")] + public string[] ProfileOrder; + + [JsonProperty(@"kudosu")] + public KudosuCount Kudosu; + + public class KudosuCount + { + [JsonProperty(@"total")] + public int Total; + + [JsonProperty(@"available")] + public int Available; + } + + [JsonProperty(@"defaultStatistics")] + public UserStatistics Statistics; } } diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs new file mode 100644 index 0000000000..22c5c5cbcc --- /dev/null +++ b/osu.Game/Users/UserStatistics.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; + +namespace osu.Game.Users +{ + public class UserStatistics + { + [JsonProperty(@"level")] + public LevelInfo Level; + + public class LevelInfo + { + [JsonProperty(@"current")] + public int Current; + + [JsonProperty(@"progress")] + public int Progress; + } + + [JsonProperty(@"pp")] + public decimal PP; + + [JsonProperty(@"pp_rank")] + public int Rank; + + [JsonProperty(@"ranked_score")] + public long RankedScore; + + [JsonProperty(@"hit_accuracy")] + public decimal Accuracy; + + [JsonProperty(@"play_count")] + public int PlayCount; + + [JsonProperty(@"total_score")] + public long TotalScore; + + [JsonProperty(@"total_hits")] + public int TotalHits; + + [JsonProperty(@"maximum_combo")] + public int MaxCombo; + + [JsonProperty(@"replays_watched_by_others")] + public int ReplayWatched; + + [JsonProperty(@"grade_counts")] + public Grades GradesCount; + + public class Grades + { + [JsonProperty(@"ss")] + public int SS; + + [JsonProperty(@"s")] + public int S; + + [JsonProperty(@"a")] + public int A; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c554ee751b..79d066461b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -471,6 +471,7 @@ + From f03530cdd2bf31681a0fdfdae2b7e148f8bd6891 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 22:33:08 +0800 Subject: [PATCH 077/312] Fetch latest user data. --- osu.Game/Overlays/UserProfileOverlay.cs | 31 +++++++++++++++++++++---- osu.Game/Users/Profile/ProfileHeader.cs | 5 ++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index d0c5726cdc..d630e11a99 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -11,6 +11,8 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Users; using osu.Game.Users.Profile; @@ -19,13 +21,23 @@ namespace osu.Game.Overlays public class UserProfileOverlay : WaveOverlayContainer { private ProfileSection lastSection; + private GetUserRequest userReq; + private APIAccess api; public const float CONTENT_X_MARGIN = 50; + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + } + public void ShowUser(User user) { + userReq?.Cancel(); Clear(); lastSection = null; + var sections = new ProfileSection[] { new AboutSection(), @@ -43,7 +55,6 @@ namespace osu.Game.Overlays Origin = Anchor.TopCentre, Height = 30 }; - sections.ForEach(tabs.AddItem); Add(new Box { @@ -51,20 +62,20 @@ namespace osu.Game.Overlays Colour = OsuColour.Gray(0.2f) }); + var header = new ProfileHeader(user); + var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, - ExpandableHeader = new ProfileHeader(user), + ExpandableHeader = header, FixedHeader = tabs, HeaderBackground = new Box { Colour = OsuColour.Gray(34), RelativeSizeAxes = Axes.Both - }, - Children = sections + } }; Add(sectionsContainer); - sectionsContainer.SelectedSection.ValueChanged += s => { if (lastSection != s) @@ -89,6 +100,16 @@ namespace osu.Game.Overlays sectionsContainer.ScrollContainer.ScrollIntoView(lastSection); } }; + + userReq = new GetUserRequest(user.Id); //fetch latest full data + userReq.Success += u => + { + header.FillFullData(u); + sectionsContainer.Children = sections; + sections.ForEach(tabs.AddItem); + }; + api.Queue(userReq); + Show(); } diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 43d86950fb..628767271a 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -295,6 +295,11 @@ namespace osu.Game.Users.Profile gradeA.Count = 1234; } + public void FillFullData(User user) + { + + } + private OsuSpriteText createScoreText(string text) => new OsuSpriteText { TextSize = 14, From 3ec5d774df29185cb0583b1b8ee49d29afc8eae5 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 22:42:15 +0800 Subject: [PATCH 078/312] Child control fixes. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index e11a12d2a1..63cc6f1a85 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -103,6 +103,8 @@ namespace osu.Game.Graphics.Containers { base.Add(drawable); lastKnownScroll = float.NaN; + headerHeight = float.NaN; + footerHeight = float.NaN; } private float headerHeight, footerHeight; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index c8cf1b539f..0a1eecd293 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown?.Contains(screenSpacePos) == true; private static bool isEnumType => typeof(T).IsEnum; diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index d630e11a99..8be3058166 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -135,6 +135,8 @@ namespace osu.Game.Overlays protected override TabItem CreateTabItem(ProfileSection value) => new ProfileTabItem(value); + protected override Dropdown CreateDropdown() => null; + private class ProfileTabItem : PageTabItem { public ProfileTabItem(ProfileSection value) : base(value) From 2770ccb78206bdfe346a1f5a607429871ffde0cc Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 23:25:13 +0800 Subject: [PATCH 079/312] Possible null fields. --- osu.Game/Users/User.cs | 2 +- osu.Game/Users/UserStatistics.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index ffe18dcfdb..99484d8ef3 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -24,7 +24,7 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); [JsonProperty(@"age")] - public int Age; + public int? Age; //public Team Team; diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 22c5c5cbcc..7e3e5db983 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -20,7 +20,7 @@ namespace osu.Game.Users } [JsonProperty(@"pp")] - public decimal PP; + public decimal? PP; [JsonProperty(@"pp_rank")] public int Rank; From 9a77332063f9883ea8a7587e1790fbc434b9f125 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 15 Jun 2017 23:47:34 +0800 Subject: [PATCH 080/312] Order sections. --- osu.Game/Overlays/UserProfileOverlay.cs | 8 +++++--- osu.Game/Users/Profile/AboutSection.cs | 3 +++ osu.Game/Users/Profile/BeatmapsSection.cs | 2 ++ osu.Game/Users/Profile/HistoricalSection.cs | 2 ++ osu.Game/Users/Profile/KudosuSection.cs | 2 ++ osu.Game/Users/Profile/MedalsSection.cs | 2 ++ osu.Game/Users/Profile/ProfileSection.cs | 2 ++ osu.Game/Users/Profile/RanksSection.cs | 2 ++ osu.Game/Users/Profile/RecentSection.cs | 2 ++ 9 files changed, 22 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 8be3058166..2042348d94 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -4,7 +4,6 @@ using System.Linq; using OpenTK; using osu.Framework.Allocation; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -105,8 +104,11 @@ namespace osu.Game.Overlays userReq.Success += u => { header.FillFullData(u); - sectionsContainer.Children = sections; - sections.ForEach(tabs.AddItem); + + var reorderedSections = u.ProfileOrder.Select(x => sections.FirstOrDefault(s => s.Identifier == x)).Where(s => s != null).ToList(); + + sectionsContainer.Children = reorderedSections; + reorderedSections.ForEach(tabs.AddItem); }; api.Queue(userReq); diff --git a/osu.Game/Users/Profile/AboutSection.cs b/osu.Game/Users/Profile/AboutSection.cs index 69ace5fc71..572eb1a273 100644 --- a/osu.Game/Users/Profile/AboutSection.cs +++ b/osu.Game/Users/Profile/AboutSection.cs @@ -1,10 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + namespace osu.Game.Users.Profile { public class AboutSection : ProfileSection { public override string Title => "me!"; + + public override string Identifier => "me"; } } diff --git a/osu.Game/Users/Profile/BeatmapsSection.cs b/osu.Game/Users/Profile/BeatmapsSection.cs index a69c65c84a..eb460bbbec 100644 --- a/osu.Game/Users/Profile/BeatmapsSection.cs +++ b/osu.Game/Users/Profile/BeatmapsSection.cs @@ -6,5 +6,7 @@ namespace osu.Game.Users.Profile public class BeatmapsSection : ProfileSection { public override string Title => "Beatmaps"; + + public override string Identifier => "beatmaps"; } } diff --git a/osu.Game/Users/Profile/HistoricalSection.cs b/osu.Game/Users/Profile/HistoricalSection.cs index c5f357d322..1b767662cf 100644 --- a/osu.Game/Users/Profile/HistoricalSection.cs +++ b/osu.Game/Users/Profile/HistoricalSection.cs @@ -6,5 +6,7 @@ namespace osu.Game.Users.Profile public class HistoricalSection : ProfileSection { public override string Title => "Historical"; + + public override string Identifier => "historical"; } } diff --git a/osu.Game/Users/Profile/KudosuSection.cs b/osu.Game/Users/Profile/KudosuSection.cs index b489f6544d..3502c61822 100644 --- a/osu.Game/Users/Profile/KudosuSection.cs +++ b/osu.Game/Users/Profile/KudosuSection.cs @@ -6,5 +6,7 @@ namespace osu.Game.Users.Profile public class KudosuSection : ProfileSection { public override string Title => "Kudosu!"; + + public override string Identifier => "kudosu"; } } diff --git a/osu.Game/Users/Profile/MedalsSection.cs b/osu.Game/Users/Profile/MedalsSection.cs index 0a52830340..18ef779f83 100644 --- a/osu.Game/Users/Profile/MedalsSection.cs +++ b/osu.Game/Users/Profile/MedalsSection.cs @@ -6,5 +6,7 @@ namespace osu.Game.Users.Profile public class MedalsSection : ProfileSection { public override string Title => "Medals"; + + public override string Identifier => "medals"; } } diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Users/Profile/ProfileSection.cs index 723024d6a6..ec938c13ac 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Users/Profile/ProfileSection.cs @@ -15,6 +15,8 @@ namespace osu.Game.Users.Profile { public abstract string Title { get; } + public abstract string Identifier { get; } + private readonly FillFlowContainer content; protected override Container Content => content; diff --git a/osu.Game/Users/Profile/RanksSection.cs b/osu.Game/Users/Profile/RanksSection.cs index 65f3f04c1b..b2a35dbd21 100644 --- a/osu.Game/Users/Profile/RanksSection.cs +++ b/osu.Game/Users/Profile/RanksSection.cs @@ -6,5 +6,7 @@ namespace osu.Game.Users.Profile public class RanksSection : ProfileSection { public override string Title => "Ranks"; + + public override string Identifier => "top_ranks"; } } diff --git a/osu.Game/Users/Profile/RecentSection.cs b/osu.Game/Users/Profile/RecentSection.cs index 6cd3bf6c49..b1961491bb 100644 --- a/osu.Game/Users/Profile/RecentSection.cs +++ b/osu.Game/Users/Profile/RecentSection.cs @@ -6,5 +6,7 @@ namespace osu.Game.Users.Profile public class RecentSection : ProfileSection { public override string Title => "Recent"; + + public override string Identifier => "recent_activities"; } } From a7e31573636a69c9980edf7f78f64440c6bb2c04 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 01:04:20 +0800 Subject: [PATCH 081/312] Fill statistic area. --- osu.Game/Users/Profile/ProfileHeader.cs | 91 +++++++++++++------------ 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 628767271a..2fd8ed77f0 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -20,11 +20,10 @@ namespace osu.Game.Users.Profile { public class ProfileHeader : Container { - //private readonly User user; - private readonly OsuTextFlowContainer infoText; private readonly FillFlowContainer scoreText, scoreNumberText; + private readonly Container coverContainer; private readonly Sprite levelBadge; private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; @@ -32,29 +31,17 @@ namespace osu.Game.Users.Profile private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) { - //this.user = user; RelativeSizeAxes = Axes.X; Height = cover_height + info_height; Children = new Drawable[] { - new Container + coverContainer = new Container { RelativeSizeAxes = Axes.X, Height = cover_height, Children = new Drawable[] { - new AsyncLoadWrapper(new UserCoverBackground(user) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(200) - }) - { - Masking = true, - RelativeSizeAxes = Axes.Both - }, new Box { RelativeSizeAxes = Axes.Both, @@ -143,7 +130,8 @@ namespace osu.Game.Users.Profile Anchor = Anchor.Centre, Origin = Anchor.Centre, Height = 50, - Width = 50 + Width = 50, + Alpha = 0 }, levelText = new OsuSpriteText { @@ -194,8 +182,8 @@ namespace osu.Game.Users.Profile Spacing = new Vector2(20, 0), Children = new[] { - gradeSSPlus = new GradeBadge("SSPlus"), - gradeSS = new GradeBadge("SS"), + gradeSSPlus = new GradeBadge("SSPlus") { Alpha = 0 }, + gradeSS = new GradeBadge("SS") { Alpha = 0 }, } }, new FillFlowContainer @@ -208,9 +196,9 @@ namespace osu.Game.Users.Profile Spacing = new Vector2(20, 0), Children = new[] { - gradeSPlus = new GradeBadge("SPlus"), - gradeS = new GradeBadge("S"), - gradeA = new GradeBadge("A"), + gradeSPlus = new GradeBadge("SPlus") { Alpha = 0 }, + gradeS = new GradeBadge("S") { Alpha = 0 }, + gradeA = new GradeBadge("A") { Alpha = 0 }, } } } @@ -270,34 +258,47 @@ namespace osu.Game.Users.Profile infoText.NewParagraph(); infoText.AddText("Play with "); infoText.AddText("Mouse, Keyboard, Tablet", bold); - - levelText.Text = "98"; - - scoreText.Add(createScoreText("Ranked Score")); - scoreNumberText.Add(createScoreNumberText("1,870,716,897")); - scoreText.Add(createScoreText("Accuracy")); - scoreNumberText.Add(createScoreNumberText("98.51%")); - scoreText.Add(createScoreText("Play Count")); - scoreNumberText.Add(createScoreNumberText("25,287")); - scoreText.Add(createScoreText("Total Score")); - scoreNumberText.Add(createScoreNumberText("28,444,797,570")); - scoreText.Add(createScoreText("Total Hits")); - scoreNumberText.Add(createScoreNumberText("4,612,765")); - scoreText.Add(createScoreText("Max Combo")); - scoreNumberText.Add(createScoreNumberText("2,056")); - scoreText.Add(createScoreText("Replay Watched")); - scoreNumberText.Add(createScoreNumberText("23")); - - gradeSSPlus.Count = 12; - gradeSS.Count = 34; - gradeSPlus.Count = 567; - gradeS.Count = 890; - gradeA.Count = 1234; } public void FillFullData(User user) { + coverContainer.Add(new AsyncLoadWrapper(new UserCoverBackground(user) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(200) + }) + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue + }); + levelBadge.Show(); + levelText.Text = user.Statistics.Level.Current.ToString(); + + scoreText.Add(createScoreText("Ranked Score")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0"))); + scoreText.Add(createScoreText("Accuracy")); + scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy}%")); + scoreText.Add(createScoreText("Play Count")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0"))); + scoreText.Add(createScoreText("Total Score")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalScore.ToString(@"#,0"))); + scoreText.Add(createScoreText("Total Hits")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalHits.ToString(@"#,0"))); + scoreText.Add(createScoreText("Max Combo")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.MaxCombo.ToString(@"#,0"))); + scoreText.Add(createScoreText("Replay Watched by Others")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplayWatched.ToString(@"#,0"))); + + gradeSS.Count = user.Statistics.GradesCount.SS; + gradeSS.Show(); + gradeS.Count = user.Statistics.GradesCount.S; + gradeS.Show(); + gradeA.Count = user.Statistics.GradesCount.A; + gradeA.Show(); } private OsuSpriteText createScoreText(string text) => new OsuSpriteText @@ -326,7 +327,7 @@ namespace osu.Game.Users.Profile { set { - numberText.Text = value.ToString(@"#,#"); + numberText.Text = value.ToString(@"#,0"); } } From 6967fb11057bca487ffb47f82d309a2c2023fb14 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 13:27:22 +0800 Subject: [PATCH 082/312] Fill user informations. --- osu.Game/Users/Profile/ProfileHeader.cs | 153 +++++++++++++++--------- 1 file changed, 98 insertions(+), 55 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 2fd8ed77f0..a3b8caf579 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -20,7 +20,7 @@ namespace osu.Game.Users.Profile { public class ProfileHeader : Container { - private readonly OsuTextFlowContainer infoText; + private readonly OsuTextFlowContainer infoTextLeft, infoTextRight; private readonly FillFlowContainer scoreText, scoreNumberText; private readonly Container coverContainer; @@ -28,7 +28,7 @@ namespace osu.Game.Users.Profile private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; - private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; + private const float cover_height = 350, info_height = 150, info_width = 250, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; public ProfileHeader(User user) { RelativeSizeAxes = Axes.X; @@ -92,17 +92,31 @@ namespace osu.Game.Users.Profile } } }, - infoText = new OsuTextFlowContainer(t => + infoTextLeft = new OsuTextFlowContainer(t => { t.TextSize = 14; t.Alpha = 0.8f; }) { + X = UserProfileOverlay.CONTENT_X_MARGIN, Y = cover_height + 20, - Margin = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN }, - RelativeSizeAxes = Axes.X, + Width = info_width, AutoSizeAxes = Axes.Y, - ParagraphSpacing = 1 + ParagraphSpacing = 0.8f, + LineSpacing = 0.2f + }, + infoTextRight = new OsuTextFlowContainer(t => + { + t.TextSize = 14; + t.Alpha = 0.8f; + }) + { + X = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20, + Y = cover_height + 20, + Width = info_width, + AutoSizeAxes = Axes.Y, + ParagraphSpacing = 0.8f, + LineSpacing = 0.2f }, new Container { @@ -231,33 +245,6 @@ namespace osu.Game.Users.Profile private void load(TextureStore textures) { levelBadge.Texture = textures.Get(@"Profile/levelbadge"); - - Action bold = t => - { - t.Font = @"Exo2.0-Bold"; - t.Alpha = 1; - }; - // fill placeholder texts - infoText.AddTextAwesome(FontAwesome.fa_map_marker); - infoText.AddText(" position "); - infoText.AddTextAwesome(FontAwesome.fa_twitter); - infoText.AddText(" tweet "); - infoText.AddTextAwesome(FontAwesome.fa_heart_o); - infoText.AddText(" favorite "); - infoText.NewParagraph(); - infoText.AddText("0 years old"); - infoText.NewLine(); - infoText.AddText("Commander of "); - infoText.AddText("The Color Scribbles", bold); - infoText.NewParagraph(); - infoText.AddText("Joined since "); - infoText.AddText("June 2017", bold); - infoText.NewLine(); - infoText.AddText("Last seen "); - infoText.AddText("0 minutes ago", bold); - infoText.NewParagraph(); - infoText.AddText("Play with "); - infoText.AddText("Mouse, Keyboard, Tablet", bold); } public void FillFullData(User user) @@ -275,32 +262,76 @@ namespace osu.Game.Users.Profile Depth = float.MaxValue }); - levelBadge.Show(); - levelText.Text = user.Statistics.Level.Current.ToString(); + Action boldItalic = t => + { + t.Font = @"Exo2.0-BoldItalic"; + t.Alpha = 1; + }; - scoreText.Add(createScoreText("Ranked Score")); - scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0"))); - scoreText.Add(createScoreText("Accuracy")); - scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy}%")); - scoreText.Add(createScoreText("Play Count")); - scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0"))); - scoreText.Add(createScoreText("Total Score")); - scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalScore.ToString(@"#,0"))); - scoreText.Add(createScoreText("Total Hits")); - scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalHits.ToString(@"#,0"))); - scoreText.Add(createScoreText("Max Combo")); - scoreNumberText.Add(createScoreNumberText(user.Statistics.MaxCombo.ToString(@"#,0"))); - scoreText.Add(createScoreText("Replay Watched by Others")); - scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplayWatched.ToString(@"#,0"))); + if (user.Age != null) + { + infoTextLeft.AddText($"{user.Age} years old", boldItalic); + } + if (user.Country != null) + { + infoTextLeft.AddText(" from "); + infoTextLeft.AddText(user.Country.FullName, boldItalic); + } + infoTextLeft.NewParagraph(); - gradeSS.Count = user.Statistics.GradesCount.SS; - gradeSS.Show(); - gradeS.Count = user.Statistics.GradesCount.S; - gradeS.Show(); - gradeA.Count = user.Statistics.GradesCount.A; - gradeA.Show(); + infoTextLeft.AddText("Joined "); + infoTextLeft.AddText(user.JoinDate, boldItalic); + infoTextLeft.NewLine(); + infoTextLeft.AddText("Last seen "); + infoTextLeft.AddText(user.LastVisit.LocalDateTime.ToShortDateString(), boldItalic); + infoTextLeft.NewParagraph(); + + if (user.PlayStyle?.Length > 0) + { + infoTextLeft.AddText("Plays with "); + infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic); + } + + tryAddInfoRightLine(FontAwesome.fa_map_marker, user.Location); + tryAddInfoRightLine(FontAwesome.fa_heart_o, user.Intrerests); + tryAddInfoRightLine(FontAwesome.fa_suitcase, user.Occupation); + infoTextRight.NewParagraph(); + if (!string.IsNullOrEmpty(user.Twitter)) + tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter); + tryAddInfoRightLine(FontAwesome.fa_globe, user.Website); + tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype); + + if (user.Statistics != null) + { + levelBadge.Show(); + levelText.Text = user.Statistics.Level.Current.ToString(); + + scoreText.Add(createScoreText("Ranked Score")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0"))); + scoreText.Add(createScoreText("Accuracy")); + scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy}%")); + scoreText.Add(createScoreText("Play Count")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0"))); + scoreText.Add(createScoreText("Total Score")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalScore.ToString(@"#,0"))); + scoreText.Add(createScoreText("Total Hits")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.TotalHits.ToString(@"#,0"))); + scoreText.Add(createScoreText("Max Combo")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.MaxCombo.ToString(@"#,0"))); + scoreText.Add(createScoreText("Replay Watched by Others")); + scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplayWatched.ToString(@"#,0"))); + + gradeSS.Count = user.Statistics.GradesCount.SS; + gradeSS.Show(); + gradeS.Count = user.Statistics.GradesCount.S; + gradeS.Show(); + gradeA.Count = user.Statistics.GradesCount.A; + gradeA.Show(); + } } + // These could be local functions when C# 7 enabled + private OsuSpriteText createScoreText(string text) => new OsuSpriteText { TextSize = 14, @@ -316,6 +347,18 @@ namespace osu.Game.Users.Profile Text = text }; + private void tryAddInfoRightLine(FontAwesome icon, string str) + { + if (string.IsNullOrEmpty(str)) return; + infoTextRight.AddTextAwesome(icon); + infoTextRight.AddText(" " + str, t => + { + t.Font = @"Exo2.0-RegularItalic"; + t.Alpha = 1; + }); + infoTextRight.NewLine(); + } + private class GradeBadge : Container { private const float width = 50; From 9e3935a73284ab432a77259e78d8712ba57d0774 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 14:34:08 +0800 Subject: [PATCH 083/312] Show available information in RankChart. --- osu.Game/Users/Profile/ProfileHeader.cs | 10 +++---- osu.Game/Users/Profile/RankChart.cs | 36 ++++++++++--------------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index a3b8caf579..ad23b8e522 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -23,7 +23,7 @@ namespace osu.Game.Users.Profile private readonly OsuTextFlowContainer infoTextLeft, infoTextRight; private readonly FillFlowContainer scoreText, scoreNumberText; - private readonly Container coverContainer; + private readonly Container coverContainer, chartContainer; private readonly Sprite levelBadge; private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; @@ -217,7 +217,7 @@ namespace osu.Game.Users.Profile } } }, - new Container + chartContainer = new Container { RelativeSizeAxes = Axes.X, Anchor = Anchor.BottomCentre, @@ -229,10 +229,6 @@ namespace osu.Game.Users.Profile { Colour = Color4.Black.Opacity(0.25f), RelativeSizeAxes = Axes.Both - }, - new RankChart(user) - { - RelativeSizeAxes = Axes.Both } } } @@ -327,6 +323,8 @@ namespace osu.Game.Users.Profile gradeS.Show(); gradeA.Count = user.Statistics.GradesCount.A; gradeA.Show(); + + chartContainer.Add(new RankChart(user) { RelativeSizeAxes = Axes.Both }); } } diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs index 8a9719e254..fde7379628 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Users/Profile/RankChart.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Threading.Tasks; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -23,8 +22,8 @@ namespace osu.Game.Users.Profile private readonly SpriteText rankText, performanceText, relativeText; private readonly RankChartLineGraph graph; - private int[] ranks, performances; - private int rank, performance, countryRank; + private int[] ranks; + private decimal?[] performances; private const float primary_textsize = 25, secondary_textsize = 13, padding = 10; @@ -33,6 +32,7 @@ namespace osu.Game.Users.Profile public RankChart(User user) { this.user = user; + Padding = new MarginPadding { Vertical = padding }; Children = new Drawable[] { @@ -69,20 +69,22 @@ namespace osu.Game.Users.Profile BallMove = showHistoryRankTexts } }; + ranks = new[] { user.Statistics.Rank }; + performances = new decimal?[] { user.Statistics.PP }; } private void updateRankTexts() { - rankText.Text = $"#{rank:#,#}"; - performanceText.Text = $"{performance:#,#}pp"; - relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,#}"; + rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; + performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty; + //relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,0}"; } private void showHistoryRankTexts(int dayIndex) { - rankText.Text = $"#{ranks[dayIndex]:#,#}"; - performanceText.Text = $"{performances[dayIndex]:#,#}pp"; - relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; + rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank"; + performanceText.Text = performances[dayIndex] != null ? $"{performances[dayIndex]:#,0}pp" : string.Empty; + //relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; //plural should be handled in a general way } @@ -90,20 +92,10 @@ namespace osu.Game.Users.Profile private void load(OsuColour colours) { graph.Colour = colours.Yellow; - Task.Factory.StartNew(() => - { - System.Threading.Thread.Sleep(1000); - // put placeholder data here to show the transform - rank = 12345; - countryRank = 678; - performance = 4567; - ranks = Enumerable.Range(1234, 80).ToArray(); - performances = ranks.Select(x => 6000 - x).ToArray(); - // use logarithmic coordinates - graph.Values = ranks.Select(x => -(float)Math.Log(x)); - graph.ResetBall(); - }); + // use logarithmic coordinates + graph.Values = ranks.Select(x => -(float)Math.Log(x)); + graph.ResetBall(); } public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) From fa98cfa9e5e32ed52f2538ddce1179e252fcfbfc Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 14:47:14 +0800 Subject: [PATCH 084/312] Handle max==min in LineGraph. --- osu.Game/Graphics/UserInterface/LineGraph.cs | 12 +++++++++--- osu.Game/Users/Profile/RankChart.cs | 19 ++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 02e8a8329a..28b62ff957 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -23,8 +23,8 @@ namespace osu.Game.Graphics.UserInterface /// public float? MinValue { get; set; } - public float? ActualMaxValue { get; private set; } - public float? ActualMinValue { get; private set; } + public float ActualMaxValue { get; private set; } = float.NaN; + public float ActualMinValue { get; private set; } = float.NaN; private const double transform_duration = 500; @@ -87,10 +87,16 @@ namespace osu.Game.Graphics.UserInterface for (int i = 0; i < values.Length; i++) { float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1; - float y = (max - values[i]) / (max - min) * DrawHeight - 1; + float y = GetYPosition(values[i]) * DrawHeight - 1; // the -1 is for inner offset in path (actually -PathWidth) path.AddVertex(new Vector2(x, y)); } } + + protected float GetYPosition(float value) + { + if (ActualMaxValue == ActualMinValue) return 0; + return (ActualMaxValue - value) / (ActualMaxValue - ActualMinValue); + } } } diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Users/Profile/RankChart.cs index fde7379628..8581635cd7 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Users/Profile/RankChart.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using OpenTK; using osu.Framework.Allocation; @@ -93,9 +92,12 @@ namespace osu.Game.Users.Profile { graph.Colour = colours.Yellow; - // use logarithmic coordinates - graph.Values = ranks.Select(x => -(float)Math.Log(x)); - graph.ResetBall(); + if (user.Statistics.Rank > 0) + { + // use logarithmic coordinates + graph.Values = ranks.Select(x => -(float)Math.Log(x)); + graph.ResetBall(); + } } public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) @@ -136,9 +138,7 @@ namespace osu.Game.Users.Profile public void ResetBall() { - Trace.Assert(ActualMaxValue.HasValue); - Trace.Assert(ActualMinValue.HasValue); - ball.MoveTo(new Vector2(1, ((ActualMaxValue - Values.Last()) / (ActualMaxValue - ActualMinValue)).Value), ballShown ? transform_duration : 0, EasingTypes.OutQuint); + ball.MoveTo(new Vector2(1, GetYPosition(Values.Last())), ballShown ? transform_duration : 0, EasingTypes.OutQuint); ball.Show(); BallRelease(); ballShown = true; @@ -155,10 +155,7 @@ namespace osu.Game.Users.Profile if (index >= count - values.Count) { int i = index + values.Count - count; - float value = values[i]; - Trace.Assert(ActualMaxValue.HasValue); - Trace.Assert(ActualMinValue.HasValue); - float y = ((ActualMaxValue - value) / (ActualMaxValue - ActualMinValue)).Value; + float y = GetYPosition(values[i]); if (Math.Abs(y * DrawHeight - position.Y) <= 8f) { ball.MoveTo(new Vector2(index / (float)(count - 1), y), transform_duration, EasingTypes.OutQuint); From a08d35ec4c85bb37c6ddeaff9c876e7fd1d55d46 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 15:01:09 +0800 Subject: [PATCH 085/312] Update some container structure. --- osu.Game/Users/Profile/ProfileHeader.cs | 75 +++++++++++++------------ 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index ad23b8e522..7d57bde963 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -28,7 +28,7 @@ namespace osu.Game.Users.Profile private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; - private const float cover_height = 350, info_height = 150, info_width = 250, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60; + private const float cover_height = 350, info_height = 150, info_width = 250, avatar_size = 110, level_position = 30, level_height = 60; public ProfileHeader(User user) { RelativeSizeAxes = Axes.X; @@ -47,49 +47,58 @@ namespace osu.Game.Users.Profile RelativeSizeAxes = Axes.Both, ColourInfo = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) }, - new UpdateableAvatar - { - User = user, - Size = new Vector2(avatar_size), - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - X = UserProfileOverlay.CONTENT_X_MARGIN, - Y = avatar_bottom_position, - Masking = true, - CornerRadius = 5, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), - Radius = 4, - }, - }, new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - X = UserProfileOverlay.CONTENT_X_MARGIN + avatar_size + 10, - Y = avatar_bottom_position, + X = UserProfileOverlay.CONTENT_X_MARGIN, + Y = -20, + AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + new UpdateableAvatar { - Text = user.Username, - TextSize = 30, - Font = @"Exo2.0-RegularItalic", + User = user, + Size = new Vector2(avatar_size), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Y = -55 + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }, }, - new DrawableFlag(user.Country?.FlagName ?? "__") + new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Width = 30, - Height = 20 + X = avatar_size + 10, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = user.Username, + TextSize = 30, + Font = @"Exo2.0-RegularItalic", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Y = -55 + }, + new DrawableFlag(user.Country?.FlagName ?? "__") + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Width = 30, + Height = 20 + } + } } } - } + }, } }, infoTextLeft = new OsuTextFlowContainer(t => @@ -108,7 +117,7 @@ namespace osu.Game.Users.Profile infoTextRight = new OsuTextFlowContainer(t => { t.TextSize = 14; - t.Alpha = 0.8f; + t.Font = @"Exo2.0-RegularItalic"; }) { X = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20, @@ -349,11 +358,7 @@ namespace osu.Game.Users.Profile { if (string.IsNullOrEmpty(str)) return; infoTextRight.AddTextAwesome(icon); - infoTextRight.AddText(" " + str, t => - { - t.Font = @"Exo2.0-RegularItalic"; - t.Alpha = 1; - }); + infoTextRight.AddText(" " + str); infoTextRight.NewLine(); } From bd49ae622ac4228c9066fd7029526c5b524b6fd9 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 15:54:55 +0800 Subject: [PATCH 086/312] Add color bar and supporter tag. --- osu.Game/Users/Profile/ProfileHeader.cs | 49 ++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 7d57bde963..faedc18d09 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -23,10 +23,11 @@ namespace osu.Game.Users.Profile private readonly OsuTextFlowContainer infoTextLeft, infoTextRight; private readonly FillFlowContainer scoreText, scoreNumberText; - private readonly Container coverContainer, chartContainer; + private readonly Container coverContainer, chartContainer, supporterTag; private readonly Sprite levelBadge; private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; + private readonly Box colourBar; private const float cover_height = 350, info_height = 150, info_width = 250, avatar_size = 110, level_position = 30, level_height = 60; public ProfileHeader(User user) @@ -79,6 +80,33 @@ namespace osu.Game.Users.Profile AutoSizeAxes = Axes.Both, Children = new Drawable[] { + supporterTag = new CircularContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Y = -75, + Size = new Vector2(25, 25), + Masking = true, + BorderThickness = 3, + BorderColour = Color4.White, + Alpha = 0, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + }, + new TextAwesome + { + Icon = FontAwesome.fa_heart, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + TextSize = 12 + } + } + }, new OsuSpriteText { Text = user.Username, @@ -86,7 +114,7 @@ namespace osu.Game.Users.Profile Font = @"Exo2.0-RegularItalic", Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Y = -55 + Y = -48 }, new DrawableFlag(user.Country?.FlagName ?? "__") { @@ -99,6 +127,15 @@ namespace osu.Game.Users.Profile } } }, + colourBar = new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + X = UserProfileOverlay.CONTENT_X_MARGIN, + Height = 5, + Width = info_width, + Alpha = 0 + } } }, infoTextLeft = new OsuTextFlowContainer(t => @@ -267,6 +304,14 @@ namespace osu.Game.Users.Profile Depth = float.MaxValue }); + if (user.IsSupporter) supporterTag.Show(); + + if(!string.IsNullOrEmpty(user.Colour)) + { + colourBar.Colour = OsuColour.FromHex(user.Colour); + colourBar.Show(); + } + Action boldItalic = t => { t.Font = @"Exo2.0-BoldItalic"; From 43569d69a76822b2133fee8e6d3430c6fcb4a07a Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 16:13:23 +0800 Subject: [PATCH 087/312] Update transforms. --- .../Tests/TestCaseUserProfile.cs | 8 +----- osu.Game/Overlays/UserProfileOverlay.cs | 27 ++++++++++++++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index e55d881d93..1dc880ea90 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -16,13 +16,7 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); - var profile = new UserProfileOverlay - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = 50 }, - }; + var profile = new UserProfileOverlay(); Add(profile); AddStep("Show ppy", () => profile.ShowUser(new User diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 2042348d94..a44ffd0319 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -5,6 +5,7 @@ using System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; @@ -17,13 +18,21 @@ using osu.Game.Users.Profile; namespace osu.Game.Overlays { - public class UserProfileOverlay : WaveOverlayContainer + public class UserProfileOverlay : FocusedOverlayContainer { private ProfileSection lastSection; private GetUserRequest userReq; private APIAccess api; public const float CONTENT_X_MARGIN = 50; + private const float transition_length = 500; + + public UserProfileOverlay() + { + RelativeSizeAxes = Axes.Both; + RelativePositionAxes = Axes.Both; + Padding = new MarginPadding { Horizontal = 50 }; + } [BackgroundDependencyLoader] private void load(APIAccess api) @@ -115,6 +124,22 @@ namespace osu.Game.Overlays Show(); } + protected override void PopIn() + { + MoveToY(0, transition_length, EasingTypes.OutQuint); + FadeIn(transition_length, EasingTypes.OutQuint); + + base.PopIn(); + } + + protected override void PopOut() + { + MoveToY(Height, transition_length, EasingTypes.OutQuint); + FadeOut(transition_length, EasingTypes.OutQuint); + + base.PopOut(); + } + private class ProfileTabControl : PageTabControl { private readonly Box bottom; From 3883f4a74642b999c162d81d33be12f7b7c755b2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 16:23:20 +0800 Subject: [PATCH 088/312] Show profile when click on user panel. --- osu.Game/OsuGame.cs | 1 + osu.Game/Users/UserPanel.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 62f9164fdd..4692c89048 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -208,6 +208,7 @@ namespace osu.Game Dependencies.Cache(settings); Dependencies.Cache(social); Dependencies.Cache(chat); + Dependencies.Cache(userProfile); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); Dependencies.Cache(dialogOverlay); diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 19ed2c3394..c0adaa19fb 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; namespace osu.Game.Users { @@ -21,6 +22,7 @@ namespace osu.Game.Users private const float status_height = 30; private OsuColour colours; + private UserProfileOverlay profile; private readonly Container statusBar; private readonly Box statusBg; @@ -74,7 +76,7 @@ namespace osu.Game.Users Radius = 4, }, }, - new Container + new ClickableContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = height - status_height - content_padding }, @@ -114,6 +116,7 @@ namespace osu.Game.Users }, }, }, + Action = () => profile?.ShowUser(user) }, }, }, @@ -159,10 +162,11 @@ namespace osu.Game.Users }; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(permitNulls:true)] + private void load(OsuColour colours, UserProfileOverlay profile) { this.colours = colours; + this.profile = profile; Status.ValueChanged += displayStatus; } From 6372cd0a13e11b1f2c9048bcc0645164aceb8c90 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 16:36:23 +0800 Subject: [PATCH 089/312] Move namespace under Overlays. --- .../Profile/AboutSection.cs | 2 +- .../Profile/BeatmapsSection.cs | 2 +- .../Profile/HistoricalSection.cs | 2 +- .../Profile/KudosuSection.cs | 2 +- .../Profile/MedalsSection.cs | 2 +- .../Profile/ProfileHeader.cs | 4 ++-- .../Profile/ProfileSection.cs | 2 +- .../{Users => Overlays}/Profile/RankChart.cs | 3 ++- .../Profile/RanksSection.cs | 2 +- .../Profile/RecentSection.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 20 +++++++++---------- 12 files changed, 23 insertions(+), 22 deletions(-) rename osu.Game/{Users => Overlays}/Profile/AboutSection.cs (86%) rename osu.Game/{Users => Overlays}/Profile/BeatmapsSection.cs (87%) rename osu.Game/{Users => Overlays}/Profile/HistoricalSection.cs (87%) rename osu.Game/{Users => Overlays}/Profile/KudosuSection.cs (87%) rename osu.Game/{Users => Overlays}/Profile/MedalsSection.cs (87%) rename osu.Game/{Users => Overlays}/Profile/ProfileHeader.cs (97%) rename osu.Game/{Users => Overlays}/Profile/ProfileSection.cs (95%) rename osu.Game/{Users => Overlays}/Profile/RankChart.cs (96%) rename osu.Game/{Users => Overlays}/Profile/RanksSection.cs (87%) rename osu.Game/{Users => Overlays}/Profile/RecentSection.cs (87%) diff --git a/osu.Game/Users/Profile/AboutSection.cs b/osu.Game/Overlays/Profile/AboutSection.cs similarity index 86% rename from osu.Game/Users/Profile/AboutSection.cs rename to osu.Game/Overlays/Profile/AboutSection.cs index 572eb1a273..8dc27b1fdf 100644 --- a/osu.Game/Users/Profile/AboutSection.cs +++ b/osu.Game/Overlays/Profile/AboutSection.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class AboutSection : ProfileSection { diff --git a/osu.Game/Users/Profile/BeatmapsSection.cs b/osu.Game/Overlays/Profile/BeatmapsSection.cs similarity index 87% rename from osu.Game/Users/Profile/BeatmapsSection.cs rename to osu.Game/Overlays/Profile/BeatmapsSection.cs index eb460bbbec..0748b7d943 100644 --- a/osu.Game/Users/Profile/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/BeatmapsSection.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class BeatmapsSection : ProfileSection { diff --git a/osu.Game/Users/Profile/HistoricalSection.cs b/osu.Game/Overlays/Profile/HistoricalSection.cs similarity index 87% rename from osu.Game/Users/Profile/HistoricalSection.cs rename to osu.Game/Overlays/Profile/HistoricalSection.cs index 1b767662cf..a4d03d1938 100644 --- a/osu.Game/Users/Profile/HistoricalSection.cs +++ b/osu.Game/Overlays/Profile/HistoricalSection.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class HistoricalSection : ProfileSection { diff --git a/osu.Game/Users/Profile/KudosuSection.cs b/osu.Game/Overlays/Profile/KudosuSection.cs similarity index 87% rename from osu.Game/Users/Profile/KudosuSection.cs rename to osu.Game/Overlays/Profile/KudosuSection.cs index 3502c61822..bb3988230c 100644 --- a/osu.Game/Users/Profile/KudosuSection.cs +++ b/osu.Game/Overlays/Profile/KudosuSection.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class KudosuSection : ProfileSection { diff --git a/osu.Game/Users/Profile/MedalsSection.cs b/osu.Game/Overlays/Profile/MedalsSection.cs similarity index 87% rename from osu.Game/Users/Profile/MedalsSection.cs rename to osu.Game/Overlays/Profile/MedalsSection.cs index 18ef779f83..eaefc4cc42 100644 --- a/osu.Game/Users/Profile/MedalsSection.cs +++ b/osu.Game/Overlays/Profile/MedalsSection.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class MedalsSection : ProfileSection { diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs similarity index 97% rename from osu.Game/Users/Profile/ProfileHeader.cs rename to osu.Game/Overlays/Profile/ProfileHeader.cs index faedc18d09..3ea4d66008 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -14,9 +14,9 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; +using osu.Game.Users; -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class ProfileHeader : Container { diff --git a/osu.Game/Users/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs similarity index 95% rename from osu.Game/Users/Profile/ProfileSection.cs rename to osu.Game/Overlays/Profile/ProfileSection.cs index ec938c13ac..dfefe7fba1 100644 --- a/osu.Game/Users/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public abstract class ProfileSection : FillFlowContainer { diff --git a/osu.Game/Users/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs similarity index 96% rename from osu.Game/Users/Profile/RankChart.cs rename to osu.Game/Overlays/Profile/RankChart.cs index 8581635cd7..26fba0dba5 100644 --- a/osu.Game/Users/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -13,8 +13,9 @@ using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Users; -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class RankChart : Container { diff --git a/osu.Game/Users/Profile/RanksSection.cs b/osu.Game/Overlays/Profile/RanksSection.cs similarity index 87% rename from osu.Game/Users/Profile/RanksSection.cs rename to osu.Game/Overlays/Profile/RanksSection.cs index b2a35dbd21..df41077996 100644 --- a/osu.Game/Users/Profile/RanksSection.cs +++ b/osu.Game/Overlays/Profile/RanksSection.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class RanksSection : ProfileSection { diff --git a/osu.Game/Users/Profile/RecentSection.cs b/osu.Game/Overlays/Profile/RecentSection.cs similarity index 87% rename from osu.Game/Users/Profile/RecentSection.cs rename to osu.Game/Overlays/Profile/RecentSection.cs index b1961491bb..7bc1b5def1 100644 --- a/osu.Game/Users/Profile/RecentSection.cs +++ b/osu.Game/Overlays/Profile/RecentSection.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Users.Profile +namespace osu.Game.Overlays.Profile { public class RecentSection : ProfileSection { diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index a44ffd0319..1b91075e9c 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -13,8 +13,8 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Overlays.Profile; using osu.Game.Users; -using osu.Game.Users.Profile; namespace osu.Game.Overlays { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c592a1dcd3..819fb83c60 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -97,18 +97,18 @@ - - - - - - - - + + + + + + + + - - + + From f00ee92143200a3ce82e4885f9332421de2fe092 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 16:48:35 +0800 Subject: [PATCH 090/312] Add more acronyms. --- osu.sln.DotSettings | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 95c6676455..a4dbeef25d 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -193,6 +193,10 @@ SRGB TK SS + PP + GMT + QAT + BNG HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> From 69270814d581ade70e86746b67cc605f02343dee Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 16:48:46 +0800 Subject: [PATCH 091/312] CI fixes. --- osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs | 2 -- osu.Game/Overlays/Profile/ProfileHeader.cs | 3 +++ osu.Game/Overlays/Profile/ProfileSection.cs | 1 - osu.Game/Overlays/Profile/RankChart.cs | 9 +++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index 1dc880ea90..f932b01d2c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.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 osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Users; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 3ea4d66008..5fbbd531ce 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -378,6 +378,9 @@ namespace osu.Game.Overlays.Profile gradeA.Count = user.Statistics.GradesCount.A; gradeA.Show(); + gradeSPlus.Count = 0; + gradeSSPlus.Count = 0; + chartContainer.Add(new RankChart(user) { RelativeSizeAxes = Axes.Both }); } } diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index dfefe7fba1..84668d8675 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; namespace osu.Game.Overlays.Profile { diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 26fba0dba5..dc28ec1ffd 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -22,8 +22,8 @@ namespace osu.Game.Overlays.Profile private readonly SpriteText rankText, performanceText, relativeText; private readonly RankChartLineGraph graph; - private int[] ranks; - private decimal?[] performances; + private readonly int[] ranks; + private readonly decimal?[] performances; private const float primary_textsize = 25, secondary_textsize = 13, padding = 10; @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Profile } }; ranks = new[] { user.Statistics.Rank }; - performances = new decimal?[] { user.Statistics.PP }; + performances = new [] { user.Statistics.PP }; } private void updateRankTexts() @@ -78,13 +78,14 @@ namespace osu.Game.Overlays.Profile rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty; //relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,0}"; + relativeText.Text = string.Empty; } private void showHistoryRankTexts(int dayIndex) { rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank"; performanceText.Text = performances[dayIndex] != null ? $"{performances[dayIndex]:#,0}pp" : string.Empty; - //relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; + relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; //plural should be handled in a general way } From 4afe83e74e9eb8978fc5fe77bae67badb1bff5b8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 16 Jun 2017 19:21:54 +0900 Subject: [PATCH 092/312] Rework DrawableHitObject to provide default life times and proper DrawableTimingSection autosizing. This exposes LifetimeOffset from DrawableHitObject which is used by the XSRG rulesets to adjust the life time range by the VisibleTimeRange. --- .../Tests/TestCaseScrollingHitObjects.cs | 16 +--- .../Drawables/DrawableManiaHitObject.cs | 7 -- .../Objects/Drawables/DrawableNote.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 8 +- .../Objects/Drawables/DrawableHitObject.cs | 34 +++++++++ .../Rulesets/Timing/DrawableTimingSection.cs | 76 ++++++++++++------- .../Timing/SpeedAdjustmentContainer.cs | 16 +++- 7 files changed, 103 insertions(+), 56 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 5a4b3deb05..2d30d5603a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -125,6 +125,8 @@ namespace osu.Desktop.VisualTests.Tests private class TestSpeedAdjustmentContainer : SpeedAdjustmentContainer { + public override bool RemoveWhenNotAlive => false; + public TestSpeedAdjustmentContainer(MultiplierControlPoint controlPoint) : base(controlPoint) { @@ -195,25 +197,11 @@ namespace osu.Desktop.VisualTests.Tests FadeInFromZero(250, EasingTypes.OutQuint); } - private bool hasExpired; protected override void Update() { base.Update(); if (Time.Current >= HitObject.StartTime) - { background.Colour = Color4.Red; - - if (!hasExpired) - { - using (BeginDelayedSequence(200)) - { - FadeOut(200); - Expire(); - } - - hasExpired = true; - } - } } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index e32e953404..c0eea3ce22 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -33,13 +33,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Y = (float)HitObject.StartTime; } - protected override void LoadComplete() - { - base.LoadComplete(); - - LifetimeStart = HitObject.StartTime - ManiaPlayfield.TIME_SPAN_MAX; - } - public override Color4 AccentColour { get { return base.AccentColour; } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 658d409bb8..9322fed3eb 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public DrawableNote(Note hitObject, Bindable key = null) : base(hitObject, key) { - RelativeSizeAxes = Axes.Both; + RelativeSizeAxes = Axes.X; Height = 100; Add(headPiece = new NotePiece diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 5f33ac2cf1..205f8e152c 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Mania.UI public const float HIT_TARGET_POSITION = 50; private const double time_span_default = 1500; - public const double TIME_SPAN_MIN = 50; - public const double TIME_SPAN_MAX = 10000; + private const double time_span_min = 50; + private const double time_span_max = 10000; private const double time_span_step = 50; /// @@ -60,8 +60,8 @@ namespace osu.Game.Rulesets.Mania.UI private readonly BindableDouble visibleTimeRange = new BindableDouble(time_span_default) { - MinValue = TIME_SPAN_MIN, - MaxValue = TIME_SPAN_MAX + MinValue = time_span_min, + MaxValue = time_span_max }; private readonly SpeedAdjustmentCollection barLineContainer; diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index fcdcf672d5..68d2023109 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -12,11 +12,28 @@ using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Audio; using System.Linq; +using osu.Framework.Configuration; namespace osu.Game.Rulesets.Objects.Drawables { public abstract class DrawableHitObject : Container { + private readonly BindableDouble lifetimeOffset = new BindableDouble(); + /// + /// Time offset before at which this becomes visible and the time offset + /// after or at which it expires. + /// + /// + /// This provides only a default life time range, however classes inheriting from should expire their state through + /// if more tight control over the life time is desired. + /// + /// + public BindableDouble LifetimeOffset + { + get { return lifetimeOffset; } + set { lifetimeOffset.BindTo(value); } + } + public readonly HitObject HitObject; /// @@ -28,6 +45,22 @@ namespace osu.Game.Rulesets.Objects.Drawables { HitObject = hitObject; } + + public override double LifetimeStart + { + get { return Math.Min(HitObject.StartTime - lifetimeOffset, base.LifetimeStart); } + set { base.LifetimeStart = value; } + } + + public override double LifetimeEnd + { + get + { + var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; + return Math.Max(endTime + LifetimeOffset, base.LifetimeEnd); + } + set { base.LifetimeEnd = value; } + } } public abstract class DrawableHitObject : DrawableHitObject @@ -190,6 +223,7 @@ namespace osu.Game.Rulesets.Objects.Drawables nestedHitObjects = new List>(); h.OnJudgement += d => OnJudgement?.Invoke(d); + h.LifetimeOffset = LifetimeOffset; nestedHitObjects.Add(h); } diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index ef5daf0de8..1f1abc9bb4 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -10,6 +10,8 @@ using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; +using osu.Game.Rulesets.Objects.Types; +using System; namespace osu.Game.Rulesets.Timing { @@ -44,14 +46,17 @@ namespace osu.Game.Rulesets.Timing set { visibleTimeRange.BindTo(value); } } - protected override IComparer DepthComparer => new HitObjectReverseStartTimeComparer(); - /// - /// Axes through which this timing section scrolls. This is set from . + /// Axes through which this timing section scrolls. This is set by the . /// internal Axes ScrollingAxes; - private Cached layout = new Cached(); + /// + /// The control point that provides the speed adjustments for this container. This is set by the . + /// + internal MultiplierControlPoint ControlPoint; + + protected override IComparer DepthComparer => new HitObjectReverseStartTimeComparer(); /// /// Creates a new . @@ -71,41 +76,54 @@ namespace osu.Game.Rulesets.Timing return; } - layout.Invalidate(); + durationBacking.Invalidate(); base.InvalidateFromChild(invalidation); } - protected override void UpdateAfterChildren() + private Cached durationBacking = new Cached(); + /// + /// The maximum duration of any one hit object inside this . This is calculated as the maximum + /// end time between all hit objects relative to this 's . + /// + public double Duration => durationBacking.EnsureValid() + ? durationBacking.Value + : durationBacking.Refresh(() => { - base.UpdateAfterChildren(); + if (!Children.Any()) + return 0; - if (!layout.EnsureValid()) - { - layout.Refresh(() => - { - if (!Children.Any()) - return; + double baseDuration = Children.Max(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime) - ControlPoint.StartTime; - //double maxDuration = Children.Select(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime).Max(); - //float width = (float)maxDuration - RelativeChildOffset.X; - //float height = (float)maxDuration - RelativeChildOffset.Y; + if (baseDuration == 0) + baseDuration = 1000; + // Scrolling rulesets typically have anchors/origins set to their start time, but if an object has no end time and lies on the control point + // then the baseDuration above will be 0. This will cause problems with masking when it is set as the value for Size in Update(). + // + // Thus we _want_ the timing section to completely contain the hit object, and to do with we'll need to find a duration that corresponds + // to the absolute size of the element that extrudes beyond our bounds. For simplicity, we can approximate this by just using the largest + // absolute size available from our children. + float maxAbsoluteSize = Children.Where(c => (c.RelativeSizeAxes & ScrollingAxes) == 0) + .Select(c => (ScrollingAxes & Axes.X) > 0 ? c.Width : c.Height) + .DefaultIfEmpty().Max(); - // Auto-size to the total size of our children - // This ends up being the total duration of our children, however for now this is a more sure-fire way to calculate this - // than the above due to some undesired masking optimisations causing some hit objects to be culled... - // Todo: When this is investigated more we should use the above method as it is a little more exact - // Todo: This is not working correctly in the case that hit objects are absolutely-sized - needs a proper looking into in osu!framework - float width = Children.Select(child => child.X + child.Width).Max() - RelativeChildOffset.X; - float height = Children.Select(child => child.Y + child.Height).Max() - RelativeChildOffset.Y; + float ourAbsoluteSize = (ScrollingAxes & Axes.X) > 0 ? DrawWidth : DrawHeight; - // Consider that width/height are time values. To have ourselves span these time values 1:1, we first need to set our size - Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? width : Size.X, (ScrollingAxes & Axes.Y) > 0 ? height : Size.Y); - // Then to make our position-space be time values again, we need our relative child size to follow our size - RelativeChildSize = Size; - }); - } + // Add the extra duration to account for the absolute size + baseDuration *= 1 + maxAbsoluteSize / ourAbsoluteSize; + + return baseDuration; + }); + + protected override void Update() + { + base.Update(); + + // Consider that width/height are time values. To have ourselves span these time values 1:1, we first need to set our size + Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)Duration : Size.X, (ScrollingAxes & Axes.Y) > 0 ? (float)Duration : Size.Y); + // Then to make our position-space be time values again, we need our relative child size to follow our size + RelativeChildSize = Size; } } } diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs index af9a79adb5..b5973099d2 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs @@ -7,6 +7,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; +using System.Linq; +using System; namespace osu.Game.Rulesets.Timing { @@ -42,6 +44,8 @@ namespace osu.Game.Rulesets.Timing public readonly MultiplierControlPoint ControlPoint; + private DrawableTimingSection timingSection; + /// /// Creates a new . /// @@ -56,9 +60,10 @@ namespace osu.Game.Rulesets.Timing [BackgroundDependencyLoader] private void load() { - DrawableTimingSection timingSection = CreateTimingSection(); + timingSection = CreateTimingSection(); timingSection.ScrollingAxes = ScrollingAxes; + timingSection.ControlPoint = ControlPoint; timingSection.VisibleTimeRange.BindTo(VisibleTimeRange); timingSection.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0); @@ -74,6 +79,15 @@ namespace osu.Game.Rulesets.Timing RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1); } + public override double LifetimeStart => ControlPoint.StartTime - VisibleTimeRange; + public override double LifetimeEnd => ControlPoint.StartTime + timingSection.Duration + VisibleTimeRange; + + public override void Add(DrawableHitObject drawable) + { + drawable.LifetimeOffset.BindTo(VisibleTimeRange); + base.Add(drawable); + } + /// /// Whether this speed adjustment can contain a hit object. This is true if the hit object occurs after this speed adjustment with respect to time. /// From 28e48eab2b491c73eb4a10517d39b5c3021c770a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 16 Jun 2017 19:30:30 +0900 Subject: [PATCH 093/312] CI fixes. --- .../Objects/Drawables/DrawableManiaHitObject.cs | 1 - osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ++-- osu.Game/Rulesets/Timing/DrawableTimingSection.cs | 3 +-- osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index c0eea3ce22..4e276fddb7 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -6,7 +6,6 @@ using OpenTK.Input; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Judgements; -using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 68d2023109..f23fab6d1b 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Objects.Drawables { private readonly BindableDouble lifetimeOffset = new BindableDouble(); /// - /// Time offset before at which this becomes visible and the time offset - /// after or at which it expires. + /// Time offset before the hit object start time at which this becomes visible and the time offset + /// after the hit object's end time after which it expires. /// /// /// This provides only a default life time range, however classes inheriting from should expire their state through diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index 1f1abc9bb4..d759a7caa6 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -11,7 +11,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using osu.Game.Rulesets.Objects.Types; -using System; namespace osu.Game.Rulesets.Timing { @@ -84,7 +83,7 @@ namespace osu.Game.Rulesets.Timing private Cached durationBacking = new Cached(); /// /// The maximum duration of any one hit object inside this . This is calculated as the maximum - /// end time between all hit objects relative to this 's . + /// end time between all hit objects relative to this 's . /// public double Duration => durationBacking.EnsureValid() ? durationBacking.Value diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs index b5973099d2..0024b3c9c8 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs @@ -7,8 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; -using System.Linq; -using System; namespace osu.Game.Rulesets.Timing { From 9fea18778849e9cad2009231c2bb6b0024de6e40 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 16 Jun 2017 19:47:15 +0900 Subject: [PATCH 094/312] A bit more commenting. --- .../Rulesets/Timing/DrawableTimingSection.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index d759a7caa6..c565fd73a6 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -94,15 +94,19 @@ namespace osu.Game.Rulesets.Timing double baseDuration = Children.Max(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime) - ControlPoint.StartTime; + // If we have a singular hit object at the timing section's start time, let's set a sane default duration if (baseDuration == 0) baseDuration = 1000; - // Scrolling rulesets typically have anchors/origins set to their start time, but if an object has no end time and lies on the control point - // then the baseDuration above will be 0. This will cause problems with masking when it is set as the value for Size in Update(). + // Scrolling ruleset hit objects typically have anchors+origins set to the hit object's start time, but if the hit object doesn't implement IHasEndTime and lies on the control point + // then the baseDuration above will be 0. This will cause problems with masking when it is further set as the value for Size in Update(). We _want_ the timing section bounds to + // completely enclose the hit object to avoid the masking optimisations. // - // Thus we _want_ the timing section to completely contain the hit object, and to do with we'll need to find a duration that corresponds - // to the absolute size of the element that extrudes beyond our bounds. For simplicity, we can approximate this by just using the largest - // absolute size available from our children. + // To do this we need to find a duration that corresponds to the absolute size of the element that extrudes beyond the timing section's bounds and add that to baseDuration. + // We can utilize the fact that the Size and RelativeChildSpace are 1:1, meaning that an change in duration for the timing section has no change to the hit object's positioning + // and simply find the largest absolutely-sized element in this timing section. This introduces a little bit of error, but will never under-estimate the duration. + + // Find the largest element that is absolutely-sized along ScrollingAxes float maxAbsoluteSize = Children.Where(c => (c.RelativeSizeAxes & ScrollingAxes) == 0) .Select(c => (ScrollingAxes & Axes.X) > 0 ? c.Width : c.Height) .DefaultIfEmpty().Max(); @@ -119,9 +123,9 @@ namespace osu.Game.Rulesets.Timing { base.Update(); - // Consider that width/height are time values. To have ourselves span these time values 1:1, we first need to set our size + // We want our size and position-space along ScrollingAxes to span our duration to completely enclose all the hit objects Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)Duration : Size.X, (ScrollingAxes & Axes.Y) > 0 ? (float)Duration : Size.Y); - // Then to make our position-space be time values again, we need our relative child size to follow our size + // And we need to make sure the hit object's position-space doesn't change due to our resizing RelativeChildSize = Size; } } From 38f2bd47c5fe94286c8d507b7b41880856be812c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 16 Jun 2017 20:00:16 +0900 Subject: [PATCH 095/312] Even saner default. --- osu.Game/Rulesets/Timing/DrawableTimingSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index c565fd73a6..3ad9f23605 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Timing // If we have a singular hit object at the timing section's start time, let's set a sane default duration if (baseDuration == 0) - baseDuration = 1000; + baseDuration = 1; // Scrolling ruleset hit objects typically have anchors+origins set to the hit object's start time, but if the hit object doesn't implement IHasEndTime and lies on the control point // then the baseDuration above will be 0. This will cause problems with masking when it is further set as the value for Size in Update(). We _want_ the timing section bounds to From fe3cbb70729d3b5f708414ab8fbd347f7c29d845 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 20:32:11 +0800 Subject: [PATCH 096/312] Update join date definition. --- osu.Game/Overlays/Profile/ProfileHeader.cs | 13 ++++++++++--- osu.Game/Users/User.cs | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 5fbbd531ce..3471b27fac 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -306,7 +306,7 @@ namespace osu.Game.Overlays.Profile if (user.IsSupporter) supporterTag.Show(); - if(!string.IsNullOrEmpty(user.Colour)) + if (!string.IsNullOrEmpty(user.Colour)) { colourBar.Colour = OsuColour.FromHex(user.Colour); colourBar.Show(); @@ -329,8 +329,15 @@ namespace osu.Game.Overlays.Profile } infoTextLeft.NewParagraph(); - infoTextLeft.AddText("Joined "); - infoTextLeft.AddText(user.JoinDate, boldItalic); + if (user.JoinDate.ToUniversalTime().Year < 2008) + { + infoTextLeft.AddText("Here since the beginning", boldItalic); + } + else + { + infoTextLeft.AddText("Joined "); + infoTextLeft.AddText(user.JoinDate.LocalDateTime.ToShortDateString(), boldItalic); + } infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen "); infoTextLeft.AddText(user.LastVisit.LocalDateTime.ToShortDateString(), boldItalic); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 99484d8ef3..69a0e9c98b 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -12,8 +12,8 @@ namespace osu.Game.Users [JsonProperty(@"id")] public long Id = 1; - [JsonProperty(@"joinDate")] - public string JoinDate; + [JsonProperty(@"join_date")] + public DateTimeOffset JoinDate; [JsonProperty(@"username")] public string Username; From 1d5c5a0a4da5a16d21b9bd868f6a58b086a0fb24 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 19 Jun 2017 07:50:26 +0900 Subject: [PATCH 097/312] Fix an invalid depth operation. --- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 4c4b6c4d48..afd4e2f7fb 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -62,8 +62,12 @@ namespace osu.Game.Graphics.UserInterface X = (value & Anchor.x2) > 0 ? SIZE_RETRACTED.X * shear * 0.5f : 0; + Remove(c1); + Remove(c2); c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1; c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0; + Add(c1); + Add(c2); } } From ccac2e9a7511b72e7d60a0b635ec5ae51ccd7222 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 19:33:50 -0500 Subject: [PATCH 098/312] Add a visualizer around the logo --- osu.Game/Screens/Menu/LogoVisualisation.cs | 198 +++++++++++++++++++++ osu.Game/Screens/Menu/MenuVisualisation.cs | 11 -- osu.Game/Screens/Menu/OsuLogo.cs | 21 ++- osu.Game/osu.Game.csproj | 4 +- 4 files changed, 213 insertions(+), 21 deletions(-) create mode 100644 osu.Game/Screens/Menu/LogoVisualisation.cs delete mode 100644 osu.Game/Screens/Menu/MenuVisualisation.cs diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs new file mode 100644 index 0000000000..36b5a672a3 --- /dev/null +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -0,0 +1,198 @@ +// 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 OpenTK.Graphics.ES30; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Batches; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.OpenGL.Vertices; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Shaders; +using osu.Framework.Graphics.Textures; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using System; + +namespace osu.Game.Screens.Menu +{ + internal class LogoVisualisation : Drawable, IHasAccentColour + { + private Bindable beatmap = new Bindable(); + private Color4 barColour; + + private const int index_change = 5; + private const int bar_length = 1200; + private const int bars_per_visualizer = 250; + private const int visualizers = 5; + + /// + /// How much should each bar go down each milisecond (based on a full bar) + /// + private const float decay_per_milisecond = 0.0024f; + + private int indexOffset; + + public Color4 AccentColour + { + get + { + return barColour; + } + set + { + //Half alpha makes it look really good! + value.A = 0.5f; + barColour = value; + } + } + + private float[] fftData = new float[256]; + + public override bool HandleInput => false; + + private Shader shader; + private readonly Texture texture; + + public LogoVisualisation() + { + texture = Texture.WhitePixel; + AccentColour = Color4.White; + } + + [BackgroundDependencyLoader] + private void load(ShaderManager shaders, OsuGame game) + { + beatmap.BindTo(game.Beatmap); + shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); + } + + private void ensureFFTData() + { + float[] temporalFFTData = beatmap?.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + + for (int i = 0; i < bars_per_visualizer; i++) + { + int index = (i + indexOffset) % bars_per_visualizer; + if (beatmap?.Value?.Track?.IsRunning ?? false) + { + if (temporalFFTData[index] > fftData[i]) + fftData[i] = temporalFFTData[index]; + } + else + { + if (fftData[(i + index_change) % bars_per_visualizer] > fftData[i]) + fftData[i] = fftData[(i + index_change) % bars_per_visualizer]; + } + } + indexOffset = (indexOffset + index_change) % bars_per_visualizer; + Scheduler.AddDelayed(ensureFFTData, 50); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + ensureFFTData(); + } + + protected override void Update() + { + base.Update(); + + float decayFactor = (float)Time.Elapsed * decay_per_milisecond; + for (int i = 0; i < bars_per_visualizer; i++) + { + //0.03% of extra bar length to make it a little faster when bar is almost at it's minimum + fftData[i] -= decayFactor * (fftData[i] + 0.03f); + if (fftData[i] < 0) + fftData[i] = 0; + } + + Invalidate(Invalidation.DrawNode, shallPropagate: false); + } + + protected override DrawNode CreateDrawNode() => new VisualisationDrawNode(); + + private readonly VisualizerSharedData sharedData = new VisualizerSharedData(); + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + var visNode = (VisualisationDrawNode)node; + + visNode.Shader = shader; + visNode.Texture = texture; + visNode.Size = DrawSize.X; + visNode.Shared = sharedData; + visNode.Colour = barColour; + visNode.AudioData = fftData; + } + + private class VisualizerSharedData + { + public readonly LinearBatch VertexBatch = new LinearBatch(100 * 4, 10, PrimitiveType.Quads); + } + + private class VisualisationDrawNode : DrawNode + { + public Shader Shader; + public Texture Texture; + public VisualizerSharedData Shared; + //Asuming the logo is a circle, we don't need a second dimension. + public float Size; + + public Color4 Colour; + public float[] AudioData; + + public override void Draw(Action vertexAction) + { + base.Draw(vertexAction); + + Shader.Bind(); + Texture.TextureGL.Bind(); + + Vector2 inflation = DrawInfo.MatrixInverse.ExtractScale().Xy; + + ColourInfo colourInfo = DrawInfo.Colour; + colourInfo.ApplyChild(Colour); + + if (AudioData != null) + { + for (int i = 0; i < bars_per_visualizer * visualizers; i++) + { + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + (i / bars_per_visualizer * (360 / visualizers))); + float rotationCos = (float)Math.Cos(rotation); + float rotationSin = (float)Math.Sin(rotation); + //taking the cos and sin to the 0..1 range + var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * Size; + + var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualizer)))) / 2f, bar_length * AudioData[i % bars_per_visualizer]); + //The distance between the position and the sides of the bar. + var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); + //The distance between the bottom side of the bar and the top side. + var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y); + + var rectangle = new Quad( + (barPosition - bottomOffset) * DrawInfo.Matrix, + (barPosition - bottomOffset + amplitudeOffset) * DrawInfo.Matrix, + (barPosition + bottomOffset) * DrawInfo.Matrix, + (barPosition + bottomOffset + amplitudeOffset) * DrawInfo.Matrix + ); + + Texture.DrawQuad( + rectangle, + colourInfo, + null, + Shared.VertexBatch.Add, + //barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that. + Vector2.Divide(inflation, barSize.Yx)); + } + } + Shader.Unbind(); + } + } + } +} diff --git a/osu.Game/Screens/Menu/MenuVisualisation.cs b/osu.Game/Screens/Menu/MenuVisualisation.cs deleted file mode 100644 index 85c65b460d..0000000000 --- a/osu.Game/Screens/Menu/MenuVisualisation.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; - -namespace osu.Game.Screens.Menu -{ - internal class MenuVisualisation : Drawable - { - } -} diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index db1f008dcf..8459993967 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -34,6 +34,7 @@ namespace osu.Game.Screens.Menu private readonly Container logoBeatContainer; private readonly Container logoAmplitudeContainer; private readonly Container logoHoverContainer; + private readonly LogoVisualisation visualizer; private SampleChannel sampleClick; @@ -120,6 +121,14 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both, Children = new Drawable[] { + visualizer = new LogoVisualisation + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Alpha = 0.5f, + Size = new Vector2(0.96f) + }, new BufferedContainer { AutoSizeAxes = Axes.Both, @@ -189,14 +198,6 @@ namespace osu.Game.Screens.Menu Alpha = 0, } } - }, - new MenuVisualisation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Alpha = 0.2f, } } } @@ -246,10 +247,14 @@ namespace osu.Game.Screens.Menu if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); + visualizer.ClearTransforms(); flashLayer.FadeTo(0.2f * amplitudeAdjust, beat_in_time, EasingTypes.Out); + visualizer.FadeTo(0.9f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (flashLayer.BeginDelayedSequence(beat_in_time)) flashLayer.FadeOut(beatLength); + using (visualizer.BeginDelayedSequence(beat_in_time)) + visualizer.FadeTo(0.5f, beatLength); } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 36f358801e..4b1985e3d4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -45,7 +45,7 @@ True - $(SolutionDir)\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll + $(SolutionDir)\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -276,7 +276,7 @@ - + From 34ac932fe2aff3de756edfe8bda997e3b14f1687 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 19 Jun 2017 10:54:23 +0900 Subject: [PATCH 099/312] Reduce pollution in DrawableHitObject in favor of a loosely-coupled IScrollingHitObject. --- .../Tests/TestCaseScrollingHitObjects.cs | 4 +- .../Drawables/DrawableManiaHitObject.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 35 +------------ .../Drawables/DrawableScrollingHitObject.cs | 49 +++++++++++++++++++ .../Objects/Drawables/IScrollingHitObject.cs | 25 ++++++++++ .../Timing/SpeedAdjustmentCollection.cs | 17 ++++--- .../Timing/SpeedAdjustmentContainer.cs | 4 +- osu.Game/osu.Game.csproj | 2 + 8 files changed, 94 insertions(+), 44 deletions(-) create mode 100644 osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs create mode 100644 osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 2d30d5603a..62e5cda052 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -152,11 +152,13 @@ namespace osu.Desktop.VisualTests.Tests } } - private class TestDrawableHitObject : DrawableHitObject + private class TestDrawableHitObject : DrawableHitObject, IScrollingHitObject { private readonly Box background; private const float height = 14; + public BindableDouble LifetimeOffset { get; } = new BindableDouble(); + public TestDrawableHitObject(HitObject hitObject) : base(hitObject) { diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index 4e276fddb7..cb1352fc4a 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables { - public abstract class DrawableManiaHitObject : DrawableHitObject + public abstract class DrawableManiaHitObject : DrawableScrollingHitObject where TObject : ManiaHitObject { /// diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index f23fab6d1b..79265d6266 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -18,22 +18,6 @@ namespace osu.Game.Rulesets.Objects.Drawables { public abstract class DrawableHitObject : Container { - private readonly BindableDouble lifetimeOffset = new BindableDouble(); - /// - /// Time offset before the hit object start time at which this becomes visible and the time offset - /// after the hit object's end time after which it expires. - /// - /// - /// This provides only a default life time range, however classes inheriting from should expire their state through - /// if more tight control over the life time is desired. - /// - /// - public BindableDouble LifetimeOffset - { - get { return lifetimeOffset; } - set { lifetimeOffset.BindTo(value); } - } - public readonly HitObject HitObject; /// @@ -45,22 +29,6 @@ namespace osu.Game.Rulesets.Objects.Drawables { HitObject = hitObject; } - - public override double LifetimeStart - { - get { return Math.Min(HitObject.StartTime - lifetimeOffset, base.LifetimeStart); } - set { base.LifetimeStart = value; } - } - - public override double LifetimeEnd - { - get - { - var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - return Math.Max(endTime + LifetimeOffset, base.LifetimeEnd); - } - set { base.LifetimeEnd = value; } - } } public abstract class DrawableHitObject : DrawableHitObject @@ -217,13 +185,12 @@ namespace osu.Game.Rulesets.Objects.Drawables private List> nestedHitObjects; protected IEnumerable> NestedHitObjects => nestedHitObjects; - protected void AddNested(DrawableHitObject h) + protected virtual void AddNested(DrawableHitObject h) { if (nestedHitObjects == null) nestedHitObjects = new List>(); h.OnJudgement += d => OnJudgement?.Invoke(d); - h.LifetimeOffset = LifetimeOffset; nestedHitObjects.Add(h); } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs new file mode 100644 index 0000000000..ff6ee35745 --- /dev/null +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Configuration; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects.Types; + +namespace osu.Game.Rulesets.Objects.Drawables +{ + /// + /// A basic class that overrides and implements . + /// + public abstract class DrawableScrollingHitObject : DrawableHitObject, IScrollingHitObject + where TObject : HitObject + where TJudgement : Judgement + { + public BindableDouble LifetimeOffset { get; } = new BindableDouble(); + + public DrawableScrollingHitObject(TObject hitObject) + : base(hitObject) + { + } + + public override double LifetimeStart + { + get { return Math.Min(HitObject.StartTime - LifetimeOffset, base.LifetimeStart); } + set { base.LifetimeStart = value; } + } + + public override double LifetimeEnd + { + get + { + var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; + return Math.Max(endTime + LifetimeOffset, base.LifetimeEnd); + } + set { base.LifetimeEnd = value; } + } + + protected override void AddNested(DrawableHitObject h) + { + var scrollingHitObject = h as IScrollingHitObject; + scrollingHitObject?.LifetimeOffset.BindTo(LifetimeOffset); + + base.AddNested(h); + } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs new file mode 100644 index 0000000000..560f15f133 --- /dev/null +++ b/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Framework.Graphics; + +namespace osu.Game.Rulesets.Objects.Drawables +{ + /// + /// An interface that exposes properties required for scrolling hit objects to be properly displayed. + /// + public interface IScrollingHitObject : IDrawable + { + /// + /// Time offset before the hit object start time at which this becomes visible and the time offset + /// after the hit object's end time after which it expires. + /// + /// + /// This provides only a default life time range, however classes inheriting from should override + /// their life times if more tight control is desired. + /// + /// + BindableDouble LifetimeOffset { get; } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs index 53ad00c5e1..1323bb14a1 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs @@ -51,6 +51,13 @@ namespace osu.Game.Rulesets.Timing this.scrollingAxes = scrollingAxes; } + public override void Add(SpeedAdjustmentContainer speedAdjustment) + { + speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange); + speedAdjustment.ScrollingAxes = scrollingAxes; + base.Add(speedAdjustment); + } + /// /// Adds a hit object to this . The hit objects will be kept in a queue /// and will be processed when new s are added to this . @@ -58,14 +65,10 @@ namespace osu.Game.Rulesets.Timing /// The hit object to add. public void Add(DrawableHitObject hitObject) { - queuedHitObjects.Enqueue(hitObject); - } + if (!(hitObject is IScrollingHitObject)) + throw new InvalidOperationException($"Hit objects added to a {nameof(SpeedAdjustmentCollection)} must implement {nameof(IScrollingHitObject)}."); - public override void Add(SpeedAdjustmentContainer speedAdjustment) - { - speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange); - speedAdjustment.ScrollingAxes = scrollingAxes; - base.Add(speedAdjustment); + queuedHitObjects.Enqueue(hitObject); } protected override void Update() diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs index 0024b3c9c8..f41ef21c1e 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs @@ -82,7 +82,9 @@ namespace osu.Game.Rulesets.Timing public override void Add(DrawableHitObject drawable) { - drawable.LifetimeOffset.BindTo(VisibleTimeRange); + var scrollingHitObject = drawable as IScrollingHitObject; + scrollingHitObject?.LifetimeOffset.BindTo(VisibleTimeRange); + base.Add(drawable); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 36f358801e..21cf1f0687 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -185,6 +185,7 @@ + @@ -223,6 +224,7 @@ + From cc7f341f98a11fe2107dc03c632cdede2a15c481 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 21:52:39 -0500 Subject: [PATCH 100/312] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 3dd751659b..09746aa895 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 3dd751659b5f8e3267146db1557ec43d77456b8e +Subproject commit 09746aa89545253546d69a38d08e6972ddd06871 From d3662636d6ed9ba446aafde58d372a07e90c2f00 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 22:01:07 -0500 Subject: [PATCH 101/312] CI fixes --- osu.Game/Screens/Menu/LogoVisualisation.cs | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 36b5a672a3..0bbaf33c98 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Menu { internal class LogoVisualisation : Drawable, IHasAccentColour { - private Bindable beatmap = new Bindable(); + private readonly Bindable beatmap = new Bindable(); private Color4 barColour; private const int index_change = 5; @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Menu } } - private float[] fftData = new float[256]; + private readonly float[] frequencyAmplitudes = new float[256]; public override bool HandleInput => false; @@ -70,32 +70,32 @@ namespace osu.Game.Screens.Menu shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); } - private void ensureFFTData() + private void ensureAmplitudes() { - float[] temporalFFTData = beatmap?.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + float[] temporalAmplitudes = beatmap?.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; for (int i = 0; i < bars_per_visualizer; i++) { int index = (i + indexOffset) % bars_per_visualizer; if (beatmap?.Value?.Track?.IsRunning ?? false) { - if (temporalFFTData[index] > fftData[i]) - fftData[i] = temporalFFTData[index]; + if (temporalAmplitudes[index] > frequencyAmplitudes[i]) + frequencyAmplitudes[i] = temporalAmplitudes[index]; } else { - if (fftData[(i + index_change) % bars_per_visualizer] > fftData[i]) - fftData[i] = fftData[(i + index_change) % bars_per_visualizer]; + if (frequencyAmplitudes[(i + index_change) % bars_per_visualizer] > frequencyAmplitudes[i]) + frequencyAmplitudes[i] = frequencyAmplitudes[(i + index_change) % bars_per_visualizer]; } } indexOffset = (indexOffset + index_change) % bars_per_visualizer; - Scheduler.AddDelayed(ensureFFTData, 50); + Scheduler.AddDelayed(ensureAmplitudes, 50); } protected override void LoadComplete() { base.LoadComplete(); - ensureFFTData(); + ensureAmplitudes(); } protected override void Update() @@ -106,9 +106,9 @@ namespace osu.Game.Screens.Menu for (int i = 0; i < bars_per_visualizer; i++) { //0.03% of extra bar length to make it a little faster when bar is almost at it's minimum - fftData[i] -= decayFactor * (fftData[i] + 0.03f); - if (fftData[i] < 0) - fftData[i] = 0; + frequencyAmplitudes[i] -= decayFactor * (frequencyAmplitudes[i] + 0.03f); + if (frequencyAmplitudes[i] < 0) + frequencyAmplitudes[i] = 0; } Invalidate(Invalidation.DrawNode, shallPropagate: false); @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Menu visNode.Size = DrawSize.X; visNode.Shared = sharedData; visNode.Colour = barColour; - visNode.AudioData = fftData; + visNode.AudioData = frequencyAmplitudes; } private class VisualizerSharedData @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Menu { for (int i = 0; i < bars_per_visualizer * visualizers; i++) { - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + (i / bars_per_visualizer * (360 / visualizers))); + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + i / bars_per_visualizer * 360 / visualizers); float rotationCos = (float)Math.Cos(rotation); float rotationSin = (float)Math.Sin(rotation); //taking the cos and sin to the 0..1 range From cea8dc5602eb1f431407e49c4629c724f0ee2ca9 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 22:13:21 -0500 Subject: [PATCH 102/312] Fix possible loss of fraction --- osu.Game/Screens/Menu/LogoVisualisation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 0bbaf33c98..52f6abd3e7 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Menu { for (int i = 0; i < bars_per_visualizer * visualizers; i++) { - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + i / bars_per_visualizer * 360 / visualizers); + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + i / bars_per_visualizer * (360 / visualizers)); float rotationCos = (float)Math.Cos(rotation); float rotationSin = (float)Math.Sin(rotation); //taking the cos and sin to the 0..1 range From 3764c1d7993b8979b99db703ae1defd9ecb18aec Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 22:28:18 -0500 Subject: [PATCH 103/312] Make bar length and visualizer count floats --- osu.Game/Screens/Menu/LogoVisualisation.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 52f6abd3e7..08816019a0 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -25,9 +25,9 @@ namespace osu.Game.Screens.Menu private Color4 barColour; private const int index_change = 5; - private const int bar_length = 1200; + private const float bar_length = 1200; private const int bars_per_visualizer = 250; - private const int visualizers = 5; + private const float visualizers = 5; /// /// How much should each bar go down each milisecond (based on a full bar) From 63aabc162b85ab2e189d9011e857d28219068e22 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 22:34:45 -0500 Subject: [PATCH 104/312] Fix TestCaseMenuButtonSystem not starting up --- osu.Game/Screens/Menu/LogoVisualisation.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 08816019a0..3a49793cc2 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -63,10 +63,11 @@ namespace osu.Game.Screens.Menu AccentColour = Color4.White; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(ShaderManager shaders, OsuGame game) { - beatmap.BindTo(game.Beatmap); + if (game?.Beatmap != null) + beatmap.BindTo(game.Beatmap); shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); } From 84aa17dea3ba9bcba63d15fb92d6775b1eac2689 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 23:08:27 -0500 Subject: [PATCH 105/312] Attempt to fix possible loss of fraction --- osu.Game/Screens/Menu/LogoVisualisation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 3a49793cc2..d4ebdf8125 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Menu { for (int i = 0; i < bars_per_visualizer * visualizers; i++) { - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + i / bars_per_visualizer * (360 / visualizers)); + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + (i / bars_per_visualizer) * (360 / visualizers)); float rotationCos = (float)Math.Cos(rotation); float rotationSin = (float)Math.Sin(rotation); //taking the cos and sin to the 0..1 range From 77ca48c1bd03bd51d82db449725a0033342daa79 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 18 Jun 2017 23:52:42 -0500 Subject: [PATCH 106/312] CI Fixes --- osu.Game/Screens/Menu/LogoVisualisation.cs | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index d4ebdf8125..2752418687 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -162,34 +162,37 @@ namespace osu.Game.Screens.Menu if (AudioData != null) { - for (int i = 0; i < bars_per_visualizer * visualizers; i++) + for (int j = 0; j < visualizers; j++) { - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + (i / bars_per_visualizer) * (360 / visualizers)); - float rotationCos = (float)Math.Cos(rotation); - float rotationSin = (float)Math.Sin(rotation); - //taking the cos and sin to the 0..1 range - var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * Size; + for (int i = 0; i < bars_per_visualizer; i++) + { + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + j * 360 / visualizers); + float rotationCos = (float)Math.Cos(rotation); + float rotationSin = (float)Math.Sin(rotation); + //taking the cos and sin to the 0..1 range + var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * Size; - var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualizer)))) / 2f, bar_length * AudioData[i % bars_per_visualizer]); - //The distance between the position and the sides of the bar. - var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); - //The distance between the bottom side of the bar and the top side. - var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y); + var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualizer)))) / 2f, bar_length * AudioData[i % bars_per_visualizer]); + //The distance between the position and the sides of the bar. + var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); + //The distance between the bottom side of the bar and the top side. + var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y); - var rectangle = new Quad( - (barPosition - bottomOffset) * DrawInfo.Matrix, - (barPosition - bottomOffset + amplitudeOffset) * DrawInfo.Matrix, - (barPosition + bottomOffset) * DrawInfo.Matrix, - (barPosition + bottomOffset + amplitudeOffset) * DrawInfo.Matrix - ); + var rectangle = new Quad( + (barPosition - bottomOffset) * DrawInfo.Matrix, + (barPosition - bottomOffset + amplitudeOffset) * DrawInfo.Matrix, + (barPosition + bottomOffset) * DrawInfo.Matrix, + (barPosition + bottomOffset + amplitudeOffset) * DrawInfo.Matrix + ); - Texture.DrawQuad( - rectangle, - colourInfo, - null, - Shared.VertexBatch.Add, - //barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that. - Vector2.Divide(inflation, barSize.Yx)); + Texture.DrawQuad( + rectangle, + colourInfo, + null, + Shared.VertexBatch.Add, + //barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that. + Vector2.Divide(inflation, barSize.Yx)); + } } } Shader.Unbind(); From 359cb4c083f09e5151d00d9a285d60e2dcc8cc18 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Jun 2017 18:29:44 +0900 Subject: [PATCH 107/312] Add kiai support --- osu.Game/Screens/Menu/LogoVisualisation.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 2752418687..dec90087e4 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -73,7 +73,9 @@ namespace osu.Game.Screens.Menu private void ensureAmplitudes() { - float[] temporalAmplitudes = beatmap?.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + float[] temporalAmplitudes = beatmap.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + + var effect = beatmap.Value?.Beatmap.ControlPointInfo.EffectPointAt(beatmap.Value.Track?.CurrentTime ?? Time.Current); for (int i = 0; i < bars_per_visualizer; i++) { @@ -81,7 +83,7 @@ namespace osu.Game.Screens.Menu if (beatmap?.Value?.Track?.IsRunning ?? false) { if (temporalAmplitudes[index] > frequencyAmplitudes[i]) - frequencyAmplitudes[i] = temporalAmplitudes[index]; + frequencyAmplitudes[i] = temporalAmplitudes[index] * (effect?.KiaiMode == true ? 1 : 0.5f); } else { From e269bdbad7fcd755e15b97e45d291b12143f3de2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Jun 2017 18:30:13 +0900 Subject: [PATCH 108/312] Use additive colour; adjust constants a bit --- osu.Game/Screens/Menu/LogoVisualisation.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index dec90087e4..77ebd768f7 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -25,8 +25,8 @@ namespace osu.Game.Screens.Menu private Color4 barColour; private const int index_change = 5; - private const float bar_length = 1200; - private const int bars_per_visualizer = 250; + private const float bar_length = 600; + private const int bars_per_visualizer = 200; private const float visualizers = 5; /// @@ -44,8 +44,6 @@ namespace osu.Game.Screens.Menu } set { - //Half alpha makes it look really good! - value.A = 0.5f; barColour = value; } } @@ -60,7 +58,8 @@ namespace osu.Game.Screens.Menu public LogoVisualisation() { texture = Texture.WhitePixel; - AccentColour = Color4.White; + AccentColour = new Color4(1, 1, 1, 0.2f); + BlendingMode = BlendingMode.Additive; } [BackgroundDependencyLoader(true)] From 25b1058cd389df90f1eeeb80cf28c4d7cb67fd3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Jun 2017 18:30:44 +0900 Subject: [PATCH 109/312] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 09746aa895..5f3ec7ba17 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 09746aa89545253546d69a38d08e6972ddd06871 +Subproject commit 5f3ec7ba178a6edda281ab42b4ca14c8c3c2e0b5 From 8c063fe2b88ba5e061931776cce348ee692ed843 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Jun 2017 18:38:39 +0900 Subject: [PATCH 110/312] Simplify AccentColour property for now --- osu.Game/Screens/Menu/LogoVisualisation.cs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 77ebd768f7..76f0292660 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -22,7 +22,6 @@ namespace osu.Game.Screens.Menu internal class LogoVisualisation : Drawable, IHasAccentColour { private readonly Bindable beatmap = new Bindable(); - private Color4 barColour; private const int index_change = 5; private const float bar_length = 600; @@ -36,17 +35,7 @@ namespace osu.Game.Screens.Menu private int indexOffset; - public Color4 AccentColour - { - get - { - return barColour; - } - set - { - barColour = value; - } - } + public Color4 AccentColour { get; set; } private readonly float[] frequencyAmplitudes = new float[256]; @@ -129,7 +118,7 @@ namespace osu.Game.Screens.Menu visNode.Texture = texture; visNode.Size = DrawSize.X; visNode.Shared = sharedData; - visNode.Colour = barColour; + visNode.Colour = AccentColour; visNode.AudioData = frequencyAmplitudes; } From a1b9499480b152354588983235abf560cc982aa9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Jun 2017 18:41:11 +0900 Subject: [PATCH 111/312] More documentation and constants --- osu.Game/Screens/Menu/LogoVisualisation.cs | 33 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 76f0292660..dcba07a8a3 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -23,16 +23,36 @@ namespace osu.Game.Screens.Menu { private readonly Bindable beatmap = new Bindable(); + /// + /// The number of bars to jump each update iteration. + /// private const int index_change = 5; + + /// + /// The maximum length of each bar in the visualiser. Will be reduced when kiai is not activated. + /// private const float bar_length = 600; + + /// + /// The number of bars in one rotation of the visualiser. + /// private const int bars_per_visualizer = 200; - private const float visualizers = 5; + + /// + /// How many times we should stretch around the circumference (overlapping overselves). + /// + private const float visualiser_rounds = 5; /// /// How much should each bar go down each milisecond (based on a full bar) /// private const float decay_per_milisecond = 0.0024f; + /// + /// Number of milliseconds between each amplitude update. + /// + private const float time_between_updates = 50; + private int indexOffset; public Color4 AccentColour { get; set; } @@ -59,7 +79,7 @@ namespace osu.Game.Screens.Menu shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); } - private void ensureAmplitudes() + private void updateAmplitudes() { float[] temporalAmplitudes = beatmap.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; @@ -79,14 +99,15 @@ namespace osu.Game.Screens.Menu frequencyAmplitudes[i] = frequencyAmplitudes[(i + index_change) % bars_per_visualizer]; } } + indexOffset = (indexOffset + index_change) % bars_per_visualizer; - Scheduler.AddDelayed(ensureAmplitudes, 50); + Scheduler.AddDelayed(updateAmplitudes, time_between_updates); } protected override void LoadComplete() { base.LoadComplete(); - ensureAmplitudes(); + updateAmplitudes(); } protected override void Update() @@ -152,11 +173,11 @@ namespace osu.Game.Screens.Menu if (AudioData != null) { - for (int j = 0; j < visualizers; j++) + for (int j = 0; j < visualiser_rounds; j++) { for (int i = 0; i < bars_per_visualizer; i++) { - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + j * 360 / visualizers); + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + j * 360 / visualiser_rounds); float rotationCos = (float)Math.Cos(rotation); float rotationSin = (float)Math.Sin(rotation); //taking the cos and sin to the 0..1 range From 17cb043cb21dc9f70848e287c1845dd03c1172a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Jun 2017 18:41:35 +0900 Subject: [PATCH 112/312] Visualiser --- osu.Game/Screens/Menu/LogoVisualisation.cs | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index dcba07a8a3..9fe98036ad 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Menu /// /// The number of bars in one rotation of the visualiser. /// - private const int bars_per_visualizer = 200; + private const int bars_per_visualiser = 200; /// /// How many times we should stretch around the circumference (overlapping overselves). @@ -85,9 +85,9 @@ namespace osu.Game.Screens.Menu var effect = beatmap.Value?.Beatmap.ControlPointInfo.EffectPointAt(beatmap.Value.Track?.CurrentTime ?? Time.Current); - for (int i = 0; i < bars_per_visualizer; i++) + for (int i = 0; i < bars_per_visualiser; i++) { - int index = (i + indexOffset) % bars_per_visualizer; + int index = (i + indexOffset) % bars_per_visualiser; if (beatmap?.Value?.Track?.IsRunning ?? false) { if (temporalAmplitudes[index] > frequencyAmplitudes[i]) @@ -95,12 +95,12 @@ namespace osu.Game.Screens.Menu } else { - if (frequencyAmplitudes[(i + index_change) % bars_per_visualizer] > frequencyAmplitudes[i]) - frequencyAmplitudes[i] = frequencyAmplitudes[(i + index_change) % bars_per_visualizer]; + if (frequencyAmplitudes[(i + index_change) % bars_per_visualiser] > frequencyAmplitudes[i]) + frequencyAmplitudes[i] = frequencyAmplitudes[(i + index_change) % bars_per_visualiser]; } } - indexOffset = (indexOffset + index_change) % bars_per_visualizer; + indexOffset = (indexOffset + index_change) % bars_per_visualiser; Scheduler.AddDelayed(updateAmplitudes, time_between_updates); } @@ -115,7 +115,7 @@ namespace osu.Game.Screens.Menu base.Update(); float decayFactor = (float)Time.Elapsed * decay_per_milisecond; - for (int i = 0; i < bars_per_visualizer; i++) + for (int i = 0; i < bars_per_visualiser; i++) { //0.03% of extra bar length to make it a little faster when bar is almost at it's minimum frequencyAmplitudes[i] -= decayFactor * (frequencyAmplitudes[i] + 0.03f); @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Menu protected override DrawNode CreateDrawNode() => new VisualisationDrawNode(); - private readonly VisualizerSharedData sharedData = new VisualizerSharedData(); + private readonly VisualiserSharedData sharedData = new VisualiserSharedData(); protected override void ApplyDrawNode(DrawNode node) { base.ApplyDrawNode(node); @@ -143,7 +143,7 @@ namespace osu.Game.Screens.Menu visNode.AudioData = frequencyAmplitudes; } - private class VisualizerSharedData + private class VisualiserSharedData { public readonly LinearBatch VertexBatch = new LinearBatch(100 * 4, 10, PrimitiveType.Quads); } @@ -152,7 +152,7 @@ namespace osu.Game.Screens.Menu { public Shader Shader; public Texture Texture; - public VisualizerSharedData Shared; + public VisualiserSharedData Shared; //Asuming the logo is a circle, we don't need a second dimension. public float Size; @@ -175,15 +175,15 @@ namespace osu.Game.Screens.Menu { for (int j = 0; j < visualiser_rounds; j++) { - for (int i = 0; i < bars_per_visualizer; i++) + for (int i = 0; i < bars_per_visualiser; i++) { - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualizer * 360 + j * 360 / visualiser_rounds); + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds); float rotationCos = (float)Math.Cos(rotation); float rotationSin = (float)Math.Sin(rotation); //taking the cos and sin to the 0..1 range var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * Size; - var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualizer)))) / 2f, bar_length * AudioData[i % bars_per_visualizer]); + var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * AudioData[i % bars_per_visualiser]); //The distance between the position and the sides of the bar. var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); //The distance between the bottom side of the bar and the top side. From a991cff9082ecc20dabf6eb025352ef9a8b4323f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 19 Jun 2017 17:37:00 +0300 Subject: [PATCH 113/312] OsuLogo beat sound --- osu.Game/Screens/Menu/OsuLogo.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 8459993967..c8cdfb393e 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -37,6 +37,7 @@ namespace osu.Game.Screens.Menu private readonly LogoVisualisation visualizer; private SampleChannel sampleClick; + private SampleChannel sampleBeat; private readonly Container colourAndTriangles; @@ -214,6 +215,7 @@ namespace osu.Game.Screens.Menu private void load(TextureStore textures, AudioManager audio) { sampleClick = audio.Sample.Get(@"Menu/menuhit"); + sampleBeat = audio.Sample.Get(@"Menu/heartbeat"); logo.Texture = textures.Get(@"Menu/logo"); ripple.Texture = textures.Get(@"Menu/logo"); } @@ -224,6 +226,9 @@ namespace osu.Game.Screens.Menu { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + if (Hovering) + sampleBeat.Play(); + lastBeatIndex = beatIndex; var beatLength = timingPoint.BeatLength; From 62dee5967215f8f27e73583dc4d045359fa26008 Mon Sep 17 00:00:00 2001 From: paparony03 Date: Tue, 20 Jun 2017 15:54:23 +1000 Subject: [PATCH 114/312] Shapes namespace Depends on https://github.com/ppy/osu-framework/pull/837 --- osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs | 1 + osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 1 + osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs | 1 + osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 + osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs | 1 + osu.Desktop/Overlays/VersionManager.cs | 1 + osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs | 2 +- .../Objects/Drawables/DrawableHoldNoteTick.cs | 2 +- .../Objects/Drawables/Pieces/BodyPiece.cs | 2 +- .../Objects/Drawables/Pieces/NotePiece.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 2 +- .../Objects/Drawables/Connections/FollowPoint.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs | 2 +- .../Objects/Drawables/Pieces/NumberPiece.cs | 1 + osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerBackground.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerTicks.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs | 2 +- .../Objects/Drawables/DrawableBarLineMajor.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs | 2 +- .../Objects/Drawables/Pieces/CentreHitSymbolPiece.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- .../Objects/Drawables/Pieces/RimHitSymbolPiece.cs | 2 +- .../Objects/Drawables/Pieces/TickPiece.cs | 2 +- osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 2 +- osu.Game.Rulesets.Taiko/UI/HitTarget.cs | 2 +- osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 1 + osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 1 + osu.Game/Graphics/Backgrounds/Triangles.cs | 1 - osu.Game/Graphics/Cursor/GameplayCursor.cs | 2 +- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 2 +- osu.Game/Graphics/UserInterface/Bar.cs | 2 +- osu.Game/Graphics/UserInterface/DialogButton.cs | 1 + osu.Game/Graphics/UserInterface/IconButton.cs | 2 +- osu.Game/Graphics/UserInterface/Nub.cs | 2 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 1 + osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 1 + osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs | 3 ++- osu.Game/Graphics/UserInterface/PageTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 1 + osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs | 2 +- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Chat/ChatTabControl.cs | 1 + osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 1 + osu.Game/Overlays/DialogOverlay.cs | 2 +- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/DragBar.cs | 2 +- osu.Game/Overlays/LoginOverlay.cs | 5 +++-- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 1 + osu.Game/Overlays/NotificationManager.cs | 2 +- osu.Game/Overlays/Notifications/Notification.cs | 2 +- osu.Game/Overlays/Notifications/ProgressNotification.cs | 1 + osu.Game/Overlays/Notifications/SimpleNotification.cs | 1 + osu.Game/Overlays/OnScreenDisplay.cs | 1 + .../Overlays/SearchableList/SearchableListFilterControl.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListHeader.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 2 +- osu.Game/Overlays/Settings/SettingsSection.cs | 1 + osu.Game/Overlays/Settings/Sidebar.cs | 2 +- osu.Game/Overlays/Settings/SidebarButton.cs | 1 + osu.Game/Overlays/SettingsOverlay.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 1 + osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs | 2 +- osu.Game/Overlays/WaveOverlayContainer.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 1 + osu.Game/Screens/Multiplayer/DrawableRoom.cs | 2 +- osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs | 2 +- osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 2 +- osu.Game/Screens/Play/MenuOverlay.cs | 2 +- osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs | 2 +- osu.Game/Screens/Play/SkipButton.cs | 2 +- osu.Game/Screens/Play/SongProgressBar.cs | 5 +++-- osu.Game/Screens/Play/SquareGraph.cs | 2 +- osu.Game/Screens/Ranking/ResultModeButton.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 1 + osu.Game/Screens/Ranking/ResultsPage.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageRanking.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 1 + osu.Game/Screens/ScreenWhiteBox.cs | 2 +- osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/Footer.cs | 2 +- osu.Game/Screens/Select/FooterButton.cs | 1 + osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs | 2 +- osu.Game/Screens/Select/WedgeBackground.cs | 2 +- osu.Game/Screens/Tournament/Drawings.cs | 1 + osu.Game/Screens/Tournament/Group.cs | 1 + osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 1 + osu.Game/Users/UserPanel.cs | 1 + 110 files changed, 114 insertions(+), 82 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index 00d4d33c86..acbeb20e50 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -6,6 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 000d59a365..a28176b512 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using OpenTK; using OpenTK.Graphics; using osu.Framework.MathUtils; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index ddb62598cf..0ffd6de482 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Menu; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index f28cdd6a7e..37f3892100 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -15,6 +15,7 @@ using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; using osu.Game.Rulesets.Osu.UI; +using osu.Framework.Graphics.Shapes; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 5a4b3deb05..71bec2d1e2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -6,6 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 9532652bfe..b53c4ab3d4 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using Squirrel; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 4b1e6e93cd..8be52150fc 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.UI; using OpenTK; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs index 0b4d8b2d4e..fc5ea4e116 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs @@ -3,7 +3,7 @@ using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 734b62c931..39abbb6b3d 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -7,9 +7,9 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Drawables; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Mania.Objects.Drawables { diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index c10aa9994b..04e8df4ae2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -4,7 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index e01199e929..3df085c346 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index dea4dc1a3a..12b6f61a12 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -7,7 +7,7 @@ using OpenTK.Input; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Colour; using osu.Framework.Input; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 5f33ac2cf1..cfc20d4bd4 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.UI; using OpenTK; @@ -22,6 +21,7 @@ using osu.Framework.MathUtils; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Timing; using osu.Framework.Configuration; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Mania.UI { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index 20b4655e59..30e6172802 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 6b4d40e080..28fbf46a92 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -3,11 +3,11 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Osu.Objects.Drawables { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs index 68ffb756d4..97d7de35cf 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs @@ -3,8 +3,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 21bcc07f63..28e54c3b4e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs index a04d3e7a0a..f66099e1c3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs @@ -3,9 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 4cffc1def3..4857f5c0d2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 4c8f9cd18f..bdd5b71211 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -4,7 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs index f95063dcea..fc0d436788 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs @@ -5,9 +5,9 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 4c83e08bab..5d627f2b50 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using OpenTK; namespace osu.Game.Rulesets.Taiko.Objects.Drawables diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs index e64682a1e4..c07be915d5 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs @@ -3,8 +3,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 037b9dae89..1c72f2a7dd 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Judgements; @@ -15,6 +14,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs index ddf1492ecc..cc88105e03 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs @@ -3,8 +3,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 9f115d07eb..709343d086 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -4,7 +4,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs index 4146edbdf7..704a27a96d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs @@ -3,9 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index 1a0d0156e8..2af65f2ed7 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -3,9 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index c0c329c870..4d39ba0ead 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/UI/HitTarget.cs b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs index fde2623246..1ca6e4eb34 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitTarget.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs @@ -5,7 +5,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.UI diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index 403730aa0e..b4aec7057b 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -5,7 +5,7 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 97b2c9d343..0ad7969c78 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.UI; using OpenTK; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index cb929dcca5..f4ac01c0f1 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -14,6 +14,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Input; using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Beatmaps.Drawables { diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 2ab5487082..1ac6261621 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Beatmaps.Drawables { diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index e6a5c5104d..b747214d06 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index 453d821a96..da3975f606 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -9,7 +9,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 42d82a088c..133caf8040 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.Cursor diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index a0f796050b..1da73a60a2 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -5,7 +5,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 2076b3e9be..10c821e9bd 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -5,6 +5,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 7cacd09618..8540b35702 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index b91612f3c0..d5059945c6 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index bee12133ff..7bd58d38a5 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -5,6 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 904aa14aa7..dc52fd0f62 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -3,9 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 2dab952204..4f0ac28731 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -9,10 +9,10 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 6f955b1696..37bf30646d 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -9,6 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 6fc3875f61..940d9b4943 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -6,10 +6,11 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; -using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 993ac4a238..7f2e6c9c8c 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -7,7 +7,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 4c4b6c4d48..4547adb738 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; using System; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index fd1d890330..57eea71086 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -4,11 +4,11 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Graphics.UserInterface.Volume { diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index cd736a5fe9..6ff3cc7be5 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 1bc1daa599..92147db57f 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 4f51575da3..23b8aac6a7 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -10,7 +10,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Threading; using osu.Game.Online.API; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 97d8f03b9b..c8ca50823f 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Dialog { diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 461eb2595a..757781a4ab 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -4,9 +4,9 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index a4c4d51f29..a670b27540 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -8,12 +8,12 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Direct { diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 4fe76728d1..2cede1e574 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Colour; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -16,6 +15,7 @@ using osu.Framework.Localisation; using osu.Framework.Graphics.Textures; using System.Linq; using osu.Framework.Input; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Direct { diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index bb28f08553..281f02a451 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -4,10 +4,10 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index c3f41270ce..b688bafd4d 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -4,10 +4,10 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Overlays.Settings.Sections.General; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays { @@ -27,7 +27,8 @@ namespace osu.Game.Overlays { Children = new Drawable[] { - new Box { + new Box + { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.6f, diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index c001d613e4..ca74189c86 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; @@ -17,6 +16,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Database; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 1ed7da83b6..e5dc66fc75 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -10,7 +10,6 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Graphics; @@ -18,6 +17,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions; using osu.Framework.Input; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Music { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 3a8a0a883a..e1e920ec0f 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -23,6 +23,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Threading; using osu.Game.Overlays.Music; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 05644599dd..34690013df 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -6,9 +6,9 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Notifications; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 4a16f5c98c..2833ef9f3a 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -7,12 +7,12 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Notifications { diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index f689a7c9e7..437971337b 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index ba2ec02651..2ac93b2ada 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index eb2b2dbaae..2887d4355b 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -9,6 +9,7 @@ using osu.Framework.Configuration; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using OpenTK; diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index dfc2dbe49a..d5f7683257 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -8,9 +8,9 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.SearchableList { diff --git a/osu.Game/Overlays/SearchableList/SearchableListHeader.cs b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs index 26dc9b03c8..af99a39cc4 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListHeader.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs @@ -7,8 +7,8 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.SearchableList { diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 093750bcc0..05ee38153d 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -4,7 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index e65b7f19d9..2e3dc1ada2 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -6,6 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 0813f1898a..6c91f69fd9 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -5,7 +5,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Threading; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index b6e4ad3f5e..309216dd91 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -7,6 +7,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 87f6d836af..88f4599383 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 158992fef8..16e4f22ec8 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -6,10 +6,10 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index e2eac477bf..bb3fc0783f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 05f54b5408..59c4ac4a61 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -6,11 +6,11 @@ using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Database; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index 976164a53e..6d61a096b2 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -4,7 +4,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 3669001d72..e744f23a3a 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -6,8 +6,8 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using System; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Overlays { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 741fcf80a2..19bb084af4 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -8,7 +8,7 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 73f1c91be3..82b7335a9b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -8,7 +8,7 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 77239726e8..065c7c5be0 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -8,7 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 8459993967..8517f1ba08 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -8,6 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input; diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 57f556725d..cbd5e6ad78 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index 82b06482aa..cac1f1a71b 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -5,12 +5,12 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Play.HUD { diff --git a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs index 16062bebe5..f673965c2b 100644 --- a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -9,7 +9,7 @@ using osu.Framework.Audio; using System; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using OpenTK.Graphics; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 8d83dcdda0..1d557269c4 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK; @@ -14,6 +13,7 @@ using osu.Game.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs b/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs index 91850a99d2..a2494d3a69 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs +++ b/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index 06c7044049..d110f8ecac 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Threading; using osu.Framework.Timing; @@ -18,6 +17,7 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Audio.Sample; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index d0fb3c8a3d..34818912d5 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Game.Overlays; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Play { @@ -25,7 +25,8 @@ namespace osu.Game.Screens.Play Fill.RelativeSizeAxes = Axes.X; Fill.Height = barHeight; - Add(new Box + Add(new + Box { Name = "Background", Anchor = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 0b3bcc55a2..cd1e9c78c6 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -8,9 +8,9 @@ using osu.Framework.Caching; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Ranking/ResultModeButton.cs b/osu.Game/Screens/Ranking/ResultModeButton.cs index cc1dbbe444..4789a5abb7 100644 --- a/osu.Game/Screens/Ranking/ResultModeButton.cs +++ b/osu.Game/Screens/Ranking/ResultModeButton.cs @@ -5,11 +5,11 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Ranking { diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 2523ce05ec..2bff535603 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -16,6 +16,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Ranking { diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index f02850bf82..d0a1c49119 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Screens/Ranking/ResultsPageRanking.cs b/osu.Game/Screens/Ranking/ResultsPageRanking.cs index 827abd556e..d316dc7fb4 100644 --- a/osu.Game/Screens/Ranking/ResultsPageRanking.cs +++ b/osu.Game/Screens/Ranking/ResultsPageRanking.cs @@ -3,12 +3,12 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select.Leaderboards; using OpenTK; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Ranking { diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 70542dab8b..ac333e47ff 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -23,6 +23,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Ranking { diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 04432058dc..986947a517 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Backgrounds; using osu.Game.Graphics.UserInterface; @@ -16,6 +15,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Game.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens { diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index e3c95d42a1..bd0f745016 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -8,10 +8,10 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index aefb9901b6..daf28c8f1b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -16,6 +15,7 @@ using System.Linq; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Framework.Threading; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 01a233e9a2..264fe6643b 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -11,7 +11,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -21,6 +20,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 94bc60a6ca..51937df189 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -16,6 +15,7 @@ using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; using osu.Framework.Input; using osu.Game.Database; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 32e09a5f28..882aa482da 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -8,7 +8,7 @@ using OpenTK.Input; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Menu; diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 58df409ca1..9be940e06a 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -7,6 +7,7 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index fd26caf2b6..32e6d9630b 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -5,7 +5,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 7aaed9b360..db8ab439eb 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -4,7 +4,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index be2f5196ef..a6ad56b86f 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -5,7 +5,7 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Select/WedgeBackground.cs b/osu.Game/Screens/Select/WedgeBackground.cs index af25e9b9ae..4841fcdd09 100644 --- a/osu.Game/Screens/Select/WedgeBackground.cs +++ b/osu.Game/Screens/Select/WedgeBackground.cs @@ -4,9 +4,9 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 483841122b..7efb86a403 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -21,6 +21,7 @@ using osu.Game.Screens.Tournament.Teams; using OpenTK; using OpenTK.Graphics; using osu.Framework.IO.Stores; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Tournament { diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 90ee90901f..441a5c7bcd 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using osu.Game.Screens.Tournament.Teams; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Tournament { diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 31043a411b..4e34975085 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index a031cbe64a..8cff3517a3 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -8,6 +8,7 @@ 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.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; From c8720bc5d500af2d815564fc8aaab1078150013c Mon Sep 17 00:00:00 2001 From: paparony03 Date: Tue, 20 Jun 2017 16:00:09 +1000 Subject: [PATCH 115/312] Oops --- osu-framework | 2 +- osu.Game/Screens/Play/SongProgressBar.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/osu-framework b/osu-framework index 5f3ec7ba17..231a39bf63 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 5f3ec7ba178a6edda281ab42b4ca14c8c3c2e0b5 +Subproject commit 231a39bf63544566212b02019f1de2518a60946f diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 34818912d5..730cf471da 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -25,8 +25,7 @@ namespace osu.Game.Screens.Play Fill.RelativeSizeAxes = Axes.X; Fill.Height = barHeight; - Add(new - Box + Add(new Box { Name = "Background", Anchor = Anchor.BottomLeft, From fc0e44b2141c649290f1a044113f98d5eb0743ff Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 21 Jun 2017 11:18:52 +0900 Subject: [PATCH 116/312] Update framework. --- osu-framework | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 2 +- osu.Game/Graphics/IHasAccentColour.cs | 4 +++- osu.Game/Graphics/Transforms/TransformAccent.cs | 2 +- osu.Game/Graphics/UserInterface/PercentageCounter.cs | 2 +- osu.Game/Graphics/UserInterface/RollingCounter.cs | 8 ++++---- osu.Game/Graphics/UserInterface/ScoreCounter.cs | 2 +- osu.Game/Graphics/UserInterface/SimpleComboCounter.cs | 2 +- osu.Game/Overlays/DragBar.cs | 2 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 2 +- osu.Game/Screens/Play/HUD/ComboResultCounter.cs | 2 +- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 2 +- 12 files changed, 17 insertions(+), 15 deletions(-) diff --git a/osu-framework b/osu-framework index 231a39bf63..a4bd66e369 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 231a39bf63544566212b02019f1de2518a60946f +Subproject commit a4bd66e369f7ed5c1c0dc7a0157950dac1f11c5c diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index cfc20d4bd4..b51a7730e0 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Mania.UI barLineContainer.Width = columns.Width; } - private class TransformTimeSpan : Transform + private class TransformTimeSpan : Transform { public override double CurrentValue { diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index e4647f22fd..672c59a935 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -3,6 +3,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Transforms; namespace osu.Game.Graphics @@ -26,7 +27,8 @@ namespace osu.Game.Graphics /// The new accent colour. /// The tween duration. /// The tween easing. - public static void FadeAccent(this IHasAccentColour accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + public static void FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + where T : Transformable, IHasAccentColour { accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); } diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs index 406d1ea9eb..d49f969c20 100644 --- a/osu.Game/Graphics/Transforms/TransformAccent.cs +++ b/osu.Game/Graphics/Transforms/TransformAccent.cs @@ -8,7 +8,7 @@ using osu.Framework.MathUtils; namespace osu.Game.Graphics.Transforms { - public class TransformAccent : Transform + public class TransformAccent : Transform { /// /// Current value of the transformed colour in linear colour space. diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index c32b654840..79cdc9effe 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface Current.Value = Current + amount; } - protected class TransformAccuracy : Transform + protected class TransformAccuracy : Transform { public override double CurrentValue { diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index bdb2054ca4..4338dd23eb 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface /// /// Must be a subclass of Transform(T) /// - protected virtual Type TransformType => typeof(Transform); + protected virtual Type TransformType => typeof(Transform); protected SpriteText DisplayedCountSpriteText; @@ -181,17 +181,17 @@ namespace osu.Game.Graphics.UserInterface protected virtual void TransformCount(T currentValue, T newValue) { Debug.Assert( - typeof(Transform).IsAssignableFrom(TransformType), + typeof(Transform).IsAssignableFrom(TransformType), @"transformType should be a subclass of Transform." ); - TransformCount((Transform)Activator.CreateInstance(TransformType), currentValue, newValue); + TransformCount((Transform)Activator.CreateInstance(TransformType), currentValue, newValue); } /// /// Intended to be used by TransformCount(T currentValue, T newValue). /// - protected void TransformCount(Transform transform, T currentValue, T newValue) + protected void TransformCount(Transform transform, T currentValue, T newValue) { Type type = transform.GetType(); diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 3e01b9e4f4..f98e84852a 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -56,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface Current.Value = Current + amount; } - protected class TransformScore : Transform + protected class TransformScore : Transform { public override double CurrentValue { diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index 8537e80f63..bee1a71894 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface Current.Value = Current + amount; } - private class TransformCounterCount : Transform + private class TransformCounterCount : Transform { public override int CurrentValue { diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 281f02a451..07e0c76396 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -98,7 +98,7 @@ namespace osu.Game.Overlays return true; } - private class TransformSeek : TransformFloat + private class TransformSeek : TransformFloat { public override void Apply(Drawable d) { diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index 46c7084cec..3793181ecd 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -205,7 +205,7 @@ namespace osu.Game.Screens.Play.HUD Transforms.Add(transform); } - protected class TransformComboRoll : Transform + protected class TransformComboRoll : Transform { public override int CurrentValue { diff --git a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs index a1a166f944..a4a20c1fd0 100644 --- a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play.HUD Current.Value = Current + amount; } - protected class TransformComboResult : Transform + protected class TransformComboResult : Transform { public override ulong CurrentValue { diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 4e34975085..a7019f1e35 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -308,7 +308,7 @@ namespace osu.Game.Screens.Tournament Scrolling } - public class TransformScrollSpeed : TransformFloat + public class TransformScrollSpeed : TransformFloat { public override void Apply(Drawable d) { From b191d96aab0da4a47ba0fa9fa0fbe2b9037dd430 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 21 Jun 2017 11:35:19 +0900 Subject: [PATCH 117/312] CI fixes. --- osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs | 1 - osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 - osu.Game/Graphics/Backgrounds/Triangles.cs | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index acbeb20e50..808e9b5d19 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index 0ffd6de482..0caa518a0b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -3,7 +3,6 @@ using osu.Framework.Testing; using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Menu; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 37f3892100..d922f3bb4b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using OpenTK; -using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index b747214d06..08745ce6ba 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -55,7 +55,7 @@ namespace osu.Game.Graphics.Backgrounds /// /// Whether we should drop-off alpha values of triangles more quickly to improve /// the visual appearance of fading. This defaults to on as it is generally more - /// aesthetically pleasing, but should be turned off in s. + /// aesthetically pleasing, but should be turned off in buffered containers. /// public bool HideAlphaDiscrepancies = true; From 89986e8e77459a796d3f07d71d1da4bffdc9d936 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 21 Jun 2017 17:03:47 +0900 Subject: [PATCH 118/312] Fix namespaces --- osu.Game/Graphics/UserInterface/PageTabControl.cs | 1 + osu.Game/Overlays/Profile/ProfileHeader.cs | 1 + osu.Game/Overlays/Profile/ProfileSection.cs | 2 +- osu.Game/Overlays/Profile/RankChart.cs | 3 ++- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/Users/UserPanel.cs | 3 +-- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index c4daaeb6d8..6b97e54ecd 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 3471b27fac..193fa2dfda 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index 84668d8675..a840eea504 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -4,7 +4,7 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index dc28ec1ffd..9a3d88cf62 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -8,6 +8,7 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics; @@ -70,7 +71,7 @@ namespace osu.Game.Overlays.Profile } }; ranks = new[] { user.Statistics.Rank }; - performances = new [] { user.Statistics.PP }; + performances = new[] { user.Statistics.PP }; } private void updateRankTexts() diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 1b91075e9c..bfae071e93 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -6,7 +6,7 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 06cd7919e5..ecce411819 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -9,7 +9,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; @@ -163,7 +162,7 @@ namespace osu.Game.Users }; } - [BackgroundDependencyLoader(permitNulls:true)] + [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours, UserProfileOverlay profile) { this.colours = colours; From bcfb1392d72635420cd1651531a900a490186ca9 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 21 Jun 2017 17:17:54 +0800 Subject: [PATCH 119/312] Hide scroll bar. --- osu.Game/Overlays/UserProfileOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index bfae071e93..3246b88c9d 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -83,6 +83,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both } }; + sectionsContainer.ScrollContainer.ScrollbarVisible = false; Add(sectionsContainer); sectionsContainer.SelectedSection.ValueChanged += s => { From 3389c8a4dcbf66f3119a14f0bae47987469c21bb Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 21 Jun 2017 20:17:15 +0900 Subject: [PATCH 120/312] CI fixes. --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 1 - .../Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 79265d6266..8cfedc9599 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Audio; using System.Linq; -using osu.Framework.Configuration; namespace osu.Game.Rulesets.Objects.Drawables { diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs index ff6ee35745..8dc17b9542 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Objects.Drawables { public BindableDouble LifetimeOffset { get; } = new BindableDouble(); - public DrawableScrollingHitObject(TObject hitObject) + protected DrawableScrollingHitObject(TObject hitObject) : base(hitObject) { } From 1978a4e8a6f0afcfa08bbfa091380782ca8c0616 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Wed, 21 Jun 2017 18:32:31 -0500 Subject: [PATCH 121/312] Boost visualiser performance Also fixes amplitudes being set wrongly if kiai was false. --- osu.Game/Screens/Menu/LogoVisualisation.cs | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 9fe98036ad..ce698a6fb6 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Menu private const float visualiser_rounds = 5; /// - /// How much should each bar go down each milisecond (based on a full bar) + /// How much should each bar go down each milisecond (based on a full bar). /// private const float decay_per_milisecond = 0.0024f; @@ -53,6 +53,11 @@ namespace osu.Game.Screens.Menu /// private const float time_between_updates = 50; + /// + /// The minimum amplitude to show a bar. + /// + private const float amplitude_dead_zone = 1f / (bar_length); + private int indexOffset; public Color4 AccentColour { get; set; } @@ -87,16 +92,17 @@ namespace osu.Game.Screens.Menu for (int i = 0; i < bars_per_visualiser; i++) { - int index = (i + indexOffset) % bars_per_visualiser; if (beatmap?.Value?.Track?.IsRunning ?? false) { - if (temporalAmplitudes[index] > frequencyAmplitudes[i]) - frequencyAmplitudes[i] = temporalAmplitudes[index] * (effect?.KiaiMode == true ? 1 : 0.5f); + float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f); + if (targetAmplitude > frequencyAmplitudes[i]) + frequencyAmplitudes[i] = targetAmplitude; } else { - if (frequencyAmplitudes[(i + index_change) % bars_per_visualiser] > frequencyAmplitudes[i]) - frequencyAmplitudes[i] = frequencyAmplitudes[(i + index_change) % bars_per_visualiser]; + int index = (i + index_change) % bars_per_visualiser; + if (frequencyAmplitudes[index] > frequencyAmplitudes[i]) + frequencyAmplitudes[i] = frequencyAmplitudes[index]; } } @@ -117,7 +123,7 @@ namespace osu.Game.Screens.Menu float decayFactor = (float)Time.Elapsed * decay_per_milisecond; for (int i = 0; i < bars_per_visualiser; i++) { - //0.03% of extra bar length to make it a little faster when bar is almost at it's minimum + //3% of extra bar length to make it a little faster when bar is almost at it's minimum frequencyAmplitudes[i] -= decayFactor * (frequencyAmplitudes[i] + 0.03f); if (frequencyAmplitudes[i] < 0) frequencyAmplitudes[i] = 0; @@ -129,6 +135,7 @@ namespace osu.Game.Screens.Menu protected override DrawNode CreateDrawNode() => new VisualisationDrawNode(); private readonly VisualiserSharedData sharedData = new VisualiserSharedData(); + protected override void ApplyDrawNode(DrawNode node) { base.ApplyDrawNode(node); @@ -177,13 +184,16 @@ namespace osu.Game.Screens.Menu { for (int i = 0; i < bars_per_visualiser; i++) { + if (AudioData[i] < bar_dead_zone) + continue; + float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds); float rotationCos = (float)Math.Cos(rotation); float rotationSin = (float)Math.Sin(rotation); //taking the cos and sin to the 0..1 range var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * Size; - var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * AudioData[i % bars_per_visualiser]); + var barSize = new Vector2(Size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * AudioData[i]); //The distance between the position and the sides of the bar. var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); //The distance between the bottom side of the bar and the top side. From c619de7f9b56fcdbda84ecf2d7f0ccfb6430b384 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Wed, 21 Jun 2017 18:40:35 -0500 Subject: [PATCH 122/312] Rename const in all of the code --- osu.Game/Screens/Menu/LogoVisualisation.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index ce698a6fb6..7fa1eda880 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Menu /// /// The minimum amplitude to show a bar. /// - private const float amplitude_dead_zone = 1f / (bar_length); + private const float amplitude_dead_zone = 1f / bar_length; private int indexOffset; @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Menu { for (int i = 0; i < bars_per_visualiser; i++) { - if (AudioData[i] < bar_dead_zone) + if (AudioData[i] < amplitude_dead_zone) continue; float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds); From 986e9687ea629811247f63e0ea33ffb74988191c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 22 Jun 2017 14:08:28 +0900 Subject: [PATCH 123/312] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index a4bd66e369..eed53d35f9 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a4bd66e369f7ed5c1c0dc7a0157950dac1f11c5c +Subproject commit eed53d35f999ae08a6d233c046aa333a7623c5f0 From 1d4add907950a1274a449773a0657a05e9892854 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 22 Jun 2017 20:23:49 +0800 Subject: [PATCH 124/312] Assign an explicit depth when reordering. --- osu.Game/Overlays/UserProfileOverlay.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 3246b88c9d..f52f88bc07 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -115,10 +115,16 @@ namespace osu.Game.Overlays { header.FillFullData(u); - var reorderedSections = u.ProfileOrder.Select(x => sections.FirstOrDefault(s => s.Identifier == x)).Where(s => s != null).ToList(); - - sectionsContainer.Children = reorderedSections; - reorderedSections.ForEach(tabs.AddItem); + for (int i = 0; i < u.ProfileOrder.Length; i++) + { + var sec = sections.FirstOrDefault(s => s.Identifier == u.ProfileOrder[i]); + if (sec != null) + { + sec.Depth = -i; + sectionsContainer.Add(sec); + tabs.AddItem(sec); + } + } }; api.Queue(userReq); From bb2e63e714162d244d4692f716900ef178f64a56 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 22 Jun 2017 20:34:28 +0800 Subject: [PATCH 125/312] Avoid unverifiable capture. --- osu.Game/Overlays/UserProfileOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index f52f88bc07..52edcf6d6e 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -117,7 +117,8 @@ namespace osu.Game.Overlays for (int i = 0; i < u.ProfileOrder.Length; i++) { - var sec = sections.FirstOrDefault(s => s.Identifier == u.ProfileOrder[i]); + string id = u.ProfileOrder[i]; + var sec = sections.FirstOrDefault(s => s.Identifier == id); if (sec != null) { sec.Depth = -i; From 4297c1a376f58b92912dd69e571a5e1b1b0f3c9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Jun 2017 21:38:43 +0900 Subject: [PATCH 126/312] Use WaveOverlayContainer --- osu.Game/Overlays/UserProfileOverlay.cs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 52edcf6d6e..d67c99ec24 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -5,7 +5,6 @@ using System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; @@ -18,7 +17,7 @@ using osu.Game.Users; namespace osu.Game.Overlays { - public class UserProfileOverlay : FocusedOverlayContainer + public class UserProfileOverlay : WaveOverlayContainer { private ProfileSection lastSection; private GetUserRequest userReq; @@ -29,6 +28,11 @@ namespace osu.Game.Overlays public UserProfileOverlay() { + FirstWaveColour = OsuColour.Gray(0.4f); + SecondWaveColour = OsuColour.Gray(0.3f); + ThirdWaveColour = OsuColour.Gray(0.2f); + FourthWaveColour = OsuColour.Gray(0.1f); + RelativeSizeAxes = Axes.Both; RelativePositionAxes = Axes.Both; Padding = new MarginPadding { Horizontal = 50 }; @@ -132,22 +136,6 @@ namespace osu.Game.Overlays Show(); } - protected override void PopIn() - { - MoveToY(0, transition_length, EasingTypes.OutQuint); - FadeIn(transition_length, EasingTypes.OutQuint); - - base.PopIn(); - } - - protected override void PopOut() - { - MoveToY(Height, transition_length, EasingTypes.OutQuint); - FadeOut(transition_length, EasingTypes.OutQuint); - - base.PopOut(); - } - private class ProfileTabControl : PageTabControl { private readonly Box bottom; From 8b8954b8253aa46ec85e1c456e7b6cdd995989a7 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 22 Jun 2017 21:42:06 +0800 Subject: [PATCH 127/312] Add edge effect and adjust positioning. --- osu.Game/Overlays/UserProfileOverlay.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index d67c99ec24..aac7fe97f5 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -3,8 +3,11 @@ using System.Linq; using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; @@ -35,7 +38,17 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both; RelativePositionAxes = Axes.Both; - Padding = new MarginPadding { Horizontal = 50 }; + Width = 0.85f; + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; + + Masking = true; + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.5f), + Type = EdgeEffectType.Shadow, + Radius = 10 + }; } [BackgroundDependencyLoader] From 35bec7ddc065da307e7fce5ca7630feb3645a8b1 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 22 Jun 2017 21:43:58 +0800 Subject: [PATCH 128/312] Hide profile when not showing overlays. --- osu.Game/OsuGame.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4692c89048..7ef01e8053 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -324,6 +324,7 @@ namespace osu.Game chat.State = Visibility.Hidden; direct.State = Visibility.Hidden; social.State = Visibility.Hidden; + userProfile.State = Visibility.Hidden; } else { From eafd05e98f09f1862829ffcacfb68cd0e53f1a73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Jun 2017 11:54:32 +0900 Subject: [PATCH 129/312] Fade shadow effect in to avoid appearing too early in transition --- osu.Game/Overlays/UserProfileOverlay.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index aac7fe97f5..fc6a050d3e 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays Masking = true; EdgeEffect = new EdgeEffectParameters { - Colour = Color4.Black.Opacity(0.5f), + Colour = Color4.Black.Opacity(0), Type = EdgeEffectType.Shadow, Radius = 10 }; @@ -57,6 +57,18 @@ namespace osu.Game.Overlays this.api = api; } + protected override void PopIn() + { + base.PopIn(); + FadeEdgeEffectTo(0.5f, APPEAR_DURATION, EasingTypes.In); + } + + protected override void PopOut() + { + base.PopOut(); + FadeEdgeEffectTo(0, DISAPPEAR_DURATION, EasingTypes.Out); + } + public void ShowUser(User user) { userReq?.Cancel(); From 5dc0b87ef5f175396347164bb3d6ba113997a34e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Jun 2017 14:02:19 +0900 Subject: [PATCH 130/312] Apply some fixes for my own comments --- osu.Game/Graphics/UserInterface/LineGraph.cs | 9 ++++++--- osu.Game/Overlays/Profile/ProfileSection.cs | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 28b62ff957..8817d79bdd 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -58,9 +58,12 @@ namespace osu.Game.Graphics.UserInterface Add(maskingContainer = new Container { Masking = true, - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, + Children = new[] + { + path = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 } + } }); - maskingContainer.Add(path = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 }); } public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) @@ -72,9 +75,9 @@ namespace osu.Game.Graphics.UserInterface private void applyPath() { + path.ClearVertices(); if (values == null) return; - path.ClearVertices(); int count = Math.Max(values.Length, DefaultValueCount); float max = values.Max(), min = values.Min(); diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index a840eea504..63c5263a72 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -45,7 +45,16 @@ namespace osu.Game.Overlays.Profile Margin = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, - Bottom = 20 + Bottom = 200 + }, + Children = new Drawable[] + { + new TextFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Text = "Coming soon!" + } } }, new Box From b020fe0d50c82a2eb2d38ff716c4546e90532417 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 08:36:47 +0300 Subject: [PATCH 131/312] Added TestCase --- .../Tests/TestCaseBeatSyncedContainer.cs | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs new file mode 100644 index 0000000000..a8fa8bf218 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -0,0 +1,186 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Framework.Timing; +using osu.Game.Overlays; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; +using osu.Framework.Audio.Track; +using osu.Game.Beatmaps.ControlPoints; +using osu.Framework.Graphics.Shapes; +using OpenTK.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Framework.Lists; +using System; +using System.Globalization; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatSyncedContainer : TestCase + { + public override string Description => @"Tests beat synced containers."; + + private MusicController mc; + + public TestCaseBeatSyncedContainer() + { + Clock = new FramedClock(); + } + + public override void Reset() + { + base.Reset(); + Clock.ProcessFrame(); + + Add(new BeatContainer + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }); + + Add(mc = new MusicController + { + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + }); + mc.State = Visibility.Visible; + } + + private class BeatContainer : BeatSyncedContainer + { + private const int flash_layer_heigth = 150; + + private readonly InfoString timingPointCount; + private readonly InfoString currentTimingPoint; + private readonly InfoString beatCount; + private readonly InfoString currentBeat; + private readonly InfoString beatsPerMinute; + private readonly InfoString beatLength; + + private readonly Box flashLayer; + + public BeatContainer() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + new FillFlowContainer + { + Name = @"Info Layer", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Bottom = flash_layer_heigth, }, + Children = new Drawable[] + { + timingPointCount = new InfoString(@"Timing points amount: "), + currentTimingPoint = new InfoString(@"Current timing point: "), + beatCount = new InfoString(@"Beats amount (in the current timing point): "), + currentBeat = new InfoString(@"Current beat: "), + beatsPerMinute = new InfoString(@"BPM: "), + beatLength = new InfoString(@"Beat length: "), + } + }, + new Container + { + Name = @"Color indicator", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = flash_layer_heigth, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + Alpha = 0, + } + } + } + }; + + Beatmap.ValueChanged += delegate + { + timingPointCount.Value = 0; + currentTimingPoint.Value = 0; + beatCount.Value = 0; + currentBeat.Value = 0; + beatsPerMinute.Value = 0; + beatLength.Value = 0; + }; + } + + private SortedList timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints; + private TimingControlPoint getNextTimingPoint(TimingControlPoint current) + { + if (timingPoints[timingPoints.Count - 1] == current) + return current; + + return timingPoints[timingPoints.IndexOf(current) + 1]; + } + + private int calculateBeatCount(TimingControlPoint current) + { + if (timingPoints.IndexOf(current) + 1 == timingPoints.Count) + return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength); + + return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength); + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + timingPointCount.Value = timingPoints.Count; + currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; + beatCount.Value = calculateBeatCount(timingPoint); + currentBeat.Value = beatIndex + 1; + beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); + beatLength.Value = (float)timingPoint.BeatLength; + + flashLayer.ClearTransforms(); + flashLayer.FadeTo(1); + flashLayer.FadeTo(0, timingPoint.BeatLength); + } + } + + private class InfoString : FillFlowContainer + { + private const int text_size = 20; + private const int margin = 7; + + private readonly OsuSpriteText valueText; + + private float? value; + public float Value + { + set + { + if (value == this.value) return; + this.value = value; + + valueText.Text = value.ToString(CultureInfo.CurrentCulture); + } + } + + public InfoString(string header) + { + AutoSizeAxes = Axes.Both; + Direction = FillDirection.Horizontal; + Add(new OsuSpriteText { Text = header, TextSize = text_size }); + Add(valueText = new OsuSpriteText() { TextSize = text_size }); + Margin = new MarginPadding { Vertical = margin, }; + } + } + } +} From 608f3fe8c5d5744da212d552f7e755d5b9494cab Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 08:41:48 +0300 Subject: [PATCH 132/312] oops --- osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index de84e567d2..bd333c4df9 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -187,6 +187,7 @@ + From 5533ebabfcb23178b50bd73f37c17e9ab23c3540 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 23 Jun 2017 15:32:45 +0900 Subject: [PATCH 133/312] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index eed53d35f9..97ff3376d1 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit eed53d35f999ae08a6d233c046aa333a7623c5f0 +Subproject commit 97ff3376d1bdac3703d442e62f5ee6a36eb3b73f From a59af5b0054a10c2f5f1f2b89bccaf37c56b8fa6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 10:01:28 +0300 Subject: [PATCH 134/312] Applied suggested changes --- .../Tests/TestCaseBeatSyncedContainer.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index a8fa8bf218..d70e60cd93 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests private readonly InfoString beatCount; private readonly InfoString currentBeat; private readonly InfoString beatsPerMinute; - private readonly InfoString beatLength; + private readonly InfoString adjustedBeatLength; private readonly Box flashLayer; @@ -77,12 +77,12 @@ namespace osu.Desktop.VisualTests.Tests Margin = new MarginPadding { Bottom = flash_layer_heigth, }, Children = new Drawable[] { - timingPointCount = new InfoString(@"Timing points amount: "), - currentTimingPoint = new InfoString(@"Current timing point: "), - beatCount = new InfoString(@"Beats amount (in the current timing point): "), - currentBeat = new InfoString(@"Current beat: "), - beatsPerMinute = new InfoString(@"BPM: "), - beatLength = new InfoString(@"Beat length: "), + timingPointCount = new InfoString(@"Timing points amount"), + currentTimingPoint = new InfoString(@"Current timing point"), + beatCount = new InfoString(@"Beats amount (in the current timing point)"), + currentBeat = new InfoString(@"Current beat"), + beatsPerMinute = new InfoString(@"BPM"), + adjustedBeatLength = new InfoString(@"Beat length"), } }, new Container @@ -116,7 +116,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount.Value = 0; currentBeat.Value = 0; beatsPerMinute.Value = 0; - beatLength.Value = 0; + adjustedBeatLength.Value = 0; }; } @@ -146,7 +146,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount.Value = calculateBeatCount(timingPoint); currentBeat.Value = beatIndex + 1; beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); - beatLength.Value = (float)timingPoint.BeatLength; + adjustedBeatLength.Value = (float)timingPoint.BeatLength; flashLayer.ClearTransforms(); flashLayer.FadeTo(1); @@ -177,7 +177,7 @@ namespace osu.Desktop.VisualTests.Tests { AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; - Add(new OsuSpriteText { Text = header, TextSize = text_size }); + Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); Add(valueText = new OsuSpriteText() { TextSize = text_size }); Margin = new MarginPadding { Vertical = margin, }; } From 3150bdb54b75d33b76a98f92dd1dd8fed63ee7ba Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 14:56:43 +0300 Subject: [PATCH 135/312] Fixed wrong display string --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index d70e60cd93..c0d2b04bcb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -82,7 +82,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount = new InfoString(@"Beats amount (in the current timing point)"), currentBeat = new InfoString(@"Current beat"), beatsPerMinute = new InfoString(@"BPM"), - adjustedBeatLength = new InfoString(@"Beat length"), + adjustedBeatLength = new InfoString(@"Adjusted beat length"), } }, new Container From 1a8f207db32c1ea14241285b1cedc7b4a4cb706a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Jun 2017 22:14:56 +0900 Subject: [PATCH 136/312] Code formatting --- .../Tests/TestCaseRoomInspector.cs | 21 +++++++++++-------- osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 7ec78cd136..c5fac3afe8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -23,7 +23,7 @@ namespace osu.Desktop.VisualTests.Tests var room = new Room(); room.Name.Value = @"My Awesome Room"; - room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; + room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } }; room.Status.Value = new RoomStatusOpen(); room.Type.Value = new GameTypeTeamVersus(); room.Beatmap.Value = new BeatmapInfo @@ -42,12 +42,15 @@ namespace osu.Desktop.VisualTests.Tests }, }; room.MaxParticipants.Value = 200; - room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, - new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, - new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, - new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, - new User { Username = @"peppy", Id = 2, GlobalRank = 6251 }}; + room.Participants.Value = new[] + { + new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, + new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, + new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, + new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, + new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + }; RoomInspector inspector; Add(inspector = new RoomInspector @@ -58,7 +61,7 @@ namespace osu.Desktop.VisualTests.Tests }); AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above"); - AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" }}); + AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }); AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying()); AddStep(@"change type", () => room.Type.Value = new GameTypeTag()); AddStep(@"change beatmap", () => room.Beatmap.Value = null); @@ -73,7 +76,7 @@ namespace osu.Desktop.VisualTests.Tests { var newRoom = new Room(); newRoom.Name.Value = @"My New, Better Than Ever Room"; - newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; + newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } }; newRoom.Status.Value = new RoomStatusOpen(); newRoom.Type.Value = new GameTypeTagTeam(); newRoom.Beatmap.Value = new BeatmapInfo diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index b7eca2dc8a..2181f37be9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -48,6 +48,7 @@ namespace osu.Game.Screens.Multiplayer private TextureStore textures; private Room room; + public Room Room { get { return room; } From f314f5f7ea8aa5f0c93f9475f7c8dfb0f83acc79 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Jun 2017 22:34:36 +0900 Subject: [PATCH 137/312] CI fixes --- .../Tests/TestCaseRoomInspector.cs | 110 ++++++++++-------- 1 file changed, 63 insertions(+), 47 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index c5fac3afe8..beb664e7ff 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -21,35 +21,43 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - var room = new Room(); - room.Name.Value = @"My Awesome Room"; - room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } }; - room.Status.Value = new RoomStatusOpen(); - room.Type.Value = new GameTypeTeamVersus(); - room.Beatmap.Value = new BeatmapInfo + var room = new Room { - StarDifficulty = 3.7, - Ruleset = rulesets.GetRuleset(3), - Metadata = new BeatmapMetadata + Name = { Value = @"My Awesome Room" }, + Host = { Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTeamVersus() }, + Beatmap = { - Title = @"Platina", - Artist = @"Maaya Sakamoto", - Author = @"uwutm8", + Value = new BeatmapInfo + { + StarDifficulty = 3.7, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Platina", + Artist = @"Maaya Sakamoto", + Author = @"uwutm8", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" }, + }, + } }, - OnlineInfo = new BeatmapOnlineInfo + MaxParticipants = { Value = 200 }, + Participants = { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" }, - }, - }; - room.MaxParticipants.Value = 200; - room.Participants.Value = new[] - { - new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, - new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, - new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, - new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, - new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + Value = new[] + { + new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, + new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, + new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, + new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, + new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + } + } }; RoomInspector inspector; @@ -74,32 +82,40 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change room", () => { - var newRoom = new Room(); - newRoom.Name.Value = @"My New, Better Than Ever Room"; - newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } }; - newRoom.Status.Value = new RoomStatusOpen(); - newRoom.Type.Value = new GameTypeTagTeam(); - newRoom.Beatmap.Value = new BeatmapInfo + var newRoom = new Room { - StarDifficulty = 7.07, - Ruleset = rulesets.GetRuleset(0), - Metadata = new BeatmapMetadata + Name = { Value = @"My New, Better Than Ever Room" }, + Host = { Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTagTeam() }, + Beatmap = { - Title = @"xi", - Artist = @"FREEDOM DIVE", - Author = @"Nakagawa-Kanon", + Value = new BeatmapInfo + { + StarDifficulty = 7.07, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"xi", + Artist = @"FREEDOM DIVE", + Author = @"Nakagawa-Kanon", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" }, + }, + } }, - OnlineInfo = new BeatmapOnlineInfo + MaxParticipants = { Value = 10 }, + Participants = { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" }, - }, - }; - newRoom.MaxParticipants.Value = 10; - newRoom.Participants.Value = new[] - { - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, - new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, - new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + Value = new[] + { + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, + new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, + new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + } + } }; inspector.Room = newRoom; From 674e2a43955719ace56bd9d2cbd9aa2bc8f61aad Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 23 Jun 2017 21:59:22 +0800 Subject: [PATCH 138/312] Align placeholder. --- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- osu.Game/Overlays/Profile/ProfileSection.cs | 24 +++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 193fa2dfda..a85486b0eb 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -321,11 +321,11 @@ namespace osu.Game.Overlays.Profile if (user.Age != null) { - infoTextLeft.AddText($"{user.Age} years old", boldItalic); + infoTextLeft.AddText($"{user.Age} years old ", boldItalic); } if (user.Country != null) { - infoTextLeft.AddText(" from "); + infoTextLeft.AddText("from "); infoTextLeft.AddText(user.Country.FullName, boldItalic); } infoTextLeft.NewParagraph(); diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index 63c5263a72..5bbdccbbf0 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -42,19 +42,10 @@ namespace osu.Game.Overlays.Profile Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Margin = new MarginPadding + Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, - Bottom = 200 - }, - Children = new Drawable[] - { - new TextFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Text = "Coming soon!" - } + Bottom = 20 } }, new Box @@ -65,6 +56,17 @@ namespace osu.Game.Overlays.Profile EdgeSmoothness = new Vector2(1) } }; + + // placeholder + Add(new OsuSpriteText + { + Text = @"Coming soon!", + TextSize = 36, + Font = @"Exo2.0-RegularItalic", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Margin = new MarginPadding { Bottom = 200 } + }); } } } From f5829860a2241a767a5500de9b31637f19dc8554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 23 Jun 2017 18:02:24 +0200 Subject: [PATCH 139/312] Get rid of AlwaysReceiveInput --- osu-framework | 2 +- .../Objects/Drawables/DrawableSlider.cs | 4 ---- .../Objects/Drawables/DrawableSpinner.cs | 2 -- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 3 ++- osu.Game/Graphics/Containers/ParallaxContainer.cs | 2 -- osu.Game/Graphics/Cursor/CursorTrail.cs | 3 ++- osu.Game/Graphics/Processing/RatioAdjust.cs | 1 - osu.Game/OsuGameBase.cs | 1 - .../Overlays/SearchableList/SearchableListOverlay.cs | 1 - osu.Game/Overlays/Toolbar/Toolbar.cs | 3 --- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 2 -- osu.Game/Rulesets/UI/Playfield.cs | 12 ------------ osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMouse.cs | 4 +++- osu.Game/Screens/Play/MenuOverlay.cs | 1 - osu.Game/Screens/Play/SkipButton.cs | 2 -- osu.Game/Screens/Select/FilterControl.cs | 2 -- 17 files changed, 11 insertions(+), 40 deletions(-) diff --git a/osu-framework b/osu-framework index 97ff3376d1..6a81d52ba2 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 97ff3376d1bdac3703d442e62f5ee6a36eb3b73f +Subproject commit 6a81d52ba24c4c4bcd83bf1062143ad93d8f4545 diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index b80f1d7178..395e496b61 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -28,10 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSlider(Slider s) : base(s) { - // Since the DrawableSlider itself is just a container without a size we need to - // pass all input through. - AlwaysReceiveInput = true; - SliderBouncer bouncer1; slider = s; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 3722d13ffc..840acb8221 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSpinner(Spinner s) : base(s) { - AlwaysReceiveInput = true; - Origin = Anchor.Centre; Position = s.Position; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 29d6d1f147..86dfe8e95e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { spinner = s; - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; Children = new Drawable[] @@ -40,6 +39,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + private bool tracking; public bool Tracking { diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 2d5952a3ce..19475b00c9 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -19,8 +19,6 @@ namespace osu.Game.Graphics.Containers public ParallaxContainer() { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Both; AddInternal(content = new Container { diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 183679fbd3..d3386c2bbf 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -65,7 +65,6 @@ namespace osu.Game.Graphics.Cursor // as we are currently very dependent on having a running clock, let's make our own clock for the time being. Clock = new FramedClock(); - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; for (int i = 0; i < max_sprites; i++) @@ -75,6 +74,8 @@ namespace osu.Game.Graphics.Cursor } } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) { diff --git a/osu.Game/Graphics/Processing/RatioAdjust.cs b/osu.Game/Graphics/Processing/RatioAdjust.cs index dd039d5144..640814d8e1 100644 --- a/osu.Game/Graphics/Processing/RatioAdjust.cs +++ b/osu.Game/Graphics/Processing/RatioAdjust.cs @@ -12,7 +12,6 @@ namespace osu.Game.Graphics.Processing { public RatioAdjust() { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 306cdaddf0..5e73ea55e6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -152,7 +152,6 @@ namespace osu.Game { new Container { - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Depth = float.MinValue, Children = new Drawable[] diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 05ee38153d..25f6b4f60b 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -82,7 +82,6 @@ namespace osu.Game.Overlays.SearchableList RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - AlwaysReceiveInput = true, Children = new Drawable[] { Header = CreateHeader(), diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 16e4f22ec8..a7e5f8dcc4 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -33,8 +33,6 @@ namespace osu.Game.Overlays.Toolbar public Toolbar() { - AlwaysReceiveInput = true; - Children = new Drawable[] { new ToolbarBackground(), @@ -55,7 +53,6 @@ namespace osu.Game.Overlays.Toolbar }, new FillFlowContainer { - AlwaysReceiveInput = true, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 1928c0fc1f..c1fd234628 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -17,8 +17,6 @@ namespace osu.Game.Overlays.Toolbar public ToolbarUserArea() { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 612569a9ae..ff321a18a5 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.UI /// Whether we want our internal coordinate system to be scaled to a specified width. protected Playfield(float? customWidth = null) { - AlwaysReceiveInput = true; - // Default height since we force relative size axes Size = Vector2.One; @@ -50,7 +48,6 @@ namespace osu.Game.Rulesets.UI { content = new Container { - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, } } @@ -100,19 +97,10 @@ namespace osu.Game.Rulesets.UI //dividing by the customwidth will effectively scale our content to the required container size. protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale; - - public ScaledContainer() - { - AlwaysReceiveInput = true; - } } public class HitObjectContainer : Container where U : Drawable { - public HitObjectContainer() - { - AlwaysReceiveInput = true; - } } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 25cbfc14b7..8d70a0f1a9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -9,6 +9,7 @@ using osu.Framework.Input; using osu.Framework.Configuration; using osu.Framework.Allocation; using osu.Game.Configuration; +using OpenTK; namespace osu.Game.Screens.Play { @@ -20,8 +21,6 @@ namespace osu.Game.Screens.Play public KeyCounterCollection() { - AlwaysReceiveInput = true; - Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; } @@ -124,11 +123,12 @@ namespace osu.Game.Screens.Play public Receptor(KeyCounterCollection target) { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; this.target = target; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool HandleInput => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args)); diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 744cb905d9..49d669aef9 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -3,6 +3,7 @@ using osu.Framework.Input; using OpenTK.Input; +using OpenTK; namespace osu.Game.Screens.Play { @@ -12,10 +13,11 @@ namespace osu.Game.Screens.Play public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) { - AlwaysReceiveInput = true; Button = button; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + private static string getStringRepresentation(MouseButton button) { switch (button) diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 1d557269c4..adfa1a736b 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -186,7 +186,6 @@ namespace osu.Game.Screens.Play protected MenuOverlay() { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index d110f8ecac..b38a9b4934 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -34,8 +34,6 @@ namespace osu.Game.Screens.Play public SkipButton(double startTime) { - AlwaysReceiveInput = true; - this.startTime = startTime; RelativePositionAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 51937df189..531c78c17e 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -82,7 +82,6 @@ namespace osu.Game.Screens.Select new Container { Padding = new MarginPadding(20), - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Width = 0.5f, Anchor = Anchor.TopRight, @@ -109,7 +108,6 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - AlwaysReceiveInput = true, Children = new Drawable[] { groupTabs = new OsuTabControl From 817d2c3da1996fdc816a15b9329097c282b4e6e0 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 23:57:57 +0300 Subject: [PATCH 140/312] Fixed logo heartbeat playing even without beating --- osu.Game/Screens/Menu/OsuLogo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 78bcbc5c63..12b6b994d0 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -227,9 +227,6 @@ namespace osu.Game.Screens.Menu { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - if (Hovering) - sampleBeat.Play(); - lastBeatIndex = beatIndex; var beatLength = timingPoint.BeatLength; @@ -238,6 +235,9 @@ namespace osu.Game.Screens.Menu if (beatIndex < 0) return; + if (Hovering) + sampleBeat.Play(); + logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); From 15cd4f77b2eb40506f985860d18c5084e2f74efd Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 22:35:06 -0300 Subject: [PATCH 141/312] Proper dismissing. --- osu.Game/Overlays/MedalOverlay.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 2d2a32fa4f..a796da82b9 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -19,6 +19,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK.Input; +using System.Linq; namespace osu.Game.Overlays { @@ -37,7 +38,16 @@ namespace osu.Game.Overlays private SampleChannel getSample; - protected override bool BlockPassThroughKeyboard => true; + protected override bool OnClick(InputState state) + { + dismiss(); + return true; + } + + protected override void OnFocusLost(InputState state) + { + if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + } public MedalOverlay(Medal medal) { @@ -189,6 +199,12 @@ namespace osu.Game.Overlays FadeOut(200); } + private void dismiss() + { + if (drawableMedal.Transforms.Count != 0) return; + Hide(); + } + private class BackgroundStrip : Container { public BackgroundStrip(float start, float end) From 3c97f0482655b2cb049ee5447c04db1e0618630a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 23:18:44 -0300 Subject: [PATCH 142/312] Particles. --- osu.Game/Overlays/MedalOverlay.cs | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index a40d9bffda..6cb7e7662b 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -21,6 +21,8 @@ using osu.Framework.Input; using OpenTK.Input; using System.Linq; using osu.Framework.Graphics.Shapes; +using System; +using osu.Framework.MathUtils; namespace osu.Game.Overlays { @@ -144,6 +146,13 @@ namespace osu.Game.Overlays }; } + protected override void Update() + { + base.Update(); + + Add(new MedalParticle(RNG.Next(0, 359))); + } + protected override void PopIn() { base.PopIn(); @@ -225,5 +234,36 @@ namespace osu.Game.Overlays }; } } + + private class MedalParticle : CircularContainer + { + private readonly float direction; + + private Vector2 positionForOffset(float offset) => new Vector2((float)(offset * Math.Sin(direction)), (float)(offset * Math.Cos(direction))); + + public MedalParticle(float direction) + { + this.direction = direction; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + Position = positionForOffset(DISC_SIZE / 2); + Masking = true; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Colour = colours.Blue.Opacity(0.5f), + Radius = 5, + }; + + MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500); + FadeOut(500); + Expire(); + } + } } } From c71f34c50796eea717378dede6cb101dd31f6e4a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 23:51:28 -0300 Subject: [PATCH 143/312] Make the background strip expand from the disc edges. --- osu.Game/Overlays/MedalOverlay.cs | 43 ++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 6cb7e7662b..ecd9a0af2f 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays private const float border_width = 5; private readonly Box background; - private readonly FillFlowContainer backgroundStrip; + private readonly Container backgroundStrip; private readonly BackgroundStrip leftStrip, rightStrip; private readonly CircularContainer disc; private readonly Sprite innerSpin, outterSpin; @@ -72,20 +72,44 @@ namespace osu.Game.Overlays Size = new Vector2(DISC_SIZE + 500), Alpha = 0f, }, - backgroundStrip = new FillFlowContainer + backgroundStrip = new Container { Name = @"background strip", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, - Width = 0f, Height = border_width, Alpha = 0f, - Direction = FillDirection.Horizontal, Children = new[] { - leftStrip = new BackgroundStrip(0f, 1f), - rightStrip = new BackgroundStrip(1f, 0f), + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + Width = 0.5f, + Padding = new MarginPadding { Right = DISC_SIZE / 2 }, + Children = new[] + { + leftStrip = new BackgroundStrip(0f, 1f) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + Width = 0.5f, + Padding = new MarginPadding { Left = DISC_SIZE / 2 }, + Children = new[] + { + rightStrip = new BackgroundStrip(1f, 0f), + }, + }, }, }, disc = new CircularContainer @@ -187,12 +211,13 @@ namespace osu.Game.Overlays }); disc.FadeIn(duration1); - backgroundStrip.FadeIn(duration1); - backgroundStrip.ResizeWidthTo(1f, duration1 * 2, EasingTypes.OutQuint); outterSpin.FadeTo(0.1f, duration1 * 2); disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); Delay(duration1 + 200, true); + backgroundStrip.FadeIn(duration2); + leftStrip.ResizeWidthTo(1f, duration2, EasingTypes.OutQuint); + rightStrip.ResizeWidthTo(1f, duration2, EasingTypes.OutQuint); drawableMedal.ChangeState(DrawableMedal.DisplayState.Icon, duration2); Delay(duration2, true); @@ -220,7 +245,7 @@ namespace osu.Game.Overlays public BackgroundStrip(float start, float end) { RelativeSizeAxes = Axes.Both; - Width = 0.5f; + Width = 0f; ColourInfo = ColourInfo.GradientHorizontal(Color4.White.Opacity(start), Color4.White.Opacity(end)); Masking = true; From 0133f9c0869d4ff7123d049a1c1623f9a2c0acee Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 01:19:44 -0300 Subject: [PATCH 144/312] Medal sprite, make MedalOverlay auto-show when loaded. --- .../Tests/TestCaseMedalOverlay.cs | 6 ++--- osu.Game/Overlays/MedalOverlay.cs | 2 ++ .../Overlays/MedalSplash/DrawableMedal.cs | 23 +++++++++++++------ osu.Game/Users/Medal.cs | 2 ++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs index 581675e66a..ac983277a4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -15,14 +15,12 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - MedalOverlay overlay; - Add(overlay = new MedalOverlay(new Medal + Add(new MedalOverlay(new Medal { Name = @"Animations", + InternalName = @"all-intro-doubletime", Description = @"More complex than you think.", })); - - AddStep(@"show", overlay.Show); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index ecd9a0af2f..d9c949a0da 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -168,6 +168,8 @@ namespace osu.Game.Overlays Colour = colours.Blue.Opacity(0.5f), Radius = 50, }; + + Show(); } protected override void Update() diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index ba2e3964a4..e230b9de9b 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -19,8 +19,9 @@ namespace osu.Game.Overlays.MedalSplash private const float scale_when_unlocked = 0.76f; private const float scale_when_full = 0.6f; - private readonly Container medal; - private readonly Sprite medalGlow; + private readonly Medal medal; + private readonly Container medalContainer; + private readonly Sprite medalGlow, medalSprite; private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private readonly FillFlowContainer infoFlow; @@ -28,11 +29,12 @@ namespace osu.Game.Overlays.MedalSplash public DrawableMedal(Medal medal) { + this.medal = medal; Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); Children = new Drawable[] { - this.medal = new Container + this.medalContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, @@ -40,6 +42,12 @@ namespace osu.Game.Overlays.MedalSplash Alpha = 0f, Children = new[] { + medalSprite = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(0.81f), + }, medalGlow = new Sprite { Anchor = Anchor.Centre, @@ -102,12 +110,13 @@ namespace osu.Game.Overlays.MedalSplash [BackgroundDependencyLoader] private void load(OsuColour colours, TextureStore textures) { + medalSprite.Texture = textures.Get(medal.ImageUrl); medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); foreach (var s in descriptionSprites) s.Colour = colours.BlueLight; - var pos = new Vector2(0f, medal.Size.Y / 2 + 10); + var pos = new Vector2(0f, medalContainer.Size.Y / 2 + 10); unlocked.Position = pos; pos.Y += 90; infoFlow.Position = pos; @@ -118,9 +127,9 @@ namespace osu.Game.Overlays.MedalSplash switch (newState) { case DisplayState.Icon: - medal.Scale = Vector2.Zero; - medal.ScaleTo(1, duration, EasingTypes.OutElastic); - medal.FadeInFromZero(duration); + medalContainer.Scale = Vector2.Zero; + medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic); + medalContainer.FadeInFromZero(duration); break; case DisplayState.MedalUnlocked: ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); diff --git a/osu.Game/Users/Medal.cs b/osu.Game/Users/Medal.cs index 5ac6eceddc..aa7382b457 100644 --- a/osu.Game/Users/Medal.cs +++ b/osu.Game/Users/Medal.cs @@ -6,6 +6,8 @@ namespace osu.Game.Users public class Medal { public string Name { get; set; } + public string InternalName { get; set; } + public string ImageUrl => $@"https://s.ppy.sh/images/medals-client/{InternalName}@2x.png"; public string Description { get; set; } } } From b2c516238e70f4b19950dbde62701df3eb4dd3e2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 01:48:55 -0300 Subject: [PATCH 145/312] Cleanup. --- osu.Game/Overlays/MedalOverlay.cs | 15 ++++++++++----- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 14 ++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index d9c949a0da..617a5f7d0b 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays private const float border_width = 5; private readonly Box background; - private readonly Container backgroundStrip; + private readonly Container backgroundStrip, particleContainer; private readonly BackgroundStrip leftStrip, rightStrip; private readonly CircularContainer disc; private readonly Sprite innerSpin, outterSpin; @@ -61,7 +61,6 @@ namespace osu.Game.Overlays { background = new Box { - Name = @"dim", RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(60), }, @@ -74,7 +73,6 @@ namespace osu.Game.Overlays }, backgroundStrip = new Container { - Name = @"background strip", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, @@ -112,9 +110,12 @@ namespace osu.Game.Overlays }, }, }, + particleContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, disc = new CircularContainer { - Name = @"content", Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0f, @@ -168,7 +169,11 @@ namespace osu.Game.Overlays Colour = colours.Blue.Opacity(0.5f), Radius = 50, }; + } + protected override void LoadComplete() + { + base.LoadComplete(); Show(); } @@ -176,7 +181,7 @@ namespace osu.Game.Overlays { base.Update(); - Add(new MedalParticle(RNG.Next(0, 359))); + particleContainer.Add(new MedalParticle(RNG.Next(0, 359))); } protected override void PopIn() diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index e230b9de9b..e385601f6d 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.MedalSplash Children = new Drawable[] { - this.medalContainer = new Container + medalContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.MedalSplash TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, - Scale = new Vector2(1 / scale_when_unlocked), + Scale = new Vector2(1f / scale_when_unlocked), }, infoFlow = new FillFlowContainer { @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.MedalSplash TextSize = 20, Font = @"Exo2.0-Bold", Alpha = 0f, - Scale = new Vector2(1 / scale_when_full), + Scale = new Vector2(1f / scale_when_full), }, description = new TextFlowContainer { @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.MedalSplash RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Alpha = 0f, - Scale = new Vector2(1 / scale_when_full), + Scale = new Vector2(1f / scale_when_full), }, }, }, @@ -116,10 +116,8 @@ namespace osu.Game.Overlays.MedalSplash foreach (var s in descriptionSprites) s.Colour = colours.BlueLight; - var pos = new Vector2(0f, medalContainer.Size.Y / 2 + 10); - unlocked.Position = pos; - pos.Y += 90; - infoFlow.Position = pos; + unlocked.Position = new Vector2(0f, medalContainer.Size.Y / 2 + 10); + infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90); } public void ChangeState(DisplayState newState, double duration) From e3489928b788e26ee7228f27f16d69291f3507c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 24 Jun 2017 09:21:08 +0200 Subject: [PATCH 146/312] Remove now obsolete InternalContains --- osu-framework | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game/Graphics/Cursor/CursorTrail.cs | 2 +- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 2 +- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- osu.Game/Screens/Play/KeyCounterMouse.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/Footer.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu-framework b/osu-framework index 6a81d52ba2..f832f77c04 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6a81d52ba24c4c4bcd83bf1062143ad93d8f4545 +Subproject commit f832f77c04dd2c64063763a4283831ff95854aab diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 86dfe8e95e..234aa8d055 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; private bool tracking; public bool Tracking diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index d3386c2bbf..bbebc7e1b1 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -74,7 +74,7 @@ namespace osu.Game.Graphics.Cursor } } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 8d113f4918..c284398240 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface public readonly TextAwesome Chevron; //don't allow clicking between transitions and don't make the chevron clickable - protected override bool InternalContains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); public override bool HandleInput => State == Visibility.Visible; private Visibility state; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 10c821e9bd..47f628f96c 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking - protected override bool InternalContains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); protected override bool OnClick(Framework.Input.InputState state) { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 37bf30646d..c60a937440 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -23,7 +23,7 @@ namespace osu.Game.Graphics.UserInterface protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || Dropdown.Contains(screenSpacePos); private bool isEnumType => typeof(T).IsEnum; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index b504c70be7..b188e782e2 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -171,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface } } - protected override bool InternalContains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 23b8aac6a7..97c7907874 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); public ChatOverlay() { diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index d5f7683257..b5ec70b9e2 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.SearchableList protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos); protected SearchableListFilterControl() { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 19bb084af4..cdff79c94f 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Menu private readonly Key triggerKey; private SampleChannel sampleClick; - protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 78bcbc5c63..f6eaae01b3 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu set { colourAndTriangles.Alpha = value ? 1 : 0; } } - protected override bool InternalContains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos); public bool Ripple { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 8d70a0f1a9..88522e23ab 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play this.target = target; } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; public override bool HandleInput => true; diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 49d669aef9..3f3b44aef9 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play Button = button; } - protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool Contains(Vector2 screenSpacePos) => true; private static string getStringRepresentation(MouseButton button) { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 531c78c17e..6d732b58e4 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select private readonly SearchTextBox searchTextBox; - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); public FilterControl() { diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 882aa482da..613c666b92 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select updateModeLight(); } - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || StartButton.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || StartButton.Contains(screenSpacePos); protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index db8ab439eb..942d3a6a32 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Select.Options return false; } - protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); public BeatmapOptionsButton() { From 494a77aa0d1c2d5918c99f53a1b229ca1d452bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 24 Jun 2017 09:35:54 +0200 Subject: [PATCH 147/312] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index f832f77c04..2f7ebfcf63 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit f832f77c04dd2c64063763a4283831ff95854aab +Subproject commit 2f7ebfcf637cc1928d8d37f6336e5da77f4926a0 From 0de55776c03bfbb7f47e467c5dac68f40c35f6cc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:05:48 -0300 Subject: [PATCH 148/312] Update DrawableRoom design. --- .../Tests/TestCaseDrawableRoom.cs | 130 +++++++---- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 212 ++++++++++++++---- osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 - 3 files changed, 254 insertions(+), 89 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 43a8069720..db8b712638 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -8,6 +8,7 @@ using osu.Game.Screens.Multiplayer; using osu.Game.Online.Multiplayer; using osu.Game.Users; using osu.Game.Database; +using osu.Framework.Allocation; namespace osu.Desktop.VisualTests.Tests { @@ -15,74 +16,105 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Select your favourite room"; + private RulesetDatabase rulesets; + public override void Reset() { base.Reset(); DrawableRoom first; - DrawableRoom second; Add(new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Y, - Width = 500f, + Width = 580f, Direction = FillDirection.Vertical, Children = new Drawable[] { - first = new DrawableRoom(new Room()), - second = new DrawableRoom(new Room()), + first = new DrawableRoom(new Room + { + Name = { Value = @"Great Room Right Here" }, + Host = { Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTeamVersus() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 4.65, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Critical Crystal", + Artist = @"Seiryu", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455" }, + }, + }, + }, + Participants = + { + Value = new[] + { + new User { GlobalRank = 1355 }, + new User { GlobalRank = 8756 }, + }, + }, + }), + new DrawableRoom(new Room + { + Name = { Value = @"Relax It's The Weekend" }, + Host = { Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } } }, + Status = { Value = new RoomStatusPlaying() }, + Type = { Value = new GameTypeTagTeam() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 1.96, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"Serendipity", + Artist = @"ZAQ", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706" }, + }, + }, + }, + Participants = + { + Value = new[] + { + new User { GlobalRank = 578975 }, + new User { GlobalRank = 24554 }, + }, + }, + }), } }); - first.Room.Name.Value = @"Great Room Right Here"; - first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } }; - first.Room.Status.Value = new RoomStatusOpen(); - first.Room.Beatmap.Value = new BeatmapInfo + AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name"); + AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }); + AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying()); + AddStep(@"change type", () => first.Room.Type.Value = new GameTypeVersus()); + AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null); + AddStep(@"change participants", () => first.Room.Participants.Value = new[] { - Metadata = new BeatmapMetadata - { - Title = @"Seiryu", - Artist = @"Critical Crystal", - }, - }; - - second.Room.Name.Value = @"Relax It's The Weekend"; - second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } }; - second.Room.Status.Value = new RoomStatusPlaying(); - second.Room.Beatmap.Value = new BeatmapInfo - { - Metadata = new BeatmapMetadata - { - Title = @"Serendipity", - Artist = @"ZAQ", - }, - }; - - AddStep(@"change state", () => - { - first.Room.Status.Value = new RoomStatusPlaying(); + new User { GlobalRank = 1254 }, + new User { GlobalRank = 123189 }, }); + } - AddStep(@"change name", () => - { - first.Room.Name.Value = @"I Changed Name"; - }); - - AddStep(@"change host", () => - { - first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }; - }); - - AddStep(@"change beatmap", () => - { - first.Room.Beatmap.Value = null; - }); - - AddStep(@"change state", () => - { - first.Room.Status.Value = new RoomStatusOpen(); - }); + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; } } } diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 71114dd3a3..bd58fafd12 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -1,14 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; +using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -19,22 +23,36 @@ namespace osu.Game.Screens.Multiplayer { public class DrawableRoom : ClickableContainer { - private const float content_padding = 5; - private const float height = 90; + private const float transition_duration = 100; + private const float content_padding = 10; + private const float height = 100; + private const float side_strip_width = 5; + private const float cover_width = 145; + private const float ruleset_height = 30; private readonly Box sideStrip; - private readonly UpdateableAvatar avatar; + private readonly Container coverContainer, rulesetContainer, gameTypeContainer; private readonly OsuSpriteText name; private readonly Container flagContainer; private readonly OsuSpriteText host; - private readonly OsuSpriteText rankBounds; + private readonly FillFlowContainer levelRangeContainer; + private readonly OsuSpriteText levelRangeLower; + private readonly OsuSpriteText levelRangeHigher; private readonly OsuSpriteText status; private readonly FillFlowContainer beatmapInfoFlow; private readonly OsuSpriteText beatmapTitle; private readonly OsuSpriteText beatmapDash; private readonly OsuSpriteText beatmapArtist; + private readonly Bindable nameBind = new Bindable(); + private readonly Bindable hostBind = new Bindable(); + private readonly Bindable statusBind = new Bindable(); + private readonly Bindable typeBind = new Bindable(); + private readonly Bindable beatmapBind = new Bindable(); + private readonly Bindable participantsBind = new Bindable(); + private OsuColour colours; + private TextureStore textures; private LocalisationEngine localisation; public readonly Room Room; @@ -59,24 +77,36 @@ namespace osu.Game.Screens.Multiplayer new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(34), + Colour = OsuColour.FromHex(@"212121"), }, sideStrip = new Box { RelativeSizeAxes = Axes.Y, - Width = content_padding, + Width = side_strip_width, }, - avatar = new UpdateableAvatar + new Container { - Size = new Vector2(Height - content_padding * 2), + Width = cover_width, + RelativeSizeAxes = Axes.Y, Masking = true, - CornerRadius = 5f, - Margin = new MarginPadding { Left = content_padding * 2, Top = content_padding }, + Margin = new MarginPadding { Left = side_strip_width }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + coverContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + }, }, new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = Height + content_padding * 2, Right = content_padding }, + Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = side_strip_width + cover_width + content_padding, Right = content_padding }, Children = new Drawable[] { new FillFlowContainer @@ -100,20 +130,30 @@ namespace osu.Game.Screens.Multiplayer new FillFlowContainer { AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, + Height = 15f, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { flagContainer = new Container { - Width = 30f, + Width = 22f, RelativeSizeAxes = Axes.Y, }, - new Container + new Container //todo: team banners { - Width = 40f, + Width = 38f, RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, }, new OsuSpriteText { @@ -131,13 +171,40 @@ namespace osu.Game.Screens.Multiplayer }, }, }, - rankBounds = new OsuSpriteText + levelRangeContainer = new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = "#0 - #0", - TextSize = 14, - Margin = new MarginPadding { Right = 10 }, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, }, }, }, @@ -150,7 +217,6 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Margin = new MarginPadding { Bottom = content_padding }, Children = new Drawable[] { status = new OsuSpriteText @@ -173,7 +239,7 @@ namespace osu.Game.Screens.Multiplayer beatmapDash = new OsuSpriteText { TextSize = 14, - Font = @"Exo2.0-RegularItalic", + Font = @"Exo2.0-BoldItalic", }, beatmapArtist = new OsuSpriteText { @@ -184,26 +250,64 @@ namespace osu.Game.Screens.Multiplayer }, }, }, + new FillFlowContainer + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Height = ruleset_height, + Direction = FillDirection.Horizontal, + LayoutDuration = transition_duration, + Spacing = new Vector2(5f, 0f), + Children = new[] + { + rulesetContainer = new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + }, + gameTypeContainer = new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + }, + }, + }, }, }, }; - Room.Name.ValueChanged += displayName; - Room.Host.ValueChanged += displayUser; - Room.Status.ValueChanged += displayStatus; - Room.Beatmap.ValueChanged += displayBeatmap; + nameBind.ValueChanged += displayName; + hostBind.ValueChanged += displayUser; + participantsBind.ValueChanged += displayParticipants; + + nameBind.BindTo(Room.Name); + hostBind.BindTo(Room.Host); + statusBind.BindTo(Room.Status); + typeBind.BindTo(Room.Type); + beatmapBind.BindTo(Room.Beatmap); + participantsBind.BindTo(Room.Participants); } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours, TextureStore textures, LocalisationEngine localisation) { this.localisation = localisation; + this.textures = textures; this.colours = colours; - beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9; + beatmapInfoFlow.Colour = levelRangeContainer.Colour = colours.Gray9; host.Colour = colours.Blue; - displayStatus(Room.Status.Value); + //binded here instead of ctor because dependencies are needed + statusBind.ValueChanged += displayStatus; + typeBind.ValueChanged += displayGameType; + beatmapBind.ValueChanged += displayBeatmap; + + statusBind.TriggerChange(); + typeBind.TriggerChange(); + beatmapBind.TriggerChange(); } private void displayName(string value) @@ -213,7 +317,6 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { - avatar.User = value; host.Text = value.Username; flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; } @@ -227,33 +330,64 @@ namespace osu.Game.Screens.Multiplayer d.FadeColour(value.GetAppropriateColour(colours), 100); } + private void displayGameType(GameType value) + { + gameTypeContainer.Children = new[] + { + new DrawableGameType(value) + { + Size = new Vector2(ruleset_height), + }, + }; + } + private void displayBeatmap(BeatmapInfo value) { if (value != null) { + coverContainer.FadeIn(transition_duration); + coverContainer.Children = new[] + { + new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + }) { RelativeSizeAxes = Axes.Both } + }; + + rulesetContainer.FadeIn(transition_duration); + rulesetContainer.Children = new[] + { + new DifficultyIcon(value) + { + Size = new Vector2(ruleset_height), + } + }; + beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { + coverContainer.FadeOut(transition_duration); + rulesetContainer.FadeOut(transition_duration); + beatmapTitle.Current = null; beatmapArtist.Current = null; - beatmapTitle.Text = @"Changing map"; - beatmapDash.Text = string.Empty; - beatmapArtist.Text = string.Empty; + beatmapTitle.Text = "Changing map"; + beatmapDash.Text = beatmapArtist.Text = string.Empty; } } - protected override void Dispose(bool isDisposing) + private void displayParticipants(User[] value) { - Room.Name.ValueChanged -= displayName; - Room.Host.ValueChanged -= displayUser; - Room.Status.ValueChanged -= displayStatus; - Room.Beatmap.ValueChanged -= displayBeatmap; - - base.Dispose(isDisposing); + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); } } } diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 2181f37be9..508128c749 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -331,7 +331,6 @@ namespace osu.Game.Screens.Multiplayer }, levelRangeHigher = new OsuSpriteText { - Text = "6251", TextSize = 14, Font = @"Exo2.0-Bold", }, From 05b5fe8ae7cfff1d9caed9037d951b31345576ed Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:21:42 -0300 Subject: [PATCH 149/312] Share host/participant info displaying. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 105 +------------ .../Screens/Multiplayer/ParticipantInfo.cs | 142 ++++++++++++++++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 110 +------------- osu.Game/osu.Game.csproj | 1 + 4 files changed, 156 insertions(+), 202 deletions(-) create mode 100644 osu.Game/Screens/Multiplayer/ParticipantInfo.cs diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index bd58fafd12..507e0039e1 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -33,11 +32,7 @@ namespace osu.Game.Screens.Multiplayer private readonly Box sideStrip; private readonly Container coverContainer, rulesetContainer, gameTypeContainer; private readonly OsuSpriteText name; - private readonly Container flagContainer; - private readonly OsuSpriteText host; - private readonly FillFlowContainer levelRangeContainer; - private readonly OsuSpriteText levelRangeLower; - private readonly OsuSpriteText levelRangeHigher; + private readonly ParticipantInfo participantInfo; private readonly OsuSpriteText status; private readonly FillFlowContainer beatmapInfoFlow; private readonly OsuSpriteText beatmapTitle; @@ -121,93 +116,7 @@ namespace osu.Game.Screens.Multiplayer { TextSize = 18, }, - new Container - { - RelativeSizeAxes = Axes.X, - Height = 20f, - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.X, - Height = 15f, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - flagContainer = new Container - { - Width = 22f, - RelativeSizeAxes = Axes.Y, - }, - new Container //todo: team banners - { - Width = 38f, - RelativeSizeAxes = Axes.Y, - CornerRadius = 2f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"ad387e"), - }, - }, - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - host = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - }, - }, - levelRangeContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeLower = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - new OsuSpriteText - { - Text = " - ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeHigher = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - }, - }, - }, - }, + participantInfo = new ParticipantInfo(), }, }, new FillFlowContainer @@ -297,8 +206,7 @@ namespace osu.Game.Screens.Multiplayer this.textures = textures; this.colours = colours; - beatmapInfoFlow.Colour = levelRangeContainer.Colour = colours.Gray9; - host.Colour = colours.Blue; + beatmapInfoFlow.Colour = colours.Gray9; //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; @@ -317,8 +225,7 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { - host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + participantInfo.Host = value; } private void displayStatus(RoomStatus value) @@ -385,9 +292,7 @@ namespace osu.Game.Screens.Multiplayer private void displayParticipants(User[] value) { - var ranks = value.Select(u => u.GlobalRank); - levelRangeLower.Text = ranks.Min().ToString(); - levelRangeHigher.Text = ranks.Max().ToString(); + participantInfo.Participants = value; } } } diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs new file mode 100644 index 0000000000..cd9101d5ad --- /dev/null +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -0,0 +1,142 @@ +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class ParticipantInfo : Container + { + private readonly Container flagContainer; + private readonly OsuSpriteText host; + private readonly FillFlowContainer levelRangeContainer; + private readonly OsuSpriteText levelRangeLower; + private readonly OsuSpriteText levelRangeHigher; + + public User Host + { + set + { + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + } + + public IEnumerable Participants + { + set + { + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); + } + } + + public ParticipantInfo(string rankPrefix = null) + { + RelativeSizeAxes = Axes.X; + Height = 15f; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + flagContainer = new Container + { + Width = 22f, + RelativeSizeAxes = Axes.Y, + }, + new Container //todo: team banners + { + Width = 38f, + RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + levelRangeContainer = new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = rankPrefix, + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + levelRangeContainer.Colour = colours.Gray9; + host.Colour = colours.Blue; + } + } +} diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 508128c749..d840495765 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -30,9 +30,10 @@ namespace osu.Game.Screens.Multiplayer private const float ruleset_height = 30; private readonly Box statusStrip; - private readonly Container coverContainer, rulesetContainer, gameTypeContainer, flagContainer; - private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow; - private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; + private readonly Container coverContainer, rulesetContainer, gameTypeContainer; + private readonly FillFlowContainer topFlow, participantsFlow; + private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; + private readonly ParticipantInfo participantInfo; private readonly ScrollContainer participantsScroll; private readonly Bindable nameBind = new Bindable(); @@ -252,90 +253,7 @@ namespace osu.Game.Screens.Multiplayer Padding = contentPadding, Children = new Drawable[] { - new FillFlowContainer - { - AutoSizeAxes = Axes.X, - Height = 15f, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - flagContainer = new Container - { - Width = 22f, - RelativeSizeAxes = Axes.Y, - }, - new Container //todo: team banners - { - Width = 38f, - RelativeSizeAxes = Axes.Y, - CornerRadius = 2f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"ad387e"), - }, - }, - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - host = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - }, - }, - levelRangeContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = "Rank Range ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeLower = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - new OsuSpriteText - { - Text = " - ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeHigher = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - }, - }, + participantInfo = new ParticipantInfo(@"Rank Range "), }, }, }, @@ -372,8 +290,7 @@ namespace osu.Game.Screens.Multiplayer this.colours = colours; this.textures = textures; - beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; - host.Colour = colours.Blue; + beatmapAuthor.Colour = colours.Gray9; //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; @@ -399,14 +316,7 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { - host.Text = value.Username; - flagContainer.Children = new[] - { - new DrawableFlag(value.Country?.FlagName ?? @"__") - { - RelativeSizeAxes = Axes.Both, - }, - }; + participantInfo.Host = value; } private void displayStatus(RoomStatus value) @@ -489,11 +399,7 @@ namespace osu.Game.Screens.Multiplayer private void displayParticipants(User[] value) { participants.Text = value.Length.ToString(); - - var ranks = value.Select(u => u.GlobalRank); - levelRangeLower.Text = ranks.Min().ToString(); - levelRangeHigher.Text = ranks.Max().ToString(); - + participantInfo.Participants = value; participantsFlow.Children = value.Select(u => new UserTile(u)); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 64b81ddc6a..4e015242e2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -490,6 +490,7 @@ + From 35951ffc40053e1a03570a26081a6ca87438c6b0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:23:31 -0300 Subject: [PATCH 150/312] Line endings. --- .../Screens/Multiplayer/ParticipantInfo.cs | 284 +++++++++--------- 1 file changed, 142 insertions(+), 142 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index cd9101d5ad..c1a031f8cb 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -1,142 +1,142 @@ -using System.Collections.Generic; -using System.Linq; -using OpenTK; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Users; - -namespace osu.Game.Screens.Multiplayer -{ - public class ParticipantInfo : Container - { - private readonly Container flagContainer; - private readonly OsuSpriteText host; - private readonly FillFlowContainer levelRangeContainer; - private readonly OsuSpriteText levelRangeLower; - private readonly OsuSpriteText levelRangeHigher; - - public User Host - { - set - { - host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; - } - } - - public IEnumerable Participants - { - set - { - var ranks = value.Select(u => u.GlobalRank); - levelRangeLower.Text = ranks.Min().ToString(); - levelRangeHigher.Text = ranks.Max().ToString(); - } - } - - public ParticipantInfo(string rankPrefix = null) - { - RelativeSizeAxes = Axes.X; - Height = 15f; - - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - flagContainer = new Container - { - Width = 22f, - RelativeSizeAxes = Axes.Y, - }, - new Container //todo: team banners - { - Width = 38f, - RelativeSizeAxes = Axes.Y, - CornerRadius = 2f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"ad387e"), - }, - }, - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - host = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - }, - }, - levelRangeContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = rankPrefix, - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeLower = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - new OsuSpriteText - { - Text = " - ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeHigher = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - }, - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - levelRangeContainer.Colour = colours.Gray9; - host.Colour = colours.Blue; - } - } -} +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class ParticipantInfo : Container + { + private readonly Container flagContainer; + private readonly OsuSpriteText host; + private readonly FillFlowContainer levelRangeContainer; + private readonly OsuSpriteText levelRangeLower; + private readonly OsuSpriteText levelRangeHigher; + + public User Host + { + set + { + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + } + + public IEnumerable Participants + { + set + { + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); + } + } + + public ParticipantInfo(string rankPrefix = null) + { + RelativeSizeAxes = Axes.X; + Height = 15f; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + flagContainer = new Container + { + Width = 22f, + RelativeSizeAxes = Axes.Y, + }, + new Container //todo: team banners + { + Width = 38f, + RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + levelRangeContainer = new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = rankPrefix, + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + levelRangeContainer.Colour = colours.Gray9; + host.Colour = colours.Blue; + } + } +} From fe875957a708bbd4093bfa611ffabd967b3ecbd6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:43:52 -0300 Subject: [PATCH 151/312] Share ruleset and type displaying, fix tag team icon. --- osu.Game/Online/Multiplayer/GameType.cs | 24 +++++- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 45 ++-------- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 82 +++++++++++++++++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 33 ++------ osu.Game/osu.Game.csproj | 1 + 5 files changed, 118 insertions(+), 67 deletions(-) create mode 100644 osu.Game/Screens/Multiplayer/ModeTypeInfo.cs diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs index 4d1a6c4839..22e2ffac31 100644 --- a/osu.Game/Online/Multiplayer/GameType.cs +++ b/osu.Game/Online/Multiplayer/GameType.cs @@ -52,10 +52,32 @@ namespace osu.Game.Online.Multiplayer public override string Name => "Tag Team"; public override Drawable GetIcon(OsuColour colours, float size) { - return new VersusRow(colours.Blue, colours.Blue, size * 0.6f) + return new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(2f), + Children = new[] + { + new TextAwesome + { + Icon = FontAwesome.fa_refresh, + TextSize = size * 0.75f, + Colour = colours.Blue, + Shadow = false, + UseFullGlyphHeight = false, + }, + new TextAwesome + { + Icon = FontAwesome.fa_refresh, + TextSize = size * 0.75f, + Colour = colours.Pink, + Shadow = false, + UseFullGlyphHeight = false, + }, + }, }; } } diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 507e0039e1..8a970427e5 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -27,12 +27,12 @@ namespace osu.Game.Screens.Multiplayer private const float height = 100; private const float side_strip_width = 5; private const float cover_width = 145; - private const float ruleset_height = 30; private readonly Box sideStrip; - private readonly Container coverContainer, rulesetContainer, gameTypeContainer; + private readonly Container coverContainer; private readonly OsuSpriteText name; private readonly ParticipantInfo participantInfo; + private readonly ModeTypeInfo modeTypeInfo; private readonly OsuSpriteText status; private readonly FillFlowContainer beatmapInfoFlow; private readonly OsuSpriteText beatmapTitle; @@ -159,29 +159,10 @@ namespace osu.Game.Screens.Multiplayer }, }, }, - new FillFlowContainer + modeTypeInfo = new ModeTypeInfo { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, - Height = ruleset_height, - Direction = FillDirection.Horizontal, - LayoutDuration = transition_duration, - Spacing = new Vector2(5f, 0f), - Children = new[] - { - rulesetContainer = new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - }, - gameTypeContainer = new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - }, - }, }, }, }, @@ -239,17 +220,13 @@ namespace osu.Game.Screens.Multiplayer private void displayGameType(GameType value) { - gameTypeContainer.Children = new[] - { - new DrawableGameType(value) - { - Size = new Vector2(ruleset_height), - }, - }; + modeTypeInfo.Type = value; } private void displayBeatmap(BeatmapInfo value) { + modeTypeInfo.Beatmap = value; + if (value != null) { coverContainer.FadeIn(transition_duration); @@ -264,15 +241,6 @@ namespace osu.Game.Screens.Multiplayer }) { RelativeSizeAxes = Axes.Both } }; - rulesetContainer.FadeIn(transition_duration); - rulesetContainer.Children = new[] - { - new DifficultyIcon(value) - { - Size = new Vector2(ruleset_height), - } - }; - beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); @@ -280,7 +248,6 @@ namespace osu.Game.Screens.Multiplayer else { coverContainer.FadeOut(transition_duration); - rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs new file mode 100644 index 0000000000..07e62d4d2f --- /dev/null +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -0,0 +1,82 @@ +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps.Drawables; +using osu.Game.Database; +using osu.Game.Online.Multiplayer; + +namespace osu.Game.Screens.Multiplayer +{ + public class ModeTypeInfo : Container + { + private const float height = 30; + private const float transition_duration = 100; + + private readonly Container rulesetContainer, gameTypeContainer; + + public BeatmapInfo Beatmap + { + set + { + if (value != null) + { + rulesetContainer.FadeIn(transition_duration); + rulesetContainer.Children = new[] + { + new DifficultyIcon(value) + { + Size = new Vector2(height), + } + }; + } + else + { + rulesetContainer.FadeOut(transition_duration); + } + } + } + + public GameType Type + { + set + { + gameTypeContainer.Children = new[] + { + new DrawableGameType(value) + { + Size = new Vector2(height), + }, + }; + } + } + + public ModeTypeInfo() + { + AutoSizeAxes = Axes.Both; + + Children = new[] + { + new FillFlowContainer + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + LayoutDuration = transition_duration, + Spacing = new Vector2(5f, 0f), + Children = new[] + { + rulesetContainer = new Container + { + AutoSizeAxes = Axes.Both, + }, + gameTypeContainer = new Container + { + AutoSizeAxes = Axes.Both, + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index d840495765..3ed0b78f36 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -27,11 +27,11 @@ namespace osu.Game.Screens.Multiplayer { private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; - private const float ruleset_height = 30; private readonly Box statusStrip; private readonly Container coverContainer, rulesetContainer, gameTypeContainer; private readonly FillFlowContainer topFlow, participantsFlow; + private readonly ModeTypeInfo modeTypeInfo; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; private readonly ParticipantInfo participantInfo; private readonly ScrollContainer participantsScroll; @@ -191,20 +191,13 @@ namespace osu.Game.Screens.Multiplayer new FillFlowContainer { AutoSizeAxes = Axes.X, - Height = ruleset_height, + Height = 30, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { - rulesetContainer = new Container - { - AutoSizeAxes = Axes.Both, - }, - gameTypeContainer = new Container - { - AutoSizeAxes = Axes.Both, - }, + modeTypeInfo = new ModeTypeInfo(), new Container { AutoSizeAxes = Axes.X, @@ -329,17 +322,13 @@ namespace osu.Game.Screens.Multiplayer private void displayGameType(GameType value) { - gameTypeContainer.Children = new[] - { - new DrawableGameType(value) - { - Size = new Vector2(ruleset_height), - }, - }; + modeTypeInfo.Type = value; } private void displayBeatmap(BeatmapInfo value) { + modeTypeInfo.Beatmap = value; + if (value != null) { coverContainer.FadeIn(transition_duration); @@ -354,15 +343,6 @@ namespace osu.Game.Screens.Multiplayer }) { RelativeSizeAxes = Axes.Both } }; - rulesetContainer.FadeIn(transition_duration); - rulesetContainer.Children = new[] - { - new DifficultyIcon(value) - { - Size = new Vector2(ruleset_height), - } - }; - beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); @@ -371,7 +351,6 @@ namespace osu.Game.Screens.Multiplayer else { coverContainer.FadeOut(transition_duration); - rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4e015242e2..553e55c83e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -491,6 +491,7 @@ + From bcd82a02f499308fbe9c7e29be4fe4797e429d74 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:45:34 -0300 Subject: [PATCH 152/312] Licenses. --- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 5 ++++- osu.Game/Screens/Multiplayer/ParticipantInfo.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs index 07e62d4d2f..ca93163ac3 100644 --- a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -1,4 +1,7 @@ -using OpenTK; +// 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.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index c1a031f8cb..639f29567f 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; using System.Linq; using OpenTK; using osu.Framework.Allocation; From 9f417743b641a7faf19907ad8ff52e06515f448a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:54:00 -0300 Subject: [PATCH 153/312] Cleanup. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 13 ++++--------- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 2 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 5 ++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 8a970427e5..eb66fd3d2a 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -30,14 +30,10 @@ namespace osu.Game.Screens.Multiplayer private readonly Box sideStrip; private readonly Container coverContainer; - private readonly OsuSpriteText name; + private readonly OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist; + private readonly FillFlowContainer beatmapInfoFlow; private readonly ParticipantInfo participantInfo; private readonly ModeTypeInfo modeTypeInfo; - private readonly OsuSpriteText status; - private readonly FillFlowContainer beatmapInfoFlow; - private readonly OsuSpriteText beatmapTitle; - private readonly OsuSpriteText beatmapDash; - private readonly OsuSpriteText beatmapArtist; private readonly Bindable nameBind = new Bindable(); private readonly Bindable hostBind = new Bindable(); @@ -170,6 +166,7 @@ namespace osu.Game.Screens.Multiplayer nameBind.ValueChanged += displayName; hostBind.ValueChanged += displayUser; + typeBind.ValueChanged += displayGameType; participantsBind.ValueChanged += displayParticipants; nameBind.BindTo(Room.Name); @@ -191,11 +188,9 @@ namespace osu.Game.Screens.Multiplayer //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; - typeBind.ValueChanged += displayGameType; beatmapBind.ValueChanged += displayBeatmap; statusBind.TriggerChange(); - typeBind.TriggerChange(); beatmapBind.TriggerChange(); } @@ -238,7 +233,7 @@ namespace osu.Game.Screens.Multiplayer Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), - }) { RelativeSizeAxes = Axes.Both } + }) { RelativeSizeAxes = Axes.Both }, }; beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs index ca93163ac3..fbb15ec2c5 100644 --- a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multiplayer new DifficultyIcon(value) { Size = new Vector2(height), - } + }, }; } else diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 3ed0b78f36..2c9ee9dfe6 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -272,6 +272,7 @@ namespace osu.Game.Screens.Multiplayer nameBind.ValueChanged += displayName; hostBind.ValueChanged += displayUser; + typeBind.ValueChanged += displayGameType; maxParticipantsBind.ValueChanged += displayMaxParticipants; participantsBind.ValueChanged += displayParticipants; } @@ -287,11 +288,9 @@ namespace osu.Game.Screens.Multiplayer //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; - typeBind.ValueChanged += displayGameType; beatmapBind.ValueChanged += displayBeatmap; statusBind.TriggerChange(); - typeBind.TriggerChange(); beatmapBind.TriggerChange(); } @@ -340,7 +339,7 @@ namespace osu.Game.Screens.Multiplayer Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), - }) { RelativeSizeAxes = Axes.Both } + }) { RelativeSizeAxes = Axes.Both }, }; beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); From 68915d79a6e4f5c42226815174d06d147aadb670 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 06:03:40 -0300 Subject: [PATCH 154/312] Remove unused fields. --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 2c9ee9dfe6..92bb92fbb9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multiplayer private const float transition_duration = 100; private readonly Box statusStrip; - private readonly Container coverContainer, rulesetContainer, gameTypeContainer; + private readonly Container coverContainer; private readonly FillFlowContainer topFlow, participantsFlow; private readonly ModeTypeInfo modeTypeInfo; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; From 1bca9ca0e9e1345b4033bb847a8f6bfbf32f31f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 24 Jun 2017 12:56:35 +0200 Subject: [PATCH 155/312] Update framework with better children list --- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 2 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index f12ec53605..cafb88b6ac 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Chat public IEnumerable Channels { - set { ChannelFlow.Children = value.Select(c => new ChannelListItem(c)); } + set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); } } public ChannelSection() diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 6ff3cc7be5..7c10c4fb9b 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat { set { - sectionsFlow.Children = value; + sectionsFlow.ChildrenEnumerable = value; foreach (ChannelSection s in sectionsFlow.Children) { diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index c8ca50823f..5edb48e136 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Dialog get { return buttonsContainer.Children; } set { - buttonsContainer.Children = value; + buttonsContainer.ChildrenEnumerable = value; foreach (PopupDialogButton b in value) { var action = b.Action; diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 8a56cf392e..f8acad1f59 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Direct SetInfo = setInfo; } - protected IEnumerable GetDifficultyIcons() + protected List GetDifficultyIcons() { var icons = new List(); diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 93c440384b..beb1355f36 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays private void recreatePanels(PanelDisplayStyle displayStyle) { if (BeatmapSets == null) return; - panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); + panels.ChildrenEnumerable = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); } public class ResultCounts diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index c6ce20f5cf..1cd2343848 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -44,7 +44,7 @@ namespace osu.Game.Overlays panelFlow.Clear(); else { - panelFlow.Children = users.Select(u => + panelFlow.ChildrenEnumerable = users.Select(u => { var p = new UserPanel(u) { Width = 300 }; p.Status.BindTo(u.Status); diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 2181f37be9..f9e015eceb 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -495,7 +495,7 @@ namespace osu.Game.Screens.Multiplayer levelRangeLower.Text = ranks.Min().ToString(); levelRangeHigher.Text = ranks.Max().ToString(); - participantsFlow.Children = value.Select(u => new UserTile(u)); + participantsFlow.ChildrenEnumerable = value.Select(u => new UserTile(u)); } private class UserTile : Container, IHasTooltip diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index ac333e47ff..15e8e4bfcd 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Ranking } }; - statisticsContainer.Children = Score.Statistics.Select(s => new DrawableScoreStatistic(s)); + statisticsContainer.ChildrenEnumerable = Score.Statistics.Select(s => new DrawableScoreStatistic(s)); } protected override void LoadComplete() diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index daf28c8f1b..481637e2af 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -439,7 +439,7 @@ namespace osu.Game.Screens.Select { Show(); if (header.Text == "Tags") - content.Children = value.Split(' ').Select(text => new OsuSpriteText + content.ChildrenEnumerable = value.Split(' ').Select(text => new OsuSpriteText { Text = text, Font = "Exo2.0-Regular", From ba783f984cb964cc6317126c33bb0742405b7980 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 24 Jun 2017 13:36:57 +0200 Subject: [PATCH 156/312] Change usage of ScrollIntoView to ScrollTo in the setttings overlay --- osu.Game/Overlays/SettingsOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 88f4599383..5677bbcad9 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = sectionsContainer.ScrollContainer.ScrollIntoView, + Action = sectionsContainer.ScrollContainer.ScrollTo, } ).ToArray() } From d914a1b00ef20bbc88082d3760775a4b4a363252 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 24 Jun 2017 13:47:34 +0200 Subject: [PATCH 157/312] Added animation parameter --- osu.Game/Overlays/Settings/SidebarButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 309216dd91..8d5e0e96b7 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Settings private readonly Box backgroundBox; private readonly Box selectionIndicator; private readonly Container text; - public Action Action; + public Action Action; private SettingsSection section; public SettingsSection Section @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.Settings protected override bool OnClick(InputState state) { - Action?.Invoke(section); + Action?.Invoke(section, true); backgroundBox.FlashColour(Color4.White, 400); return true; } From 091d786d47546d66260b17eb750a89269599ed10 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 18:37:28 -0300 Subject: [PATCH 158/312] Split long MarginPadding onto multiple lines. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index eb66fd3d2a..d1b6b5079b 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -97,7 +97,13 @@ namespace osu.Game.Screens.Multiplayer new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = side_strip_width + cover_width + content_padding, Right = content_padding }, + Padding = new MarginPadding + { + Top = content_padding, + Bottom = content_padding, + Left = side_strip_width + cover_width + content_padding, + Right = content_padding, + }, Children = new Drawable[] { new FillFlowContainer From 5e1cb14e624ccba84795c88762a6aa6aaee69334 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 19:11:02 -0300 Subject: [PATCH 159/312] Use Vertical instead of Top and Bottom. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index d1b6b5079b..b88341bee1 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -99,8 +99,7 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { - Top = content_padding, - Bottom = content_padding, + Vertical = content_padding, Left = side_strip_width + cover_width + content_padding, Right = content_padding, }, From 18295a9b97cc84d7f87a3c39d5f6b7897007ebc4 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 25 Jun 2017 10:06:54 +0800 Subject: [PATCH 160/312] Handle scrolling in SectionsContainer. --- .../Graphics/Containers/SectionsContainer.cs | 23 ++++++++++++++----- osu.Game/Overlays/SettingsOverlay.cs | 3 +-- osu.Game/Overlays/UserProfileOverlay.cs | 3 +-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 63cc6f1a85..8221c5d3a6 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.Containers where T : Drawable { private Drawable expandableHeader, fixedHeader, footer, headerBackground; - public readonly ScrollContainer ScrollContainer; + private readonly ScrollContainer scrollContainer; private readonly Container headerBackgroundContainer; private readonly FlowContainer scrollContentContainer; @@ -62,13 +62,13 @@ namespace osu.Game.Graphics.Containers if (value == footer) return; if (footer != null) - ScrollContainer.Remove(footer); + scrollContainer.Remove(footer); footer = value; if (value == null) return; footer.Anchor |= Anchor.y2; footer.Origin |= Anchor.y2; - ScrollContainer.Add(footer); + scrollContainer.Add(footer); lastKnownScroll = float.NaN; } } @@ -122,10 +122,11 @@ namespace osu.Game.Graphics.Containers public SectionsContainer() { - AddInternal(ScrollContainer = new ScrollContainer() + AddInternal(scrollContainer = new ScrollContainer() { RelativeSizeAxes = Axes.Both, Masking = true, + ScrollbarVisible = false, Children = new Drawable[] { scrollContentContainer = CreateScrollContentContainer() }, Depth = float.MaxValue }); @@ -137,6 +138,15 @@ namespace osu.Game.Graphics.Containers originalSectionsMargin = scrollContentContainer.Margin; } + public void ScrollToTop(T section) + { + float pos = scrollContainer.GetChildPosInContent(section); + float current = scrollContainer.Current; + float scrollOffset = FixedHeader?.LayoutSize.Y ?? 0; + if (section == Children.First() && current < pos - scrollOffset) return; + scrollContainer.ScrollTo(pos - scrollOffset); + } + private float lastKnownScroll; protected override void UpdateAfterChildren() { @@ -151,7 +161,7 @@ namespace osu.Game.Graphics.Containers updateSectionsMargin(); } - float currentScroll = Math.Max(0, ScrollContainer.Current); + float currentScroll = Math.Max(0, scrollContainer.Current); if (currentScroll != lastKnownScroll) { lastKnownScroll = currentScroll; @@ -169,10 +179,11 @@ namespace osu.Game.Graphics.Containers T bestMatch = null; float minDiff = float.MaxValue; + float scrollOffset = FixedHeader?.LayoutSize.Y ?? 0; foreach (var section in Children) { - float diff = Math.Abs(ScrollContainer.GetChildPosInContent(section) - currentScroll); + float diff = Math.Abs(scrollContainer.GetChildPosInContent(section) - currentScroll - scrollOffset); if (diff < minDiff) { minDiff = diff; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 267489fc79..2734aa642d 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = sectionsContainer.ScrollContainer.ScrollIntoView, + Action = sectionsContainer.ScrollToTop } ).ToArray() } @@ -162,7 +162,6 @@ namespace osu.Game.Overlays public SettingsSectionsContainer() { - ScrollContainer.ScrollbarVisible = false; HeaderBackground = new Box { Colour = Color4.Black, diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index fc6a050d3e..1cc11bc4e9 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -112,7 +112,6 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both } }; - sectionsContainer.ScrollContainer.ScrollbarVisible = false; Add(sectionsContainer); sectionsContainer.SelectedSection.ValueChanged += s => { @@ -135,7 +134,7 @@ namespace osu.Game.Overlays if (lastSection != s) { lastSection = s; - sectionsContainer.ScrollContainer.ScrollIntoView(lastSection); + sectionsContainer.ScrollToTop(lastSection); } }; From a187e50889c7671720a8363886798dd85637432c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 25 Jun 2017 10:07:54 +0800 Subject: [PATCH 161/312] Unify usages of field and property. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 8221c5d3a6..21ffa04351 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -166,12 +166,12 @@ namespace osu.Game.Graphics.Containers { lastKnownScroll = currentScroll; - if (expandableHeader != null && fixedHeader != null) + if (ExpandableHeader != null && FixedHeader != null) { - float offset = Math.Min(expandableHeader.LayoutSize.Y, currentScroll); + float offset = Math.Min(ExpandableHeader.LayoutSize.Y, currentScroll); - expandableHeader.Y = -offset; - fixedHeader.Y = -offset + expandableHeader.LayoutSize.Y; + ExpandableHeader.Y = -offset; + FixedHeader.Y = -offset + ExpandableHeader.LayoutSize.Y; } headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0); From be12f318e94112e49a6d1dc8ffbc79f80c896fc2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 25 Jun 2017 10:40:45 +0800 Subject: [PATCH 162/312] Allow showing offline data only in profile. --- osu.Game/Overlays/UserProfileOverlay.cs | 61 +++++++++++++++---------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 1cc11bc4e9..854382c5d5 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -23,8 +23,12 @@ namespace osu.Game.Overlays public class UserProfileOverlay : WaveOverlayContainer { private ProfileSection lastSection; + private ProfileSection[] sections; private GetUserRequest userReq; private APIAccess api; + private ProfileHeader header; + private SectionsContainer sectionsContainer; + private ProfileTabControl tabs; public const float CONTENT_X_MARGIN = 50; private const float transition_length = 500; @@ -69,13 +73,13 @@ namespace osu.Game.Overlays FadeEdgeEffectTo(0, DISAPPEAR_DURATION, EasingTypes.Out); } - public void ShowUser(User user) + public void ShowUser(User user, bool fetchOnline = true) { userReq?.Cancel(); Clear(); lastSection = null; - var sections = new ProfileSection[] + sections = new ProfileSection[] { new AboutSection(), new RecentSection(), @@ -85,7 +89,7 @@ namespace osu.Game.Overlays new BeatmapsSection(), new KudosuSection() }; - var tabs = new ProfileTabControl + tabs = new ProfileTabControl { RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, @@ -99,9 +103,9 @@ namespace osu.Game.Overlays Colour = OsuColour.Gray(0.2f) }); - var header = new ProfileHeader(user); + header = new ProfileHeader(user); - var sectionsContainer = new SectionsContainer + Add(sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, ExpandableHeader = header, @@ -111,8 +115,7 @@ namespace osu.Game.Overlays Colour = OsuColour.Gray(34), RelativeSizeAxes = Axes.Both } - }; - Add(sectionsContainer); + }); sectionsContainer.SelectedSection.ValueChanged += s => { if (lastSection != s) @@ -138,28 +141,38 @@ namespace osu.Game.Overlays } }; - userReq = new GetUserRequest(user.Id); //fetch latest full data - userReq.Success += u => + if (fetchOnline) { - header.FillFullData(u); - - for (int i = 0; i < u.ProfileOrder.Length; i++) - { - string id = u.ProfileOrder[i]; - var sec = sections.FirstOrDefault(s => s.Identifier == id); - if (sec != null) - { - sec.Depth = -i; - sectionsContainer.Add(sec); - tabs.AddItem(sec); - } - } - }; - api.Queue(userReq); + userReq = new GetUserRequest(user.Id); + userReq.Success += fillData; + api.Queue(userReq); + } + else + { + userReq = null; + fillData(user); + } Show(); } + private void fillData(User user) + { + header.FillFullData(user); + + for (int i = 0; i < user.ProfileOrder.Length; i++) + { + string id = user.ProfileOrder[i]; + var sec = sections.FirstOrDefault(s => s.Identifier == id); + if (sec != null) + { + sec.Depth = -i; + sectionsContainer.Add(sec); + tabs.AddItem(sec); + } + } + } + private class ProfileTabControl : PageTabControl { private readonly Box bottom; From bfa275ad1c32e0cda7eab918a8de14d7269f0491 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 25 Jun 2017 10:51:54 +0800 Subject: [PATCH 163/312] Change some small classes to struct to avoid potential null check. --- osu.Game/Users/UserStatistics.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 7e3e5db983..05f3d65f30 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -10,7 +10,7 @@ namespace osu.Game.Users [JsonProperty(@"level")] public LevelInfo Level; - public class LevelInfo + public struct LevelInfo { [JsonProperty(@"current")] public int Current; @@ -49,7 +49,7 @@ namespace osu.Game.Users [JsonProperty(@"grade_counts")] public Grades GradesCount; - public class Grades + public struct Grades { [JsonProperty(@"ss")] public int SS; From 63aeb42657dc0084cd9a417e8356246e0599629c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 25 Jun 2017 14:38:00 +0900 Subject: [PATCH 164/312] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 2f7ebfcf63..a5e66079b9 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 2f7ebfcf637cc1928d8d37f6336e5da77f4926a0 +Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f From 7baa2b742175286c6c70b254c8540efab23b2bba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 25 Jun 2017 14:46:59 +0900 Subject: [PATCH 165/312] Fix CI issues --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 5 ++--- .../Screens/Tournament/Components/VisualiserContainer.cs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 395e496b61..c6c009e8f2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { if (!userTriggered && Time.Current >= slider.EndTime) { - var ticksCount = ticks.Children.Count() + 1; + var ticksCount = ticks.Children.Count + 1; var ticksHit = ticks.Children.Count(t => t.Judgement.Result == HitResult.Hit); if (initialCircle.Judgement.Result == HitResult.Hit) ticksHit++; diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index d0965a1861..e4a471bbba 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -29,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; foreach (var bar in Children) { - bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count()) : new Vector2(1.0f / Children.Count(), 1); + bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1); bar.Direction = direction; } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 2887d4355b..4a616a8685 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions; @@ -182,7 +181,7 @@ namespace osu.Game.Overlays textLine2.Origin = optionCount > 0 ? Anchor.BottomCentre : Anchor.Centre; textLine2.Y = optionCount > 0 ? 0 : 5; - if (optionLights.Children.Count() != optionCount) + if (optionLights.Children.Count != optionCount) { optionLights.Clear(); for (int i = 0; i < optionCount; i++) @@ -190,7 +189,7 @@ namespace osu.Game.Overlays } for (int i = 0; i < optionCount; i++) - optionLights.Children.Skip(i).First().Glowing = i == selectedOption; + optionLights.Children[i].Glowing = i == selectedOption; }); } diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs index 373934f775..3dd7207607 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Tournament.Components { base.UpdateAfterChildren(); - while (Children.Count() < 3) + while (Children.Count < 3) addLine(); float pos = leftPos; From cad594018f925e7fd51581833ebc0a1fb50cd3da Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 26 Jun 2017 00:38:00 +0800 Subject: [PATCH 166/312] Add dummy data in test case. --- .../Tests/TestCaseUserProfile.cs | 27 +++++++++++++++++++ osu.Game/Users/User.cs | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index f932b01d2c..a41834b647 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.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 System; +using System.Linq; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Users; @@ -17,6 +19,31 @@ namespace osu.Desktop.VisualTests.Tests var profile = new UserProfileOverlay(); Add(profile); + AddStep("Show offline dummy", () => profile.ShowUser(new User + { + Username = @"Somebody", + Id = 1, + Country = new Country { FullName = @"Alien" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", + JoinDate = DateTimeOffset.Now.AddDays(-1), + LastVisit = DateTimeOffset.Now, + Age = 1, + ProfileOrder = new[] { "me" }, + CountryRank = 1, + Statistics = new UserStatistics + { + Rank = 2148, + PP = 4567.89m + }, + AllRankHistories = new User.RankHistories + { + Osu = new User.RankHistory + { + Mode = @"osu", + Data = Enumerable.Range(2345,45).Concat(Enumerable.Range(2109,40)).ToArray() + } + } + }, false)); AddStep("Show ppy", () => profile.ShowUser(new User { Username = @"peppy", diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index bf78565e28..37b426ac2c 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -124,5 +124,32 @@ namespace osu.Game.Users [JsonProperty(@"defaultStatistics")] public UserStatistics Statistics; + + public class RankHistories + { + [JsonProperty(@"osu")] + public RankHistory Osu; + + [JsonProperty(@"taiko")] + public RankHistory Taiko; + + [JsonProperty(@"fruits")] + public RankHistory Fruits; + + [JsonProperty(@"mania")] + public RankHistory Mania; + } + + public class RankHistory + { + [JsonProperty(@"mode")] + public string Mode; + + [JsonProperty(@"data")] + public int[] Data; + } + + [JsonProperty(@"allRankHistories")] + public RankHistories AllRankHistories; } } From d6a720604142e9fbdd8f957f50c90aee5ce5dd9c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 26 Jun 2017 00:43:49 +0800 Subject: [PATCH 167/312] Show rank chart with dummy data. --- osu.Game/Overlays/Profile/RankChart.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 9a3d88cf62..3335f7ca9a 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -24,7 +24,6 @@ namespace osu.Game.Overlays.Profile private readonly RankChartLineGraph graph; private readonly int[] ranks; - private readonly decimal?[] performances; private const float primary_textsize = 25, secondary_textsize = 13, padding = 10; @@ -70,22 +69,19 @@ namespace osu.Game.Overlays.Profile BallMove = showHistoryRankTexts } }; - ranks = new[] { user.Statistics.Rank }; - performances = new[] { user.Statistics.PP }; + ranks = user.AllRankHistories?.Osu?.Data ?? new[] { user.Statistics.Rank }; } private void updateRankTexts() { rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty; - //relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,0}"; - relativeText.Text = string.Empty; + relativeText.Text = $"{user.Country?.FullName} #{user.CountryRank:#,0}"; } private void showHistoryRankTexts(int dayIndex) { rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank"; - performanceText.Text = performances[dayIndex] != null ? $"{performances[dayIndex]:#,0}pp" : string.Empty; relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; //plural should be handled in a general way } From 0582eddcba365dec197ffc51c952b0996d6d37bc Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 26 Jun 2017 00:52:03 +0800 Subject: [PATCH 168/312] Slightly update text position. --- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index a85486b0eb..c15afb080c 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Profile private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; private readonly Box colourBar; - private const float cover_height = 350, info_height = 150, info_width = 250, avatar_size = 110, level_position = 30, level_height = 60; + private const float cover_height = 350, info_height = 150, info_width = 220, avatar_size = 110, level_position = 30, level_height = 60; public ProfileHeader(User user) { RelativeSizeAxes = Axes.X; From 684d1887522ebbdb489409af77dabfebc4410221 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 26 Jun 2017 16:26:43 +0900 Subject: [PATCH 169/312] Adjust transition duration slightly --- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 8817d79bdd..b135d8004d 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface public float ActualMaxValue { get; private set; } = float.NaN; public float ActualMinValue { get; private set; } = float.NaN; - private const double transform_duration = 500; + private const double transform_duration = 1500; /// /// Hold an empty area if values are less. From b5cf02267659184cd8dad2183d44149e413d4f27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 26 Jun 2017 16:26:50 +0900 Subject: [PATCH 170/312] Add missing newline --- osu.Game/Overlays/Profile/RankChart.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 3335f7ca9a..dfd2219e1f 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -69,6 +69,7 @@ namespace osu.Game.Overlays.Profile BallMove = showHistoryRankTexts } }; + ranks = user.AllRankHistories?.Osu?.Data ?? new[] { user.Statistics.Rank }; } From cbf188c293e0a7ca467a5ee6076cb7b39db8d7a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 26 Jun 2017 19:06:08 +0900 Subject: [PATCH 171/312] Add new main menu backgrounds --- osu-resources | 2 +- .../Backgrounds/BackgroundScreenDefault.cs | 25 ++++++++++++++++++- osu.Game/Screens/Loader.cs | 5 ++-- osu.Game/Screens/Menu/MainMenu.cs | 11 +++++++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/osu-resources b/osu-resources index 10fda22522..900f47563f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 10fda22522ffadbdbc43fa0f3683a065e536f7d1 +Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5 diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index f411f74361..3248fef0db 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -2,16 +2,39 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { public class BackgroundScreenDefault : BackgroundScreen { + private int currentDisplay; + private const int background_count = 5; + + + private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; + + private Background current; + [BackgroundDependencyLoader] private void load() { - Add(new Background(@"Backgrounds/bg1")); + display(new Background(backgroundName)); + } + + private void display(Background b) + { + current?.FadeOut(800, EasingTypes.OutQuint); + current?.Expire(); + + Add(current = b); + } + + public void Next() + { + currentDisplay++; + LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display); } } } \ No newline at end of file diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 30e1538b47..af084e740b 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Screens; using osu.Game.Screens.Menu; namespace osu.Game.Screens @@ -20,9 +19,9 @@ namespace osu.Game.Screens private void load(OsuGame game) { if (game.IsDeployedBuild) - LoadComponentAsync(new Disclaimer(), d => Push((Screen)d)); + LoadComponentAsync(new Disclaimer(), d => Push(d)); else - LoadComponentAsync(new Intro(), d => Push((Screen)d)); + LoadComponentAsync(new Intro(), d => Push(d)); } } } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 1a7d2d4e37..5a2e0a7b12 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Screens; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -24,7 +25,7 @@ namespace osu.Game.Screens.Menu internal override bool ShowOverlays => buttons.State != MenuState.Initial; - private readonly BackgroundScreen background; + private readonly BackgroundScreenDefault background; private Screen songSelect; protected override BackgroundScreen CreateBackground() => background; @@ -66,6 +67,12 @@ namespace osu.Game.Screens.Menu preloadSongSelect(); } + protected override void OnBeatmapChanged(WorkingBeatmap beatmap) + { + base.OnBeatmapChanged(beatmap); + background.Next(); + } + private void preloadSongSelect() { if (songSelect == null) @@ -111,6 +118,8 @@ namespace osu.Game.Screens.Menu { base.OnResuming(last); + background.Next(); + //we may have consumed our preloaded instance, so let's make another. preloadSongSelect(); From 803bb3c7802357d24f078bf3fb0dcbd0f6c69e78 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 26 Jun 2017 23:05:35 +0900 Subject: [PATCH 172/312] Cleanup. --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 3248fef0db..bab267a24a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -12,7 +12,6 @@ namespace osu.Game.Screens.Backgrounds private int currentDisplay; private const int background_count = 5; - private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; private Background current; @@ -23,12 +22,12 @@ namespace osu.Game.Screens.Backgrounds display(new Background(backgroundName)); } - private void display(Background b) + private void display(Background newBackground) { current?.FadeOut(800, EasingTypes.OutQuint); current?.Expire(); - Add(current = b); + Add(current = newBackground); } public void Next() @@ -37,4 +36,4 @@ namespace osu.Game.Screens.Backgrounds LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display); } } -} \ No newline at end of file +} From b40526ced22d250dd2c5cfac7976bc9e7a58d9ff Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 26 Jun 2017 23:47:15 +0900 Subject: [PATCH 173/312] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index a5e66079b9..25b660ce32 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f +Subproject commit 25b660ce322922abbb9be53caca2041c0e0c3ba0 From b105d6d7415956e68ab3c2679e445c2899393ed5 Mon Sep 17 00:00:00 2001 From: Vlad K Date: Tue, 27 Jun 2017 02:10:00 +0300 Subject: [PATCH 174/312] Insert icon into osu exe --- osu.Desktop/OsuGameDesktop.cs | 3 ++- osu.Desktop/osu.Desktop.csproj | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 299f64d998..536fe40c6a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -12,6 +12,7 @@ using System.Drawing; using System.IO; using System.Threading.Tasks; using osu.Game.Screens.Menu; +using System.Resources; namespace osu.Desktop { @@ -45,7 +46,7 @@ namespace osu.Desktop { desktopWindow.CursorState |= CursorState.Hidden; - desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); + desktopWindow.Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType(), "lazer.ico")); desktopWindow.Title = Name; desktopWindow.DragEnter += dragEnter; diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 5ac888b515..e69603602c 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -232,7 +232,7 @@ - +