From 481f33d17be543c6cef45f5d9e4875cde2e94432 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 14:27:34 +0100 Subject: [PATCH 01/90] add setting to toggle the gameplay cursor trail --- .../Configuration/OsuConfigManager.cs | 4 +++- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 12 +++++++++++- osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs | 5 +++++ osu.Game/Configuration/GameConfigManager.cs | 5 ----- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs index 4fa49faf1d..492cc7cc7f 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs @@ -19,12 +19,14 @@ namespace osu.Game.Rulesets.Osu.Configuration Set(OsuSetting.SnakingInSliders, true); Set(OsuSetting.SnakingOutSliders, true); + Set(OsuSetting.ShowCursorTrail, true); } } public enum OsuSetting { SnakingInSliders, - SnakingOutSliders + SnakingOutSliders, + ShowCursorTrail } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 582b99af7c..cf6ae2ad3d 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; @@ -23,6 +24,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor protected override Container Content => fadeContainer; + private Bindable showTrail; + private readonly CursorTrail cursorTrail; private readonly Container fadeContainer; public GameplayCursor() @@ -32,11 +35,18 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new CursorTrail { Depth = 1 } + cursorTrail = new CursorTrail { Depth = 1 } } }; } + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + showTrail = config.GetBindable(OsuSetting.ShowCursorTrail); + showTrail.ValueChanged += v => cursorTrail.Alpha = v ? 1 : 0; + } + private int downCount; private void updateExpandedState() diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 9aa0f4101d..12ef66fa25 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -34,6 +34,11 @@ namespace osu.Game.Rulesets.Osu.UI LabelText = "Snaking out sliders", Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) }, + new SettingsCheckbox + { + LabelText = "Show cursor trail", + Bindable = config.GetBindable(OsuSetting.ShowCursorTrail) + }, }; } } diff --git a/osu.Game/Configuration/GameConfigManager.cs b/osu.Game/Configuration/GameConfigManager.cs index 736273dc35..b2f2a8e971 100644 --- a/osu.Game/Configuration/GameConfigManager.cs +++ b/osu.Game/Configuration/GameConfigManager.cs @@ -72,9 +72,6 @@ namespace osu.Game.Configuration Set(GameSetting.MenuParallax, true); - Set(GameSetting.SnakingInSliders, true); - Set(GameSetting.SnakingOutSliders, true); - // Gameplay Set(GameSetting.DimLevel, 0.3, 0, 1, 0.01); Set(GameSetting.BlurLevel, 0, 0, 1, 0.01); @@ -150,8 +147,6 @@ namespace osu.Game.Configuration DisplayStarsMinimum, DisplayStarsMaximum, RandomSelectAlgorithm, - SnakingInSliders, - SnakingOutSliders, ShowFpsDisplay, ChatDisplayHeight, Version, From 3e936d386d6975984942e0862b766b0d161b12ec Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 14:54:03 +0100 Subject: [PATCH 02/90] add missing dependency --- osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs index 472da88e1f..b24abc3d0a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.Cursor; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Tests.Visual; @@ -20,6 +21,16 @@ namespace osu.Game.Rulesets.Osu.Tests public override IReadOnlyList RequiredTypes => new [] { typeof(CursorTrail) }; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + var configCache = dependencies.Get(); + dependencies.CacheAs((OsuConfigManager)configCache.GetConfigFor(new OsuRuleset())); + + return dependencies; + } + public CursorContainer Cursor => cursor; public bool ProvidingUserCursor => true; From 92edafc44a370ad4bdc4312c70190319a1aca3dc Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 15:01:35 +0100 Subject: [PATCH 03/90] yeet whitespace --- osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs index b24abc3d0a..89b62116c5 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests return dependencies; } - + public CursorContainer Cursor => cursor; public bool ProvidingUserCursor => true; From 559960036e61edf1caefb5670fe9c939dad0ef59 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 5 Feb 2019 14:48:35 +0300 Subject: [PATCH 04/90] update top score design --- .../Graphics/Containers/OsuHoverContainer.cs | 10 +- .../BeatmapSet/Scores/ClickableUsername.cs | 15 +- .../BeatmapSet/Scores/DrawableScore.cs | 16 +- .../BeatmapSet/Scores/DrawableTopScore.cs | 422 ++++++++++++------ .../BeatmapSet/Scores/ScoresContainer.cs | 7 + 5 files changed, 328 insertions(+), 142 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index 276b0f9dd1..091499b7cd 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -1,12 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; -using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input.Events; +using osuTK.Graphics; +using System.Collections.Generic; namespace osu.Game.Graphics.Containers { @@ -16,17 +16,19 @@ namespace osu.Game.Graphics.Containers protected Color4 IdleColour = Color4.White; + protected const float FADE_DURATION = 500; + protected virtual IEnumerable EffectTargets => new[] { Content }; protected override bool OnHover(HoverEvent e) { - EffectTargets.ForEach(d => d.FadeColour(HoverColour, 500, Easing.OutQuint)); + EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - EffectTargets.ForEach(d => d.FadeColour(IdleColour, 500, Easing.OutQuint)); + EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); base.OnHoverLost(e); } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index 0eb8b325d3..e2aade986d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -3,16 +3,20 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; +using System.Collections.Generic; namespace osu.Game.Overlays.BeatmapSet.Scores { public class ClickableUsername : OsuHoverContainer { - private readonly OsuSpriteText text; + private readonly SpriteText text; + protected override IEnumerable EffectTargets => new[] { text }; + private UserProfileOverlay profile; private User user; @@ -24,7 +28,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (user == value) return; user = value; - text.Text = user.Username; + OnUserUpdate(user); } } @@ -41,12 +45,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public ClickableUsername() { AutoSizeAxes = Axes.Both; - Child = text = new OsuSpriteText + Child = text = new SpriteText { Font = @"Exo2.0-BoldItalic", }; } + protected virtual void OnUserUpdate(User user) + { + text.Text = user.Username; + } + [BackgroundDependencyLoader(true)] private void load(UserProfileOverlay profile) { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 1f50385adc..609524f170 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,6 +15,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Users; +using osuTK; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -56,13 +56,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Size = new Vector2(30, 20), Margin = new MarginPadding { Left = 60 } }, - new ClickableUsername - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - User = score.User, - Margin = new MarginPadding { Left = 100 } - }, + //new ClickableUsername + //{ + // Anchor = Anchor.CentreLeft, + // Origin = Anchor.CentreLeft, + // User = score.User, + // Margin = new MarginPadding { Left = 100 } + //}, modsContainer = new ScoreModsContainer { Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index c9551cf6f8..2e2bb78634 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -1,13 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; -using osuTK.Graphics; +using Humanizer; 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.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -19,29 +19,38 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Users; +using osuTK; +using osuTK.Graphics; +using System.Collections.Generic; namespace osu.Game.Overlays.BeatmapSet.Scores { public class DrawableTopScore : Container { private const float fade_duration = 100; - private const float height = 200; + private const float height = 100; private const float avatar_size = 80; private const float margin = 10; private readonly Box background; - private readonly Box bottomBackground; - private readonly Box middleLine; private readonly UpdateableAvatar avatar; private readonly DrawableFlag flag; private readonly ClickableUsername username; - private readonly OsuSpriteText rankText; - private readonly OsuSpriteText date; + private readonly SpriteText rankText; + private readonly SpriteText date; private readonly DrawableRank rank; - private readonly InfoColumn totalScore; - private readonly InfoColumn accuracy; - private readonly InfoColumn statistics; - private readonly ScoreModsContainer modsContainer; + + private readonly AutoSizeInfoColumn totalScore; + private readonly MediumInfoColumn accuracy; + private readonly MediumInfoColumn maxCombo; + + private readonly SmallInfoColumn hitGreat; + private readonly SmallInfoColumn hitGood; + private readonly SmallInfoColumn hitMeh; + private readonly SmallInfoColumn hitMiss; + private readonly SmallInfoColumn pp; + + private readonly ModsInfoColumn modsInfo; private APIScoreInfo score; public APIScoreInfo Score @@ -54,153 +63,296 @@ namespace osu.Game.Overlays.BeatmapSet.Scores avatar.User = username.User = score.User; flag.Country = score.User.Country; - date.Text = $@"achieved {score.Date:MMM d, yyyy}"; + date.Text = $@"achieved {score.Date.Humanize()}"; rank.UpdateRank(score.Rank); totalScore.Value = $@"{score.TotalScore:N0}"; accuracy.Value = $@"{score.Accuracy:P2}"; - statistics.Value = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}"; + maxCombo.Value = $@"{score.MaxCombo:N0}x"; - modsContainer.Clear(); - foreach (Mod mod in score.Mods) - modsContainer.Add(new ModIcon(mod) - { - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.45f), - }); + hitGreat.Value = $"{score.Statistics[HitResult.Great]}"; + hitGood.Value = $"{score.Statistics[HitResult.Good]}"; + hitMeh.Value = $"{score.Statistics[HitResult.Meh]}"; + hitMiss.Value = $"{score.Statistics[HitResult.Miss]}"; + pp.Value = $@"{score.PP:N0}"; + + modsInfo.ClearMods(); + modsInfo.Mods = score.Mods; } } public DrawableTopScore() { RelativeSizeAxes = Axes.X; - Height = height; - CornerRadius = 5; - BorderThickness = 4; + AutoSizeAxes = Axes.Y; + CornerRadius = 3; Masking = true; + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Radius = 1, + Offset = new Vector2(0, 1), + }; Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, //used for correct border representation - }, - avatar = new UpdateableAvatar - { - Size = new Vector2(avatar_size), - Masking = true, - CornerRadius = 5, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), - Offset = new Vector2(0, 2), - Radius = 1, - }, - Margin = new MarginPadding { Top = margin, Left = margin } - }, - flag = new DrawableFlag - { - Size = new Vector2(30, 20), - Position = new Vector2(margin * 2 + avatar_size, height / 4), - }, - username = new ClickableUsername - { - Origin = Anchor.BottomLeft, - TextSize = 30, - Position = new Vector2(margin * 2 + avatar_size, height / 4), - Margin = new MarginPadding { Bottom = 4 } - }, - rankText = new OsuSpriteText - { - Anchor = Anchor.TopRight, - Origin = Anchor.BottomRight, - Text = "#1", - TextSize = 40, - Font = @"Exo2.0-BoldItalic", - Y = height / 4, - Margin = new MarginPadding { Right = margin } - }, - date = new OsuSpriteText - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Y = height / 4, - Margin = new MarginPadding { Right = margin } + Colour = Color4.White, }, new Container { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.Both, - Height = 0.5f, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding(margin), Children = new Drawable[] { - bottomBackground = new Box { RelativeSizeAxes = Axes.Both }, - middleLine = new Box + new FillFlowContainer { - RelativeSizeAxes = Axes.X, - Height = 1, - }, - rank = new DrawableRank(ScoreRank.F) - { - Origin = Anchor.BottomLeft, - Size = new Vector2(avatar_size, 40), - FillMode = FillMode.Fit, - Y = height / 4, - Margin = new MarginPadding { Left = margin } - }, - new FillFlowContainer - { - Origin = Anchor.BottomLeft, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, - Position = new Vector2(height / 2, height / 4), Direction = FillDirection.Horizontal, - Spacing = new Vector2(15, 0), - Children = new[] + Spacing = new Vector2(margin, 0), + Children = new Drawable[] { - totalScore = new InfoColumn("Score"), - accuracy = new InfoColumn("Accuracy"), - statistics = new InfoColumn("300/100/50"), - }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 2), + Children = new Drawable[] + { + rankText = new SpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = "#1", + TextSize = 20, + Font = @"Exo2.0-BoldItalic", + }, + rank = new DrawableRank(ScoreRank.F) + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Size = new Vector2(30), + FillMode = FillMode.Fit, + }, + } + }, + avatar = new UpdateableAvatar + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(avatar_size), + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Offset = new Vector2(0, 2), + Radius = 1, + }, + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 3), + Children = new Drawable[] + { + username = new ClickableTopScoreUsername + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 20, + }, + date = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 10, + }, + flag = new DrawableFlag + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Size = new Vector2(20, 13), + }, + } + } + } }, - modsContainer = new ScoreModsContainer + new Container { - AutoSizeAxes = Axes.Y, - Width = 80, - Position = new Vector2(height / 2, height / 4), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + Children = new Drawable[] + { + totalScore = new AutoSizeInfoColumn("Total Score"), + accuracy = new MediumInfoColumn("Accuracy"), + maxCombo = new MediumInfoColumn("Max Combo"), + hitGreat = new SmallInfoColumn("300", 20), + hitGood = new SmallInfoColumn("100", 20), + hitMeh = new SmallInfoColumn("50", 20), + hitMiss = new SmallInfoColumn("miss", 20), + pp = new SmallInfoColumn("pp", 20), + modsInfo = new ModsInfoColumn("mods"), + } + } } } - }, + } }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - background.Colour = bottomBackground.Colour = colours.Gray4; - middleLine.Colour = colours.Gray2; - date.Colour = colours.Gray9; - BorderColour = rankText.Colour = colours.Yellow; + date.Colour = rankText.Colour = colours.ContextMenuGray; } protected override bool OnHover(HoverEvent e) { - background.FadeIn(fade_duration, Easing.OutQuint); + background.FadeColour(Color4.WhiteSmoke, fade_duration, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - background.FadeOut(fade_duration, Easing.OutQuint); + background.FadeColour(Color4.White, fade_duration, Easing.OutQuint); base.OnHoverLost(e); } - private class InfoColumn : FillFlowContainer + private class ClickableTopScoreUsername : ClickableUsername { - private readonly OsuSpriteText headerText; - private readonly OsuSpriteText valueText; + private Box underscore; + + public ClickableTopScoreUsername() + { + Add(new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Height = 1, + Position = new Vector2(0, TextSize / 2 + 1.5f), + Depth = 1, + Child = underscore = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + IdleColour = colours.ContextMenuGray; + HoverColour = underscore.Colour = colours.Blue; + } + + protected override bool OnHover(HoverEvent e) + { + underscore.FadeIn(FADE_DURATION, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + underscore.FadeOut(FADE_DURATION, Easing.OutQuint); + base.OnHoverLost(e); + } + } + + private class DrawableInfoColumn : FillFlowContainer + { + private readonly SpriteText headerText; + private const float header_text_size = 12; + + public DrawableInfoColumn(string header) + { + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Spacing = new Vector2(0, 2); + Children = new Drawable[] + { + new Container + { + AutoSizeAxes = Axes.X, + Height = header_text_size, + Child = headerText = new SpriteText + { + TextSize = 12, + Text = header.ToUpper(), + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = 3, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.LightGray, + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + headerText.Colour = colours.ContextMenuGray; + } + } + + private class ModsInfoColumn : DrawableInfoColumn + { + private readonly FillFlowContainer modsContainer; + + public IEnumerable Mods + { + set + { + foreach (Mod mod in value) + modsContainer.Add(new ModIcon(mod) + { + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.3f), + }); + } + } + + public ModsInfoColumn(string header) : base(header) + { + AutoSizeAxes = Axes.Both; + Add(modsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + }); + } + + public void ClearMods() => modsContainer.Clear(); + } + + private class TextInfoColumn : DrawableInfoColumn + { + private readonly SpriteText valueText; public string Value { @@ -213,31 +365,47 @@ namespace osu.Game.Overlays.BeatmapSet.Scores get { return valueText.Text; } } - public InfoColumn(string header) + public TextInfoColumn(string header, float valueTextSize = 25) : base(header) { - AutoSizeAxes = Axes.Both; - Direction = FillDirection.Vertical; - Spacing = new Vector2(0, 3); - Children = new Drawable[] + Add(valueText = new SpriteText { - headerText = new OsuSpriteText - { - TextSize = 14, - Text = header, - Font = @"Exo2.0-Bold", - }, - valueText = new OsuSpriteText - { - TextSize = 25, - Font = @"Exo2.0-RegularItalic", - } - }; + TextSize = valueTextSize, + Font = @"Exo2.0-Light", + }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - headerText.Colour = colours.Gray9; + valueText.Colour = colours.ContextMenuGray; + } + } + + private class AutoSizeInfoColumn : TextInfoColumn + { + public AutoSizeInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + { + AutoSizeAxes = Axes.Both; + } + } + + private class MediumInfoColumn : TextInfoColumn + { + private const float width = 70; + + public MediumInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + { + Width = width; + } + } + + private class SmallInfoColumn : TextInfoColumn + { + private const float width = 40; + + public SmallInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + { + Width = width; } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index ab34d2ba1d..ac3068c2c8 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -12,6 +12,8 @@ using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; +using osu.Framework.Graphics.Shapes; +using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -98,6 +100,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores AutoSizeAxes = Axes.Y; Children = new Drawable[] { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, new FillFlowContainer { Anchor = Anchor.TopCentre, From f560dde157acd3bb83cf417fd6d10a8d67088576 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 5 Feb 2019 15:26:45 +0300 Subject: [PATCH 05/90] Add some flow for info containers --- .../BeatmapSet/Scores/DrawableTopScore.cs | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 2e2bb78634..d061e176e0 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -193,23 +193,49 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.7f, Child = new FillFlowContainer { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(margin, 0), + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Spacing = new Vector2(margin), Children = new Drawable[] { - totalScore = new AutoSizeInfoColumn("Total Score"), - accuracy = new MediumInfoColumn("Accuracy"), - maxCombo = new MediumInfoColumn("Max Combo"), - hitGreat = new SmallInfoColumn("300", 20), - hitGood = new SmallInfoColumn("100", 20), - hitMeh = new SmallInfoColumn("50", 20), - hitMiss = new SmallInfoColumn("miss", 20), - pp = new SmallInfoColumn("pp", 20), - modsInfo = new ModsInfoColumn("mods"), + new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + Children = new Drawable[] + { + hitGreat = new SmallInfoColumn("300", 20), + hitGood = new SmallInfoColumn("100", 20), + hitMeh = new SmallInfoColumn("50", 20), + hitMiss = new SmallInfoColumn("miss", 20), + pp = new SmallInfoColumn("pp", 20), + modsInfo = new ModsInfoColumn("mods"), + } + }, + new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + Children = new Drawable[] + { + totalScore = new AutoSizeInfoColumn("Total Score"), + accuracy = new MediumInfoColumn("Accuracy"), + maxCombo = new MediumInfoColumn("Max Combo"), + } + }, } } } @@ -248,7 +274,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Height = 1, - Position = new Vector2(0, TextSize / 2 + 1.5f), + Position = new Vector2(0, TextSize / 2 - 1), Depth = 1, Child = underscore = new Box { From c85dc1a2362434298d57661f4cd87e8f71f4e049 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 5 Feb 2019 19:32:33 +0300 Subject: [PATCH 06/90] update another scores design --- .../Visual/TestCaseBeatmapSetOverlay.cs | 8 +- ...eUsername.cs => ClickableUserContainer.cs} | 29 +- .../BeatmapSet/Scores/DrawableScore.cs | 278 ++++++++++++++---- .../BeatmapSet/Scores/DrawableTopScore.cs | 46 ++- .../BeatmapSet/Scores/ScoreTextLine.cs | 118 ++++++++ .../BeatmapSet/Scores/ScoresContainer.cs | 18 +- 6 files changed, 397 insertions(+), 100 deletions(-) rename osu.Game/Overlays/BeatmapSet/Scores/{ClickableUsername.cs => ClickableUserContainer.cs} (60%) create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs index b98014b866..20609dc595 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs @@ -1,9 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; -using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; @@ -13,6 +10,9 @@ using osu.Game.Overlays.BeatmapSet.Buttons; using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets; using osu.Game.Users; +using System; +using System.Collections.Generic; +using System.Linq; namespace osu.Game.Tests.Visual { @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { typeof(Header), - typeof(ClickableUsername), + typeof(ClickableUserContainer), typeof(DrawableScore), typeof(DrawableTopScore), typeof(ScoresContainer), diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs similarity index 60% rename from osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs rename to osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs index e2aade986d..2f402bfa74 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; @@ -12,11 +13,8 @@ using System.Collections.Generic; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ClickableUsername : OsuHoverContainer + public abstract class ClickableUserContainer : Container { - private readonly SpriteText text; - protected override IEnumerable EffectTargets => new[] { text }; - private UserProfileOverlay profile; private User user; @@ -28,33 +26,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (user == value) return; user = value; - OnUserUpdate(user); + OnUserChange(user); } } - public float TextSize - { - set - { - if (text.TextSize == value) return; - text.TextSize = value; - } - get { return text.TextSize; } - } - - public ClickableUsername() + public ClickableUserContainer() { AutoSizeAxes = Axes.Both; - Child = text = new SpriteText - { - Font = @"Exo2.0-BoldItalic", - }; } - protected virtual void OnUserUpdate(User user) - { - text.Text = user.Username; - } + protected abstract void OnUserChange(User user); [BackgroundDependencyLoader(true)] private void load(UserProfileOverlay profile) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 609524f170..6f6fd22a13 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -5,6 +5,7 @@ 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.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -16,62 +17,63 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Users; using osuTK; +using osuTK.Graphics; +using System.Collections.Generic; namespace osu.Game.Overlays.BeatmapSet.Scores { public class DrawableScore : Container { private const int fade_duration = 100; - private const float side_margin = 20; + private const float text_size = 14; private readonly Box background; + private readonly Box hoveredBackground; + private readonly SpriteText rank; + private readonly SpriteText scoreText; + private readonly SpriteText accuracy; + private readonly SpriteText maxCombo; + private readonly SpriteText hitGreat; + private readonly SpriteText hitGood; + private readonly SpriteText hitMeh; + private readonly SpriteText hitMiss; + private readonly SpriteText pp; + + private readonly ClickableScoreUsername username; + + private readonly APIScoreInfo score; + private Color4 backgroundColor; public DrawableScore(int index, APIScoreInfo score) { - ScoreModsContainer modsContainer; + FillFlowContainer modsContainer; + + this.score = score; RelativeSizeAxes = Axes.X; - Height = 30; + Height = 25; CornerRadius = 3; Masking = true; Children = new Drawable[] { background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + hoveredBackground = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0, }, - new OsuSpriteText + rank = new SpriteText { Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, + Origin = Anchor.CentreRight, Text = $"#{index + 1}", - Font = @"Exo2.0-RegularItalic", - Margin = new MarginPadding { Left = side_margin } - }, - new DrawableFlag(score.User.Country) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Size = new Vector2(30, 20), - Margin = new MarginPadding { Left = 60 } - }, - //new ClickableUsername - //{ - // Anchor = Anchor.CentreLeft, - // Origin = Anchor.CentreLeft, - // User = score.User, - // Margin = new MarginPadding { Left = 100 } - //}, - modsContainer = new ScoreModsContainer - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Width = 0.06f, - RelativePositionAxes = Axes.X, - X = 0.42f + TextSize = text_size, + X = ScoreTextLine.RANK_POSITION, + Font = @"Exo2.0-Bold", + Colour = Color4.Black, }, new DrawableRank(score.Rank) { @@ -79,64 +81,232 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, Size = new Vector2(30, 20), FillMode = FillMode.Fit, - RelativePositionAxes = Axes.X, - X = 0.55f + X = 45 }, - new OsuSpriteText + scoreText = new SpriteText { Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreRight, + Origin = Anchor.CentreLeft, Text = $@"{score.TotalScore:N0}", - Font = @"Venera", - RelativePositionAxes = Axes.X, - X = 0.75f, - FixedWidth = true, + X = ScoreTextLine.SCORE_POSITION, + Colour = Color4.Black, + TextSize = text_size, }, - new OsuSpriteText + accuracy = new SpriteText { Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreRight, + Origin = Anchor.CentreLeft, Text = $@"{score.Accuracy:P2}", - Font = @"Exo2.0-RegularItalic", - RelativePositionAxes = Axes.X, - X = 0.85f + X = ScoreTextLine.ACCURACY_POSITION, + TextSize = text_size, }, - new OsuSpriteText + new DrawableFlag(score.User.Country) { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Text = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}", - Font = @"Exo2.0-RegularItalic", - Margin = new MarginPadding { Right = side_margin } + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Size = new Vector2(20, 13), + X = 230, + }, + username = new ClickableScoreUsername + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + User = score.User, + X = ScoreTextLine.PLAYER_POSITION, + Colour = Color4.Black, + }, + maxCombo = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = $@"{score.MaxCombo:N0}x", + RelativePositionAxes = Axes.X, + X = ScoreTextLine.MAX_COMBO_POSITION, + TextSize = text_size, + Colour = Color4.Black, + }, + hitGreat = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = $"{score.Statistics[HitResult.Great]}", + RelativePositionAxes = Axes.X, + X = ScoreTextLine.HIT_GREAT_POSITION, + TextSize = text_size, + Colour = Color4.Black, + }, + hitGood = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = $"{score.Statistics[HitResult.Good]}", + RelativePositionAxes = Axes.X, + X = ScoreTextLine.HIT_GOOD_POSITION, + TextSize = text_size, + Colour = Color4.Black, + }, + hitMeh = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = $"{score.Statistics[HitResult.Meh]}", + RelativePositionAxes = Axes.X, + X = ScoreTextLine.HIT_MEH_POSITION, + TextSize = text_size, + Colour = Color4.Black, + }, + hitMiss = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = $"{score.Statistics[HitResult.Miss]}", + RelativePositionAxes = Axes.X, + X = ScoreTextLine.HIT_MISS_POSITION, + TextSize = text_size, + Colour = Color4.Black, + }, + pp = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = $@"{score.PP:N0}", + RelativePositionAxes = Axes.X, + X = ScoreTextLine.PP_POSITION, + TextSize = text_size, + Colour = Color4.Black, + }, + modsContainer = new FillFlowContainer + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = ScoreTextLine.MODS_POSITION, }, }; + if (index == 0) + scoreText.Font = @"Exo2.0-Bold"; + + accuracy.Colour = (score.Accuracy == 1) ? Color4.Green : Color4.Black; + + hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.Black; + hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.Black; + hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.Black; + hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.Black; + + background.Colour = backgroundColor = (index % 2 == 0) ? Color4.WhiteSmoke : Color4.White; + + foreach (Mod mod in score.Mods) modsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.35f), + Scale = new Vector2(0.3f), }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - background.Colour = colours.Gray4; + hoveredBackground.Colour = colours.Gray4; } protected override bool OnHover(HoverEvent e) { - background.FadeIn(fade_duration, Easing.OutQuint); + hoveredBackground.FadeIn(fade_duration, Easing.OutQuint); + rank.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + scoreText.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + accuracy.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + username.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + maxCombo.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + pp.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Great] != 0) + hitGreat.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Good] != 0) + hitGood.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Meh] != 0) + hitMeh.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Miss] != 0) + hitMiss.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - background.FadeOut(fade_duration, Easing.OutQuint); + hoveredBackground.FadeOut(fade_duration, Easing.OutQuint); + rank.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + scoreText.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + username.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + accuracy.FadeColour((score.Accuracy == 1) ? Color4.Green : Color4.Black, fade_duration, Easing.OutQuint); + maxCombo.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + pp.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Great] != 0) + hitGreat.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Good] != 0) + hitGood.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Meh] != 0) + hitMeh.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + + if (score.Statistics[HitResult.Miss] != 0) + hitMiss.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + base.OnHoverLost(e); } protected override bool OnClick(ClickEvent e) => true; + + private class ClickableScoreUsername : ClickableUserContainer + { + private readonly SpriteText text; + private readonly SpriteText textBold; + + public ClickableScoreUsername() + { + Add(text = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = text_size, + }); + + Add(textBold = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = text_size, + Font = @"Exo2.0-Bold", + Alpha = 0, + }); + } + + protected override void OnUserChange(User user) + { + text.Text = textBold.Text = user.Username; + } + + protected override bool OnHover(HoverEvent e) + { + textBold.FadeIn(fade_duration, Easing.OutQuint); + text.FadeOut(fade_duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + textBold.FadeOut(fade_duration, Easing.OutQuint); + text.FadeIn(fade_duration, Easing.OutQuint); + base.OnHoverLost(e); + } + } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index d061e176e0..7d82b05099 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly Box background; private readonly UpdateableAvatar avatar; private readonly DrawableFlag flag; - private readonly ClickableUsername username; + private readonly ClickableTopScoreUsername username; private readonly SpriteText rankText; private readonly SpriteText date; private readonly DrawableRank rank; @@ -262,44 +262,70 @@ namespace osu.Game.Overlays.BeatmapSet.Scores base.OnHoverLost(e); } - private class ClickableTopScoreUsername : ClickableUsername + private class ClickableTopScoreUsername : ClickableUserContainer { - private Box underscore; + private const float fade_duration = 500; + + private readonly Box underscore; + private readonly Container underscoreContainer; + private readonly SpriteText text; + + private Color4 hoverColour; + + public float TextSize + { + set + { + if (text.TextSize == value) return; + text.TextSize = value; + } + get { return text.TextSize; } + } public ClickableTopScoreUsername() { - Add(new Container + Add(underscoreContainer = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Height = 1, - Position = new Vector2(0, TextSize / 2 - 1), - Depth = 1, Child = underscore = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0, } }); + Add(text = new SpriteText + { + Font = @"Exo2.0-BoldItalic", + Colour = Color4.Black, + }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - IdleColour = colours.ContextMenuGray; - HoverColour = underscore.Colour = colours.Blue; + hoverColour = underscore.Colour = colours.Blue; + underscoreContainer.Position = new Vector2(0, TextSize / 2 - 1); + } + + protected override void OnUserChange(User user) + { + text.Text = user.Username; } protected override bool OnHover(HoverEvent e) { - underscore.FadeIn(FADE_DURATION, Easing.OutQuint); + text.FadeColour(hoverColour, fade_duration, Easing.OutQuint); + underscore.FadeIn(fade_duration, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - underscore.FadeOut(FADE_DURATION, Easing.OutQuint); + text.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); + underscore.FadeOut(fade_duration, Easing.OutQuint); base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs new file mode 100644 index 0000000000..d8655b4882 --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -0,0 +1,118 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +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.Graphics; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class ScoreTextLine : Container + { + private const float text_size = 12; + + public const float RANK_POSITION = 30; + public const float SCORE_POSITION = 90; + public const float ACCURACY_POSITION = 170; + public const float PLAYER_POSITION = 270; + public const float MAX_COMBO_POSITION = 0.5f; + public const float HIT_GREAT_POSITION = 0.6f; + public const float HIT_GOOD_POSITION = 0.65f; + public const float HIT_MEH_POSITION = 0.7f; + public const float HIT_MISS_POSITION = 0.75f; + public const float PP_POSITION = 0.8f; + public const float MODS_POSITION = 0.9f; + + public ScoreTextLine() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + new ScoreText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreRight, + Text = "rank".ToUpper(), + X = RANK_POSITION, + }, + new ScoreText + { + Text = "score".ToUpper(), + X = SCORE_POSITION, + }, + new ScoreText + { + Text = "accuracy".ToUpper(), + X = ACCURACY_POSITION, + }, + new ScoreText + { + Text = "player".ToUpper(), + X = PLAYER_POSITION, + }, + new ScoreText + { + Text = "max combo".ToUpper(), + X = MAX_COMBO_POSITION, + RelativePositionAxes = Axes.X, + }, + new ScoreText + { + Text = "300", + RelativePositionAxes = Axes.X, + X = HIT_GREAT_POSITION, + }, + new ScoreText + { + Text = "100".ToUpper(), + RelativePositionAxes = Axes.X, + X = HIT_GOOD_POSITION, + }, + new ScoreText + { + Text = "50".ToUpper(), + RelativePositionAxes = Axes.X, + X = HIT_MEH_POSITION, + }, + new ScoreText + { + Text = "miss".ToUpper(), + RelativePositionAxes = Axes.X, + X = HIT_MISS_POSITION, + }, + new ScoreText + { + Text = "pp".ToUpper(), + RelativePositionAxes = Axes.X, + X = PP_POSITION, + }, + new ScoreText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Text = "mods".ToUpper(), + X = MODS_POSITION, + RelativePositionAxes = Axes.X, + }, + }; + } + + private class ScoreText : SpriteText + { + public ScoreText() + { + TextSize = text_size; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.ContextMenuGray; + } + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index ac3068c2c8..5fd1084a14 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -1,19 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osuTK; +using osuTK.Graphics; using System.Collections.Generic; using System.Linq; -using osu.Framework.Allocation; -using osu.Game.Beatmaps; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests.Responses; -using osu.Framework.Graphics.Shapes; -using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -90,7 +90,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (scoreCount < 2) return; - for (int i = 1; i < scoreCount; i++) + flow.Add(new ScoreTextLine()); + + for (int i = 0; i < scoreCount; i++) flow.Add(new DrawableScore(i, scores.ElementAt(i))); } From 9cca11fb0d71c81f930cb48dd95a6ff9962cdd8f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 6 Feb 2019 01:48:43 +0300 Subject: [PATCH 07/90] Warning fixes --- .../BeatmapSet/Scores/ClickableUserContainer.cs | 6 +----- osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs | 9 ++------- .../Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 12 +++++------- osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs | 1 - 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs index 2f402bfa74..621e1ee1f2 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs @@ -4,12 +4,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Users; -using System.Collections.Generic; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -30,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } - public ClickableUserContainer() + protected ClickableUserContainer() { AutoSizeAxes = Axes.Both; } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 6f6fd22a13..c2f198d3ee 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -8,17 +8,14 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; -using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Users; using osuTK; using osuTK.Graphics; -using System.Collections.Generic; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -27,7 +24,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private const int fade_duration = 100; private const float text_size = 14; - private readonly Box background; private readonly Box hoveredBackground; private readonly SpriteText rank; private readonly SpriteText scoreText; @@ -42,11 +38,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly ClickableScoreUsername username; private readonly APIScoreInfo score; - private Color4 backgroundColor; public DrawableScore(int index, APIScoreInfo score) { FillFlowContainer modsContainer; + Box background; this.score = score; @@ -196,8 +192,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.Black; hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.Black; - background.Colour = backgroundColor = (index % 2 == 0) ? Color4.WhiteSmoke : Color4.White; - + background.Colour = (index % 2 == 0) ? Color4.WhiteSmoke : Color4.White; foreach (Mod mod in score.Mods) modsContainer.Add(new ModIcon(mod) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 7d82b05099..48b824390d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -10,10 +10,8 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; -using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -264,7 +262,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private class ClickableTopScoreUsername : ClickableUserContainer { - private const float fade_duration = 500; + private const float username_fade_duration = 500; private readonly Box underscore; private readonly Container underscoreContainer; @@ -317,15 +315,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores protected override bool OnHover(HoverEvent e) { - text.FadeColour(hoverColour, fade_duration, Easing.OutQuint); - underscore.FadeIn(fade_duration, Easing.OutQuint); + text.FadeColour(hoverColour, username_fade_duration, Easing.OutQuint); + underscore.FadeIn(username_fade_duration, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - text.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - underscore.FadeOut(fade_duration, Easing.OutQuint); + text.FadeColour(Color4.Black, username_fade_duration, Easing.OutQuint); + underscore.FadeOut(username_fade_duration, Easing.OutQuint); base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs index d8655b4882..53a477b908 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -5,7 +5,6 @@ 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.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores From f43ee6b6a36f12c54de0a2c941c27a01bcb85626 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 8 Feb 2019 19:06:46 +0300 Subject: [PATCH 08/90] update drawable top score inline with the latest design --- .../BeatmapSet/Scores/DrawableTopScore.cs | 85 ++++++++----------- .../BeatmapSet/Scores/ScoresContainer.cs | 7 -- 2 files changed, 35 insertions(+), 57 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 48b824390d..487194c819 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -30,6 +30,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private const float avatar_size = 80; private const float margin = 10; + private OsuColour colours; + + private Color4 backgroundIdleColour => colours.Gray3; + private Color4 backgroundHoveredColour => colours.Gray4; + private readonly Box background; private readonly UpdateableAvatar avatar; private readonly DrawableFlag flag; @@ -38,8 +43,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly SpriteText date; private readonly DrawableRank rank; - private readonly AutoSizeInfoColumn totalScore; - private readonly MediumInfoColumn accuracy; + private readonly AutoSizedInfoColumn totalScore; + private readonly AutoSizedInfoColumn accuracy; private readonly MediumInfoColumn maxCombo; private readonly SmallInfoColumn hitGreat; @@ -56,7 +61,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores get { return score; } set { - if (score == value) return; + if (score == value) + return; score = value; avatar.User = username.User = score.User; @@ -83,7 +89,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - CornerRadius = 3; + CornerRadius = 10; Masking = true; EdgeEffect = new EdgeEffectParameters { @@ -97,7 +103,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores background = new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4.White, }, new Container { @@ -115,31 +120,20 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - new FillFlowContainer + rankText = new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 2), - Children = new Drawable[] - { - rankText = new SpriteText - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Text = "#1", - TextSize = 20, - Font = @"Exo2.0-BoldItalic", - }, - rank = new DrawableRank(ScoreRank.F) - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Size = new Vector2(30), - FillMode = FillMode.Fit, - }, - } + Text = "#1", + TextSize = 30, + Font = @"Exo2.0-BoldItalic", + }, + rank = new DrawableRank(ScoreRank.F) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(40), + FillMode = FillMode.Fit, }, avatar = new UpdateableAvatar { @@ -229,8 +223,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - totalScore = new AutoSizeInfoColumn("Total Score"), - accuracy = new MediumInfoColumn("Accuracy"), + totalScore = new AutoSizedInfoColumn("Total Score"), + accuracy = new AutoSizedInfoColumn("Accuracy"), maxCombo = new MediumInfoColumn("Max Combo"), } }, @@ -245,18 +239,21 @@ namespace osu.Game.Overlays.BeatmapSet.Scores [BackgroundDependencyLoader] private void load(OsuColour colours) { - date.Colour = rankText.Colour = colours.ContextMenuGray; + this.colours = colours; + + rankText.Colour = colours.Yellow; + background.Colour = backgroundIdleColour; } protected override bool OnHover(HoverEvent e) { - background.FadeColour(Color4.WhiteSmoke, fade_duration, Easing.OutQuint); + background.FadeColour(backgroundHoveredColour, fade_duration, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - background.FadeColour(Color4.White, fade_duration, Easing.OutQuint); + background.FadeColour(backgroundIdleColour, fade_duration, Easing.OutQuint); base.OnHoverLost(e); } @@ -274,7 +271,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { set { - if (text.TextSize == value) return; + if (text.TextSize == value) + return; text.TextSize = value; } get { return text.TextSize; } @@ -297,7 +295,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Add(text = new SpriteText { Font = @"Exo2.0-BoldItalic", - Colour = Color4.Black, }); } @@ -322,7 +319,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores protected override void OnHoverLost(HoverLostEvent e) { - text.FadeColour(Color4.Black, username_fade_duration, Easing.OutQuint); + text.FadeColour(Color4.White, username_fade_duration, Easing.OutQuint); underscore.FadeOut(username_fade_duration, Easing.OutQuint); base.OnHoverLost(e); } @@ -348,6 +345,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { TextSize = 12, Text = header.ToUpper(), + Font = @"Exo2.0-Bold", } }, new Container @@ -362,12 +360,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } }; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - headerText.Colour = colours.ContextMenuGray; - } } private class ModsInfoColumn : DrawableInfoColumn @@ -420,20 +412,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Add(valueText = new SpriteText { TextSize = valueTextSize, - Font = @"Exo2.0-Light", }); } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - valueText.Colour = colours.ContextMenuGray; - } } - private class AutoSizeInfoColumn : TextInfoColumn + private class AutoSizedInfoColumn : TextInfoColumn { - public AutoSizeInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + public AutoSizedInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) { AutoSizeAxes = Axes.Both; } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 5fd1084a14..5211f1398f 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -4,14 +4,12 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osuTK; -using osuTK.Graphics; using System.Collections.Generic; using System.Linq; @@ -102,11 +100,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores AutoSizeAxes = Axes.Y; Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White, - }, new FillFlowContainer { Anchor = Anchor.TopCentre, From 7a3ae0f479bebb101ad8b00828419ff0eae5291d Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 8 Feb 2019 19:50:02 +0300 Subject: [PATCH 09/90] update drawable score inline with the latest design --- .../BeatmapSet/Scores/DrawableScore.cs | 75 ++++--------------- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 58 ++++++++++++++ .../BeatmapSet/Scores/ScoreTextLine.cs | 16 +--- .../BeatmapSet/Scores/ScoresContainer.cs | 22 +++--- 4 files changed, 87 insertions(+), 84 deletions(-) create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index c2f198d3ee..1076fe6449 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -25,6 +25,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private const float text_size = 14; private readonly Box hoveredBackground; + private readonly Box background; + private readonly SpriteText rank; private readonly SpriteText scoreText; private readonly SpriteText accuracy; @@ -39,10 +41,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly APIScoreInfo score; - public DrawableScore(int index, APIScoreInfo score) + public DrawableScore(int index, APIScoreInfo score, int maxModsAmount) { FillFlowContainer modsContainer; - Box background; this.score = score; @@ -69,7 +70,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores TextSize = text_size, X = ScoreTextLine.RANK_POSITION, Font = @"Exo2.0-Bold", - Colour = Color4.Black, }, new DrawableRank(score.Rank) { @@ -85,7 +85,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, Text = $@"{score.TotalScore:N0}", X = ScoreTextLine.SCORE_POSITION, - Colour = Color4.Black, TextSize = text_size, }, accuracy = new SpriteText @@ -109,7 +108,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, User = score.User, X = ScoreTextLine.PLAYER_POSITION, - Colour = Color4.Black, }, maxCombo = new SpriteText { @@ -119,7 +117,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativePositionAxes = Axes.X, X = ScoreTextLine.MAX_COMBO_POSITION, TextSize = text_size, - Colour = Color4.Black, }, hitGreat = new SpriteText { @@ -129,7 +126,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativePositionAxes = Axes.X, X = ScoreTextLine.HIT_GREAT_POSITION, TextSize = text_size, - Colour = Color4.Black, }, hitGood = new SpriteText { @@ -139,7 +135,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativePositionAxes = Axes.X, X = ScoreTextLine.HIT_GOOD_POSITION, TextSize = text_size, - Colour = Color4.Black, }, hitMeh = new SpriteText { @@ -149,7 +144,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativePositionAxes = Axes.X, X = ScoreTextLine.HIT_MEH_POSITION, TextSize = text_size, - Colour = Color4.Black, }, hitMiss = new SpriteText { @@ -159,7 +153,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativePositionAxes = Axes.X, X = ScoreTextLine.HIT_MISS_POSITION, TextSize = text_size, - Colour = Color4.Black, }, pp = new SpriteText { @@ -169,34 +162,35 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativePositionAxes = Axes.X, X = ScoreTextLine.PP_POSITION, TextSize = text_size, - Colour = Color4.Black, }, modsContainer = new FillFlowContainer { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreLeft, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = ScoreTextLine.MODS_POSITION, + X = -30 * maxModsAmount, }, }; if (index == 0) scoreText.Font = @"Exo2.0-Bold"; - accuracy.Colour = (score.Accuracy == 1) ? Color4.Green : Color4.Black; + accuracy.Colour = (score.Accuracy == 1) ? Color4.LightGreen : Color4.White; - hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.Black; - hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.Black; - hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.Black; - hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.Black; + hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.White; + hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.White; + hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.White; + hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.White; - background.Colour = (index % 2 == 0) ? Color4.WhiteSmoke : Color4.White; + if (index % 2 == 0) + background.Alpha = 0; foreach (Mod mod in score.Mods) modsContainer.Add(new ModIcon(mod) { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Scale = new Vector2(0.3f), }); @@ -206,55 +200,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private void load(OsuColour colours) { hoveredBackground.Colour = colours.Gray4; + background.Colour = colours.Gray3; } protected override bool OnHover(HoverEvent e) { hoveredBackground.FadeIn(fade_duration, Easing.OutQuint); - rank.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - scoreText.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - accuracy.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - username.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - maxCombo.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - pp.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Great] != 0) - hitGreat.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Good] != 0) - hitGood.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Meh] != 0) - hitMeh.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Miss] != 0) - hitMiss.FadeColour(Color4.White, fade_duration, Easing.OutQuint); - return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { hoveredBackground.FadeOut(fade_duration, Easing.OutQuint); - rank.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - scoreText.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - username.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - accuracy.FadeColour((score.Accuracy == 1) ? Color4.Green : Color4.Black, fade_duration, Easing.OutQuint); - maxCombo.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - pp.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Great] != 0) - hitGreat.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Good] != 0) - hitGood.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Meh] != 0) - hitMeh.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - - if (score.Statistics[HitResult.Miss] != 0) - hitMiss.FadeColour(Color4.Black, fade_duration, Easing.OutQuint); - base.OnHoverLost(e); } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs new file mode 100644 index 0000000000..90947364e4 --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -0,0 +1,58 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; +using System.Collections.Generic; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class ScoreTable : FillFlowContainer + { + private IEnumerable scores; + public IEnumerable Scores + { + set + { + scores = value; + + int maxModsAmount = 0; + foreach (var s in scores) + { + var scoreModsAmount = s.Mods.Length; + if (scoreModsAmount > maxModsAmount) + maxModsAmount = scoreModsAmount; + } + + Add(new ScoreTextLine(maxModsAmount)); + + + int index = 0; + foreach (var s in scores) + Add(new DrawableScore(index++, s, maxModsAmount)); + } + get + { + return scores; + } + } + + public ScoreTable() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + } + + public void ClearScores() + { + scores = null; + foreach (var s in this) + { + if (s is DrawableScore) + Remove(s); + } + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs index 53a477b908..43255683c4 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -23,9 +23,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public const float HIT_MEH_POSITION = 0.7f; public const float HIT_MISS_POSITION = 0.75f; public const float PP_POSITION = 0.8f; - public const float MODS_POSITION = 0.9f; - public ScoreTextLine() + public ScoreTextLine(int maxModsAmount) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -91,11 +90,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }, new ScoreText { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreLeft, Text = "mods".ToUpper(), - X = MODS_POSITION, - RelativePositionAxes = Axes.X, + X = -30 * maxModsAmount, }, }; } @@ -106,12 +104,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { TextSize = text_size; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.ContextMenuGray; - } } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 5211f1398f..8f3414c292 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -20,7 +20,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private const int spacing = 15; private const int fade_duration = 200; - private readonly FillFlowContainer flow; + private readonly ScoreTable scoreTable; + private readonly DrawableTopScore topScore; private readonly LoadingAnimation loadingAnimation; @@ -76,22 +77,19 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (scoreCount == 0) { topScore.Hide(); - flow.Clear(); + scoreTable.ClearScores(); return; } topScore.Score = scores.FirstOrDefault(); topScore.Show(); - flow.Clear(); + scoreTable.ClearScores(); if (scoreCount < 2) return; - flow.Add(new ScoreTextLine()); - - for (int i = 0; i < scoreCount; i++) - flow.Add(new DrawableScore(i, scores.ElementAt(i))); + scoreTable.Scores = scores; } public ScoresContainer() @@ -113,13 +111,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Children = new Drawable[] { topScore = new DrawableTopScore(), - flow = new FillFlowContainer + scoreTable = new ScoreTable { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 1), - }, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + } } }, loadingAnimation = new LoadingAnimation From 13c154a0b37f2c4c89f66d697dab122ec9a754d4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 8 Feb 2019 20:07:21 +0300 Subject: [PATCH 10/90] Fix background colour and a bug with removing scores --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 7 ++----- .../Overlays/BeatmapSet/Scores/ScoresContainer.cs | 12 +++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 90947364e4..7de13b7204 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -48,11 +49,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public void ClearScores() { scores = null; - foreach (var s in this) - { - if (s is DrawableScore) - Remove(s); - } + Clear(); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 8f3414c292..2a9e76874e 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -4,12 +4,15 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osuTK; +using osuTK.Graphics; using System.Collections.Generic; using System.Linq; @@ -20,6 +23,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private const int spacing = 15; private const int fade_duration = 200; + private readonly Box background; private readonly ScoreTable scoreTable; private readonly DrawableTopScore topScore; @@ -98,6 +102,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores AutoSizeAxes = Axes.Y; Children = new Drawable[] { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, new FillFlowContainer { Anchor = Anchor.TopCentre, @@ -127,9 +135,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } [BackgroundDependencyLoader] - private void load(APIAccess api) + private void load(APIAccess api, OsuColour colours) { this.api = api; + + background.Colour = colours.Gray2; updateDisplay(); } From bd1f4f954955bf426225e67d9db270c275135483 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 8 Feb 2019 20:35:07 +0300 Subject: [PATCH 11/90] Small design fixes --- .../BeatmapSet/Scores/DrawableScore.cs | 2 +- .../BeatmapSet/Scores/DrawableTopScore.cs | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 1076fe6449..cb9d89dc2c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -176,7 +176,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (index == 0) scoreText.Font = @"Exo2.0-Bold"; - accuracy.Colour = (score.Accuracy == 1) ? Color4.LightGreen : Color4.White; + accuracy.Colour = (score.Accuracy == 1) ? Color4.GreenYellow : Color4.White; hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.White; hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.White; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 487194c819..903e86423b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -169,7 +169,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TextSize = 10, + TextSize = 15, + Font = @"Exo2.0-Bold", }, flag = new DrawableFlag { @@ -327,9 +328,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private class DrawableInfoColumn : FillFlowContainer { - private readonly SpriteText headerText; private const float header_text_size = 12; + private readonly SpriteText headerText; + private readonly Box line; + public DrawableInfoColumn(string header) { AutoSizeAxes = Axes.Y; @@ -351,15 +354,20 @@ namespace osu.Game.Overlays.BeatmapSet.Scores new Container { RelativeSizeAxes = Axes.X, - Height = 3, - Child = new Box + Height = 2, + Child = line = new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4.LightGray, } } }; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + line.Colour = colours.Gray5; + } } private class ModsInfoColumn : DrawableInfoColumn From 107e0a5239be8e629d4c0a5498fd49ff03e082be Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 8 Feb 2019 20:43:11 +0300 Subject: [PATCH 12/90] Warning fixes --- .../BeatmapSet/Scores/DrawableScore.cs | 31 +++++++------------ .../BeatmapSet/Scores/DrawableTopScore.cs | 7 ++--- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 -- .../BeatmapSet/Scores/ScoreTextLine.cs | 2 -- .../BeatmapSet/Scores/ScoresContainer.cs | 1 - 5 files changed, 14 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index cb9d89dc2c..d37bbe5db0 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -27,25 +27,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly Box hoveredBackground; private readonly Box background; - private readonly SpriteText rank; - private readonly SpriteText scoreText; - private readonly SpriteText accuracy; - private readonly SpriteText maxCombo; - private readonly SpriteText hitGreat; - private readonly SpriteText hitGood; - private readonly SpriteText hitMeh; - private readonly SpriteText hitMiss; - private readonly SpriteText pp; - - private readonly ClickableScoreUsername username; - - private readonly APIScoreInfo score; - public DrawableScore(int index, APIScoreInfo score, int maxModsAmount) { - FillFlowContainer modsContainer; + SpriteText accuracy; + SpriteText scoreText; + SpriteText hitGreat; + SpriteText hitGood; + SpriteText hitMeh; + SpriteText hitMiss; - this.score = score; + FillFlowContainer modsContainer; RelativeSizeAxes = Axes.X; Height = 25; @@ -62,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativeSizeAxes = Axes.Both, Alpha = 0, }, - rank = new SpriteText + new SpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, @@ -102,14 +93,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Size = new Vector2(20, 13), X = 230, }, - username = new ClickableScoreUsername + new ClickableScoreUsername { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, User = score.User, X = ScoreTextLine.PLAYER_POSITION, }, - maxCombo = new SpriteText + new SpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -154,7 +145,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores X = ScoreTextLine.HIT_MISS_POSITION, TextSize = text_size, }, - pp = new SpriteText + new SpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 903e86423b..d2421ec606 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -330,10 +330,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { private const float header_text_size = 12; - private readonly SpriteText headerText; private readonly Box line; - public DrawableInfoColumn(string header) + protected DrawableInfoColumn(string header) { AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; @@ -344,7 +343,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { AutoSizeAxes = Axes.X, Height = header_text_size, - Child = headerText = new SpriteText + Child = new SpriteText { TextSize = 12, Text = header.ToUpper(), @@ -415,7 +414,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores get { return valueText.Text; } } - public TextInfoColumn(string header, float valueTextSize = 25) : base(header) + protected TextInfoColumn(string header, float valueTextSize = 25) : base(header) { Add(valueText = new SpriteText { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 7de13b7204..1b20b2c382 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -28,7 +27,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Add(new ScoreTextLine(maxModsAmount)); - int index = 0; foreach (var s in scores) Add(new DrawableScore(index++, s, maxModsAmount)); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs index 43255683c4..04934185a1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -1,11 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 2a9e76874e..2783b0483b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -12,7 +12,6 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osuTK; -using osuTK.Graphics; using System.Collections.Generic; using System.Linq; From 105053e91b01bfb86a8af60b82fa25b2a7acb344 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 9 Feb 2019 00:56:41 +0300 Subject: [PATCH 13/90] TestCase fix --- osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs | 8 ++++++-- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 321a38d087..bcc1774729 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -17,10 +17,11 @@ using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Osu; using osu.Game.Scoring; +using NUnit.Framework; namespace osu.Game.Tests.Visual { - [System.ComponentModel.Description("in BeatmapOverlay")] + [Description("in BeatmapOverlay")] public class TestCaseBeatmapScoresContainer : OsuTestCase { private readonly IEnumerable scores; @@ -160,11 +161,12 @@ namespace osu.Game.Tests.Visual Accuracy = 0.6543, }, }; - foreach(var s in scores) + foreach (var s in scores) { s.Statistics.Add(HitResult.Great, RNG.Next(2000)); s.Statistics.Add(HitResult.Good, RNG.Next(2000)); s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); + s.Statistics.Add(HitResult.Miss, RNG.Next(2000)); } anotherScores = new[] @@ -277,6 +279,7 @@ namespace osu.Game.Tests.Visual s.Statistics.Add(HitResult.Great, RNG.Next(2000)); s.Statistics.Add(HitResult.Good, RNG.Next(2000)); s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); + s.Statistics.Add(HitResult.Miss, RNG.Next(2000)); } topScoreInfo = new APIScoreInfo @@ -304,6 +307,7 @@ namespace osu.Game.Tests.Visual topScoreInfo.Statistics.Add(HitResult.Great, RNG.Next(2000)); topScoreInfo.Statistics.Add(HitResult.Good, RNG.Next(2000)); topScoreInfo.Statistics.Add(HitResult.Meh, RNG.Next(2000)); + topScoreInfo.Statistics.Add(HitResult.Miss, RNG.Next(2000)); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 2783b0483b..180f4a949c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -73,6 +73,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private void updateDisplay() { + scoreTable.ClearScores(); + loading = false; var scoreCount = scores?.Count() ?? 0; @@ -80,15 +82,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (scoreCount == 0) { topScore.Hide(); - scoreTable.ClearScores(); return; } topScore.Score = scores.FirstOrDefault(); topScore.Show(); - scoreTable.ClearScores(); - if (scoreCount < 2) return; From 04e57d7d3dcd2dc7423a6ef077437abafcfeb7e9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 9 Feb 2019 06:23:58 +0300 Subject: [PATCH 14/90] Refactor to make things more flexible --- .../BeatmapSet/Scores/DrawableScore.cs | 242 ++++++++---------- .../BeatmapSet/Scores/DrawableTopScore.cs | 2 +- .../BeatmapSet/Scores/ScoreTableLine.cs | 183 +++++++++++++ .../BeatmapSet/Scores/ScoreTextLine.cs | 146 ++++------- 4 files changed, 341 insertions(+), 232 deletions(-) create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index d37bbe5db0..8741fd8dfe 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -22,24 +22,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public class DrawableScore : Container { private const int fade_duration = 100; - private const float text_size = 14; + private const int text_size = 14; private readonly Box hoveredBackground; private readonly Box background; public DrawableScore(int index, APIScoreInfo score, int maxModsAmount) { - SpriteText accuracy; - SpriteText scoreText; - SpriteText hitGreat; - SpriteText hitGood; - SpriteText hitMeh; - SpriteText hitMiss; - - FillFlowContainer modsContainer; - RelativeSizeAxes = Axes.X; - Height = 25; + AutoSizeAxes = Axes.Y; CornerRadius = 3; Masking = true; Children = new Drawable[] @@ -53,138 +44,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativeSizeAxes = Axes.Both, Alpha = 0, }, - new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreRight, - Text = $"#{index + 1}", - TextSize = text_size, - X = ScoreTextLine.RANK_POSITION, - Font = @"Exo2.0-Bold", - }, - new DrawableRank(score.Rank) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Size = new Vector2(30, 20), - FillMode = FillMode.Fit, - X = 45 - }, - scoreText = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $@"{score.TotalScore:N0}", - X = ScoreTextLine.SCORE_POSITION, - TextSize = text_size, - }, - accuracy = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $@"{score.Accuracy:P2}", - X = ScoreTextLine.ACCURACY_POSITION, - TextSize = text_size, - }, - new DrawableFlag(score.User.Country) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Size = new Vector2(20, 13), - X = 230, - }, - new ClickableScoreUsername - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - User = score.User, - X = ScoreTextLine.PLAYER_POSITION, - }, - new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $@"{score.MaxCombo:N0}x", - RelativePositionAxes = Axes.X, - X = ScoreTextLine.MAX_COMBO_POSITION, - TextSize = text_size, - }, - hitGreat = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $"{score.Statistics[HitResult.Great]}", - RelativePositionAxes = Axes.X, - X = ScoreTextLine.HIT_GREAT_POSITION, - TextSize = text_size, - }, - hitGood = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $"{score.Statistics[HitResult.Good]}", - RelativePositionAxes = Axes.X, - X = ScoreTextLine.HIT_GOOD_POSITION, - TextSize = text_size, - }, - hitMeh = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $"{score.Statistics[HitResult.Meh]}", - RelativePositionAxes = Axes.X, - X = ScoreTextLine.HIT_MEH_POSITION, - TextSize = text_size, - }, - hitMiss = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $"{score.Statistics[HitResult.Miss]}", - RelativePositionAxes = Axes.X, - X = ScoreTextLine.HIT_MISS_POSITION, - TextSize = text_size, - }, - new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = $@"{score.PP:N0}", - RelativePositionAxes = Axes.X, - X = ScoreTextLine.PP_POSITION, - TextSize = text_size, - }, - modsContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreLeft, - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - X = -30 * maxModsAmount, - }, + new DrawableScoreData(index, score, maxModsAmount), }; - if (index == 0) - scoreText.Font = @"Exo2.0-Bold"; - - accuracy.Colour = (score.Accuracy == 1) ? Color4.GreenYellow : Color4.White; - - hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.White; - hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.White; - hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.White; - hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.White; - - if (index % 2 == 0) + if (index % 2 != 0) background.Alpha = 0; - - foreach (Mod mod in score.Mods) - modsContainer.Add(new ModIcon(mod) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.3f), - }); } [BackgroundDependencyLoader] @@ -251,5 +115,103 @@ namespace osu.Game.Overlays.BeatmapSet.Scores base.OnHoverLost(e); } } + + private class DrawableScoreData : ScoreTableLine + { + public DrawableScoreData(int index, APIScoreInfo score, int maxModsAmount) : base(maxModsAmount) + { + SpriteText scoreText; + SpriteText accuracy; + SpriteText hitGreat; + SpriteText hitGood; + SpriteText hitMeh; + SpriteText hitMiss; + + FillFlowContainer modsContainer; + + RankContainer.Add(new SpriteText + { + Text = $"#{index + 1}", + Font = @"Exo2.0-Bold", + TextSize = text_size, + }); + DrawableRankContainer.Add(new DrawableRank(score.Rank) + { + Size = new Vector2(30, 20), + FillMode = FillMode.Fit, + }); + ScoreContainer.Add(scoreText = new SpriteText + { + Text = $@"{score.TotalScore:N0}", + TextSize = text_size, + }); + AccuracyContainer.Add(accuracy = new SpriteText + { + Text = $@"{score.Accuracy:P2}", + TextSize = text_size, + }); + FlagContainer.Add(new DrawableFlag(score.User.Country) + { + Size = new Vector2(20, 13), + }); + PlayerContainer.Add(new ClickableScoreUsername + { + User = score.User, + }); + MaxComboContainer.Add(new SpriteText + { + Text = $@"{score.MaxCombo:N0}x", + TextSize = text_size, + }); + HitGreatContainer.Add(hitGreat = new SpriteText + { + Text = $"{score.Statistics[HitResult.Great]}", + TextSize = text_size, + }); + HitGoodContainer.Add(hitGood = new SpriteText + { + Text = $"{score.Statistics[HitResult.Good]}", + TextSize = text_size, + }); + HitMehContainer.Add(hitMeh = new SpriteText + { + Text = $"{score.Statistics[HitResult.Meh]}", + TextSize = text_size, + }); + HitMissContainer.Add(hitMiss = new SpriteText + { + Text = $"{score.Statistics[HitResult.Miss]}", + TextSize = text_size, + }); + PPContainer.Add(new SpriteText + { + Text = $@"{score.PP:N0}", + TextSize = text_size, + }); + ModsContainer.Add(modsContainer = new FillFlowContainer + { + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + }); + + if (index == 0) + scoreText.Font = @"Exo2.0-Bold"; + + accuracy.Colour = (score.Accuracy == 1) ? Color4.GreenYellow : Color4.White; + hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.White; + hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.White; + hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.White; + hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.White; + + foreach (Mod mod in score.Mods) + modsContainer.Add(new ModIcon(mod) + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.3f), + }); + } + } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index d2421ec606..7623153710 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -188,7 +188,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Width = 0.7f, + Width = 0.65f, Child = new FillFlowContainer { AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs new file mode 100644 index 0000000000..d57225b541 --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs @@ -0,0 +1,183 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class ScoreTableLine : GridContainer + { + private const float rank_position = 30; + private const float drawable_rank_position = 45; + private const float score_position = 90; + private const float accuracy_position = 170; + private const float flag_position = 220; + private const float player_position = 250; + + private const float max_combo_position = 0.1f; + private const float hit_great_position = 0.3f; + private const float hit_good_position = 0.45f; + private const float hit_meh_position = 0.6f; + private const float hit_miss_position = 0.75f; + private const float pp_position = 0.9f; + + protected readonly Container RankContainer; + protected readonly Container DrawableRankContainer; + protected readonly Container ScoreContainer; + protected readonly Container AccuracyContainer; + protected readonly Container FlagContainer; + protected readonly Container PlayerContainer; + protected readonly Container MaxComboContainer; + protected readonly Container HitGreatContainer; + protected readonly Container HitGoodContainer; + protected readonly Container HitMehContainer; + protected readonly Container HitMissContainer; + protected readonly Container PPContainer; + protected readonly Container ModsContainer; + + public ScoreTableLine(int maxModsAmount) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + RowDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 25), + }; + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 300), + new Dimension(), + new Dimension(GridSizeMode.AutoSize), + }; + Content = new[] + { + new Drawable[] + { + new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + RankContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + X = rank_position, + }, + DrawableRankContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + X = drawable_rank_position, + }, + ScoreContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + X = score_position, + }, + AccuracyContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + X = accuracy_position, + }, + FlagContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + X = flag_position, + }, + PlayerContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + X = player_position, + } + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + MaxComboContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = max_combo_position, + }, + HitGreatContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = hit_great_position, + }, + HitGoodContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = hit_good_position, + }, + HitMehContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = hit_meh_position, + }, + HitMissContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = hit_miss_position, + }, + PPContainer = new Container + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = pp_position, + } + } + }, + new Container + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Child = ModsContainer = new Container + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + X = -30 * maxModsAmount, + } + } + } + }; + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs index 04934185a1..b7c9742764 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -1,107 +1,71 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoreTextLine : Container + public class ScoreTextLine : ScoreTableLine { private const float text_size = 12; - public const float RANK_POSITION = 30; - public const float SCORE_POSITION = 90; - public const float ACCURACY_POSITION = 170; - public const float PLAYER_POSITION = 270; - public const float MAX_COMBO_POSITION = 0.5f; - public const float HIT_GREAT_POSITION = 0.6f; - public const float HIT_GOOD_POSITION = 0.65f; - public const float HIT_MEH_POSITION = 0.7f; - public const float HIT_MISS_POSITION = 0.75f; - public const float PP_POSITION = 0.8f; - - public ScoreTextLine(int maxModsAmount) + public ScoreTextLine(int maxModsAmount) : base(maxModsAmount) { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Children = new Drawable[] + RankContainer.Add(new SpriteText { - new ScoreText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreRight, - Text = "rank".ToUpper(), - X = RANK_POSITION, - }, - new ScoreText - { - Text = "score".ToUpper(), - X = SCORE_POSITION, - }, - new ScoreText - { - Text = "accuracy".ToUpper(), - X = ACCURACY_POSITION, - }, - new ScoreText - { - Text = "player".ToUpper(), - X = PLAYER_POSITION, - }, - new ScoreText - { - Text = "max combo".ToUpper(), - X = MAX_COMBO_POSITION, - RelativePositionAxes = Axes.X, - }, - new ScoreText - { - Text = "300", - RelativePositionAxes = Axes.X, - X = HIT_GREAT_POSITION, - }, - new ScoreText - { - Text = "100".ToUpper(), - RelativePositionAxes = Axes.X, - X = HIT_GOOD_POSITION, - }, - new ScoreText - { - Text = "50".ToUpper(), - RelativePositionAxes = Axes.X, - X = HIT_MEH_POSITION, - }, - new ScoreText - { - Text = "miss".ToUpper(), - RelativePositionAxes = Axes.X, - X = HIT_MISS_POSITION, - }, - new ScoreText - { - Text = "pp".ToUpper(), - RelativePositionAxes = Axes.X, - X = PP_POSITION, - }, - new ScoreText - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreLeft, - Text = "mods".ToUpper(), - X = -30 * maxModsAmount, - }, - }; - } - - private class ScoreText : SpriteText - { - public ScoreText() + Text = @"rank".ToUpper(), + TextSize = text_size, + }); + ScoreContainer.Add(new SpriteText { - TextSize = text_size; - } + Text = @"score".ToUpper(), + TextSize = text_size, + }); + AccuracyContainer.Add(new SpriteText + { + Text = @"accuracy".ToUpper(), + TextSize = text_size, + }); + PlayerContainer.Add(new SpriteText + { + Text = @"player".ToUpper(), + TextSize = text_size, + }); + MaxComboContainer.Add(new SpriteText + { + Text = @"max combo".ToUpper(), + TextSize = text_size, + }); + HitGreatContainer.Add(new SpriteText + { + Text = "300".ToUpper(), + TextSize = text_size, + }); + HitGoodContainer.Add(new SpriteText + { + Text = "100".ToUpper(), + TextSize = text_size, + }); + HitMehContainer.Add(new SpriteText + { + Text = "50".ToUpper(), + TextSize = text_size, + }); + HitMissContainer.Add(new SpriteText + { + Text = @"miss".ToUpper(), + TextSize = text_size, + }); + PPContainer.Add(new SpriteText + { + Text = @"pp".ToUpper(), + TextSize = text_size, + }); + ModsContainer.Add(new SpriteText + { + Text = @"mods".ToUpper(), + TextSize = text_size, + }); } } } From 4d489da03280c51ca1ff2b88f9d00d4dcdf2e715 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 10 Feb 2019 04:16:56 +0300 Subject: [PATCH 15/90] small visual improvements --- .../BeatmapSet/Scores/DrawableTopScore.cs | 12 ++--- .../BeatmapSet/Scores/ScoreTableLine.cs | 2 +- .../BeatmapSet/Scores/ScoreTextLine.cs | 48 +++++++++---------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 7623153710..e4486b1514 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -200,8 +200,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { new FillFlowContainer { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(margin, 0), @@ -210,15 +210,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores hitGreat = new SmallInfoColumn("300", 20), hitGood = new SmallInfoColumn("100", 20), hitMeh = new SmallInfoColumn("50", 20), - hitMiss = new SmallInfoColumn("miss", 20), + hitMiss = new SmallInfoColumn("misses", 20), pp = new SmallInfoColumn("pp", 20), modsInfo = new ModsInfoColumn("mods"), } }, new FillFlowContainer { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(margin, 0), @@ -347,7 +347,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { TextSize = 12, Text = header.ToUpper(), - Font = @"Exo2.0-Bold", + Font = @"Exo2.0-Black", } }, new Container diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs index d57225b541..5c4723eae1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs @@ -173,7 +173,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, - X = -30 * maxModsAmount, + X = -30 * ((maxModsAmount == 0) ? 1 : maxModsAmount), } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs index b7c9742764..9fd12df3a8 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -7,65 +7,63 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { public class ScoreTextLine : ScoreTableLine { - private const float text_size = 12; - public ScoreTextLine(int maxModsAmount) : base(maxModsAmount) { - RankContainer.Add(new SpriteText + RankContainer.Add(new ScoreText { Text = @"rank".ToUpper(), - TextSize = text_size, }); - ScoreContainer.Add(new SpriteText + ScoreContainer.Add(new ScoreText { Text = @"score".ToUpper(), - TextSize = text_size, }); - AccuracyContainer.Add(new SpriteText + AccuracyContainer.Add(new ScoreText { Text = @"accuracy".ToUpper(), - TextSize = text_size, }); - PlayerContainer.Add(new SpriteText + PlayerContainer.Add(new ScoreText { Text = @"player".ToUpper(), - TextSize = text_size, }); - MaxComboContainer.Add(new SpriteText + MaxComboContainer.Add(new ScoreText { Text = @"max combo".ToUpper(), - TextSize = text_size, }); - HitGreatContainer.Add(new SpriteText + HitGreatContainer.Add(new ScoreText { Text = "300".ToUpper(), - TextSize = text_size, }); - HitGoodContainer.Add(new SpriteText + HitGoodContainer.Add(new ScoreText { Text = "100".ToUpper(), - TextSize = text_size, }); - HitMehContainer.Add(new SpriteText + HitMehContainer.Add(new ScoreText { Text = "50".ToUpper(), - TextSize = text_size, }); - HitMissContainer.Add(new SpriteText + HitMissContainer.Add(new ScoreText { - Text = @"miss".ToUpper(), - TextSize = text_size, + Text = @"misses".ToUpper(), }); - PPContainer.Add(new SpriteText + PPContainer.Add(new ScoreText { Text = @"pp".ToUpper(), - TextSize = text_size, }); - ModsContainer.Add(new SpriteText + ModsContainer.Add(new ScoreText { Text = @"mods".ToUpper(), - TextSize = text_size, }); } + + private class ScoreText : SpriteText + { + private const float text_size = 12; + + public ScoreText() + { + TextSize = text_size; + Font = @"Exo2.0-Black"; + } + } } } From 8c0e325d8bc54ae802668c483ffdf30a6acbdd0f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 8 Mar 2019 16:40:37 +0900 Subject: [PATCH 16/90] Reduce + make beatmap scores testcase work --- .../Visual/TestCaseBeatmapScoresContainer.cs | 147 +----------------- 1 file changed, 6 insertions(+), 141 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 4ad5b2dc35..072bbff4cf 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -13,9 +13,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Users; using System.Collections.Generic; using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; -using osu.Game.Rulesets.Osu; using osu.Game.Scoring; using NUnit.Framework; @@ -67,6 +65,7 @@ namespace osu.Game.Tests.Visual new OsuModHardRock(), }, Rank = ScoreRank.XH, + MaxCombo = 1234, TotalScore = 1234567890, Accuracy = 1, }, @@ -89,6 +88,7 @@ namespace osu.Game.Tests.Visual new OsuModFlashlight(), }, Rank = ScoreRank.S, + MaxCombo = 1234, TotalScore = 1234789, Accuracy = 0.9997, }, @@ -110,6 +110,7 @@ namespace osu.Game.Tests.Visual new OsuModHidden(), }, Rank = ScoreRank.B, + MaxCombo = 1234, TotalScore = 12345678, Accuracy = 0.9854, }, @@ -130,6 +131,7 @@ namespace osu.Game.Tests.Visual new OsuModDoubleTime(), }, Rank = ScoreRank.C, + MaxCombo = 1234, TotalScore = 1234567, Accuracy = 0.8765, }, @@ -146,6 +148,7 @@ namespace osu.Game.Tests.Visual }, }, Rank = ScoreRank.F, + MaxCombo = 1234, TotalScore = 123456, Accuracy = 0.6543, }, @@ -159,145 +162,7 @@ namespace osu.Game.Tests.Visual s.Statistics.Add(HitResult.Miss, RNG.Next(2000)); } - IEnumerable anotherScores = new[] - { - new APIScoreInfo - { - User = new User - { - Id = 4608074, - Username = @"Skycries", - Country = new Country - { - FullName = @"Brazil", - FlagName = @"BR", - }, - }, - Mods = new Mod[] - { - new OsuModDoubleTime(), - new OsuModHidden(), - new OsuModFlashlight(), - }, - Rank = ScoreRank.S, - TotalScore = 1234789, - Accuracy = 0.9997, - }, - new APIScoreInfo - { - User = new User - { - Id = 6602580, - Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, - }, - Mods = new Mod[] - { - new OsuModDoubleTime(), - new OsuModHidden(), - new OsuModFlashlight(), - new OsuModHardRock(), - }, - Rank = ScoreRank.XH, - TotalScore = 1234567890, - Accuracy = 1, - }, - new APIScoreInfo - { - User = new User - { - Id = 7151382, - Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, - }, - Rank = ScoreRank.F, - TotalScore = 123456, - Accuracy = 0.6543, - }, - new APIScoreInfo - { - User = new User - { - Id = 1014222, - Username = @"eLy", - Country = new Country - { - FullName = @"Japan", - FlagName = @"JP", - }, - }, - Mods = new Mod[] - { - new OsuModDoubleTime(), - new OsuModHidden(), - }, - Rank = ScoreRank.B, - TotalScore = 12345678, - Accuracy = 0.9854, - }, - new APIScoreInfo - { - User = new User - { - Id = 1541390, - Username = @"Toukai", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, - }, - Mods = new Mod[] - { - new OsuModDoubleTime(), - }, - Rank = ScoreRank.C, - TotalScore = 1234567, - Accuracy = 0.8765, - }, - }; - foreach (var s in anotherScores) - { - s.Statistics.Add(HitResult.Great, RNG.Next(2000)); - s.Statistics.Add(HitResult.Good, RNG.Next(2000)); - s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); - s.Statistics.Add(HitResult.Miss, RNG.Next(2000)); - } - - var topScoreInfo = new APIScoreInfo - { - User = new User - { - Id = 2705430, - Username = @"Mooha", - Country = new Country - { - FullName = @"France", - FlagName = @"FR", - }, - }, - Mods = new Mod[] - { - new OsuModDoubleTime(), - new OsuModFlashlight(), - new OsuModHardRock(), - }, - Rank = ScoreRank.B, - TotalScore = 987654321, - Accuracy = 0.8487, - }; - topScoreInfo.Statistics.Add(HitResult.Great, RNG.Next(2000)); - topScoreInfo.Statistics.Add(HitResult.Good, RNG.Next(2000)); - topScoreInfo.Statistics.Add(HitResult.Meh, RNG.Next(2000)); - topScoreInfo.Statistics.Add(HitResult.Miss, RNG.Next(2000)); + scoresContainer.Scores = scores; } [BackgroundDependencyLoader] From a40ffcc6920d5bc25f0782727a1b967e1b1fc951 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 8 Mar 2019 16:44:39 +0900 Subject: [PATCH 17/90] Apply formatting adjustments --- .../Visual/TestCaseBeatmapScoresContainer.cs | 8 ++++-- .../Scores/ClickableUserContainer.cs | 1 - .../BeatmapSet/Scores/DrawableScore.cs | 3 ++- .../BeatmapSet/Scores/DrawableTopScore.cs | 25 +++++++++++++------ .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 6 ++--- .../BeatmapSet/Scores/ScoreTextLine.cs | 3 ++- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 072bbff4cf..ead743a283 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -26,10 +26,9 @@ namespace osu.Game.Tests.Visual public TestCaseBeatmapScoresContainer() { - Container container; ScoresContainer scoresContainer; - Child = container = new Container + Child = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -65,6 +64,7 @@ namespace osu.Game.Tests.Visual new OsuModHardRock(), }, Rank = ScoreRank.XH, + PP = 200, MaxCombo = 1234, TotalScore = 1234567890, Accuracy = 1, @@ -88,6 +88,7 @@ namespace osu.Game.Tests.Visual new OsuModFlashlight(), }, Rank = ScoreRank.S, + PP = 190, MaxCombo = 1234, TotalScore = 1234789, Accuracy = 0.9997, @@ -110,6 +111,7 @@ namespace osu.Game.Tests.Visual new OsuModHidden(), }, Rank = ScoreRank.B, + PP = 180, MaxCombo = 1234, TotalScore = 12345678, Accuracy = 0.9854, @@ -131,6 +133,7 @@ namespace osu.Game.Tests.Visual new OsuModDoubleTime(), }, Rank = ScoreRank.C, + PP = 170, MaxCombo = 1234, TotalScore = 1234567, Accuracy = 0.8765, @@ -148,6 +151,7 @@ namespace osu.Game.Tests.Visual }, }, Rank = ScoreRank.F, + PP = 160, MaxCombo = 1234, TotalScore = 123456, Accuracy = 0.6543, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs index 3f1c8f56f5..cf1c3d7fcf 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; -using osu.Game.Graphics; using osu.Game.Users; namespace osu.Game.Overlays.BeatmapSet.Scores diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 8741fd8dfe..19e999547b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -118,7 +118,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private class DrawableScoreData : ScoreTableLine { - public DrawableScoreData(int index, APIScoreInfo score, int maxModsAmount) : base(maxModsAmount) + public DrawableScoreData(int index, APIScoreInfo score, int maxModsAmount) + : base(maxModsAmount) { SpriteText scoreText; SpriteText accuracy; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index e4486b1514..3712f38d02 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -56,13 +56,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly ModsInfoColumn modsInfo; private APIScoreInfo score; + public APIScoreInfo Score { - get { return score; } + get => score; set { if (score == value) return; + score = value; avatar.User = username.User = score.User; @@ -274,9 +276,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { if (text.TextSize == value) return; + text.TextSize = value; } - get { return text.TextSize; } + get => text.TextSize; } public ClickableTopScoreUsername() @@ -386,7 +389,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } - public ModsInfoColumn(string header) : base(header) + public ModsInfoColumn(string header) + : base(header) { AutoSizeAxes = Axes.Both; Add(modsContainer = new FillFlowContainer @@ -409,12 +413,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { if (valueText.Text == value) return; + valueText.Text = value; } - get { return valueText.Text; } + get => valueText.Text; } - protected TextInfoColumn(string header, float valueTextSize = 25) : base(header) + protected TextInfoColumn(string header, float valueTextSize = 25) + : base(header) { Add(valueText = new SpriteText { @@ -425,7 +431,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private class AutoSizedInfoColumn : TextInfoColumn { - public AutoSizedInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + public AutoSizedInfoColumn(string header, float valueTextSize = 25) + : base(header, valueTextSize) { AutoSizeAxes = Axes.Both; } @@ -435,7 +442,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { private const float width = 70; - public MediumInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + public MediumInfoColumn(string header, float valueTextSize = 25) + : base(header, valueTextSize) { Width = width; } @@ -445,7 +453,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { private const float width = 40; - public SmallInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) + public SmallInfoColumn(string header, float valueTextSize = 25) + : base(header, valueTextSize) { Width = width; } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 1b20b2c382..d69bc39bc6 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -11,6 +11,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public class ScoreTable : FillFlowContainer { private IEnumerable scores; + public IEnumerable Scores { set @@ -31,10 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores foreach (var s in scores) Add(new DrawableScore(index++, s, maxModsAmount)); } - get - { - return scores; - } + get => scores; } public ScoreTable() diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs index 9fd12df3a8..9e201bd98d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs @@ -7,7 +7,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { public class ScoreTextLine : ScoreTableLine { - public ScoreTextLine(int maxModsAmount) : base(maxModsAmount) + public ScoreTextLine(int maxModsAmount) + : base(maxModsAmount) { RankContainer.Add(new ScoreText { From 9a05643ec980732837124698e535396c34ab73bf Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 8 Mar 2019 17:18:54 +0900 Subject: [PATCH 18/90] Minor refactorings --- .../BeatmapSet/Scores/DrawableScore.cs | 2 + .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 45 +++--- .../BeatmapSet/Scores/ScoresContainer.cs | 140 +++++++++--------- 3 files changed, 97 insertions(+), 90 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 19e999547b..a2a9f9a01b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -31,8 +31,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + CornerRadius = 3; Masking = true; + Children = new Drawable[] { background = new Box diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index d69bc39bc6..4723fcaf2b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -5,47 +5,50 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoreTable : FillFlowContainer + public class ScoreTable : CompositeDrawable { - private IEnumerable scores; + private readonly FillFlowContainer scoresFlow; + + public ScoreTable() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + InternalChild = scoresFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical + }; + } public IEnumerable Scores { set { - scores = value; + scoresFlow.Clear(); + + if (value == null || !value.Any()) + return; int maxModsAmount = 0; - foreach (var s in scores) + foreach (var s in value) { var scoreModsAmount = s.Mods.Length; if (scoreModsAmount > maxModsAmount) maxModsAmount = scoreModsAmount; } - Add(new ScoreTextLine(maxModsAmount)); + scoresFlow.Add(new ScoreTextLine(maxModsAmount)); int index = 0; - foreach (var s in scores) - Add(new DrawableScore(index++, s, maxModsAmount)); + foreach (var s in value) + scoresFlow.Add(new DrawableScore(index++, s, maxModsAmount)); } - get => scores; - } - - public ScoreTable() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; - } - - public void ClearScores() - { - scores = null; - Clear(); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index d99f391d21..6c90e192ac 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -17,7 +17,7 @@ using System.Linq; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoresContainer : Container + public class ScoresContainer : CompositeDrawable { private const int spacing = 15; private const int fade_duration = 200; @@ -28,77 +28,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly DrawableTopScore topScore; private readonly LoadingAnimation loadingAnimation; - private bool loading - { - set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration); - } - - private IEnumerable scores; - private BeatmapInfo beatmap; - - public IEnumerable Scores - { - get => scores; - set - { - getScoresRequest?.Cancel(); - scores = value; - - updateDisplay(); - } - } - - private GetScoresRequest getScoresRequest; - private APIAccess api; - - public BeatmapInfo Beatmap - { - get => beatmap; - set - { - beatmap = value; - - Scores = null; - - if (beatmap?.OnlineBeatmapID.HasValue != true) - return; - - loading = true; - - getScoresRequest = new GetScoresRequest(beatmap, beatmap.Ruleset); - getScoresRequest.Success += r => Schedule(() => Scores = r.Scores); - api.Queue(getScoresRequest); - } - } - - private void updateDisplay() - { - scoreTable.ClearScores(); - - loading = false; - - var scoreCount = scores?.Count() ?? 0; - - if (scoreCount == 0) - { - topScore.Hide(); - return; - } - - topScore.Score = scores.FirstOrDefault(); - topScore.Show(); - - if (scoreCount < 2) - return; - - scoreTable.Scores = scores; - } + [Resolved] + private APIAccess api { get; set; } public ScoresContainer() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Children = new Drawable[] + + InternalChildren = new Drawable[] { background = new Box { @@ -135,12 +73,76 @@ namespace osu.Game.Overlays.BeatmapSet.Scores [BackgroundDependencyLoader] private void load(APIAccess api, OsuColour colours) { - this.api = api; - background.Colour = colours.Gray2; updateDisplay(); } + private bool loading + { + set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration); + } + + private GetScoresRequest getScoresRequest; + + private IEnumerable scores; + + public IEnumerable Scores + { + get => scores; + set + { + getScoresRequest?.Cancel(); + scores = value; + + updateDisplay(); + } + } + + private BeatmapInfo beatmap; + + public BeatmapInfo Beatmap + { + get => beatmap; + set + { + beatmap = value; + + Scores = null; + + if (beatmap?.OnlineBeatmapID.HasValue != true) + return; + + loading = true; + + getScoresRequest = new GetScoresRequest(beatmap, beatmap.Ruleset); + getScoresRequest.Success += r => Schedule(() => Scores = r.Scores); + api.Queue(getScoresRequest); + } + } + + private void updateDisplay() + { + scoreTable.Scores = Enumerable.Empty(); + + loading = false; + + var scoreCount = scores?.Count() ?? 0; + + if (scoreCount == 0) + { + topScore.Hide(); + return; + } + + topScore.Score = scores.FirstOrDefault(); + topScore.Show(); + + if (scoreCount < 2) + return; + + scoreTable.Scores = scores; + } + protected override void Dispose(bool isDisposing) { getScoresRequest?.Cancel(); From 315788c97535344f84988c12a63777fbc5032620 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 11 Mar 2019 15:11:01 +0900 Subject: [PATCH 19/90] Rename a few classes --- osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs | 6 +++--- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- .../Scores/{ScoreTextLine.cs => ScoreTableHeader.cs} | 4 ++-- .../Scores/{ScoreTableLine.cs => ScoreTableRow.cs} | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game/Overlays/BeatmapSet/Scores/{ScoreTextLine.cs => ScoreTableHeader.cs} (94%) rename osu.Game/Overlays/BeatmapSet/Scores/{ScoreTableLine.cs => ScoreTableRow.cs} (98%) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index a2a9f9a01b..d7396c8839 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativeSizeAxes = Axes.Both, Alpha = 0, }, - new DrawableScoreData(index, score, maxModsAmount), + new ScoreRow(index, score, maxModsAmount), }; if (index % 2 != 0) @@ -118,9 +118,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } - private class DrawableScoreData : ScoreTableLine + private class ScoreRow : ScoreTableRow { - public DrawableScoreData(int index, APIScoreInfo score, int maxModsAmount) + public ScoreRow(int index, APIScoreInfo score, int maxModsAmount) : base(maxModsAmount) { SpriteText scoreText; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 4723fcaf2b..5d248c5501 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores maxModsAmount = scoreModsAmount; } - scoresFlow.Add(new ScoreTextLine(maxModsAmount)); + scoresFlow.Add(new ScoreTableHeader(maxModsAmount)); int index = 0; foreach (var s in value) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs similarity index 94% rename from osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs rename to osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs index 9e201bd98d..544bf34ec5 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTextLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs @@ -5,9 +5,9 @@ using osu.Framework.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoreTextLine : ScoreTableLine + public class ScoreTableHeader : ScoreTableRow { - public ScoreTextLine(int maxModsAmount) + public ScoreTableHeader(int maxModsAmount) : base(maxModsAmount) { RankContainer.Add(new ScoreText diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs similarity index 98% rename from osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs rename to osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs index 5c4723eae1..3a48a0cca1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableLine.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoreTableLine : GridContainer + public class ScoreTableRow : GridContainer { private const float rank_position = 30; private const float drawable_rank_position = 45; @@ -36,7 +36,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores protected readonly Container PPContainer; protected readonly Container ModsContainer; - public ScoreTableLine(int maxModsAmount) + public ScoreTableRow(int maxModsAmount) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; From 41d25c7d19d6d7babd2c0194d77fc68bf8dcfc2b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Mar 2019 17:15:21 +0900 Subject: [PATCH 20/90] Fix post-merge errors --- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 6c90e192ac..79858a9ccb 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly LoadingAnimation loadingAnimation; [Resolved] - private APIAccess api { get; set; } + private IAPIProvider api { get; set; } public ScoresContainer() { @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } [BackgroundDependencyLoader] - private void load(APIAccess api, OsuColour colours) + private void load(OsuColour colours) { background.Colour = colours.Gray2; updateDisplay(); From f7016e1d2c81b4ab675c3a654ca3695bbf1265b5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Mar 2019 17:15:38 +0900 Subject: [PATCH 21/90] Rename DrawableScore --- osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- .../Scores/{DrawableScore.cs => ScoreTableScore.cs} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename osu.Game/Overlays/BeatmapSet/Scores/{DrawableScore.cs => ScoreTableScore.cs} (98%) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs index 20609dc595..58ccaf9dfa 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual { typeof(Header), typeof(ClickableUserContainer), - typeof(DrawableScore), + typeof(ScoreTableScore), typeof(DrawableTopScore), typeof(ScoresContainer), typeof(AuthorInfo), diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 5d248c5501..aacbc12cd8 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores int index = 0; foreach (var s in value) - scoresFlow.Add(new DrawableScore(index++, s, maxModsAmount)); + scoresFlow.Add(new ScoreTableScore(index++, s, maxModsAmount)); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs similarity index 98% rename from osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs rename to osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs index d7396c8839..a54770fb39 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs @@ -19,7 +19,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class DrawableScore : Container + public class ScoreTableScore : Container { private const int fade_duration = 100; private const int text_size = 14; @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly Box hoveredBackground; private readonly Box background; - public DrawableScore(int index, APIScoreInfo score, int maxModsAmount) + public ScoreTableScore(int index, APIScoreInfo score, int maxModsAmount) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; From bc16a82494582f0d6c3f294ae3dc7f89e9cd07fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Mar 2019 17:39:53 +0900 Subject: [PATCH 22/90] Move osu! cursor to its own class --- .../UI/Cursor/GameplayCursorContainer.cs | 140 ----------------- osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs | 148 ++++++++++++++++++ 2 files changed, 148 insertions(+), 140 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs index 8c6723f5be..b64561e4f7 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs @@ -1,19 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; -using osu.Game.Beatmaps; -using osu.Game.Configuration; -using osu.Game.Skinning; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.UI.Cursor { @@ -88,136 +79,5 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint); ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint); } - - public class OsuCursor : SkinReloadableDrawable - { - private bool cursorExpand; - - private Bindable cursorScale; - private Bindable autoCursorScale; - private readonly IBindable beatmap = new Bindable(); - - private Container expandTarget; - private Drawable scaleTarget; - - public OsuCursor() - { - Origin = Anchor.Centre; - Size = new Vector2(28); - } - - protected override void SkinChanged(ISkinSource skin, bool allowFallback) - { - cursorExpand = skin.GetValue(s => s.CursorExpand ?? true); - } - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config, IBindable beatmap) - { - InternalChild = expandTarget = new Container - { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Child = scaleTarget = new SkinnableDrawable("cursor", _ => new CircularContainer - { - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = Size.X / 6, - BorderColour = Color4.White, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Pink.Opacity(0.5f), - Radius = 5, - }, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, - }, - new CircularContainer - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = Size.X / 3, - BorderColour = Color4.White.Opacity(0.5f), - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true, - }, - }, - }, - new CircularContainer - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.1f), - Masking = true, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White, - }, - }, - }, - } - }, restrictSize: false) - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - } - }; - - this.beatmap.BindTo(beatmap); - this.beatmap.ValueChanged += _ => calculateScale(); - - cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); - cursorScale.ValueChanged += _ => calculateScale(); - - autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize); - autoCursorScale.ValueChanged += _ => calculateScale(); - - calculateScale(); - } - - private void calculateScale() - { - float scale = (float)cursorScale.Value; - - if (autoCursorScale.Value && beatmap.Value != null) - { - // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier. - scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY); - } - - scaleTarget.Scale = new Vector2(scale); - } - - private const float pressed_scale = 1.2f; - private const float released_scale = 1f; - - public void Expand() - { - if (!cursorExpand) return; - - expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad); - } - - public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad); - } } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs new file mode 100644 index 0000000000..ecdafb0fa2 --- /dev/null +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs @@ -0,0 +1,148 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Skinning; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Osu.UI.Cursor +{ + public class OsuCursor : SkinReloadableDrawable + { + private bool cursorExpand; + + private Bindable cursorScale; + private Bindable autoCursorScale; + private readonly IBindable beatmap = new Bindable(); + + private Container expandTarget; + private Drawable scaleTarget; + + public OsuCursor() + { + Origin = Anchor.Centre; + Size = new Vector2(28); + } + + protected override void SkinChanged(ISkinSource skin, bool allowFallback) + { + cursorExpand = skin.GetValue(s => s.CursorExpand ?? true); + } + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config, IBindable beatmap) + { + InternalChild = expandTarget = new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Child = scaleTarget = new SkinnableDrawable("cursor", _ => new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = Size.X / 6, + BorderColour = Color4.White, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Pink.Opacity(0.5f), + Radius = 5, + }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = Size.X / 3, + BorderColour = Color4.White.Opacity(0.5f), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + }, + }, + new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.1f), + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + }, + }, + } + }, restrictSize: false) + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + } + }; + + this.beatmap.BindTo(beatmap); + this.beatmap.ValueChanged += _ => calculateScale(); + + cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); + cursorScale.ValueChanged += _ => calculateScale(); + + autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize); + autoCursorScale.ValueChanged += _ => calculateScale(); + + calculateScale(); + } + + private void calculateScale() + { + float scale = (float)cursorScale.Value; + + if (autoCursorScale.Value && beatmap.Value != null) + { + // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier. + scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY); + } + + scaleTarget.Scale = new Vector2(scale); + } + + private const float pressed_scale = 1.2f; + private const float released_scale = 1f; + + public void Expand() + { + if (!cursorExpand) return; + + expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad); + } + + public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad); + } +} From 8ad4009c33d5c0f9984d85cfb26ed69dcf0b6eec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Mar 2019 19:04:07 +0900 Subject: [PATCH 23/90] osu! resume overlay --- osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 105 +++++++++++++++++++ osu.Game/Screens/Play/ResumeOverlay.cs | 74 +++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs create mode 100644 osu.Game/Screens/Play/ResumeOverlay.cs diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs new file mode 100644 index 0000000000..c2000131db --- /dev/null +++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs @@ -0,0 +1,105 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.UI.Cursor; +using osu.Game.Screens.Play; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Osu.UI +{ + public class OsuResumeOverlay : ResumeOverlay + { + private OsuClickToResumeCursor clickToResumeCursor; + + private GameplayCursorContainer localCursorContainer; + + public override CursorContainer LocalCursor => State == Visibility.Visible ? localCursorContainer : null; + + protected override string Message => "Click the orange cursor to resume"; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Add(clickToResumeCursor = new OsuClickToResumeCursor { ResumeRequested = Resume }); + } + + public override void Show() + { + base.Show(); + clickToResumeCursor.ShowAt(GameplayCursor.ActiveCursor.Position); + Add(localCursorContainer = new GameplayCursorContainer()); + } + + public override void Hide() + { + localCursorContainer.Expire(); + base.Hide(); + } + + protected override bool OnHover(HoverEvent e) => true; + + public class OsuClickToResumeCursor : OsuCursor, IKeyBindingHandler + { + public override bool HandlePositionalInput => true; + + public Action ResumeRequested; + + public OsuClickToResumeCursor() + { + RelativePositionAxes = Axes.Both; + } + + protected override bool OnHover(HoverEvent e) + { + updateColour(); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + updateColour(); + base.OnHoverLost(e); + } + + public bool OnPressed(OsuAction action) + { + switch (action) + { + case OsuAction.LeftButton: + case OsuAction.RightButton: + if (!IsHovered) return false; + + this.ScaleTo(new Vector2(2), TRANSITION_TIME, Easing.OutQuint); + + ResumeRequested?.Invoke(); + return true; + } + + return false; + } + + public bool OnReleased(OsuAction action) => false; + + public void ShowAt(Vector2 activeCursorPosition) => Schedule(() => + { + updateColour(); + this.MoveTo(activeCursorPosition); + this.ScaleTo(new Vector2(4)).Then().ScaleTo(Vector2.One, 1000, Easing.OutQuint); + }); + + private void updateColour() + { + this.FadeColour(IsHovered ? Color4.White : Color4.Orange, 400, Easing.OutQuint); + } + } + } +} diff --git a/osu.Game/Screens/Play/ResumeOverlay.cs b/osu.Game/Screens/Play/ResumeOverlay.cs new file mode 100644 index 0000000000..2ef76069c2 --- /dev/null +++ b/osu.Game/Screens/Play/ResumeOverlay.cs @@ -0,0 +1,74 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Screens.Play +{ + /// + /// An overlay which can be used to require further user actions before gameplay is resumed. + /// + public abstract class ResumeOverlay : OverlayContainer + { + public CursorContainer GameplayCursor { get; set; } + + /// + /// The action to be performed to complete resuming. + /// + public Action ResumeAction { private get; set; } + + public virtual CursorContainer LocalCursor => null; + + protected const float TRANSITION_TIME = 500; + + protected override bool BlockPositionalInput => false; + + protected abstract string Message { get; } + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + + protected ResumeOverlay() + { + RelativeSizeAxes = Axes.Both; + } + + protected void Resume() + { + ResumeAction?.Invoke(); + Hide(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AddRange(new Drawable[] + { + new OsuSpriteText + { + RelativePositionAxes = Axes.Both, + Y = 0.4f, + Text = Message, + Font = OsuFont.GetFont(size: 30), + Spacing = new Vector2(5, 0), + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Colour = colours.Yellow, + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f) + } + }); + } + + protected override void PopIn() => this.FadeIn(TRANSITION_TIME, Easing.OutQuint); + + protected override void PopOut() => this.FadeOut(TRANSITION_TIME, Easing.OutQuint); + } +} From a694626cc66780e6527c3d843b5789d197f8c0b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 16:57:40 +0900 Subject: [PATCH 24/90] Add proper resume request logic --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 31c0afd743..ab10c48ce0 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -169,7 +169,20 @@ namespace osu.Game.Rulesets.UI mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); } - public override void RequestResume(Action continueResume) => continueResume(); + public override void RequestResume(Action continueResume) + { + if (ResumeOverlay != null && (Cursor == null || Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) + { + ResumeOverlay.ResumeAction = continueResume; + ResumeOverlay.Show(); + } + else + continueResume(); + } + + public ResumeOverlay ResumeOverlay { get; private set; } + + protected virtual ResumeOverlay CreateResumeOverlay() => null; /// /// Creates and adds the visual representation of a to this . From 57b3b7b54b8ed092b02f770aaf99f9a2c79c4a8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 11:55:05 +0900 Subject: [PATCH 25/90] Add back resume overlay --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index ab10c48ce0..4c0bc9867b 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -138,7 +138,8 @@ namespace osu.Game.Rulesets.UI { KeyBindingInputManager.AddRange(new Drawable[] { - Playfield + Playfield, + (ResumeOverlay = CreateResumeOverlay()) ?? new Container() }); InternalChildren = new Drawable[] From 650a5c993a176022c410d5f35cd1c60923f9d170 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 15:30:51 +0900 Subject: [PATCH 26/90] Add test --- .../TestCaseResumeOverlay.cs | 70 +++++++++++++++++++ osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 3 +- 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseResumeOverlay.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseResumeOverlay.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseResumeOverlay.cs new file mode 100644 index 0000000000..5956f12146 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseResumeOverlay.cs @@ -0,0 +1,70 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Screens.Play; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseResumeOverlay : ManualInputManagerTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(OsuResumeOverlay), + }; + + public TestCaseResumeOverlay() + { + ManualOsuInputManager osuInputManager; + CursorContainer cursor; + ResumeOverlay resume; + + bool resumeFired = false; + + Child = osuInputManager = new ManualOsuInputManager(new OsuRuleset().RulesetInfo) + { + Children = new Drawable[] + { + cursor = new CursorContainer(), + resume = new OsuResumeOverlay + { + GameplayCursor = cursor + }, + } + }; + + resume.ResumeAction = () => resumeFired = true; + + AddStep("move mouse to center", () => InputManager.MoveMouseTo(ScreenSpaceDrawQuad.Centre)); + AddStep("show", () => resume.Show()); + + AddStep("move mouse away", () => InputManager.MoveMouseTo(ScreenSpaceDrawQuad.TopLeft)); + AddStep("click", () => osuInputManager.GameClick()); + AddAssert("not dismissed", () => !resumeFired && resume.State == Visibility.Visible); + + AddStep("move mouse back", () => InputManager.MoveMouseTo(ScreenSpaceDrawQuad.Centre)); + AddStep("click", () => osuInputManager.GameClick()); + AddAssert("dismissed", () => resumeFired && resume.State == Visibility.Hidden); + } + + private class ManualOsuInputManager : OsuInputManager + { + public ManualOsuInputManager(RulesetInfo ruleset) + : base(ruleset) + { + } + + public void GameClick() + { + KeyBindingContainer.TriggerPressed(OsuAction.LeftButton); + KeyBindingContainer.TriggerReleased(OsuAction.LeftButton); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs index c2000131db..9829839841 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Game.Graphics; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Screens.Play; using osuTK; @@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.UI protected override string Message => "Click the orange cursor to resume"; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { Add(clickToResumeCursor = new OsuClickToResumeCursor { ResumeRequested = Resume }); } From 38e481686f03c50c50c958a5c9b71175f4e44218 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 19:21:01 +0900 Subject: [PATCH 27/90] Make PlayfieldAdjustmentContainer universal --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 34 +-- ...s => CatchPlayfieldAdjustmentContainer.cs} | 10 +- .../UI/DrawableCatchRuleset.cs | 2 + .../UI/DrawableManiaRuleset.cs | 9 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 2 - .../UI/ManiaPlayfieldAdjustmentContainer.cs | 20 ++ .../Edit/OsuHitObjectComposer.cs | 2 +- .../UI/DrawableOsuRuleset.cs | 5 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 45 ++- ....cs => OsuPlayfieldAdjustmentContainer.cs} | 10 +- .../UI/DrawableTaikoRuleset.cs | 2 + osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 256 +++++++++--------- ...s => TaikoPlayfieldAdjustmentContainer.cs} | 11 +- osu.Game/Rulesets/UI/DrawableRuleset.cs | 15 +- .../UI/PlayfieldAdjustmentContainer.cs | 19 ++ 15 files changed, 236 insertions(+), 206 deletions(-) rename osu.Game.Rulesets.Catch/UI/{PlayfieldAdjustmentContainer.cs => CatchPlayfieldAdjustmentContainer.cs} (78%) create mode 100644 osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs rename osu.Game.Rulesets.Osu/UI/{PlayfieldAdjustmentContainer.cs => OsuPlayfieldAdjustmentContainer.cs} (82%) rename osu.Game.Rulesets.Taiko/UI/{PlayfieldAdjustmentContainer.cs => TaikoPlayfieldAdjustmentContainer.cs} (68%) create mode 100644 osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 4dae95b53c..43d0dc026d 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI.Scrolling; -using osuTK; namespace osu.Game.Rulesets.Catch.UI { @@ -24,29 +23,20 @@ namespace osu.Game.Rulesets.Catch.UI { Container explodingFruitContainer; - Anchor = Anchor.TopCentre; - Origin = Anchor.TopCentre; - - Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate - - InternalChild = new PlayfieldAdjustmentContainer + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + explodingFruitContainer = new Container { - explodingFruitContainer = new Container - { - RelativeSizeAxes = Axes.Both, - }, - CatcherArea = new CatcherArea(difficulty) - { - GetVisualRepresentation = getVisualRepresentation, - ExplodingFruitTarget = explodingFruitContainer, - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopLeft, - }, - HitObjectContainer - } + RelativeSizeAxes = Axes.Both, + }, + CatcherArea = new CatcherArea(difficulty) + { + GetVisualRepresentation = getVisualRepresentation, + ExplodingFruitTarget = explodingFruitContainer, + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopLeft, + }, + HitObjectContainer }; } diff --git a/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs similarity index 78% rename from osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs rename to osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs index 76daee2bbf..b8d3dc9017 100644 --- a/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs @@ -3,17 +3,23 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Catch.UI { - public class PlayfieldAdjustmentContainer : Container + public class CatchPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer { protected override Container Content => content; private readonly Container content; - public PlayfieldAdjustmentContainer() + public CatchPlayfieldAdjustmentContainer() { + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; + + Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate + InternalChild = new Container { Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs index 406dc10eea..6981c98ec7 100644 --- a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs @@ -36,6 +36,8 @@ namespace osu.Game.Rulesets.Catch.UI protected override Playfield CreatePlayfield() => new CatchPlayfield(Beatmap.BeatmapInfo.BaseDifficulty, GetVisualRepresentation); + protected override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new CatchPlayfieldAdjustmentContainer(); + protected override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); public override DrawableHitObject GetVisualRepresentation(CatchHitObject h) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs index a019401d5b..0dc081f3da 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs @@ -6,7 +6,6 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.MathUtils; using osu.Game.Beatmaps; @@ -89,11 +88,9 @@ namespace osu.Game.Rulesets.Mania.UI /// The column which intersects with . public Column GetColumnByPosition(Vector2 screenSpacePosition) => Playfield.GetColumnByPosition(screenSpacePosition); - protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }; + protected override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new ManiaPlayfieldAdjustmentContainer(); + + protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages); public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 81888d2773..cbabfcc8b4 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -28,8 +28,6 @@ namespace osu.Game.Rulesets.Mania.UI if (stageDefinitions.Count <= 0) throw new ArgumentException("Can't have zero or fewer stages."); - Size = new Vector2(1, 0.8f); - GridContainer playfieldGrid; AddInternal(playfieldGrid = new GridContainer { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs new file mode 100644 index 0000000000..d893a3fdde --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs @@ -0,0 +1,20 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Game.Rulesets.UI; +using osuTK; + +namespace osu.Game.Rulesets.Mania.UI +{ + public class ManiaPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer + { + public ManiaPlayfieldAdjustmentContainer() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Size = new Vector2(1, 0.8f); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index dd3925e04f..952fe0b708 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Edit public override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler(); - protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; + protected override Container CreateLayerContainer() => new OsuPlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) { diff --git a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs index b632e0fb05..1c5032a938 100644 --- a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs @@ -1,7 +1,8 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; +using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Input.Handlers; @@ -32,6 +33,8 @@ namespace osu.Game.Rulesets.Osu.UI protected override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); + protected override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new OsuPlayfieldAdjustmentContainer(); + public override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { switch (h) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 51733c3c01..5e532d9b04 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -24,41 +24,28 @@ namespace osu.Game.Rulesets.Osu.UI public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); - private readonly PlayfieldAdjustmentContainer adjustmentContainer; - - protected override Container CursorTargetContainer => adjustmentContainer; - protected override CursorContainer CreateCursor() => new GameplayCursorContainer(); public OsuPlayfield() { - Anchor = Anchor.Centre; - Origin = Anchor.Centre; - - Size = new Vector2(0.75f); - - InternalChild = adjustmentContainer = new PlayfieldAdjustmentContainer + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + connectionLayer = new FollowPointRenderer { - connectionLayer = new FollowPointRenderer - { - RelativeSizeAxes = Axes.Both, - Depth = 2, - }, - judgementLayer = new JudgementContainer - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }, - HitObjectContainer, - approachCircles = new ApproachCircleProxyContainer - { - RelativeSizeAxes = Axes.Both, - Depth = -1, - }, - } + RelativeSizeAxes = Axes.Both, + Depth = 2, + }, + judgementLayer = new JudgementContainer + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + }, + HitObjectContainer, + approachCircles = new ApproachCircleProxyContainer + { + RelativeSizeAxes = Axes.Both, + Depth = -1, + }, }; } diff --git a/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs similarity index 82% rename from osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs rename to osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs index c383c47491..e28ff5f460 100644 --- a/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs @@ -3,17 +3,23 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.UI { - public class PlayfieldAdjustmentContainer : Container + public class OsuPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer { protected override Container Content => content; private readonly Container content; - public PlayfieldAdjustmentContainer() + public OsuPlayfieldAdjustmentContainer() { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Size = new Vector2(0.75f); + InternalChild = new Container { Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 899b91863e..f595432082 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -81,6 +81,8 @@ namespace osu.Game.Rulesets.Taiko.UI public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); + protected override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new TaikoPlayfieldAdjustmentContainer(); + protected override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo); protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo); diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 35b941b52b..dbff5270d2 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -55,143 +55,137 @@ namespace osu.Game.Rulesets.Taiko.UI public TaikoPlayfield(ControlPointInfo controlPoints) { - InternalChild = new PlayfieldAdjustmentContainer + InternalChildren = new Drawable[] { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + backgroundContainer = new Container { - backgroundContainer = new Container + Name = "Transparent playfield background", + RelativeSizeAxes = Axes.Both, + Masking = true, + EdgeEffect = new EdgeEffectParameters { - Name = "Transparent playfield background", - RelativeSizeAxes = Axes.Both, - Masking = true, - EdgeEffect = new EdgeEffectParameters + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Radius = 5, + }, + Children = new Drawable[] + { + background = new Box { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.2f), - Radius = 5, + RelativeSizeAxes = Axes.Both, + Alpha = 0.6f }, - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.6f - }, - } - }, - new Container - { - Name = "Right area", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = left_area_size }, - Children = new Drawable[] - { - new Container - { - Name = "Masked elements before hit objects", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Masking = true, - Children = new Drawable[] - { - hitExplosionContainer = new Container - { - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Blending = BlendingMode.Additive, - }, - HitTarget = new HitTarget - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit - } - } - }, - barlineContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } - }, - new Container - { - Name = "Hit objects", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Masking = true, - Child = HitObjectContainer - }, - kiaiExplosionContainer = new Container - { - Name = "Kiai hit explosions", - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Blending = BlendingMode.Additive - }, - judgementContainer = new JudgementContainer - { - Name = "Judgements", - RelativeSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Blending = BlendingMode.Additive - }, - } - }, - overlayBackgroundContainer = new Container - { - Name = "Left overlay", - RelativeSizeAxes = Axes.Y, - Size = new Vector2(left_area_size, 1), - Children = new Drawable[] - { - overlayBackground = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new InputDrum(controlPoints) - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Scale = new Vector2(0.9f), - Margin = new MarginPadding { Right = 20 } - }, - new Box - { - Anchor = Anchor.TopRight, - RelativeSizeAxes = Axes.Y, - Width = 10, - Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), - }, - } - }, - new Container - { - Name = "Border", - RelativeSizeAxes = Axes.Both, - Masking = true, - MaskingSmoothness = 0, - BorderThickness = 2, - AlwaysPresent = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }, - topLevelHitContainer = new Container - { - Name = "Top level hit objects", - RelativeSizeAxes = Axes.Both, } + }, + new Container + { + Name = "Right area", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = left_area_size }, + Children = new Drawable[] + { + new Container + { + Name = "Masked elements before hit objects", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Masking = true, + Children = new Drawable[] + { + hitExplosionContainer = new Container + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Blending = BlendingMode.Additive, + }, + HitTarget = new HitTarget + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit + } + } + }, + barlineContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } + }, + new Container + { + Name = "Hit objects", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Masking = true, + Child = HitObjectContainer + }, + kiaiExplosionContainer = new Container + { + Name = "Kiai hit explosions", + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Blending = BlendingMode.Additive + }, + judgementContainer = new JudgementContainer + { + Name = "Judgements", + RelativeSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Blending = BlendingMode.Additive + }, + } + }, + overlayBackgroundContainer = new Container + { + Name = "Left overlay", + RelativeSizeAxes = Axes.Y, + Size = new Vector2(left_area_size, 1), + Children = new Drawable[] + { + overlayBackground = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new InputDrum(controlPoints) + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Scale = new Vector2(0.9f), + Margin = new MarginPadding { Right = 20 } + }, + new Box + { + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 10, + Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), + }, + } + }, + new Container + { + Name = "Border", + RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingSmoothness = 0, + BorderThickness = 2, + AlwaysPresent = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }, + topLevelHitContainer = new Container + { + Name = "Top level hit objects", + RelativeSizeAxes = Axes.Both, } }; } diff --git a/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs similarity index 68% rename from osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs rename to osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs index 0f0ad59fd3..84464b199e 100644 --- a/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs @@ -1,16 +1,23 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics; +using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Taiko.UI { - public class PlayfieldAdjustmentContainer : Container + public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer { private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768; private const float default_aspect = 16f / 9f; + public TaikoPlayfieldAdjustmentContainer() + { + Anchor = Anchor.CentreLeft; + Origin = Anchor.CentreLeft; + } + protected override void Update() { base.Update(); diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 4c0bc9867b..0ced3476d0 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -133,20 +133,19 @@ namespace osu.Game.Rulesets.UI return dependencies; } + protected virtual PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new PlayfieldAdjustmentContainer(); + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - KeyBindingInputManager.AddRange(new Drawable[] - { - Playfield, - (ResumeOverlay = CreateResumeOverlay()) ?? new Container() - }); - InternalChildren = new Drawable[] { frameStabilityContainer = new FrameStabilityContainer { - Child = KeyBindingInputManager, + Child = KeyBindingInputManager + .WithChild(CreatePlayfieldAdjustmentContainer() + .WithChild(Playfield) + ) }, Overlays = new Container { RelativeSizeAxes = Axes.Both } }; diff --git a/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs b/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs new file mode 100644 index 0000000000..fff4a450e5 --- /dev/null +++ b/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Rulesets.UI +{ + /// + /// A container which handles sizing of the and any other components that need to match their size. + /// + public class PlayfieldAdjustmentContainer : Container + { + public PlayfieldAdjustmentContainer() + { + RelativeSizeAxes = Axes.Both; + } + } +} From c79d187a896176018dd38d06c18cf7400a33f6d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 19:21:25 +0900 Subject: [PATCH 28/90] Add final osu! resume screen implementation --- osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs | 6 ++++-- osu.Game/Rulesets/UI/DrawableRuleset.cs | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs index 1c5032a938..ffb5d3b5d7 100644 --- a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs @@ -1,8 +1,7 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; -using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Input.Handlers; @@ -15,6 +14,7 @@ using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; +using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Osu.UI { @@ -35,6 +35,8 @@ namespace osu.Game.Rulesets.Osu.UI protected override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new OsuPlayfieldAdjustmentContainer(); + protected override ResumeOverlay CreateResumeOverlay() => new OsuResumeOverlay(); + public override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { switch (h) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 0ced3476d0..0f61b1cb2f 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -150,6 +150,13 @@ namespace osu.Game.Rulesets.UI Overlays = new Container { RelativeSizeAxes = Axes.Both } }; + if ((ResumeOverlay = CreateResumeOverlay()) != null) + { + AddInternal(CreateInputManager() + .WithChild(CreatePlayfieldAdjustmentContainer() + .WithChild(ResumeOverlay))); + } + applyRulesetMods(mods, config); loadObjects(); @@ -173,6 +180,7 @@ namespace osu.Game.Rulesets.UI { if (ResumeOverlay != null && (Cursor == null || Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) { + ResumeOverlay.GameplayCursor = Cursor; ResumeOverlay.ResumeAction = continueResume; ResumeOverlay.Show(); } From 95889440488e9639b855e85d0c33e56aec63b6eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 19:21:34 +0900 Subject: [PATCH 29/90] Fix multiple cursors appearing --- osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs index 9829839841..5312711a7d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs @@ -35,12 +35,16 @@ namespace osu.Game.Rulesets.Osu.UI { base.Show(); clickToResumeCursor.ShowAt(GameplayCursor.ActiveCursor.Position); - Add(localCursorContainer = new GameplayCursorContainer()); + + if (localCursorContainer == null) + Add(localCursorContainer = new GameplayCursorContainer()); } public override void Hide() { - localCursorContainer.Expire(); + localCursorContainer?.Expire(); + localCursorContainer = null; + base.Hide(); } From 06d4856e1716a250d26483aa1e67d3799f33f5bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 19:21:47 +0900 Subject: [PATCH 30/90] Remove unnecessary CursorTargetContainer --- osu.Game/Rulesets/UI/Playfield.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 78d14a27e3..53bfa6af48 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.UI Cursor = CreateCursor(); if (Cursor != null) - CursorTargetContainer.Add(Cursor); + AddInternal(Cursor); } /// @@ -99,11 +99,6 @@ namespace osu.Game.Rulesets.UI /// The cursor, or null if a cursor is not rqeuired. protected virtual CursorContainer CreateCursor() => null; - /// - /// The target container to add the cursor after it is created. - /// - protected virtual Container CursorTargetContainer => null; - /// /// Registers a as a nested . /// This does not add the to the draw hierarchy. From a23dfb58ad11d7b324aa9301ddc1527c862ce56d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 20:25:16 +0900 Subject: [PATCH 31/90] Add base cursor class to retrieve true visibility state --- .../TestCaseGameplayCursor.cs | 3 ++- .../Edit/DrawableOsuEditRuleset.cs | 3 +-- .../UI/Cursor/GameplayCursorContainer.cs | 6 ++--- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 3 +-- osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 3 ++- osu.Game/Rulesets/UI/DrawableRuleset.cs | 8 +++--- .../Rulesets/UI/GameplayCursorContainer.cs | 25 +++++++++++++++++++ osu.Game/Rulesets/UI/Playfield.cs | 5 ++-- 8 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 osu.Game/Rulesets/UI/GameplayCursorContainer.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs index 5c1e775c01..1e2a936002 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.Cursor; using osu.Game.Rulesets.Osu.UI.Cursor; +using osu.Game.Rulesets.UI; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests @@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Tests [BackgroundDependencyLoader] private void load() { - Add(cursorContainer = new GameplayCursorContainer { RelativeSizeAxes = Axes.Both }); + Add(cursorContainer = new OsuCursorContainer { RelativeSizeAxes = Axes.Both }); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs index 1a6e78d918..3ae554a5d7 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; @@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Edit private class OsuPlayfieldNoCursor : OsuPlayfield { - protected override CursorContainer CreateCursor() => null; + protected override GameplayCursorContainer CreateCursor() => null; } } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs index b64561e4f7..f028a5f15c 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs @@ -3,12 +3,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Input.Bindings; +using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu.UI.Cursor { - public class GameplayCursorContainer : CursorContainer, IKeyBindingHandler + public class OsuCursorContainer : GameplayCursorContainer, IKeyBindingHandler { protected override Drawable CreateCursor() => new OsuCursor(); @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private readonly Container fadeContainer; - public GameplayCursorContainer() + public OsuCursorContainer() { InternalChild = fadeContainer = new Container { diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 5e532d9b04..0cbe0cca85 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Connections; using osu.Game.Rulesets.UI; using System.Linq; -using osu.Framework.Graphics.Cursor; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.UI.Cursor; @@ -24,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.UI public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); - protected override CursorContainer CreateCursor() => new GameplayCursorContainer(); + protected override GameplayCursorContainer CreateCursor() => new OsuCursorContainer(); public OsuPlayfield() { diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs index 5312711a7d..0d4e7edb7b 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Rulesets.Osu.UI.Cursor; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using osuTK; using osuTK.Graphics; @@ -37,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.UI clickToResumeCursor.ShowAt(GameplayCursor.ActiveCursor.Position); if (localCursorContainer == null) - Add(localCursorContainer = new GameplayCursorContainer()); + Add(localCursorContainer = new OsuCursorContainer()); } public override void Hide() diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 0f61b1cb2f..2b64aec8ea 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.UI public override void RequestResume(Action continueResume) { - if (ResumeOverlay != null && (Cursor == null || Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) + if (ResumeOverlay != null && (Cursor == null || ((GameplayCursorContainer)Cursor).LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) { ResumeOverlay.GameplayCursor = Cursor; ResumeOverlay.ResumeAction = continueResume; @@ -284,7 +284,9 @@ namespace osu.Game.Rulesets.UI protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor - public override CursorContainer Cursor => Playfield.Cursor; + CursorContainer IProvideCursor.Cursor => Playfield.Cursor; + + public override GameplayCursorContainer Cursor => Playfield.Cursor; public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value; @@ -354,7 +356,7 @@ namespace osu.Game.Rulesets.UI /// /// The cursor being displayed by the . May be null if no cursor is provided. /// - public abstract CursorContainer Cursor { get; } + public abstract GameplayCursorContainer Cursor { get; } /// /// Sets a replay to be used, overriding local input. diff --git a/osu.Game/Rulesets/UI/GameplayCursorContainer.cs b/osu.Game/Rulesets/UI/GameplayCursorContainer.cs new file mode 100644 index 0000000000..de73c08809 --- /dev/null +++ b/osu.Game/Rulesets/UI/GameplayCursorContainer.cs @@ -0,0 +1,25 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; + +namespace osu.Game.Rulesets.UI +{ + public class GameplayCursorContainer : CursorContainer + { + /// + /// Because Show/Hide are executed by a parent, is updated immediately even if the cursor + /// is in a non-updating state (via limitations). + /// + /// This holds the true visibility value. + /// + public Visibility LastFrameState; + + protected override void Update() + { + base.Update(); + LastFrameState = State; + } + } +} diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 53bfa6af48..48b950c070 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -10,7 +10,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osuTK; @@ -90,14 +89,14 @@ namespace osu.Game.Rulesets.UI /// /// The cursor currently being used by this . May be null if no cursor is provided. /// - public CursorContainer Cursor { get; private set; } + public GameplayCursorContainer Cursor { get; private set; } /// /// Provide an optional cursor which is to be used for gameplay. /// If providing a cursor, must also point to a valid target container. /// /// The cursor, or null if a cursor is not rqeuired. - protected virtual CursorContainer CreateCursor() => null; + protected virtual GameplayCursorContainer CreateCursor() => null; /// /// Registers a as a nested . From 245f463e3fd554f522f666a01c4864ccfbbde7cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 20:25:47 +0900 Subject: [PATCH 32/90] Don't update gameplay loop while paused --- osu.Game/Rulesets/UI/FrameStabilityContainer.cs | 5 ++++- osu.Game/Screens/Play/GameplayClock.cs | 3 +++ osu.Game/Screens/Play/GameplayClockContainer.cs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs index 161e7aecb4..deec2b8eac 100644 --- a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs +++ b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs @@ -36,7 +36,10 @@ namespace osu.Game.Rulesets.UI private void load(GameplayClock clock) { if (clock != null) + { parentGameplayClock = clock; + gameplayClock.IsPaused.BindTo(clock.IsPaused); + } } protected override void LoadComplete() @@ -68,7 +71,7 @@ namespace osu.Game.Rulesets.UI public override bool UpdateSubTree() { requireMoreUpdateLoops = true; - validState = true; + validState = !gameplayClock.IsPaused.Value; int loops = 0; diff --git a/osu.Game/Screens/Play/GameplayClock.cs b/osu.Game/Screens/Play/GameplayClock.cs index 0400bfbc27..3efcfa0f65 100644 --- a/osu.Game/Screens/Play/GameplayClock.cs +++ b/osu.Game/Screens/Play/GameplayClock.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osu.Framework.Timing; namespace osu.Game.Screens.Play @@ -17,6 +18,8 @@ namespace osu.Game.Screens.Play { private readonly IFrameBasedClock underlyingClock; + public readonly BindableBool IsPaused = new BindableBool(); + public GameplayClock(IFrameBasedClock underlyingClock) { this.underlyingClock = underlyingClock; diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index deac5e02bf..546364b26d 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -79,6 +79,8 @@ namespace osu.Game.Screens.Play // the clock to be exposed via DI to children. GameplayClock = new GameplayClock(offsetClock); + + GameplayClock.IsPaused.BindTo(IsPaused); } [BackgroundDependencyLoader] From 15aea7f745ac0b9dfa4695eef7da897f84a02418 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 21:39:15 +0900 Subject: [PATCH 33/90] Update framework --- osu.Game/Screens/Multi/MultiplayerSubScreen.cs | 2 -- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Multi/MultiplayerSubScreen.cs b/osu.Game/Screens/Multi/MultiplayerSubScreen.cs index ad72072981..65e501b114 100644 --- a/osu.Game/Screens/Multi/MultiplayerSubScreen.cs +++ b/osu.Game/Screens/Multi/MultiplayerSubScreen.cs @@ -14,8 +14,6 @@ namespace osu.Game.Screens.Multi { public override bool DisallowExternalBeatmapRulesetChanges => false; - public override bool RemoveWhenNotAlive => false; - public virtual string ShortTitle => Title; [Resolved(CanBeNull = true)] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 71324ea0f0..eb5d0fd8ee 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 02099a59bb..c3792a48a1 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From a642f1013167c61cd60fe4f76f69c4b391600f02 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 21:52:01 +0900 Subject: [PATCH 34/90] Remove redundant cast --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 2b64aec8ea..bdb1c9c0cc 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.UI public override void RequestResume(Action continueResume) { - if (ResumeOverlay != null && (Cursor == null || ((GameplayCursorContainer)Cursor).LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) + if (ResumeOverlay != null && (Cursor == null || Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) { ResumeOverlay.GameplayCursor = Cursor; ResumeOverlay.ResumeAction = continueResume; From 82140c38fc39ca7e0124b80ebdd043fd72281584 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 22:00:33 +0900 Subject: [PATCH 35/90] Apply CI fixes --- .../{GameplayCursorContainer.cs => OsuCursorContainer.cs} | 0 osu.Game/Rulesets/UI/DrawableRuleset.cs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Rulesets.Osu/UI/Cursor/{GameplayCursorContainer.cs => OsuCursorContainer.cs} (100%) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs similarity index 100% rename from osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs rename to osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index bdb1c9c0cc..905da3c33b 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.UI public override void RequestResume(Action continueResume) { - if (ResumeOverlay != null && (Cursor == null || Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))) + if (ResumeOverlay != null && (Cursor == null || (Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre)))) { ResumeOverlay.GameplayCursor = Cursor; ResumeOverlay.ResumeAction = continueResume; From f4aeb390efb7ee2a8620a73c02e0a43bf25b1f86 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Mar 2019 10:21:34 +0900 Subject: [PATCH 36/90] Initial re-layout of score table --- .../TestCaseBeatmapScoresContainer.cs | 12 +- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 213 +++++++++++++++++- 2 files changed, 222 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs index b626c23f25..2bc0796045 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs @@ -1,18 +1,17 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.MathUtils; -using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -24,6 +23,15 @@ namespace osu.Game.Tests.Visual.SongSelect [Description("in BeatmapOverlay")] public class TestCaseBeatmapScoresContainer : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ScoresContainer), + typeof(ScoreTable), + typeof(ScoreTableRow), + typeof(ScoreTableHeader), + typeof(ScoreTableScore) + }; + private readonly Box background; public TestCaseBeatmapScoresContainer() diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index aacbc12cd8..7e838f0aae 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -6,19 +6,52 @@ using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; using System.Linq; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Online.Leaderboards; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Users; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { public class ScoreTable : CompositeDrawable { + private const int fade_duration = 100; + private const int text_size = 14; + private readonly FillFlowContainer scoresFlow; + private readonly ScoresGrid scoresGrid; public ScoreTable() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - InternalChild = scoresFlow = new FillFlowContainer + InternalChild = scoresGrid = new ScoresGrid + { + RelativeSizeAxes = Axes.X, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 40), + new Dimension(GridSizeMode.Absolute, 70), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Distributed, minSize: 180), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 40, maxSize: 70), + new Dimension(GridSizeMode.AutoSize), + } + }; + + scoresFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -48,6 +81,184 @@ namespace osu.Game.Overlays.BeatmapSet.Scores int index = 0; foreach (var s in value) scoresFlow.Add(new ScoreTableScore(index++, s, maxModsAmount)); + + scoresGrid.Content = value.Select((s, i) => createRowContents(s, i).ToArray()).ToArray(); + } + } + + private IEnumerable createRowContents(APIScoreInfo score, int index) + { + yield return new SpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = $"#{index + 1}", + Font = @"Exo2.0-Bold", + TextSize = text_size, + }; + + yield return new DrawableRank(score.Rank) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(30, 20), + FillMode = FillMode.Fit, + }; + + yield return new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding { Right = 20 }, + Text = $@"{score.TotalScore:N0}", + TextSize = text_size, + Font = index == 0 ? OsuFont.GetFont(weight: FontWeight.Bold) : OsuFont.Default + }; + + yield return new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding { Right = 20 }, + Text = $@"{score.Accuracy:P2}", + TextSize = text_size, + Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White + }; + + yield return new FillFlowContainer + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + new DrawableFlag(score.User.Country) + { + Size = new Vector2(20, 13), + }, + new ClickableScoreUsername + { + User = score.User, + } + } + }; + + yield return new SpriteText + { + Text = $@"{score.MaxCombo:N0}x", + TextSize = text_size, + }; + + yield return new SpriteText + { + Text = $"{score.Statistics[HitResult.Great]}", + TextSize = text_size, + Colour = score.Statistics[HitResult.Great] == 0 ? Color4.Gray : Color4.White + }; + + yield return new SpriteText + { + Text = $"{score.Statistics[HitResult.Good]}", + TextSize = text_size, + Colour = score.Statistics[HitResult.Good] == 0 ? Color4.Gray : Color4.White + }; + + yield return new SpriteText + { + Text = $"{score.Statistics[HitResult.Meh]}", + TextSize = text_size, + Colour = score.Statistics[HitResult.Meh] == 0 ? Color4.Gray : Color4.White + }; + + yield return new SpriteText + { + Text = $"{score.Statistics[HitResult.Miss]}", + TextSize = text_size, + Colour = score.Statistics[HitResult.Miss] == 0 ? Color4.Gray : Color4.White + }; + + yield return new SpriteText + { + Text = $@"{score.PP:N0}", + TextSize = text_size, + }; + + yield return new FillFlowContainer + { + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m) + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.3f), + }) + }; + } + + private class ScoresGrid : GridContainer + { + public ScoresGrid() + { + AutoSizeAxes = Axes.Y; + } + + public Drawable[][] Content + { + get => base.Content; + set + { + base.Content = value; + + RowDimensions = Enumerable.Repeat(new Dimension(GridSizeMode.Absolute, 25), value.Length).ToArray(); + } + } + } + + private class ClickableScoreUsername : ClickableUserContainer + { + private readonly SpriteText text; + private readonly SpriteText textBold; + + public ClickableScoreUsername() + { + Add(text = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = text_size, + }); + + Add(textBold = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = text_size, + Font = @"Exo2.0-Bold", + Alpha = 0, + }); + } + + protected override void OnUserChange(User user) + { + text.Text = textBold.Text = user.Username; + } + + protected override bool OnHover(HoverEvent e) + { + textBold.FadeIn(fade_duration, Easing.OutQuint); + text.FadeOut(fade_duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + textBold.FadeOut(fade_duration, Easing.OutQuint); + text.FadeIn(fade_duration, Easing.OutQuint); + base.OnHoverLost(e); } } } From b75ea295dbf97862711515506e1fad7332ca8120 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 11:28:43 +0900 Subject: [PATCH 37/90] Rename KeyCounterCollection -> KeyCounterDisplay Also fix not working --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 4 +-- osu.Game/Rulesets/UI/DrawableRuleset.cs | 2 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 28 +++++++++++++------ osu.Game/Screens/Play/HUDOverlay.cs | 4 +-- ...nterCollection.cs => KeyCounterDisplay.cs} | 8 +++--- 5 files changed, 28 insertions(+), 18 deletions(-) rename osu.Game/Screens/Play/{KeyCounterCollection.cs => KeyCounterDisplay.cs} (95%) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index 52caffc29f..9360cfd911 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -20,13 +20,13 @@ namespace osu.Game.Tests.Visual { typeof(KeyCounterKeyboard), typeof(KeyCounterMouse), - typeof(KeyCounterCollection) + typeof(KeyCounterDisplay) }; public TestCaseKeyCounter() { KeyCounterKeyboard rewindTestKeyCounterKeyboard; - KeyCounterCollection kc = new KeyCounterCollection + KeyCounterDisplay kc = new KeyCounterDisplay { Origin = Anchor.Centre, Anchor = Anchor.Centre, diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 905da3c33b..88fdb9a135 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -232,7 +232,7 @@ namespace osu.Game.Rulesets.UI /// The DrawableHitObject. public abstract DrawableHitObject GetVisualRepresentation(TObject h); - public void Attach(KeyCounterCollection keyCounter) => + public void Attach(KeyCounterDisplay keyCounter) => (KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter); /// diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index e303166774..150c53274f 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; @@ -34,11 +35,19 @@ namespace osu.Game.Rulesets.UI protected readonly KeyBindingContainer KeyBindingContainer; - protected override Container Content => KeyBindingContainer; + protected override Container Content => content; + + private readonly Container content; + + private class Poop : Container + { + } protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) { - InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique); + InternalChild = KeyBindingContainer = + (KeyBindingContainer)CreateKeyBindingContainer(ruleset, variant, unique) + .WithChild(content = new Container { RelativeSizeAxes = Axes.Both }); } [BackgroundDependencyLoader(true)] @@ -115,18 +124,19 @@ namespace osu.Game.Rulesets.UI #region Key Counter Attachment - public void Attach(KeyCounterCollection keyCounter) + public void Attach(KeyCounterDisplay keyCounter) { var receptor = new ActionReceptor(keyCounter); - Add(receptor); - keyCounter.SetReceptor(receptor); + KeyBindingContainer.Add(receptor); + + keyCounter.SetReceptor(receptor); keyCounter.AddRange(KeyBindingContainer.DefaultKeyBindings.Select(b => b.GetAction()).Distinct().Select(b => new KeyCounterAction(b))); } - public class ActionReceptor : KeyCounterCollection.Receptor, IKeyBindingHandler + public class ActionReceptor : KeyCounterDisplay.Receptor, IKeyBindingHandler { - public ActionReceptor(KeyCounterCollection target) + public ActionReceptor(KeyCounterDisplay target) : base(target) { } @@ -159,12 +169,12 @@ namespace osu.Game.Rulesets.UI } /// - /// Supports attaching a . + /// Supports attaching a . /// Keys will be populated automatically and a receptor will be injected inside. /// public interface ICanAttachKeyCounter { - void Attach(KeyCounterCollection keyCounter); + void Attach(KeyCounterDisplay keyCounter); } public class RulesetInputManagerInputState : InputState diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 285e6eab23..a7b7f96e7a 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play { private const int duration = 100; - public readonly KeyCounterCollection KeyCounter; + public readonly KeyCounterDisplay KeyCounter; public readonly RollingCounter ComboCounter; public readonly ScoreCounter ScoreCounter; public readonly RollingCounter AccuracyCounter; @@ -201,7 +201,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20 } }; - protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + protected virtual KeyCounterDisplay CreateKeyCounter() => new KeyCounterDisplay { FadeTime = 50, Anchor = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterDisplay.cs similarity index 95% rename from osu.Game/Screens/Play/KeyCounterCollection.cs rename to osu.Game/Screens/Play/KeyCounterDisplay.cs index 1b43737731..d5967f5899 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterDisplay.cs @@ -14,14 +14,14 @@ using osuTK.Graphics; namespace osu.Game.Screens.Play { - public class KeyCounterCollection : FillFlowContainer + public class KeyCounterDisplay : FillFlowContainer { private const int duration = 100; public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); - public KeyCounterCollection() + public KeyCounterDisplay() { Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; @@ -138,9 +138,9 @@ namespace osu.Game.Screens.Play public class Receptor : Drawable { - protected readonly KeyCounterCollection Target; + protected readonly KeyCounterDisplay Target; - public Receptor(KeyCounterCollection target) + public Receptor(KeyCounterDisplay target) { RelativeSizeAxes = Axes.Both; Depth = float.MinValue; From c403dede20ccddd7186fd315acf4a0e5f1d09f49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 13:16:46 +0900 Subject: [PATCH 38/90] Add ManualInputManager to screen tests Also sanitises content init order (ctor for content; bdl for other) --- .../Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs | 3 ++- osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs | 4 +++- osu.Game/Tests/Visual/ManualInputManagerTestCase.cs | 3 +-- osu.Game/Tests/Visual/PlayerTestCase.cs | 5 +++++ osu.Game/Tests/Visual/ScreenTestCase.cs | 8 +++++--- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs index 34de61cb5b..497da33a05 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs @@ -27,7 +27,8 @@ namespace osu.Game.Tests.Visual.Multiplayer [Cached(Type = typeof(IRoomManager))] private TestRoomManager roomManager = new TestRoomManager(); - public TestCaseLoungeRoomsContainer() + [BackgroundDependencyLoader] + private void load() { RoomsContainer container; diff --git a/osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs b/osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs index 9453d0a5b2..53fb60bcb6 100644 --- a/osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs +++ b/osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; +using osu.Framework.Allocation; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; @@ -11,7 +12,8 @@ namespace osu.Game.Tests.Visual.Tournament [Description("for tournament use")] public class TestCaseDrawings : ScreenTestCase { - public TestCaseDrawings() + [BackgroundDependencyLoader] + private void load() { LoadScreen(new Drawings { diff --git a/osu.Game/Tests/Visual/ManualInputManagerTestCase.cs b/osu.Game/Tests/Visual/ManualInputManagerTestCase.cs index 7c7c5938aa..f14ac833e4 100644 --- a/osu.Game/Tests/Visual/ManualInputManagerTestCase.cs +++ b/osu.Game/Tests/Visual/ManualInputManagerTestCase.cs @@ -14,8 +14,7 @@ namespace osu.Game.Tests.Visual protected ManualInputManagerTestCase() { - base.Content.Add(InputManager = new ManualInputManager()); - ReturnUserInput(); + base.Content.Add(InputManager = new ManualInputManager { UseParentInput = true }); } /// diff --git a/osu.Game/Tests/Visual/PlayerTestCase.cs b/osu.Game/Tests/Visual/PlayerTestCase.cs index 50cb839ed9..fb10244b12 100644 --- a/osu.Game/Tests/Visual/PlayerTestCase.cs +++ b/osu.Game/Tests/Visual/PlayerTestCase.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Testing; @@ -23,7 +24,11 @@ namespace osu.Game.Tests.Visual protected PlayerTestCase(Ruleset ruleset) { this.ruleset = ruleset; + } + [BackgroundDependencyLoader] + private void load() + { Add(new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Tests/Visual/ScreenTestCase.cs b/osu.Game/Tests/Visual/ScreenTestCase.cs index eec60d01c5..981f9acb63 100644 --- a/osu.Game/Tests/Visual/ScreenTestCase.cs +++ b/osu.Game/Tests/Visual/ScreenTestCase.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Screens; @@ -9,11 +10,12 @@ namespace osu.Game.Tests.Visual /// /// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions). /// - public abstract class ScreenTestCase : OsuTestCase + public abstract class ScreenTestCase : ManualInputManagerTestCase { - private readonly OsuScreenStack stack; + private OsuScreenStack stack; - protected ScreenTestCase() + [BackgroundDependencyLoader] + private void load() { Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; } From 256a579de02228bb3e243c6c6b350c4907eabb63 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 13:17:00 +0900 Subject: [PATCH 39/90] Allow player to not pause on focus loss --- osu.Game/Screens/Play/Player.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7b1cdd21a6..f2fd7e765f 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -47,6 +47,8 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; + public bool PauseOnFocusLost { get; set; } = true; + private Bindable mouseWheelDisabled; private readonly Bindable storyboardReplacesBackground = new Bindable(); @@ -372,7 +374,7 @@ namespace osu.Game.Screens.Play base.Update(); // eagerly pause when we lose window focus (if we are locally playing). - if (!Game.IsActive.Value) + if (PauseOnFocusLost && !Game.IsActive.Value) Pause(); } From 85c63f14f2e630c5eadf1b66646bb658cdabdd43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 13:18:33 +0900 Subject: [PATCH 40/90] Add comprehensive player resume testing --- .../Visual/Gameplay/TestCasePause.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index 1ed61c9fe1..a52e84ed62 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -1,13 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using NUnit.Framework; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Cursor; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; +using osuTK; +using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay { @@ -15,14 +21,52 @@ namespace osu.Game.Tests.Visual.Gameplay { protected new PausePlayer Player => (PausePlayer)base.Player; + private readonly Container content; + + protected override Container Content => content; + public TestCasePause() : base(new OsuRuleset()) { + base.Content.Add(content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }); } [Test] public void TestPauseResume() { + AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10))); + pauseAndConfirm(); + resumeAndConfirm(); + } + + [Test] + public void TestResumeWithResumeOverlay() + { + AddStep("move cursor to center", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.Centre)); + AddUntilStep("wait for hitobjects", () => Player.ScoreProcessor.Health.Value < 1); + + pauseAndConfirm(); + resume(); + + confirmClockRunning(false); + confirmPauseOverlayShown(false); + + AddStep("click to resume", () => + { + InputManager.PressButton(MouseButton.Left); + InputManager.ReleaseButton(MouseButton.Left); + }); + + confirmClockRunning(true); + } + + [Test] + public void TestResumeWithResumeOverlaySkipped() + { + AddStep("move cursor to button", () => + InputManager.MoveMouseTo(Player.HUDOverlay.HoldToQuit.Children.OfType().First().ScreenSpaceDrawQuad.Centre)); + AddUntilStep("wait for hitobjects", () => Player.ScoreProcessor.Health.Value < 1); + pauseAndConfirm(); resumeAndConfirm(); } @@ -30,6 +74,8 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestPauseTooSoon() { + AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10))); + pauseAndConfirm(); resumeAndConfirm(); @@ -144,9 +190,16 @@ namespace osu.Game.Tests.Visual.Gameplay public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; + public new HUDOverlay HUDOverlay => base.HUDOverlay; + public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible; public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible; + + public PausePlayer() + { + PauseOnFocusLost = false; + } } } } From 27cb4ce0d1a761b1e9df48f92cdd74802c46d061 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 13:48:35 +0900 Subject: [PATCH 41/90] Remove poop --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 150c53274f..656170f339 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -39,10 +39,6 @@ namespace osu.Game.Rulesets.UI private readonly Container content; - private class Poop : Container - { - } - protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) { InternalChild = KeyBindingContainer = From fb302e7ad8e464ac6dd6950c0972819e213147b6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 13:58:07 +0900 Subject: [PATCH 42/90] Remove using --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 656170f339..3ce8f92458 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; From adab31fd582dfe6509e863f3f221b012271142b1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Mar 2019 17:38:56 +0900 Subject: [PATCH 43/90] Cleanup + fix up score table layout --- .../Online/TestCaseBeatmapSetOverlay.cs | 6 +- .../TestCaseBeatmapScoresContainer.cs | 5 +- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 237 +++-------------- .../BeatmapSet/Scores/ScoreTableHeader.cs | 70 ----- .../BeatmapSet/Scores/ScoreTableHeaderRow.cs | 46 ++++ .../BeatmapSet/Scores/ScoreTableRow.cs | 246 ++++++------------ .../Scores/ScoreTableRowBackground.cs | 64 +++++ .../BeatmapSet/Scores/ScoreTableScore.cs | 220 ---------------- .../BeatmapSet/Scores/ScoreTableScoreRow.cs | 168 ++++++++++++ 9 files changed, 401 insertions(+), 661 deletions(-) delete mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs delete mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs diff --git a/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs index df24c42b00..19d295cf12 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs @@ -25,7 +25,11 @@ namespace osu.Game.Tests.Visual.Online { typeof(Header), typeof(ClickableUserContainer), - typeof(ScoreTableScore), + typeof(ScoreTable), + typeof(ScoreTableRow), + typeof(ScoreTableHeaderRow), + typeof(ScoreTableScoreRow), + typeof(ScoreTableRowBackground), typeof(DrawableTopScore), typeof(ScoresContainer), typeof(AuthorInfo), diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs index 2bc0796045..63dacef8fa 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs @@ -28,8 +28,9 @@ namespace osu.Game.Tests.Visual.SongSelect typeof(ScoresContainer), typeof(ScoreTable), typeof(ScoreTableRow), - typeof(ScoreTableHeader), - typeof(ScoreTableScore) + typeof(ScoreTableHeaderRow), + typeof(ScoreTableScoreRow), + typeof(ScoreTableRowBackground), }; private readonly Box background; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 7e838f0aae..e2acf778a3 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -6,203 +6,74 @@ using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; using System.Linq; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Online.Leaderboards; -using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; -using osu.Game.Users; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { public class ScoreTable : CompositeDrawable { - private const int fade_duration = 100; - private const int text_size = 14; - - private readonly FillFlowContainer scoresFlow; private readonly ScoresGrid scoresGrid; + private readonly FillFlowContainer backgroundFlow; public ScoreTable() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - InternalChild = scoresGrid = new ScoresGrid + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.X, - ColumnDimensions = new[] + backgroundFlow = new FillFlowContainer { - new Dimension(GridSizeMode.Absolute, 40), - new Dimension(GridSizeMode.Absolute, 70), - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.Distributed, minSize: 180), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 40, maxSize: 70), - new Dimension(GridSizeMode.AutoSize), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = 25 } + }, + scoresGrid = new ScoresGrid + { + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 40), + new Dimension(GridSizeMode.Absolute, 70), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Distributed, minSize: 150), + new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), + new Dimension(GridSizeMode.Distributed, minSize: 40, maxSize: 70), + new Dimension(GridSizeMode.AutoSize), + } } }; - - scoresFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical - }; } public IEnumerable Scores { set { - scoresFlow.Clear(); - if (value == null || !value.Any()) return; - int maxModsAmount = 0; - foreach (var s in value) - { - var scoreModsAmount = s.Mods.Length; - if (scoreModsAmount > maxModsAmount) - maxModsAmount = scoreModsAmount; - } - - scoresFlow.Add(new ScoreTableHeader(maxModsAmount)); + var content = new List { new ScoreTableHeaderRow().CreateDrawables().ToArray() }; int index = 0; foreach (var s in value) - scoresFlow.Add(new ScoreTableScore(index++, s, maxModsAmount)); + content.Add(new ScoreTableScoreRow(index++, s).CreateDrawables().ToArray()); - scoresGrid.Content = value.Select((s, i) => createRowContents(s, i).ToArray()).ToArray(); + scoresGrid.Content = content.ToArray(); + + backgroundFlow.Clear(); + for (int i = 0; i < index; i++) + backgroundFlow.Add(new ScoreTableRowBackground(i)); } } - private IEnumerable createRowContents(APIScoreInfo score, int index) - { - yield return new SpriteText - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Text = $"#{index + 1}", - Font = @"Exo2.0-Bold", - TextSize = text_size, - }; - - yield return new DrawableRank(score.Rank) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(30, 20), - FillMode = FillMode.Fit, - }; - - yield return new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding { Right = 20 }, - Text = $@"{score.TotalScore:N0}", - TextSize = text_size, - Font = index == 0 ? OsuFont.GetFont(weight: FontWeight.Bold) : OsuFont.Default - }; - - yield return new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding { Right = 20 }, - Text = $@"{score.Accuracy:P2}", - TextSize = text_size, - Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White - }; - - yield return new FillFlowContainer - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Children = new Drawable[] - { - new DrawableFlag(score.User.Country) - { - Size = new Vector2(20, 13), - }, - new ClickableScoreUsername - { - User = score.User, - } - } - }; - - yield return new SpriteText - { - Text = $@"{score.MaxCombo:N0}x", - TextSize = text_size, - }; - - yield return new SpriteText - { - Text = $"{score.Statistics[HitResult.Great]}", - TextSize = text_size, - Colour = score.Statistics[HitResult.Great] == 0 ? Color4.Gray : Color4.White - }; - - yield return new SpriteText - { - Text = $"{score.Statistics[HitResult.Good]}", - TextSize = text_size, - Colour = score.Statistics[HitResult.Good] == 0 ? Color4.Gray : Color4.White - }; - - yield return new SpriteText - { - Text = $"{score.Statistics[HitResult.Meh]}", - TextSize = text_size, - Colour = score.Statistics[HitResult.Meh] == 0 ? Color4.Gray : Color4.White - }; - - yield return new SpriteText - { - Text = $"{score.Statistics[HitResult.Miss]}", - TextSize = text_size, - Colour = score.Statistics[HitResult.Miss] == 0 ? Color4.Gray : Color4.White - }; - - yield return new SpriteText - { - Text = $@"{score.PP:N0}", - TextSize = text_size, - }; - - yield return new FillFlowContainer - { - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.3f), - }) - }; - } - private class ScoresGrid : GridContainer { public ScoresGrid() { + RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; } @@ -217,49 +88,5 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } } - - private class ClickableScoreUsername : ClickableUserContainer - { - private readonly SpriteText text; - private readonly SpriteText textBold; - - public ClickableScoreUsername() - { - Add(text = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = text_size, - }); - - Add(textBold = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = text_size, - Font = @"Exo2.0-Bold", - Alpha = 0, - }); - } - - protected override void OnUserChange(User user) - { - text.Text = textBold.Text = user.Username; - } - - protected override bool OnHover(HoverEvent e) - { - textBold.FadeIn(fade_duration, Easing.OutQuint); - text.FadeOut(fade_duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - textBold.FadeOut(fade_duration, Easing.OutQuint); - text.FadeIn(fade_duration, Easing.OutQuint); - base.OnHoverLost(e); - } - } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs deleted file mode 100644 index 544bf34ec5..0000000000 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeader.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics.Sprites; - -namespace osu.Game.Overlays.BeatmapSet.Scores -{ - public class ScoreTableHeader : ScoreTableRow - { - public ScoreTableHeader(int maxModsAmount) - : base(maxModsAmount) - { - RankContainer.Add(new ScoreText - { - Text = @"rank".ToUpper(), - }); - ScoreContainer.Add(new ScoreText - { - Text = @"score".ToUpper(), - }); - AccuracyContainer.Add(new ScoreText - { - Text = @"accuracy".ToUpper(), - }); - PlayerContainer.Add(new ScoreText - { - Text = @"player".ToUpper(), - }); - MaxComboContainer.Add(new ScoreText - { - Text = @"max combo".ToUpper(), - }); - HitGreatContainer.Add(new ScoreText - { - Text = "300".ToUpper(), - }); - HitGoodContainer.Add(new ScoreText - { - Text = "100".ToUpper(), - }); - HitMehContainer.Add(new ScoreText - { - Text = "50".ToUpper(), - }); - HitMissContainer.Add(new ScoreText - { - Text = @"misses".ToUpper(), - }); - PPContainer.Add(new ScoreText - { - Text = @"pp".ToUpper(), - }); - ModsContainer.Add(new ScoreText - { - Text = @"mods".ToUpper(), - }); - } - - private class ScoreText : SpriteText - { - private const float text_size = 12; - - public ScoreText() - { - TextSize = text_size; - Font = @"Exo2.0-Black"; - } - } - } -} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs new file mode 100644 index 0000000000..a48716b71a --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class ScoreTableHeaderRow : ScoreTableRow + { + protected override Drawable CreateIndexCell() => new CellText("rank"); + + protected override Drawable CreateRankCell() => new Container(); + + protected override Drawable CreateScoreCell() => new CellText("score"); + + protected override Drawable CreateAccuracyCell() => new CellText("accuracy"); + + protected override Drawable CreatePlayerCell() => new CellText("player"); + + protected override IEnumerable CreateStatisticsCells() => new[] + { + new CellText("max combo"), + new CellText("300"), + new CellText("100"), + new CellText("50"), + new CellText("miss"), + }; + + protected override Drawable CreatePpCell() => new CellText("pp"); + + protected override Drawable CreateModsCell() => new CellText("mods"); + + private class CellText : OsuSpriteText + { + public CellText(string text) + { + Text = text.ToUpper(); + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black); + } + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs index 3a48a0cca1..4abfb92957 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs @@ -1,183 +1,103 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoreTableRow : GridContainer + public abstract class ScoreTableRow { - private const float rank_position = 30; - private const float drawable_rank_position = 45; - private const float score_position = 90; - private const float accuracy_position = 170; - private const float flag_position = 220; - private const float player_position = 250; + protected const int TEXT_SIZE = 14; - private const float max_combo_position = 0.1f; - private const float hit_great_position = 0.3f; - private const float hit_good_position = 0.45f; - private const float hit_meh_position = 0.6f; - private const float hit_miss_position = 0.75f; - private const float pp_position = 0.9f; - - protected readonly Container RankContainer; - protected readonly Container DrawableRankContainer; - protected readonly Container ScoreContainer; - protected readonly Container AccuracyContainer; - protected readonly Container FlagContainer; - protected readonly Container PlayerContainer; - protected readonly Container MaxComboContainer; - protected readonly Container HitGreatContainer; - protected readonly Container HitGoodContainer; - protected readonly Container HitMehContainer; - protected readonly Container HitMissContainer; - protected readonly Container PPContainer; - protected readonly Container ModsContainer; - - public ScoreTableRow(int maxModsAmount) + public IEnumerable CreateDrawables() { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - RowDimensions = new[] + yield return new Container { - new Dimension(GridSizeMode.Absolute, 25), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Child = CreateIndexCell() }; - ColumnDimensions = new[] + + yield return new Container { - new Dimension(GridSizeMode.Absolute, 300), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Child = CreateRankCell() }; - Content = new[] + + yield return new Container { - new Drawable[] + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Right = 20 }, + Child = CreateScoreCell() + }; + + yield return new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Right = 20 }, + Child = CreateAccuracyCell() + }; + + yield return new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Right = 20 }, + Child = CreatePlayerCell() + }; + + foreach (var cell in CreateStatisticsCells()) + { + yield return new Container { - new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - RankContainer = new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - X = rank_position, - }, - DrawableRankContainer = new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - X = drawable_rank_position, - }, - ScoreContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - X = score_position, - }, - AccuracyContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - X = accuracy_position, - }, - FlagContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - X = flag_position, - }, - PlayerContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - X = player_position, - } - } - }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - MaxComboContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = max_combo_position, - }, - HitGreatContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = hit_great_position, - }, - HitGoodContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = hit_good_position, - }, - HitMehContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = hit_meh_position, - }, - HitMissContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = hit_miss_position, - }, - PPContainer = new Container - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = pp_position, - } - } - }, - new Container - { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Child = ModsContainer = new Container - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - X = -30 * ((maxModsAmount == 0) ? 1 : maxModsAmount), - } - } - } + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Child = cell + }; + } + + yield return new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Child = CreatePpCell() + }; + + yield return new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, + Child = CreateModsCell() }; } + + protected abstract Drawable CreateIndexCell(); + + protected abstract Drawable CreateRankCell(); + + protected abstract Drawable CreateScoreCell(); + + protected abstract Drawable CreateAccuracyCell(); + + protected abstract Drawable CreatePlayerCell(); + + protected abstract IEnumerable CreateStatisticsCells(); + + protected abstract Drawable CreatePpCell(); + + protected abstract Drawable CreateModsCell(); } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs new file mode 100644 index 0000000000..d820f4d89d --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs @@ -0,0 +1,64 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class ScoreTableRowBackground : CompositeDrawable + { + private const int fade_duration = 100; + + private readonly Box hoveredBackground; + private readonly Box background; + + public ScoreTableRowBackground(int index) + { + RelativeSizeAxes = Axes.X; + Height = 25; + + CornerRadius = 3; + Masking = true; + + InternalChildren = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + hoveredBackground = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + }, + }; + + if (index % 2 != 0) + background.Alpha = 0; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + hoveredBackground.Colour = colours.Gray4; + background.Colour = colours.Gray3; + } + + protected override bool OnHover(HoverEvent e) + { + hoveredBackground.FadeIn(fade_duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + hoveredBackground.FadeOut(fade_duration, Easing.OutQuint); + base.OnHoverLost(e); + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs deleted file mode 100644 index a54770fb39..0000000000 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScore.cs +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -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.Events; -using osu.Game.Graphics; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Online.Leaderboards; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; -using osu.Game.Users; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.BeatmapSet.Scores -{ - public class ScoreTableScore : Container - { - private const int fade_duration = 100; - private const int text_size = 14; - - private readonly Box hoveredBackground; - private readonly Box background; - - public ScoreTableScore(int index, APIScoreInfo score, int maxModsAmount) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - CornerRadius = 3; - Masking = true; - - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - hoveredBackground = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - }, - new ScoreRow(index, score, maxModsAmount), - }; - - if (index % 2 != 0) - background.Alpha = 0; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - hoveredBackground.Colour = colours.Gray4; - background.Colour = colours.Gray3; - } - - protected override bool OnHover(HoverEvent e) - { - hoveredBackground.FadeIn(fade_duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - hoveredBackground.FadeOut(fade_duration, Easing.OutQuint); - base.OnHoverLost(e); - } - - protected override bool OnClick(ClickEvent e) => true; - - private class ClickableScoreUsername : ClickableUserContainer - { - private readonly SpriteText text; - private readonly SpriteText textBold; - - public ClickableScoreUsername() - { - Add(text = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = text_size, - }); - - Add(textBold = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = text_size, - Font = @"Exo2.0-Bold", - Alpha = 0, - }); - } - - protected override void OnUserChange(User user) - { - text.Text = textBold.Text = user.Username; - } - - protected override bool OnHover(HoverEvent e) - { - textBold.FadeIn(fade_duration, Easing.OutQuint); - text.FadeOut(fade_duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - textBold.FadeOut(fade_duration, Easing.OutQuint); - text.FadeIn(fade_duration, Easing.OutQuint); - base.OnHoverLost(e); - } - } - - private class ScoreRow : ScoreTableRow - { - public ScoreRow(int index, APIScoreInfo score, int maxModsAmount) - : base(maxModsAmount) - { - SpriteText scoreText; - SpriteText accuracy; - SpriteText hitGreat; - SpriteText hitGood; - SpriteText hitMeh; - SpriteText hitMiss; - - FillFlowContainer modsContainer; - - RankContainer.Add(new SpriteText - { - Text = $"#{index + 1}", - Font = @"Exo2.0-Bold", - TextSize = text_size, - }); - DrawableRankContainer.Add(new DrawableRank(score.Rank) - { - Size = new Vector2(30, 20), - FillMode = FillMode.Fit, - }); - ScoreContainer.Add(scoreText = new SpriteText - { - Text = $@"{score.TotalScore:N0}", - TextSize = text_size, - }); - AccuracyContainer.Add(accuracy = new SpriteText - { - Text = $@"{score.Accuracy:P2}", - TextSize = text_size, - }); - FlagContainer.Add(new DrawableFlag(score.User.Country) - { - Size = new Vector2(20, 13), - }); - PlayerContainer.Add(new ClickableScoreUsername - { - User = score.User, - }); - MaxComboContainer.Add(new SpriteText - { - Text = $@"{score.MaxCombo:N0}x", - TextSize = text_size, - }); - HitGreatContainer.Add(hitGreat = new SpriteText - { - Text = $"{score.Statistics[HitResult.Great]}", - TextSize = text_size, - }); - HitGoodContainer.Add(hitGood = new SpriteText - { - Text = $"{score.Statistics[HitResult.Good]}", - TextSize = text_size, - }); - HitMehContainer.Add(hitMeh = new SpriteText - { - Text = $"{score.Statistics[HitResult.Meh]}", - TextSize = text_size, - }); - HitMissContainer.Add(hitMiss = new SpriteText - { - Text = $"{score.Statistics[HitResult.Miss]}", - TextSize = text_size, - }); - PPContainer.Add(new SpriteText - { - Text = $@"{score.PP:N0}", - TextSize = text_size, - }); - ModsContainer.Add(modsContainer = new FillFlowContainer - { - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - }); - - if (index == 0) - scoreText.Font = @"Exo2.0-Bold"; - - accuracy.Colour = (score.Accuracy == 1) ? Color4.GreenYellow : Color4.White; - hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.White; - hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.White; - hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.White; - hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.White; - - foreach (Mod mod in score.Mods) - modsContainer.Add(new ModIcon(mod) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.3f), - }); - } - } - } -} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs new file mode 100644 index 0000000000..cd1ade934a --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs @@ -0,0 +1,168 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Leaderboards; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Scoring; +using osu.Game.Users; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class ScoreTableScoreRow : ScoreTableRow + { + private readonly int index; + private readonly ScoreInfo score; + + public ScoreTableScoreRow(int index, ScoreInfo score) + { + this.index = index; + this.score = score; + } + + protected override Drawable CreateIndexCell() => new OsuSpriteText + { + Text = $"#{index + 1}", + Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold) + }; + + protected override Drawable CreateRankCell() => new DrawableRank(score.Rank) + { + Size = new Vector2(30, 20), + }; + + protected override Drawable CreateScoreCell() => new OsuSpriteText + { + Text = $@"{score.TotalScore:N0}", + Font = OsuFont.GetFont(size: TEXT_SIZE, weight: index == 0 ? FontWeight.Bold : FontWeight.Medium) + }; + + protected override Drawable CreateAccuracyCell() => new OsuSpriteText + { + Text = $@"{score.Accuracy:P2}", + Font = OsuFont.GetFont(size: TEXT_SIZE), + Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White + }; + + protected override Drawable CreatePlayerCell() => new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + new DrawableFlag(score.User.Country) { Size = new Vector2(20, 13) }, + new ClickableScoreUsername { User = score.User } + } + }; + + protected override IEnumerable CreateStatisticsCells() + { + yield return new OsuSpriteText + { + Text = $@"{score.MaxCombo:N0}x", + Font = OsuFont.GetFont(size: TEXT_SIZE) + }; + + yield return new OsuSpriteText + { + Text = $"{score.Statistics[HitResult.Great]}", + Font = OsuFont.GetFont(size: TEXT_SIZE), + Colour = score.Statistics[HitResult.Great] == 0 ? Color4.Gray : Color4.White + }; + + yield return new OsuSpriteText + { + Text = $"{score.Statistics[HitResult.Good]}", + Font = OsuFont.GetFont(size: TEXT_SIZE), + Colour = score.Statistics[HitResult.Good] == 0 ? Color4.Gray : Color4.White + }; + + yield return new OsuSpriteText + { + Text = $"{score.Statistics[HitResult.Meh]}", + Font = OsuFont.GetFont(size: TEXT_SIZE), + Colour = score.Statistics[HitResult.Meh] == 0 ? Color4.Gray : Color4.White + }; + + yield return new OsuSpriteText + { + Text = $"{score.Statistics[HitResult.Miss]}", + Font = OsuFont.GetFont(size: TEXT_SIZE), + Colour = score.Statistics[HitResult.Miss] == 0 ? Color4.Gray : Color4.White + }; + } + + protected override Drawable CreatePpCell() => new OsuSpriteText + { + Text = $@"{score.PP:N0}", + Font = OsuFont.GetFont(size: TEXT_SIZE) + }; + + protected override Drawable CreateModsCell() => new FillFlowContainer + { + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m) + { + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.3f) + }) + }; + + private class ClickableScoreUsername : ClickableUserContainer + { + private const int fade_duration = 100; + + private readonly SpriteText text; + private readonly SpriteText textBold; + + public ClickableScoreUsername() + { + Add(text = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: TEXT_SIZE) + }); + + Add(textBold = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold), + Alpha = 0, + }); + } + + protected override void OnUserChange(User user) + { + text.Text = textBold.Text = user.Username; + } + + protected override bool OnHover(HoverEvent e) + { + textBold.FadeIn(fade_duration, Easing.OutQuint); + text.FadeOut(fade_duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + textBold.FadeOut(fade_duration, Easing.OutQuint); + text.FadeIn(fade_duration, Easing.OutQuint); + base.OnHoverLost(e); + } + } + } +} From 7239ebf5deb6b0809e453fa8e9fcd1c1b61056a5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Mar 2019 13:57:26 +0900 Subject: [PATCH 44/90] Add margin for mods --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs index 4abfb92957..8efda73270 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs @@ -80,6 +80,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Right = 20 }, Child = CreateModsCell() }; } From eefc55f89bbf9ab64e94291a01c792473955645b Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 29 Mar 2019 00:20:16 -0700 Subject: [PATCH 45/90] Fix volume overlay being blocked by other floating overlays - excluding settings --- osu.Game/OsuGame.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e470d554c9..2172f5870d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -421,7 +421,6 @@ namespace osu.Game }, }, topMostOverlayContent.Add); - loadComponentSingleFile(volume = new VolumeOverlay(), floatingOverlayContent.Add); loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add); loadComponentSingleFile(loginOverlay = new LoginOverlay @@ -438,7 +437,6 @@ namespace osu.Game loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal); loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add); - loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, floatingOverlayContent.Add); loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add); @@ -456,6 +454,9 @@ namespace osu.Game Origin = Anchor.TopRight, }, floatingOverlayContent.Add); + loadComponentSingleFile(volume = new VolumeOverlay(), floatingOverlayContent.Add); + loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, floatingOverlayContent.Add); + loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add); loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add); From 1ba608f01fcc3edb0f854ce4f2d6bc1e9bcd3777 Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 29 Mar 2019 00:26:17 -0700 Subject: [PATCH 46/90] Remove line spacing on similar code --- osu.Game/OsuGame.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 2172f5870d..9f47d545e2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -458,9 +458,7 @@ namespace osu.Game loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, floatingOverlayContent.Add); loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add); - loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add); - loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener(), topMostOverlayContent.Add); dependencies.CacheAs(idleTracker); From f1952c08162ff088194ab0d19a365c57871f6553 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Apr 2019 19:55:24 +0900 Subject: [PATCH 47/90] Update font awesome usage --- osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Desktop/Updater/SimpleUpdateManager.cs | 2 +- osu.Desktop/Updater/SquirrelUpdateManager.cs | 2 +- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs | 6 +++--- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs | 4 ++-- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs | 6 +++--- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 +- .../Objects/Drawables/DrawableRepeatPoint.cs | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs | 6 +++--- .../Objects/Drawables/Pieces/SwellSymbolPiece.cs | 2 +- .../SongSelect/TestCaseBeatmapOptionsOverlay.cs | 8 ++++---- .../UserInterface/TestCaseDialogOverlay.cs | 4 ++-- .../Visual/UserInterface/TestCasePopupDialog.cs | 2 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 +- .../Graphics/Containers/LinkFlowContainer.cs | 2 +- .../Graphics/UserInterface/BreadcrumbControl.cs | 2 +- .../Graphics/UserInterface/ExternalLinkButton.cs | 2 +- .../Graphics/UserInterface/LoadingAnimation.cs | 4 ++-- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 4 ++-- .../Graphics/UserInterface/OsuPasswordTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- .../UserInterface/OsuTabControlCheckbox.cs | 6 +++--- osu.Game/Graphics/UserInterface/SearchTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/StarCounter.cs | 2 +- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 6 +++--- .../Online/Leaderboards/MessagePlaceholder.cs | 2 +- .../Leaderboards/RetrievalFailurePlaceholder.cs | 2 +- .../Online/Multiplayer/GameTypes/GameTypeTag.cs | 2 +- .../Multiplayer/GameTypes/GameTypeTagTeam.cs | 4 ++-- .../Multiplayer/GameTypes/GameTypeTimeshift.cs | 2 +- osu.Game/OsuGame.cs | 4 ++-- osu.Game/Overlays/BeatmapSet/BasicStats.cs | 10 +++++----- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 4 ++-- .../BeatmapSet/Buttons/DownloadButton.cs | 2 +- .../BeatmapSet/Buttons/FavouriteButton.cs | 6 +++--- osu.Game/Overlays/Chat/ExternalLinkDialog.cs | 2 +- .../Overlays/Chat/Selection/ChannelListItem.cs | 4 ++-- osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs | 2 +- osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs | 2 +- .../Overlays/Chat/Tabs/PrivateChannelTabItem.cs | 2 +- osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- osu.Game/Overlays/Direct/DirectGridPanel.cs | 8 ++++---- osu.Game/Overlays/Direct/DirectListPanel.cs | 8 ++++---- osu.Game/Overlays/Direct/DownloadButton.cs | 4 ++-- osu.Game/Overlays/Direct/PlayButton.cs | 4 ++-- .../KeyBinding/GlobalKeyBindingsSection.cs | 2 +- osu.Game/Overlays/KeyBindingOverlay.cs | 2 +- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/MusicController.cs | 12 ++++++------ osu.Game/Overlays/Notifications/Notification.cs | 2 +- .../ProgressCompletionNotification.cs | 2 +- .../Overlays/Notifications/SimpleNotification.cs | 2 +- .../Overlays/Profile/Header/SupporterIcon.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 16 ++++++++-------- .../SearchableList/DisplayStyleControl.cs | 4 ++-- .../Overlays/Settings/Sections/AudioSection.cs | 2 +- .../Overlays/Settings/Sections/DebugSection.cs | 2 +- .../Settings/Sections/GameplaySection.cs | 2 +- .../Settings/Sections/General/LoginSettings.cs | 2 +- .../Overlays/Settings/Sections/GeneralSection.cs | 2 +- .../Settings/Sections/GraphicsSection.cs | 2 +- .../Overlays/Settings/Sections/InputSection.cs | 2 +- .../Maintenance/DeleteAllBeatmapsDialog.cs | 2 +- .../Settings/Sections/MaintenanceSection.cs | 2 +- .../Overlays/Settings/Sections/OnlineSection.cs | 2 +- .../Overlays/Settings/Sections/SkinSection.cs | 2 +- osu.Game/Overlays/Social/Header.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarChatButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs | 2 +- .../Toolbar/ToolbarNotificationButton.cs | 2 +- .../Overlays/Toolbar/ToolbarSettingsButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs | 2 +- osu.Game/Overlays/Volume/MuteButton.cs | 2 +- osu.Game/Rulesets/Mods/Mod.cs | 2 +- osu.Game/Rulesets/Mods/ModDaycore.cs | 2 +- osu.Game/Rulesets/Mods/ModWindDown.cs | 2 +- osu.Game/Rulesets/Mods/ModWindUp.cs | 2 +- osu.Game/Rulesets/Ruleset.cs | 2 +- .../Screens/Edit/Components/PlaybackControl.cs | 4 ++-- .../Compose/Components/BeatDivisorControl.cs | 4 ++-- .../Compose/Components/Timeline/TimelineArea.cs | 4 ++-- osu.Game/Screens/Menu/ButtonSystem.cs | 8 ++++---- osu.Game/Screens/Menu/Disclaimer.cs | 4 ++-- .../Match/Components/MatchLeaderboardScore.cs | 6 +++--- .../Ranking/Types/RoomLeaderboardPageInfo.cs | 2 +- osu.Game/Screens/Play/Break/BreakArrows.cs | 8 ++++---- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 2 +- .../Play/PlayerSettings/PlayerSettingsGroup.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 6 +++--- .../Ranking/Types/LocalLeaderboardPageInfo.cs | 2 +- .../Ranking/Types/ScoreOverviewPageInfo.cs | 2 +- osu.Game/Screens/ScreenWhiteBox.cs | 2 +- .../Screens/Select/BeatmapClearScoresDialog.cs | 2 +- osu.Game/Screens/Select/BeatmapDeleteDialog.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 6 +++--- osu.Game/Screens/Select/ImportFromStablePopup.cs | 2 +- .../Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 6 +++--- osu.Game/Users/UserPanel.cs | 2 +- 107 files changed, 173 insertions(+), 173 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 2998e08715..711ffa7d9e 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -110,7 +110,7 @@ namespace osu.Desktop.Overlays public UpdateCompleteNotification(string version, Action openUrl = null) { Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; - Icon = FontAwesome.CheckSquare; + Icon = FontAwesome.Solid.CheckSquare; Activated = delegate { openUrl?.Invoke($"https://osu.ppy.sh/home/changelog/lazer/{version}"); diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index 1cb47d6b58..0600804339 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -54,7 +54,7 @@ namespace osu.Desktop.Updater { Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + "Click here to download the new version, which can be installed over the top of your existing installation", - Icon = FontAwesome.Upload, + Icon = FontAwesome.Solid.Upload, Activated = () => { host.OpenUrlExternally(getBestUrl(latest)); diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index 6ebadeb4e9..5fed2a63e1 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -159,7 +159,7 @@ namespace osu.Desktop.Updater { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.Upload, + Icon = FontAwesome.Solid.Upload, Colour = Color4.White, Size = new Vector2(20), } diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs index d55f3ff159..18cc300ff9 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs @@ -23,19 +23,19 @@ namespace osu.Game.Rulesets.Catch.Beatmaps { Name = @"Fruit Count", Content = fruits.ToString(), - Icon = FontAwesome.CircleOutline + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Juice Stream Count", Content = juiceStreams.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Banana Shower Count", Content = bananaShowers.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle } }; } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs index 184cbf339d..dc24a344e9 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs @@ -42,13 +42,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { Name = @"Note Count", Content = notes.ToString(), - Icon = FontAwesome.CircleOutline + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Hold Note Count", Content = holdnotes.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle }, }; } diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs index 7099758e3d..491d82b89e 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs @@ -23,19 +23,19 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { Name = @"Circle Count", Content = circles.ToString(), - Icon = FontAwesome.CircleOutline + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Slider Count", Content = sliders.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Spinner Count", Content = spinners.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle } }; } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index 7f94b68cc0..f3c7939a94 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Play with blinds on your screen."; public override string Acronym => "BL"; - public override IconUsage Icon => FontAwesome.Adjust; + public override IconUsage Icon => FontAwesome.Solid.Adjust; public override ModType Type => ModType.DifficultyIncrease; public override bool Ranked => false; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index 2e93815ef0..35a5992e25 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Acronym => "GR"; - public override IconUsage Icon => FontAwesome.ArrowsV; + public override IconUsage Icon => FontAwesome.Solid.ArrowsAltV; public override ModType Type => ModType.Fun; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 31195b7878..9b079895fa 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Transform"; public override string Acronym => "TR"; - public override IconUsage Icon => FontAwesome.Arrows; + public override IconUsage Icon => FontAwesome.Solid.ArrowsAlt; public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index bdc2873d8d..17fcd03dd5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Wiggle"; public override string Acronym => "WG"; - public override IconUsage Icon => FontAwesome.Certificate; + public override IconUsage Icon => FontAwesome.Solid.Certificate; public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index a6714690b1..edf2d90c08 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.ChevronRight + Icon = FontAwesome.Solid.ChevronRight }, restrictSize: false) }; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 3a6ff3fcf8..ab4935e350 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(48), - Icon = FontAwesome.Asterisk, + Icon = FontAwesome.Solid.Asterisk, Shadow = false, }, } diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs index 4149da67c7..b595f43fbb 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs @@ -23,19 +23,19 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps { Name = @"Hit Count", Content = hits.ToString(), - Icon = FontAwesome.CircleOutline + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Drumroll Count", Content = drumrolls.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle }, new BeatmapStatistic { Name = @"Swell Count", Content = swells.ToString(), - Icon = FontAwesome.Circle + Icon = FontAwesome.Regular.Circle } }; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index 569ac96c15..0ed9923924 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces new SpriteIcon { RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.Asterisk, + Icon = FontAwesome.Solid.Asterisk, Shadow = false } }; diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs index 3cb480bab8..7d09debbd6 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs @@ -16,10 +16,10 @@ namespace osu.Game.Tests.Visual.SongSelect { var overlay = new BeatmapOptionsOverlay(); - overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.TimesCircleOutline, Color4.Purple, null, Key.Number1); - overlay.AddButton(@"Clear", @"local scores", FontAwesome.Eraser, Color4.Purple, null, Key.Number2); - overlay.AddButton(@"Edit", @"Beatmap", FontAwesome.Pencil, Color4.Yellow, null, Key.Number3); - overlay.AddButton(@"Delete", @"Beatmap", FontAwesome.Trash, Color4.Pink, null, Key.Number4, float.MaxValue); + overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, Color4.Purple, null, Key.Number1); + overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, Color4.Purple, null, Key.Number2); + overlay.AddButton(@"Edit", @"Beatmap", FontAwesome.Solid.PencilAlt, Color4.Yellow, null, Key.Number3); + overlay.AddButton(@"Delete", @"Beatmap", FontAwesome.Solid.Trash, Color4.Pink, null, Key.Number4, float.MaxValue); Add(overlay); diff --git a/osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs index 98d6f3a149..8964d20564 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("dialog #1", () => overlay.Push(new PopupDialog { - Icon = FontAwesome.TrashOutline, + Icon = FontAwesome.Regular.TrashAlt, HeaderText = @"Confirm deletion of", BodyText = @"Ayase Rie - Yuima-ru*World TVver.", Buttons = new PopupDialogButton[] @@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("dialog #2", () => overlay.Push(new PopupDialog { - Icon = FontAwesome.Gear, + Icon = FontAwesome.Solid.Cog, HeaderText = @"What do you want to do with", BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz", Buttons = new PopupDialogButton[] diff --git a/osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs b/osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs index bcba7e6811..2f01f593c7 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface { RelativeSizeAxes = Axes.Both, State = Framework.Graphics.Containers.Visibility.Visible, - Icon = FontAwesome.AssistiveListeningSystems, + Icon = FontAwesome.Solid.AssistiveListeningSystems, HeaderText = @"This is a test popup", BodyText = "I can say lots of stuff and even wrap my words!", Buttons = new PopupDialogButton[] diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index f0f58b9b5d..1be7411bec 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps.Drawables Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, // the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment) - Icon = ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.QuestionCircleOutline } + Icon = ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle } } }; } diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 204c83aac9..dace873b92 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Graphics.Containers showNotImplementedError = () => notifications?.Post(new SimpleNotification { Text = @"This link type is not yet supported!", - Icon = FontAwesome.LifeSaver, + Icon = FontAwesome.Solid.LifeRing, }); } diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 8eb9b99f29..f5e57e5f27 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, Size = new Vector2(item_chevron_size), - Icon = FontAwesome.ChevronRight, + Icon = FontAwesome.Solid.ChevronRight, Margin = new MarginPadding { Left = padding }, Alpha = 0f, }); diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 14328930ce..8c00cae08a 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface Size = new Vector2(12); InternalChild = new SpriteIcon { - Icon = FontAwesome.ExternalLink, + Icon = FontAwesome.Solid.ExternalLinkAlt, RelativeSizeAxes = Axes.Both }; } diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index bb92d8a2a9..5a8a0da135 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -37,14 +37,14 @@ namespace osu.Game.Graphics.UserInterface Position = new Vector2(1, 1), Colour = Color4.Black, Alpha = 0.4f, - Icon = FontAwesome.CircleONotch + Icon = FontAwesome.Solid.CircleNotch }, spinner = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.CircleONotch + Icon = FontAwesome.Solid.CircleNotch } }; } diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 902fd310c5..8245de9f70 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -179,7 +179,7 @@ namespace osu.Game.Graphics.UserInterface Chevron = new SpriteIcon { AlwaysPresent = true, - Icon = FontAwesome.ChevronRight, + Icon = FontAwesome.Solid.ChevronRight, Colour = Color4.Black, Alpha = 0.5f, Size = new Vector2(8), @@ -244,7 +244,7 @@ namespace osu.Game.Graphics.UserInterface }, Icon = new SpriteIcon { - Icon = FontAwesome.ChevronDown, + Icon = FontAwesome.Solid.ChevronDown, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 4 }, diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 37a13f5274..418ad038f7 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -108,7 +108,7 @@ namespace osu.Game.Graphics.UserInterface public CapsWarning() { - Icon = FontAwesome.Warning; + Icon = FontAwesome.Solid.ExclamationTriangle; } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 0ddc88b29e..fadc905541 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -254,7 +254,7 @@ namespace osu.Game.Graphics.UserInterface { new SpriteIcon { - Icon = FontAwesome.EllipsisH, + Icon = FontAwesome.Solid.EllipsisH, Size = new Vector2(14), Origin = Anchor.Centre, Anchor = Anchor.Centre, diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 557a337941..869005d05c 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -99,7 +99,7 @@ namespace osu.Game.Graphics.UserInterface icon = new SpriteIcon { Size = new Vector2(14), - Icon = FontAwesome.CircleOutline, + Icon = FontAwesome.Regular.Circle, Shadow = true, }, }, @@ -120,12 +120,12 @@ namespace osu.Game.Graphics.UserInterface if (selected.NewValue) { fadeIn(); - icon.Icon = FontAwesome.CheckCircleOutline; + icon.Icon = FontAwesome.Regular.CheckCircle; } else { fadeOut(); - icon.Icon = FontAwesome.CircleOutline; + icon.Icon = FontAwesome.Regular.Circle; } }; } diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 341f49732e..7023711aaa 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface { new SpriteIcon { - Icon = FontAwesome.Search, + Icon = FontAwesome.Solid.Search, Origin = Anchor.CentreRight, Anchor = Anchor.CentreRight, Margin = new MarginPadding { Right = 10 }, diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index ac6e393435..8ccf3001e3 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -143,7 +143,7 @@ namespace osu.Game.Graphics.UserInterface Child = Icon = new SpriteIcon { Size = new Vector2(star_size), - Icon = FontAwesome.Star, + Icon = FontAwesome.Solid.Star, Anchor = Anchor.Centre, Origin = Anchor.Centre, }; diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index da5cc76060..70edcc3fc8 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -258,8 +258,8 @@ namespace osu.Game.Online.Leaderboards protected virtual IEnumerable GetStatistics(ScoreInfo model) => new[] { - new LeaderboardScoreStatistic(FontAwesome.Link, "Max Combo", model.MaxCombo.ToString()), - new LeaderboardScoreStatistic(FontAwesome.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy)) + new LeaderboardScoreStatistic(FontAwesome.Solid.Link, "Max Combo", model.MaxCombo.ToString()), + new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy)) }; protected override bool OnHover(HoverEvent e) @@ -353,7 +353,7 @@ namespace osu.Game.Online.Leaderboards Size = new Vector2(icon_size), Rotation = 45, Colour = OsuColour.FromHex(@"3087ac"), - Icon = FontAwesome.Square, + Icon = FontAwesome.Solid.Square, Shadow = true, }, new SpriteIcon diff --git a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs index b4980444d1..ef425dacd8 100644 --- a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs +++ b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs @@ -12,7 +12,7 @@ namespace osu.Game.Online.Leaderboards public MessagePlaceholder(string message) { - AddIcon(FontAwesome.ExclamationCircle, cp => + AddIcon(FontAwesome.Solid.ExclamationCircle, cp => { cp.Font = cp.Font.With(size: TEXT_SIZE); cp.Padding = new MarginPadding { Right = 10 }; diff --git a/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs index 9a35dbc476..801f3f8ff0 100644 --- a/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs @@ -41,7 +41,7 @@ namespace osu.Game.Online.Leaderboards Action = () => Action?.Invoke(), Child = icon = new SpriteIcon { - Icon = FontAwesome.Refresh, + Icon = FontAwesome.Solid.Sync, Size = new Vector2(TEXT_SIZE), Shadow = true, }, diff --git a/osu.Game/Online/Multiplayer/GameTypes/GameTypeTag.cs b/osu.Game/Online/Multiplayer/GameTypes/GameTypeTag.cs index d51c5eb9bb..5ba5f1a415 100644 --- a/osu.Game/Online/Multiplayer/GameTypes/GameTypeTag.cs +++ b/osu.Game/Online/Multiplayer/GameTypes/GameTypeTag.cs @@ -18,7 +18,7 @@ namespace osu.Game.Online.Multiplayer.GameTypes { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.Refresh, + Icon = FontAwesome.Solid.Sync, Size = new Vector2(size), Colour = colours.Blue, Shadow = false, diff --git a/osu.Game/Online/Multiplayer/GameTypes/GameTypeTagTeam.cs b/osu.Game/Online/Multiplayer/GameTypes/GameTypeTagTeam.cs index 266f4a77b2..ef0a00a9f0 100644 --- a/osu.Game/Online/Multiplayer/GameTypes/GameTypeTagTeam.cs +++ b/osu.Game/Online/Multiplayer/GameTypes/GameTypeTagTeam.cs @@ -26,14 +26,14 @@ namespace osu.Game.Online.Multiplayer.GameTypes { new SpriteIcon { - Icon = FontAwesome.Refresh, + Icon = FontAwesome.Solid.Sync, Size = new Vector2(size * 0.75f), Colour = colours.Blue, Shadow = false, }, new SpriteIcon { - Icon = FontAwesome.Refresh, + Icon = FontAwesome.Solid.Sync, Size = new Vector2(size * 0.75f), Colour = colours.Pink, Shadow = false, diff --git a/osu.Game/Online/Multiplayer/GameTypes/GameTypeTimeshift.cs b/osu.Game/Online/Multiplayer/GameTypes/GameTypeTimeshift.cs index 1271556db4..1a3d2837ce 100644 --- a/osu.Game/Online/Multiplayer/GameTypes/GameTypeTimeshift.cs +++ b/osu.Game/Online/Multiplayer/GameTypes/GameTypeTimeshift.cs @@ -16,7 +16,7 @@ namespace osu.Game.Online.Multiplayer.GameTypes { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.ClockOutline, + Icon = FontAwesome.Regular.Clock, Size = new Vector2(size), Colour = colours.Blue, Shadow = false diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e470d554c9..f8ca1bc65f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -580,7 +580,7 @@ namespace osu.Game { Schedule(() => notifications.Post(new SimpleNotification { - Icon = entry.Level == LogLevel.Important ? FontAwesome.ExclamationCircle : FontAwesome.Bomb, + Icon = entry.Level == LogLevel.Important ? FontAwesome.Solid.ExclamationCircle : FontAwesome.Solid.Bomb, Text = entry.Message + (entry.Exception != null && IsDeployedBuild ? "\n\nThis error has been automatically reported to the devs." : string.Empty), })); } @@ -588,7 +588,7 @@ namespace osu.Game { Schedule(() => notifications.Post(new SimpleNotification { - Icon = FontAwesome.EllipsisH, + Icon = FontAwesome.Solid.EllipsisH, Text = "Subsequent messages have been logged. Click to view log files.", Activated = () => { diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index e817b28589..8ed52dade5 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -75,10 +75,10 @@ namespace osu.Game.Overlays.BeatmapSet Direction = FillDirection.Horizontal, Children = new[] { - length = new Statistic(FontAwesome.ClockOutline, "Length") { Width = 0.25f }, - bpm = new Statistic(FontAwesome.Circle, "BPM") { Width = 0.25f }, - circleCount = new Statistic(FontAwesome.CircleOutline, "Circle Count") { Width = 0.25f }, - sliderCount = new Statistic(FontAwesome.Circle, "Slider Count") { Width = 0.25f }, + length = new Statistic(FontAwesome.Regular.Clock, "Length") { Width = 0.25f }, + bpm = new Statistic(FontAwesome.Regular.Circle, "BPM") { Width = 0.25f }, + circleCount = new Statistic(FontAwesome.Regular.Circle, "Circle Count") { Width = 0.25f }, + sliderCount = new Statistic(FontAwesome.Regular.Circle, "Slider Count") { Width = 0.25f }, }, }; } @@ -121,7 +121,7 @@ namespace osu.Game.Overlays.BeatmapSet { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, - Icon = FontAwesome.Square, + Icon = FontAwesome.Solid.Square, Size = new Vector2(13), Rotation = 45, Colour = OsuColour.FromHex(@"441288"), diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 1d4f181256..baf702eebc 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -131,8 +131,8 @@ namespace osu.Game.Overlays.BeatmapSet Margin = new MarginPadding { Top = 5 }, Children = new[] { - plays = new Statistic(FontAwesome.PlayCircle), - favourites = new Statistic(FontAwesome.Heart), + plays = new Statistic(FontAwesome.Solid.PlayCircle), + favourites = new Statistic(FontAwesome.Solid.Heart), }, }, }, diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 667869e310..4a60b69a5a 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons Depth = -1, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Icon = FontAwesome.Download, + Icon = FontAwesome.Solid.Download, Size = new Vector2(16), Margin = new MarginPadding { Right = 5 }, }, diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index 43c14e2a58..7207739646 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.HeartOutline, + Icon = FontAwesome.Regular.Heart, Size = new Vector2(18), Shadow = false, }, @@ -59,12 +59,12 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons if (favourited.NewValue) { pink.FadeIn(200); - icon.Icon = FontAwesome.Heart; + icon.Icon = FontAwesome.Solid.Heart; } else { pink.FadeOut(200); - icon.Icon = FontAwesome.HeartOutline; + icon.Icon = FontAwesome.Regular.Heart; } }; diff --git a/osu.Game/Overlays/Chat/ExternalLinkDialog.cs b/osu.Game/Overlays/Chat/ExternalLinkDialog.cs index bcf63672ac..dbae091fb0 100644 --- a/osu.Game/Overlays/Chat/ExternalLinkDialog.cs +++ b/osu.Game/Overlays/Chat/ExternalLinkDialog.cs @@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Chat HeaderText = "Just checking..."; BodyText = $"You are about to leave osu! and open the following link in a web browser:\n\n{url}"; - Icon = FontAwesome.Warning; + Icon = FontAwesome.Solid.ExclamationTriangle; Buttons = new PopupDialogButton[] { diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 85a10510ef..4d77e5f93d 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Chat.Selection { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Icon = FontAwesome.CheckCircle, + Icon = FontAwesome.Solid.CheckCircle, Size = new Vector2(text_size), Shadow = false, Margin = new MarginPadding { Right = 10f }, @@ -121,7 +121,7 @@ namespace osu.Game.Overlays.Chat.Selection { new SpriteIcon { - Icon = FontAwesome.User, + Icon = FontAwesome.Solid.User, Size = new Vector2(text_size - 2), Shadow = false, Margin = new MarginPadding { Top = 1 }, diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index f8a8038878..2e7f2d5908 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Chat.Tabs AddInternal(new SpriteIcon { - Icon = FontAwesome.Comments, + Icon = FontAwesome.Solid.Comments, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(20), diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs index e1f29a40e4..a4aefa4c4f 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs @@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Chat.Tabs }; } - protected virtual IconUsage DisplayIcon => FontAwesome.Hashtag; + protected virtual IconUsage DisplayIcon => FontAwesome.Solid.Hashtag; protected virtual bool ShowCloseOnHover => true; diff --git a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs index f8add20674..8aa6d6fecd 100644 --- a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Chat.Tabs private readonly OsuSpriteText username; private readonly Avatar avatarContainer; - protected override IconUsage DisplayIcon => FontAwesome.At; + protected override IconUsage DisplayIcon => FontAwesome.Solid.At; public PrivateChannelTabItem(Channel value) : base(value) diff --git a/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs b/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs index b15f568c94..bde930d4fb 100644 --- a/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs +++ b/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Chat.Tabs Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(0.75f), - Icon = FontAwesome.Close, + Icon = FontAwesome.Solid.TimesCircle, RelativeSizeAxes = Axes.Both, }; } diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index ede2f34574..91f42a491a 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -166,7 +166,7 @@ namespace osu.Game.Overlays.Dialog { Origin = Anchor.Centre, Anchor = Anchor.Centre, - Icon = FontAwesome.Close, + Icon = FontAwesome.Solid.TimesCircle, Size = new Vector2(50), }, }, diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index b8168f692a..eb73a50f99 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -186,8 +186,8 @@ namespace osu.Game.Overlays.Direct Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding }, Children = new[] { - new Statistic(FontAwesome.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0), - new Statistic(FontAwesome.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), + new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0), + new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), }, }, statusContainer = new FillFlowContainer @@ -206,12 +206,12 @@ namespace osu.Game.Overlays.Direct if (SetInfo.OnlineInfo?.HasVideo ?? false) { - statusContainer.Add(new IconPill(FontAwesome.Film)); + statusContainer.Add(new IconPill(FontAwesome.Solid.Film)); } if (SetInfo.OnlineInfo?.HasStoryboard ?? false) { - statusContainer.Add(new IconPill(FontAwesome.Image)); + statusContainer.Add(new IconPill(FontAwesome.Solid.Image)); } statusContainer.Add(new BeatmapSetOnlineStatusPill diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 518f6e498a..d645fd3bda 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -161,8 +161,8 @@ namespace osu.Game.Overlays.Direct Direction = FillDirection.Vertical, Children = new Drawable[] { - new Statistic(FontAwesome.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0), - new Statistic(FontAwesome.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), + new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0), + new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), new FillFlowContainer { Anchor = Anchor.TopRight, @@ -211,12 +211,12 @@ namespace osu.Game.Overlays.Direct if (SetInfo.OnlineInfo?.HasVideo ?? false) { - statusContainer.Add(new IconPill(FontAwesome.Film) { IconSize = new Vector2(20) }); + statusContainer.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) }); } if (SetInfo.OnlineInfo?.HasStoryboard ?? false) { - statusContainer.Add(new IconPill(FontAwesome.Image) { IconSize = new Vector2(20) }); + statusContainer.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); } statusContainer.Add(new BeatmapSetOnlineStatusPill diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 7fc145d635..6107dc3af3 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Direct Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(13), - Icon = FontAwesome.Download, + Icon = FontAwesome.Solid.Download, }, checkmark = new SpriteIcon { @@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Direct Origin = Anchor.Centre, X = 8, Size = Vector2.Zero, - Icon = FontAwesome.Check, + Icon = FontAwesome.Solid.Check, } } } diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 05ef5c8496..6daebb3c15 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Direct Origin = Anchor.Centre, FillMode = FillMode.Fit, RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.Play, + Icon = FontAwesome.Solid.Play, }, loadingAnimation = new LoadingAnimation { @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Direct private void playingStateChanged(ValueChangedEvent e) { - icon.Icon = e.NewValue ? FontAwesome.Stop : FontAwesome.Play; + icon.Icon = e.NewValue ? FontAwesome.Solid.Stop : FontAwesome.Solid.Play; icon.FadeColour(e.NewValue || IsHovered ? hoverColour : Color4.White, 120, Easing.InOutQuint); if (e.NewValue) diff --git a/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs b/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs index fb524e32c3..7e33d7ba27 100644 --- a/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs +++ b/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs @@ -9,7 +9,7 @@ namespace osu.Game.Overlays.KeyBinding { public class GlobalKeyBindingsSection : SettingsSection { - public override IconUsage Icon => FontAwesome.Globe; + public override IconUsage Icon => FontAwesome.Solid.Globe; public override string Header => "Global"; public GlobalKeyBindingsSection(GlobalActionContainer manager) diff --git a/osu.Game/Overlays/KeyBindingOverlay.cs b/osu.Game/Overlays/KeyBindingOverlay.cs index 6259f39c66..b223d4701d 100644 --- a/osu.Game/Overlays/KeyBindingOverlay.cs +++ b/osu.Game/Overlays/KeyBindingOverlay.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays Y = -15, Size = new Vector2(15), Shadow = true, - Icon = FontAwesome.ChevronLeft + Icon = FontAwesome.Solid.ChevronLeft }, new OsuSpriteText { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 96e9cc9ca7..df37a1b2c7 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -164,7 +164,7 @@ namespace osu.Game.Overlays.Music Anchor = Anchor.TopLeft; Origin = Anchor.TopLeft; Size = new Vector2(12); - Icon = FontAwesome.Bars; + Icon = FontAwesome.Solid.Bars; Alpha = 0f; Margin = new MarginPadding { Left = 5, Top = 2 }; } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index ce2137346f..b24c6c3508 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -148,7 +148,7 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = prev, - Icon = FontAwesome.StepBackward, + Icon = FontAwesome.Solid.StepBackward, }, playButton = new MusicIconButton { @@ -157,14 +157,14 @@ namespace osu.Game.Overlays Scale = new Vector2(1.4f), IconScale = new Vector2(1.4f), Action = play, - Icon = FontAwesome.PlayCircleOutline, + Icon = FontAwesome.Regular.PlayCircle, }, nextButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => next(), - Icon = FontAwesome.StepForward, + Icon = FontAwesome.Solid.StepForward, }, } }, @@ -173,7 +173,7 @@ namespace osu.Game.Overlays Origin = Anchor.Centre, Anchor = Anchor.CentreRight, Position = new Vector2(-bottom_black_area_height / 2, 0), - Icon = FontAwesome.Bars, + Icon = FontAwesome.Solid.Bars, Action = () => playlist.ToggleVisibility(), }, } @@ -264,13 +264,13 @@ namespace osu.Game.Overlays progressBar.EndTime = track.Length; progressBar.CurrentTime = track.CurrentTime; - playButton.Icon = track.IsRunning ? FontAwesome.PauseCircleOutline : FontAwesome.PlayCircleOutline; + playButton.Icon = track.IsRunning ? FontAwesome.Regular.PauseCircle : FontAwesome.Regular.PlayCircle; } else { progressBar.CurrentTime = 0; progressBar.EndTime = 1; - playButton.Icon = FontAwesome.PlayCircleOutline; + playButton.Icon = FontAwesome.Regular.PlayCircle; } } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 7abff9252f..522e039cdb 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -175,7 +175,7 @@ namespace osu.Game.Overlays.Notifications { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.TimesCircle, + Icon = FontAwesome.Solid.TimesCircle, Size = new Vector2(20), } }; diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index d5993e1f79..feffb4fa66 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Notifications { public ProgressCompletionNotification() { - Icon = FontAwesome.Check; + Icon = FontAwesome.Solid.Check; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 26852242d2..3a3136b1ea 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Notifications } } - private IconUsage icon = FontAwesome.InfoCircle; + private IconUsage icon = FontAwesome.Solid.InfoCircle; public IconUsage Icon { diff --git a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs index 7b07617e2e..5c9126dbe0 100644 --- a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Profile.Header Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.Heart, + Icon = FontAwesome.Solid.Heart, Scale = new Vector2(0.45f), } }; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 28877c21f0..138e522cd7 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -415,16 +415,16 @@ namespace osu.Game.Overlays.Profile websiteWithoutProtcol = websiteWithoutProtcol.Substring(protocolIndex + 2); } - tryAddInfoRightLine(FontAwesome.MapMarker, user.Location); - tryAddInfoRightLine(FontAwesome.HeartOutline, user.Interests); - tryAddInfoRightLine(FontAwesome.Suitcase, user.Occupation); + tryAddInfoRightLine(FontAwesome.Solid.MapMarker, user.Location); + tryAddInfoRightLine(FontAwesome.Regular.Heart, user.Interests); + tryAddInfoRightLine(FontAwesome.Solid.Suitcase, user.Occupation); infoTextRight.NewParagraph(); if (!string.IsNullOrEmpty(user.Twitter)) - tryAddInfoRightLine(FontAwesome.Twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}"); - tryAddInfoRightLine(FontAwesome.Gamepad, user.Discord); - tryAddInfoRightLine(FontAwesome.Skype, user.Skype, @"skype:" + user.Skype + @"?chat"); - tryAddInfoRightLine(FontAwesome.Lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}"); - tryAddInfoRightLine(FontAwesome.Globe, websiteWithoutProtcol, user.Website); + tryAddInfoRightLine(FontAwesome.Brands.Twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}"); + tryAddInfoRightLine(FontAwesome.Solid.Gamepad, user.Discord); + tryAddInfoRightLine(FontAwesome.Brands.Skype, user.Skype, @"skype:" + user.Skype + @"?chat"); + tryAddInfoRightLine(FontAwesome.Brands.Lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}"); + tryAddInfoRightLine(FontAwesome.Solid.Globe, websiteWithoutProtcol, user.Website); if (user.Statistics != null) { diff --git a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs index 48be91ea23..0808cc8fcc 100644 --- a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs +++ b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs @@ -37,8 +37,8 @@ namespace osu.Game.Overlays.SearchableList Direction = FillDirection.Horizontal, Children = new[] { - new DisplayStyleToggleButton(FontAwesome.ThLarge, PanelDisplayStyle.Grid, DisplayStyle), - new DisplayStyleToggleButton(FontAwesome.ListUl, PanelDisplayStyle.List, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.Solid.ThLarge, PanelDisplayStyle.Grid, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.Solid.ListUl, PanelDisplayStyle.List, DisplayStyle), }, }, Dropdown = new SlimEnumDropdown diff --git a/osu.Game/Overlays/Settings/Sections/AudioSection.cs b/osu.Game/Overlays/Settings/Sections/AudioSection.cs index ea7011ea01..772f5c2039 100644 --- a/osu.Game/Overlays/Settings/Sections/AudioSection.cs +++ b/osu.Game/Overlays/Settings/Sections/AudioSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections public class AudioSection : SettingsSection { public override string Header => "Audio"; - public override IconUsage Icon => FontAwesome.VolumeUp; + public override IconUsage Icon => FontAwesome.Solid.VolumeUp; public AudioSection() { diff --git a/osu.Game/Overlays/Settings/Sections/DebugSection.cs b/osu.Game/Overlays/Settings/Sections/DebugSection.cs index d90bb9be10..0149cab802 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSection.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections public class DebugSection : SettingsSection { public override string Header => "Debug"; - public override IconUsage Icon => FontAwesome.Bug; + public override IconUsage Icon => FontAwesome.Solid.Bug; public DebugSection() { diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index e69a19b447..97d9d3c697 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections public class GameplaySection : SettingsSection { public override string Header => "Gameplay"; - public override IconUsage Icon => FontAwesome.CircleOutline; + public override IconUsage Icon => FontAwesome.Regular.Circle; public GameplaySection() { diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 078c01ce92..e4ddc53e17 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -363,7 +363,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Icon = FontAwesome.CircleOutline, + Icon = FontAwesome.Regular.Circle, Size = new Vector2(14), }); diff --git a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs index f571d5ff7c..d9947f16cc 100644 --- a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs +++ b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections public class GeneralSection : SettingsSection { public override string Header => "General"; - public override IconUsage Icon => FontAwesome.Gear; + public override IconUsage Icon => FontAwesome.Solid.Cog; public GeneralSection() { diff --git a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs index 92746d5117..3d6086d3ea 100644 --- a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs +++ b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections public class GraphicsSection : SettingsSection { public override string Header => "Graphics"; - public override IconUsage Icon => FontAwesome.Laptop; + public override IconUsage Icon => FontAwesome.Solid.Laptop; public GraphicsSection() { diff --git a/osu.Game/Overlays/Settings/Sections/InputSection.cs b/osu.Game/Overlays/Settings/Sections/InputSection.cs index d193277a6b..6a3f8783b0 100644 --- a/osu.Game/Overlays/Settings/Sections/InputSection.cs +++ b/osu.Game/Overlays/Settings/Sections/InputSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections public class InputSection : SettingsSection { public override string Header => "Input"; - public override IconUsage Icon => FontAwesome.KeyboardOutline; + public override IconUsage Icon => FontAwesome.Regular.Keyboard; public InputSection(KeyBindingOverlay keyConfig) { diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/DeleteAllBeatmapsDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/DeleteAllBeatmapsDialog.cs index 7ab3629e12..a124501454 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/DeleteAllBeatmapsDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/DeleteAllBeatmapsDialog.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { BodyText = "Everything?"; - Icon = FontAwesome.TrashOutline; + Icon = FontAwesome.Regular.TrashAlt; HeaderText = @"Confirm deletion of"; Buttons = new PopupDialogButton[] { diff --git a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs index 41530e20ca..0f3acd5b7f 100644 --- a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections public class MaintenanceSection : SettingsSection { public override string Header => "Maintenance"; - public override IconUsage Icon => FontAwesome.Wrench; + public override IconUsage Icon => FontAwesome.Solid.Wrench; public MaintenanceSection() { diff --git a/osu.Game/Overlays/Settings/Sections/OnlineSection.cs b/osu.Game/Overlays/Settings/Sections/OnlineSection.cs index f9f5d99c84..80295690c0 100644 --- a/osu.Game/Overlays/Settings/Sections/OnlineSection.cs +++ b/osu.Game/Overlays/Settings/Sections/OnlineSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections public class OnlineSection : SettingsSection { public override string Header => "Online"; - public override IconUsage Icon => FontAwesome.Globe; + public override IconUsage Icon => FontAwesome.Solid.GlobeAsia; public OnlineSection() { diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 79b9076a52..100022bd13 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections public override string Header => "Skin"; - public override IconUsage Icon => FontAwesome.PaintBrush; + public override IconUsage Icon => FontAwesome.Solid.PaintBrush; private readonly Bindable dropdownBindable = new Bindable { Default = SkinInfo.Default }; private readonly Bindable configBindable = new Bindable(); diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index bf07c343e6..22bca9b421 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Social protected override Color4 BackgroundColour => OsuColour.FromHex(@"38202e"); protected override SocialTab DefaultTab => SocialTab.AllPlayers; - protected override IconUsage Icon => FontAwesome.Users; + protected override IconUsage Icon => FontAwesome.Solid.Users; protected override Drawable CreateHeaderText() { diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 59d7a18a34..a7f2a0e8d0 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Toolbar new ToolbarMusicButton(), //new ToolbarButton //{ - // Icon = FontAwesome.search + // Icon = FontAwesome.Solid.search //}, userButton = new ToolbarUserButton(), new ToolbarNotificationButton(), diff --git a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs index 8ea21e88b5..ad0e5be551 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Toolbar { public ToolbarChatButton() { - SetIcon(FontAwesome.Comments); + SetIcon(FontAwesome.Solid.Comments); } [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs index 18a116127c..6f5e703a66 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs @@ -9,7 +9,7 @@ namespace osu.Game.Overlays.Toolbar { public ToolbarHomeButton() { - Icon = FontAwesome.Home; + Icon = FontAwesome.Solid.Home; TooltipMain = "Home"; TooltipSub = "Return to the main menu"; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 7f4c9d455e..f03df2ed93 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Toolbar { public ToolbarMusicButton() { - Icon = FontAwesome.Music; + Icon = FontAwesome.Solid.Music; } [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index b3bd82ae38..dbd6c557d3 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar public ToolbarNotificationButton() { - Icon = FontAwesome.Bars; + Icon = FontAwesome.Solid.Bars; TooltipMain = "Notifications"; TooltipSub = "Waiting for 'ya"; diff --git a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs index 4e48ffd034..08f8f867fd 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Toolbar { public ToolbarSettingsButton() { - Icon = FontAwesome.Gear; + Icon = FontAwesome.Solid.Cog; TooltipMain = "Settings"; TooltipSub = "Change your settings"; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs index 769fa520cb..5e353d3319 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Toolbar { public ToolbarSocialButton() { - Icon = FontAwesome.Users; + Icon = FontAwesome.Solid.Users; } [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index 090e443a0c..2b1f78243b 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -72,7 +72,7 @@ namespace osu.Game.Overlays.Volume Current.ValueChanged += muted => { - icon.Icon = muted.NewValue ? FontAwesome.VolumeOff : FontAwesome.VolumeUp; + icon.Icon = muted.NewValue ? FontAwesome.Solid.VolumeOff : FontAwesome.Solid.VolumeUp; icon.Margin = new MarginPadding { Left = muted.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths }; Current.TriggerChange(); diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index be2ff33730..d2d0a5bb26 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mods /// The icon of this mod. /// [JsonIgnore] - public virtual IconUsage Icon => FontAwesome.Question; + public virtual IconUsage Icon => FontAwesome.Solid.Question; /// /// The type of this mod. diff --git a/osu.Game/Rulesets/Mods/ModDaycore.cs b/osu.Game/Rulesets/Mods/ModDaycore.cs index 0dd5d7b815..7e6d959119 100644 --- a/osu.Game/Rulesets/Mods/ModDaycore.cs +++ b/osu.Game/Rulesets/Mods/ModDaycore.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods { public override string Name => "Daycore"; public override string Acronym => "DC"; - public override IconUsage Icon => FontAwesome.Question; + public override IconUsage Icon => FontAwesome.Solid.Question; public override string Description => "Whoaaaaa..."; public override void ApplyToClock(IAdjustableClock clock) diff --git a/osu.Game/Rulesets/Mods/ModWindDown.cs b/osu.Game/Rulesets/Mods/ModWindDown.cs index eccd848c48..5d71c8950b 100644 --- a/osu.Game/Rulesets/Mods/ModWindDown.cs +++ b/osu.Game/Rulesets/Mods/ModWindDown.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mods public override string Name => "Wind Down"; public override string Acronym => "WD"; public override string Description => "Sloooow doooown..."; - public override IconUsage Icon => FontAwesome.ChevronCircleDown; + public override IconUsage Icon => FontAwesome.Solid.ChevronCircleDown; public override double ScoreMultiplier => 1.0; protected override double FinalRateAdjustment => -0.25; diff --git a/osu.Game/Rulesets/Mods/ModWindUp.cs b/osu.Game/Rulesets/Mods/ModWindUp.cs index d430c291cb..aae85cec19 100644 --- a/osu.Game/Rulesets/Mods/ModWindUp.cs +++ b/osu.Game/Rulesets/Mods/ModWindUp.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mods public override string Name => "Wind Up"; public override string Acronym => "WU"; public override string Description => "Can you keep up?"; - public override IconUsage Icon => FontAwesome.ChevronCircleUp; + public override IconUsage Icon => FontAwesome.Solid.ChevronCircleUp; public override double ScoreMultiplier => 1.0; protected override double FinalRateAdjustment => 0.5; diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 013fffb7cb..cdfe02b60b 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets public virtual HitObjectComposer CreateHitObjectComposer() => null; - public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.QuestionCircle }; + public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.QuestionCircle }; public abstract string Description { get; } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 6d590780b0..f5c9f74f62 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit.Components Origin = Anchor.Centre, Scale = new Vector2(1.4f), IconScale = new Vector2(1.4f), - Icon = FontAwesome.PlayCircleOutline, + Icon = FontAwesome.Regular.PlayCircle, Action = togglePause, Padding = new MarginPadding { Left = 20 } }, @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Edit.Components { base.Update(); - playButton.Icon = adjustableClock.IsRunning ? FontAwesome.PauseCircleOutline : FontAwesome.PlayCircleOutline; + playButton.Icon = adjustableClock.IsRunning ? FontAwesome.Regular.PauseCircle : FontAwesome.Regular.PlayCircle; } private class PlaybackTabControl : OsuTabControl diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 1f13797497..9a7ac8dfd0 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -94,13 +94,13 @@ namespace osu.Game.Screens.Edit.Compose.Components { new DivisorButton { - Icon = FontAwesome.ChevronLeft, + Icon = FontAwesome.Solid.ChevronLeft, Action = beatDivisor.Previous }, new DivisorText(beatDivisor), new DivisorButton { - Icon = FontAwesome.ChevronRight, + Icon = FontAwesome.Solid.ChevronRight, Action = beatDivisor.Next } }, diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs index 2bed231da7..863a120fc3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { RelativeSizeAxes = Axes.Y, Height = 0.5f, - Icon = FontAwesome.SearchPlus, + Icon = FontAwesome.Solid.SearchPlus, Action = () => changeZoom(1) }, new TimelineButton @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Y, Height = 0.5f, - Icon = FontAwesome.SearchMinus, + Icon = FontAwesome.Solid.SearchMinus, Action = () => changeZoom(-1) }, } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index bcd24fd83e..d3cf23dab8 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Menu buttonArea.AddRange(new[] { - new Button(@"settings", string.Empty, FontAwesome.Gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), + new Button(@"settings", string.Empty, FontAwesome.Solid.Cog, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), backButton = new Button(@"back", @"button-back-select", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel, -WEDGE_WIDTH) { VisibleState = ButtonSystemState.Play, @@ -106,8 +106,8 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) { - buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.User, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); - buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.Users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); + buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.Solid.User, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); + buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.Solid.Users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); buttonsPlay.Add(new Button(@"chart", @"button-generic-select", OsuIcon.Charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Menu notifications?.Post(new SimpleNotification { Text = "You gotta be logged in to multi 'yo!", - Icon = FontAwesome.Globe + Icon = FontAwesome.Solid.Globe }); return; diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 170209207b..0130a5143b 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Menu { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.Warning, + Icon = FontAwesome.Solid.ExclamationTriangle, Size = new Vector2(icon_size), Y = icon_y, }, @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Menu supportFlow.AddText(" to help support the game", format); } - heart = supportFlow.AddIcon(FontAwesome.Heart, t => + heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t => { t.Padding = new MarginPadding { Left = 5 }; t.Font = t.Font.With(size: 12); diff --git a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboardScore.cs b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboardScore.cs index 2734c55ce7..92074abe4b 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboardScore.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboardScore.cs @@ -25,9 +25,9 @@ namespace osu.Game.Screens.Multi.Match.Components protected override IEnumerable GetStatistics(ScoreInfo model) => new[] { - new LeaderboardScoreStatistic(FontAwesome.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy)), - new LeaderboardScoreStatistic(FontAwesome.Refresh, "Total Attempts", ((APIRoomScoreInfo)model).TotalAttempts.ToString()), - new LeaderboardScoreStatistic(FontAwesome.Check, "Completed Beatmaps", ((APIRoomScoreInfo)model).CompletedBeatmaps.ToString()), + new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy)), + new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", ((APIRoomScoreInfo)model).TotalAttempts.ToString()), + new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", ((APIRoomScoreInfo)model).CompletedBeatmaps.ToString()), }; } } diff --git a/osu.Game/Screens/Multi/Ranking/Types/RoomLeaderboardPageInfo.cs b/osu.Game/Screens/Multi/Ranking/Types/RoomLeaderboardPageInfo.cs index b03fafbd13..dcfad8458f 100644 --- a/osu.Game/Screens/Multi/Ranking/Types/RoomLeaderboardPageInfo.cs +++ b/osu.Game/Screens/Multi/Ranking/Types/RoomLeaderboardPageInfo.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Multi.Ranking.Types this.beatmap = beatmap; } - public IconUsage Icon => FontAwesome.Users; + public IconUsage Icon => FontAwesome.Solid.Users; public string Name => "Room Leaderboard"; diff --git a/osu.Game/Screens/Play/Break/BreakArrows.cs b/osu.Game/Screens/Play/Break/BreakArrows.cs index e0238f6814..4b96fa666a 100644 --- a/osu.Game/Screens/Play/Break/BreakArrows.cs +++ b/osu.Game/Screens/Play/Break/BreakArrows.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play.Break Anchor = Anchor.Centre, Origin = Anchor.CentreRight, X = -glow_icon_offscreen_offset, - Icon = FontAwesome.ChevronRight, + Icon = FontAwesome.Solid.ChevronRight, BlurSigma = new Vector2(glow_icon_blur_sigma), Size = new Vector2(glow_icon_size), }, @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play.Break Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, X = glow_icon_offscreen_offset, - Icon = FontAwesome.ChevronLeft, + Icon = FontAwesome.Solid.ChevronLeft, BlurSigma = new Vector2(glow_icon_blur_sigma), Size = new Vector2(glow_icon_size), }, @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play.Break Origin = Anchor.CentreRight, Alpha = 0.7f, X = -blurred_icon_offscreen_offset, - Icon = FontAwesome.ChevronRight, + Icon = FontAwesome.Solid.ChevronRight, BlurSigma = new Vector2(blurred_icon_blur_sigma), Size = new Vector2(blurred_icon_size), }, @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play.Break Origin = Anchor.CentreLeft, Alpha = 0.7f, X = blurred_icon_offscreen_offset, - Icon = FontAwesome.ChevronLeft, + Icon = FontAwesome.Solid.ChevronLeft, BlurSigma = new Vector2(blurred_icon_blur_sigma), Size = new Vector2(blurred_icon_size), }, diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 03843eeb90..6883f246e4 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -129,7 +129,7 @@ namespace osu.Game.Screens.Play.HUD Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(15), - Icon = FontAwesome.Close + Icon = FontAwesome.Solid.TimesCircle }, } }; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index d243ff24a3..90424ec007 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play.PlayerSettings Origin = Anchor.Centre, Anchor = Anchor.CentreRight, Position = new Vector2(-15, 0), - Icon = FontAwesome.Bars, + Icon = FontAwesome.Solid.Bars, Scale = new Vector2(0.75f), Action = () => Expanded = !Expanded, }, diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 78ed742bfa..738877232d 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -259,9 +259,9 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Horizontal, Children = new[] { - new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.ChevronRight }, - new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.ChevronRight }, - new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.ChevronRight }, + new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.Solid.ChevronRight }, + new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.Solid.ChevronRight }, + new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.Solid.ChevronRight }, } }, new OsuSpriteText diff --git a/osu.Game/Screens/Ranking/Types/LocalLeaderboardPageInfo.cs b/osu.Game/Screens/Ranking/Types/LocalLeaderboardPageInfo.cs index e563eb8116..fe183c5f89 100644 --- a/osu.Game/Screens/Ranking/Types/LocalLeaderboardPageInfo.cs +++ b/osu.Game/Screens/Ranking/Types/LocalLeaderboardPageInfo.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Ranking.Types this.beatmap = beatmap; } - public IconUsage Icon => FontAwesome.User; + public IconUsage Icon => FontAwesome.Solid.User; public string Name => @"Local Leaderboard"; diff --git a/osu.Game/Screens/Ranking/Types/ScoreOverviewPageInfo.cs b/osu.Game/Screens/Ranking/Types/ScoreOverviewPageInfo.cs index 2d9b3b9ef9..424dbff6f6 100644 --- a/osu.Game/Screens/Ranking/Types/ScoreOverviewPageInfo.cs +++ b/osu.Game/Screens/Ranking/Types/ScoreOverviewPageInfo.cs @@ -10,7 +10,7 @@ namespace osu.Game.Screens.Ranking.Types { public class ScoreOverviewPageInfo : IResultPageInfo { - public IconUsage Icon => FontAwesome.Asterisk; + public IconUsage Icon => FontAwesome.Solid.Asterisk; public string Name => "Overview"; private readonly ScoreInfo score; diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index f471cab063..d6766c2b49 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -113,7 +113,7 @@ namespace osu.Game.Screens { new SpriteIcon { - Icon = FontAwesome.UniversalAccess, + Icon = FontAwesome.Solid.UniversalAccess, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Size = new Vector2(50), diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index aa579ac665..c9b6ca7bb3 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action onCompletion) { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; - Icon = FontAwesome.Eraser; + Icon = FontAwesome.Solid.Eraser; HeaderText = @"Clearing all local scores. Are you sure?"; Buttons = new PopupDialogButton[] { diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index a1adaff1d8..5fb72e4151 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; - Icon = FontAwesome.TrashOutline; + Icon = FontAwesome.Regular.TrashAlt; HeaderText = @"Confirm deletion of"; Buttons = new PopupDialogButton[] { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index b2e08aeefd..d32387c1d3 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -293,14 +293,14 @@ namespace osu.Game.Screens.Select labels.Add(new InfoLabel(new BeatmapStatistic { Name = "Length", - Icon = FontAwesome.ClockOutline, + Icon = FontAwesome.Regular.Clock, Content = TimeSpan.FromMilliseconds(endTime - b.HitObjects.First().StartTime).ToString(@"m\:ss"), })); labels.Add(new InfoLabel(new BeatmapStatistic { Name = "BPM", - Icon = FontAwesome.Circle, + Icon = FontAwesome.Regular.Circle, Content = getBPMRange(b), })); @@ -378,7 +378,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"441288"), - Icon = FontAwesome.Square, + Icon = FontAwesome.Solid.Square, Rotation = 45, }, new SpriteIcon diff --git a/osu.Game/Screens/Select/ImportFromStablePopup.cs b/osu.Game/Screens/Select/ImportFromStablePopup.cs index f1cc3d632c..54e4c096f6 100644 --- a/osu.Game/Screens/Select/ImportFromStablePopup.cs +++ b/osu.Game/Screens/Select/ImportFromStablePopup.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Select HeaderText = @"You have no beatmaps!"; BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps (and skins)?"; - Icon = FontAwesome.Plane; + Icon = FontAwesome.Solid.Plane; Buttons = new PopupDialogButton[] { diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 0f1f49bd85..a9616ee535 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -141,7 +141,7 @@ namespace osu.Game.Screens.Select.Options Anchor = Anchor.TopCentre, Size = new Vector2(30), Shadow = true, - Icon = FontAwesome.Close, + Icon = FontAwesome.Solid.TimesCircle, Margin = new MarginPadding { Bottom = 5, diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 6a10e86198..340ceb6864 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colours) { - BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Pencil, colours.Yellow, () => + BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => { ValidForResume = false; Edit(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9ac8e26ec0..b60e693cbf 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -228,9 +228,9 @@ namespace osu.Game.Screens.Select Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3); - BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); - BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.TimesCircleOutline, colours.Purple, null, Key.Number1); - BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2); + BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); + BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1); + BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2); } if (this.beatmaps == null) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 1f62111a4e..e745aa54c8 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -166,7 +166,7 @@ namespace osu.Game.Users { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Icon = FontAwesome.CircleOutline, + Icon = FontAwesome.Regular.Circle, Shadow = true, Size = new Vector2(14), }, From bc1077ed73b2f237e4a52bf6aa2e13af0b310578 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Apr 2019 19:55:34 +0900 Subject: [PATCH 48/90] Remove remaining FontAwesome reference --- osu.Game/Graphics/OsuFont.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 26112430f6..c8a736f49a 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -42,8 +42,6 @@ namespace osu.Game.Graphics { case Typeface.Exo: return "Exo2.0"; - case Typeface.FontAwesome: - return "FontAwesome"; case Typeface.Venera: return "Venera"; } @@ -101,7 +99,6 @@ namespace osu.Game.Graphics public enum Typeface { Exo, - FontAwesome, Venera, } From bcd51afea1686f874b120cc043906d3d32ecf021 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Apr 2019 19:55:46 +0900 Subject: [PATCH 49/90] Fix osu! icon font name mismatch --- osu.Game/Graphics/OsuIcon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuIcon.cs b/osu.Game/Graphics/OsuIcon.cs index 52fb31553d..982e9dacab 100644 --- a/osu.Game/Graphics/OsuIcon.cs +++ b/osu.Game/Graphics/OsuIcon.cs @@ -7,7 +7,7 @@ namespace osu.Game.Graphics { public static class OsuIcon { - public static IconUsage Get(int icon) => new IconUsage((char)icon, "OsuFont"); + public static IconUsage Get(int icon) => new IconUsage((char)icon, "osuFont"); // ruleset icons in circles public static IconUsage RulesetOsu => Get(0xe000); From 072954e4c05fd274c276dd43d361b101d510cf95 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Apr 2019 21:00:05 +0900 Subject: [PATCH 50/90] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 52c53503ee..f3c648cf02 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 9ecc7d4632..7ce7329246 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From e9269dc83bb5df8db8e9bf470cf9f263ff42ee27 Mon Sep 17 00:00:00 2001 From: Samuel Van Allen Date: Tue, 2 Apr 2019 23:57:31 +0800 Subject: [PATCH 51/90] Prevent unnecessary query in OsuGame::PresentBeatmap This resolves issue #4575 --- osu.Game/OsuGame.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f8ca1bc65f..9ab09d1122 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -254,6 +254,12 @@ namespace osu.Game if (menuScreen.IsCurrentScreen()) menuScreen.LoadToSolo(); + // we might even already be at the song + if (Beatmap.Value.BeatmapSetInfo.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID) + { + return; + } + // Use first beatmap available for current ruleset, else switch ruleset. var first = databasedSet.Beatmaps.Find(b => b.Ruleset == ruleset.Value) ?? databasedSet.Beatmaps.First(); From ab4be3b75f1ae455a18d21fc3609c96e9dbab00c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 15:20:38 +0900 Subject: [PATCH 52/90] General refactoring --- .../TestCaseBeatmapScoresContainer.cs | 1 + .../Graphics/Containers/OsuHoverContainer.cs | 4 +- .../Scores/ClickableUserContainer.cs | 29 ++++---- .../BeatmapSet/Scores/DrawableTopScore.cs | 66 ++++++++----------- .../BeatmapSet/Scores/ScoreTableScoreRow.cs | 2 +- 5 files changed, 48 insertions(+), 54 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs index c72d12c09c..4a38f98810 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs @@ -24,6 +24,7 @@ namespace osu.Game.Tests.Visual.SongSelect { public override IReadOnlyList RequiredTypes => new[] { + typeof(DrawableTopScore), typeof(ScoresContainer), typeof(ScoreTable), typeof(ScoreTableRow), diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index 091499b7cd..880807c8b4 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -12,12 +12,12 @@ namespace osu.Game.Graphics.Containers { public class OsuHoverContainer : OsuClickableContainer { + protected const float FADE_DURATION = 500; + protected Color4 HoverColour; protected Color4 IdleColour = Color4.White; - protected const float FADE_DURATION = 500; - protected virtual IEnumerable EffectTargets => new[] { Content }; protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs index cf1c3d7fcf..2448ae17f8 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs @@ -13,6 +13,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { private UserProfileOverlay profile; + protected ClickableUserContainer() + { + AutoSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader(true)] + private void load(UserProfileOverlay profile) + { + this.profile = profile; + } + private User user; public User User @@ -20,26 +31,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores get => user; set { - if (user == value) return; + if (user == value) + return; user = value; - OnUserChange(user); + OnUserChanged(user); } } - protected ClickableUserContainer() - { - AutoSizeAxes = Axes.Both; - } - - protected abstract void OnUserChange(User user); - - [BackgroundDependencyLoader(true)] - private void load(UserProfileOverlay profile) - { - this.profile = profile; - } + protected abstract void OnUserChanged(User user); protected override bool OnClick(ClickEvent e) { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 82905d065e..e3141624b5 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -19,6 +19,7 @@ using osu.Game.Users; using osuTK; using osuTK.Graphics; using System.Collections.Generic; +using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -164,7 +165,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TextSize = 20, }, date = new SpriteText { @@ -263,67 +263,59 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { private const float username_fade_duration = 500; - private readonly Box underscore; - private readonly Container underscoreContainer; - private readonly SpriteText text; + private readonly FillFlowContainer hoverContainer; - private Color4 hoverColour; - - public float TextSize - { - set - { - if (text.TextSize == value) - return; - - text.TextSize = value; - } - get => text.TextSize; - } + private readonly SpriteText normalText; + private readonly SpriteText hoveredText; public ClickableTopScoreUsername() { - Add(underscoreContainer = new Container + var font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true); + + Children = new Drawable[] { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Height = 1, - Child = underscore = new Box + normalText = new OsuSpriteText { Font = font }, + hoverContainer = new FillFlowContainer { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Alpha = 0, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 1), + Children = new Drawable[] + { + hoveredText = new OsuSpriteText { Font = font }, + new Box + { + BypassAutoSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + Height = 1 + } + } } - }); - Add(text = new SpriteText - { - Font = @"Exo2.0-BoldItalic", - }); + }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - hoverColour = underscore.Colour = colours.Blue; - underscoreContainer.Position = new Vector2(0, TextSize / 2 - 1); + hoverContainer.Colour = colours.Blue; } - protected override void OnUserChange(User user) + protected override void OnUserChanged(User user) { - text.Text = user.Username; + normalText.Text = hoveredText.Text = user.Username; } protected override bool OnHover(HoverEvent e) { - text.FadeColour(hoverColour, username_fade_duration, Easing.OutQuint); - underscore.FadeIn(username_fade_duration, Easing.OutQuint); + hoverContainer.FadeIn(username_fade_duration, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - text.FadeColour(Color4.White, username_fade_duration, Easing.OutQuint); - underscore.FadeOut(username_fade_duration, Easing.OutQuint); + hoverContainer.FadeOut(username_fade_duration, Easing.OutQuint); base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs index cd1ade934a..a0c6db9a56 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }); } - protected override void OnUserChange(User user) + protected override void OnUserChanged(User user) { text.Text = textBold.Text = user.Username; } From 1dad1523632352769cfab479de52af7609c0e1b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 15:37:22 +0900 Subject: [PATCH 53/90] Correctly handle nvika/inspectcode return codes --- build/build.cake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/build.cake b/build/build.cake index 81deeb3bc7..3269bbf1c0 100644 --- a/build/build.cake +++ b/build/build.cake @@ -46,7 +46,9 @@ Task("InspectCode") OutputFile = "inspectcodereport.xml", }); - StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); + int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""{inspectcodereport}"" --treatwarningsaserrors"); + if (returnCode != 0) + throw new Exception($"inspectcode failed with return code {returnCode}"); }); Task("CodeFileSanity") From 7f425059aecbc83a0f8b12873fd95f789c8c5858 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 15:41:22 +0900 Subject: [PATCH 54/90] Adjust transforms --- .../Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 2 +- .../BeatmapSet/Scores/ScoreTableScoreRow.cs | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index e3141624b5..3bcb44ab94 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -261,7 +261,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private class ClickableTopScoreUsername : ClickableUserContainer { - private const float username_fade_duration = 500; + private const float username_fade_duration = 150; private readonly FillFlowContainer hoverContainer; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs index a0c6db9a56..83901cc662 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs @@ -145,22 +145,19 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }); } - protected override void OnUserChanged(User user) - { - text.Text = textBold.Text = user.Username; - } + protected override void OnUserChanged(User user) => text.Text = textBold.Text = user.Username; protected override bool OnHover(HoverEvent e) { - textBold.FadeIn(fade_duration, Easing.OutQuint); - text.FadeOut(fade_duration, Easing.OutQuint); + textBold.Show(); + text.Hide(); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - textBold.FadeOut(fade_duration, Easing.OutQuint); - text.FadeIn(fade_duration, Easing.OutQuint); + textBold.Hide(); + text.Show(); base.OnHoverLost(e); } } From dff58ab4edb52c2faec7eb241b6b50602cd1d432 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 15:41:33 +0900 Subject: [PATCH 55/90] Initial cleanup pass of DrawableTopScore --- .../BeatmapSet/Scores/DrawableTopScore.cs | 201 +++++++----------- 1 file changed, 72 insertions(+), 129 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 3bcb44ab94..66ef2a30a3 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -43,15 +43,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly SpriteText date; private readonly DrawableRank rank; - private readonly AutoSizedInfoColumn totalScore; - private readonly AutoSizedInfoColumn accuracy; - private readonly MediumInfoColumn maxCombo; - - private readonly SmallInfoColumn hitGreat; - private readonly SmallInfoColumn hitGood; - private readonly SmallInfoColumn hitMeh; - private readonly SmallInfoColumn hitMiss; - private readonly SmallInfoColumn pp; + private readonly SpriteText totalScoreText; + private readonly SpriteText accuracyText; + private readonly SpriteText maxComboText; + private readonly SpriteText hitGreatText; + private readonly SpriteText hitGoodText; + private readonly SpriteText hitMehText; + private readonly SpriteText hitMissText; + private readonly SpriteText ppText; private readonly ModsInfoColumn modsInfo; @@ -72,17 +71,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores date.Text = $@"achieved {score.Date.Humanize()}"; rank.UpdateRank(score.Rank); - totalScore.Value = $@"{score.TotalScore:N0}"; - accuracy.Value = $@"{score.Accuracy:P2}"; - maxCombo.Value = $@"{score.MaxCombo:N0}x"; + totalScoreText.Text = $@"{score.TotalScore:N0}"; + accuracyText.Text = $@"{score.Accuracy:P2}"; + maxComboText.Text = $@"{score.MaxCombo:N0}x"; - hitGreat.Value = $"{score.Statistics[HitResult.Great]}"; - hitGood.Value = $"{score.Statistics[HitResult.Good]}"; - hitMeh.Value = $"{score.Statistics[HitResult.Meh]}"; - hitMiss.Value = $"{score.Statistics[HitResult.Miss]}"; - pp.Value = $@"{score.PP:N0}"; + hitGreatText.Text = $"{score.Statistics[HitResult.Great]}"; + hitGoodText.Text = $"{score.Statistics[HitResult.Good]}"; + hitMehText.Text = $"{score.Statistics[HitResult.Meh]}"; + hitMissText.Text = $"{score.Statistics[HitResult.Miss]}"; + ppText.Text = $@"{score.PP:N0}"; - modsInfo.ClearMods(); modsInfo.Mods = score.Mods; } } @@ -91,8 +89,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - CornerRadius = 10; + Masking = true; + CornerRadius = 10; EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, @@ -100,6 +99,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Radius = 1, Offset = new Vector2(0, 1), }; + + var smallFont = OsuFont.GetFont(size: 20); + var largeFont = OsuFont.GetFont(size: 25); + Children = new Drawable[] { background = new Box @@ -208,12 +211,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - hitGreat = new SmallInfoColumn("300", 20), - hitGood = new SmallInfoColumn("100", 20), - hitMeh = new SmallInfoColumn("50", 20), - hitMiss = new SmallInfoColumn("misses", 20), - pp = new SmallInfoColumn("pp", 20), - modsInfo = new ModsInfoColumn("mods"), + new InfoColumn("300", hitGreatText = new OsuSpriteText { Font = smallFont }), + new InfoColumn("100", hitGoodText = new OsuSpriteText { Font = smallFont }), + new InfoColumn("50", hitMehText = new OsuSpriteText { Font = smallFont }), + new InfoColumn("misses", hitMissText = new OsuSpriteText { Font = smallFont }), + new InfoColumn("pp", ppText = new OsuSpriteText { Font = smallFont }), + modsInfo = new ModsInfoColumn(), } }, new FillFlowContainer @@ -225,9 +228,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - totalScore = new AutoSizedInfoColumn("Total Score"), - accuracy = new AutoSizedInfoColumn("Accuracy"), - maxCombo = new MediumInfoColumn("Max Combo"), + new InfoColumn("total score", totalScoreText = new OsuSpriteText { Font = largeFont }), + new InfoColumn("accuracy", accuracyText = new OsuSpriteText { Font = largeFont }), + new InfoColumn("max combo", maxComboText = new OsuSpriteText { Font = largeFont }) } }, } @@ -302,10 +305,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores hoverContainer.Colour = colours.Blue; } - protected override void OnUserChanged(User user) - { - normalText.Text = hoveredText.Text = user.Username; - } + protected override void OnUserChanged(User user) => normalText.Text = hoveredText.Text = user.Username; protected override bool OnHover(HoverEvent e) { @@ -320,38 +320,32 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } - private class DrawableInfoColumn : FillFlowContainer + private class InfoColumn : CompositeDrawable { - private const float header_text_size = 12; + private readonly Box separator; - private readonly Box line; - - protected DrawableInfoColumn(string header) + public InfoColumn(string title, Drawable content) { - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; - Spacing = new Vector2(0, 2); - Children = new Drawable[] + AutoSizeAxes = Axes.Both; + + InternalChild = new FillFlowContainer { - new Container + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 2), + Children = new[] { - AutoSizeAxes = Axes.X, - Height = header_text_size, - Child = new SpriteText + new OsuSpriteText { - TextSize = 12, - Text = header.ToUpper(), - Font = @"Exo2.0-Black", - } - }, - new Container - { - RelativeSizeAxes = Axes.X, - Height = 2, - Child = line = new Box + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black), + Text = title.ToUpper() + }, + separator = new Box { - RelativeSizeAxes = Axes.Both, - } + RelativeSizeAxes = Axes.X, + Height = 2 + }, + content } }; } @@ -359,96 +353,45 @@ namespace osu.Game.Overlays.BeatmapSet.Scores [BackgroundDependencyLoader] private void load(OsuColour colours) { - line.Colour = colours.Gray5; + separator.Colour = colours.Gray5; } } - private class ModsInfoColumn : DrawableInfoColumn + private class ModsInfoColumn : InfoColumn { private readonly FillFlowContainer modsContainer; + public ModsInfoColumn() + : this(new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal + }) + { + } + + private ModsInfoColumn(FillFlowContainer modsContainer) + : base("mods", modsContainer) + { + this.modsContainer = modsContainer; + } + public IEnumerable Mods { set { + modsContainer.Clear(); + foreach (Mod mod in value) + { modsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, Scale = new Vector2(0.3f), }); + } } } - - public ModsInfoColumn(string header) - : base(header) - { - AutoSizeAxes = Axes.Both; - Add(modsContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - }); - } - - public void ClearMods() => modsContainer.Clear(); - } - - private class TextInfoColumn : DrawableInfoColumn - { - private readonly SpriteText valueText; - - public string Value - { - set - { - if (valueText.Text == value) - return; - - valueText.Text = value; - } - get => valueText.Text; - } - - protected TextInfoColumn(string header, float valueTextSize = 25) - : base(header) - { - Add(valueText = new SpriteText - { - TextSize = valueTextSize, - }); - } - } - - private class AutoSizedInfoColumn : TextInfoColumn - { - public AutoSizedInfoColumn(string header, float valueTextSize = 25) - : base(header, valueTextSize) - { - AutoSizeAxes = Axes.Both; - } - } - - private class MediumInfoColumn : TextInfoColumn - { - private const float width = 70; - - public MediumInfoColumn(string header, float valueTextSize = 25) - : base(header, valueTextSize) - { - Width = width; - } - } - - private class SmallInfoColumn : TextInfoColumn - { - private const float width = 40; - - public SmallInfoColumn(string header, float valueTextSize = 25) - : base(header, valueTextSize) - { - Width = width; - } } } } From f8d53a1e30b2f3471ac7712983dc8af703a79272 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 15:43:36 +0900 Subject: [PATCH 56/90] Fix variable mismatch --- build/build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.cake b/build/build.cake index 3269bbf1c0..f1b7fa4036 100644 --- a/build/build.cake +++ b/build/build.cake @@ -46,7 +46,7 @@ Task("InspectCode") OutputFile = "inspectcodereport.xml", }); - int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""{inspectcodereport}"" --treatwarningsaserrors"); + int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); if (returnCode != 0) throw new Exception($"inspectcode failed with return code {returnCode}"); }); From 542a46b0a7675cc9b4676cdceeb1326257217261 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 15:43:48 +0900 Subject: [PATCH 57/90] Update r# version --- build/build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.cake b/build/build.cake index f1b7fa4036..de94eb7ab3 100644 --- a/build/build.cake +++ b/build/build.cake @@ -1,5 +1,5 @@ #addin "nuget:?package=CodeFileSanity&version=0.0.21" -#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2" +#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.3.4" #tool "nuget:?package=NVika.MSBuild&version=1.0.1" var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); From 0cf27e244d4948d9425cdfe18941800a96d5226e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 15:44:14 +0900 Subject: [PATCH 58/90] Fix usages of SpriteText and obsolete members --- osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 66ef2a30a3..6e5104b137 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -125,13 +125,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - rankText = new SpriteText + rankText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "#1", - TextSize = 30, - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold, italics: true) }, rank = new DrawableRank(ScoreRank.F) { @@ -173,8 +172,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TextSize = 15, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) }, flag = new DrawableFlag { From d6b15f040a7b7cab448905b4b9d562105c8ff3c1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 15:57:36 +0900 Subject: [PATCH 59/90] Improve statistics display --- .../BeatmapSet/Scores/DrawableTopScore.cs | 78 ++++++++++++------- 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 6e5104b137..052eaf60e5 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -12,13 +12,15 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Online.Leaderboards; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Users; using osuTK; using osuTK.Graphics; using System.Collections.Generic; +using System.Linq; +using osu.Framework.Extensions; +using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet.Scores @@ -26,7 +28,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public class DrawableTopScore : Container { private const float fade_duration = 100; - private const float height = 100; private const float avatar_size = 80; private const float margin = 10; @@ -35,6 +36,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private Color4 backgroundIdleColour => colours.Gray3; private Color4 backgroundHoveredColour => colours.Gray4; + private readonly FontUsage smallStatisticsFont = OsuFont.GetFont(size: 20); + private readonly FontUsage largeStatisticsFont = OsuFont.GetFont(size: 25); + private readonly Box background; private readonly UpdateableAvatar avatar; private readonly DrawableFlag flag; @@ -43,14 +47,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly SpriteText date; private readonly DrawableRank rank; - private readonly SpriteText totalScoreText; - private readonly SpriteText accuracyText; - private readonly SpriteText maxComboText; - private readonly SpriteText hitGreatText; - private readonly SpriteText hitGoodText; - private readonly SpriteText hitMehText; - private readonly SpriteText hitMissText; - private readonly SpriteText ppText; + private readonly FillFlowContainer statisticsContainer; + + private readonly TextColumn totalScoreColumn; + private readonly TextColumn accuracyColumn; + private readonly TextColumn maxComboColumn; + private readonly TextColumn ppColumn; private readonly ModsInfoColumn modsInfo; @@ -71,15 +73,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores date.Text = $@"achieved {score.Date.Humanize()}"; rank.UpdateRank(score.Rank); - totalScoreText.Text = $@"{score.TotalScore:N0}"; - accuracyText.Text = $@"{score.Accuracy:P2}"; - maxComboText.Text = $@"{score.MaxCombo:N0}x"; + totalScoreColumn.Text = $@"{score.TotalScore:N0}"; + accuracyColumn.Text = $@"{score.Accuracy:P2}"; + maxComboColumn.Text = $@"{score.MaxCombo:N0}x"; + ppColumn.Text = $@"{score.PP:N0}"; - hitGreatText.Text = $"{score.Statistics[HitResult.Great]}"; - hitGoodText.Text = $"{score.Statistics[HitResult.Good]}"; - hitMehText.Text = $"{score.Statistics[HitResult.Meh]}"; - hitMissText.Text = $"{score.Statistics[HitResult.Miss]}"; - ppText.Text = $@"{score.PP:N0}"; + statisticsContainer.ChildrenEnumerable = score.Statistics.Select(kvp => new TextColumn(kvp.Key.GetDescription(), smallStatisticsFont) { Text = kvp.Value.ToString() }); modsInfo.Mods = score.Mods; } @@ -100,9 +99,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Offset = new Vector2(0, 1), }; - var smallFont = OsuFont.GetFont(size: 20); - var largeFont = OsuFont.GetFont(size: 25); - Children = new Drawable[] { background = new Box @@ -209,11 +205,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - new InfoColumn("300", hitGreatText = new OsuSpriteText { Font = smallFont }), - new InfoColumn("100", hitGoodText = new OsuSpriteText { Font = smallFont }), - new InfoColumn("50", hitMehText = new OsuSpriteText { Font = smallFont }), - new InfoColumn("misses", hitMissText = new OsuSpriteText { Font = smallFont }), - new InfoColumn("pp", ppText = new OsuSpriteText { Font = smallFont }), + statisticsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + }, + ppColumn = new TextColumn("pp", smallStatisticsFont), modsInfo = new ModsInfoColumn(), } }, @@ -226,9 +224,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(margin, 0), Children = new Drawable[] { - new InfoColumn("total score", totalScoreText = new OsuSpriteText { Font = largeFont }), - new InfoColumn("accuracy", accuracyText = new OsuSpriteText { Font = largeFont }), - new InfoColumn("max combo", maxComboText = new OsuSpriteText { Font = largeFont }) + totalScoreColumn = new TextColumn("total score", largeStatisticsFont), + accuracyColumn = new TextColumn("accuracy", largeStatisticsFont), + maxComboColumn = new TextColumn("max combo", largeStatisticsFont) } }, } @@ -355,6 +353,28 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } + private class TextColumn : InfoColumn + { + private readonly SpriteText text; + + public TextColumn(string title, FontUsage font) + : this(title, new OsuSpriteText { Font = font }) + { + } + + private TextColumn(string title, SpriteText text) + : base(title, text) + { + this.text = text; + } + + public LocalisedString Text + { + get => text.Text; + set => text.Text = value; + } + } + private class ModsInfoColumn : InfoColumn { private readonly FillFlowContainer modsContainer; From 2c18b6df1c21e0983bc7536d95923a41a404ea82 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 16:09:19 +0900 Subject: [PATCH 60/90] Fix score table using 300/100/50 --- .../TestCaseBeatmapScoresContainer.cs | 2 +- .../API/Requests/Responses/APILegacyScores.cs | 2 +- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 21 ++++++----- .../BeatmapSet/Scores/ScoreTableHeaderRow.cs | 22 ++++++++---- .../BeatmapSet/Scores/ScoreTableScoreRow.cs | 35 +++++-------------- .../BeatmapSet/Scores/ScoresContainer.cs | 8 ++--- 6 files changed, 41 insertions(+), 49 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs index 4a38f98810..b30d6b1546 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }; - IEnumerable scores = new[] + var scores = new List { new ScoreInfo { diff --git a/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs b/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs index 15ec5d3b13..c629caaa6f 100644 --- a/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs +++ b/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs @@ -9,6 +9,6 @@ namespace osu.Game.Online.API.Requests.Responses public class APILegacyScores { [JsonProperty(@"scores")] - public IEnumerable Scores; + public List Scores; } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 08e73da841..ada442d50e 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -48,24 +48,27 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }; } - public IEnumerable Scores + public IReadOnlyList Scores { set { if (value == null || !value.Any()) return; - var content = new List { new ScoreTableHeaderRow().CreateDrawables().ToArray() }; - - int index = 0; - foreach (var s in value) - content.Add(new ScoreTableScoreRow(index++, s).CreateDrawables().ToArray()); - - scoresGrid.Content = content.ToArray(); + var content = new List + { + new ScoreTableHeaderRow(value.First()).CreateDrawables().ToArray() + }; backgroundFlow.Clear(); - for (int i = 0; i < index; i++) + + for (int i = 0; i < value.Count; i++) + { + content.Add(new ScoreTableScoreRow(i, value[i]).CreateDrawables().ToArray()); backgroundFlow.Add(new ScoreTableRowBackground(i)); + } + + scoresGrid.Content = content.ToArray(); } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs index a48716b71a..c73543eb10 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs @@ -2,15 +2,24 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Scoring; namespace osu.Game.Overlays.BeatmapSet.Scores { public class ScoreTableHeaderRow : ScoreTableRow { + private readonly ScoreInfo score; + + public ScoreTableHeaderRow(ScoreInfo score) + { + this.score = score; + } + protected override Drawable CreateIndexCell() => new CellText("rank"); protected override Drawable CreateRankCell() => new Container(); @@ -21,14 +30,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores protected override Drawable CreatePlayerCell() => new CellText("player"); - protected override IEnumerable CreateStatisticsCells() => new[] + protected override IEnumerable CreateStatisticsCells() { - new CellText("max combo"), - new CellText("300"), - new CellText("100"), - new CellText("50"), - new CellText("miss"), - }; + yield return new CellText("max combo"); + + foreach (var kvp in score.Statistics) + yield return new CellText(kvp.Key.GetDescription()); + } protected override Drawable CreatePpCell() => new CellText("pp"); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs index 83901cc662..2cb16a5785 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs @@ -10,7 +10,6 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Leaderboards; -using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Users; @@ -74,33 +73,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Font = OsuFont.GetFont(size: TEXT_SIZE) }; - yield return new OsuSpriteText + foreach (var kvp in score.Statistics) { - Text = $"{score.Statistics[HitResult.Great]}", - Font = OsuFont.GetFont(size: TEXT_SIZE), - Colour = score.Statistics[HitResult.Great] == 0 ? Color4.Gray : Color4.White - }; - - yield return new OsuSpriteText - { - Text = $"{score.Statistics[HitResult.Good]}", - Font = OsuFont.GetFont(size: TEXT_SIZE), - Colour = score.Statistics[HitResult.Good] == 0 ? Color4.Gray : Color4.White - }; - - yield return new OsuSpriteText - { - Text = $"{score.Statistics[HitResult.Meh]}", - Font = OsuFont.GetFont(size: TEXT_SIZE), - Colour = score.Statistics[HitResult.Meh] == 0 ? Color4.Gray : Color4.White - }; - - yield return new OsuSpriteText - { - Text = $"{score.Statistics[HitResult.Miss]}", - Font = OsuFont.GetFont(size: TEXT_SIZE), - Colour = score.Statistics[HitResult.Miss] == 0 ? Color4.Gray : Color4.White - }; + yield return new OsuSpriteText + { + Text = $"{kvp.Value}", + Font = OsuFont.GetFont(size: TEXT_SIZE), + Colour = kvp.Value == 0 ? Color4.Gray : Color4.White + }; + } } protected override Drawable CreatePpCell() => new OsuSpriteText diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index a29d812088..de080732f9 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -83,9 +83,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } private GetScoresRequest getScoresRequest; - private IEnumerable scores; + private IReadOnlyList scores; - public IEnumerable Scores + public IReadOnlyList Scores { get => scores; set @@ -121,11 +121,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private void updateDisplay() { - scoreTable.Scores = Enumerable.Empty(); + scoreTable.Scores = new List(); loading = false; - var scoreCount = scores?.Count() ?? 0; + var scoreCount = scores?.Count ?? 0; if (scoreCount == 0) { From e246fad301616d1b97ec20a5f21a2ef4186e731f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 16:09:34 +0900 Subject: [PATCH 61/90] Clear table if no scores are provided --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index ada442d50e..09ab0e3f6a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -52,6 +52,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { set { + scoresGrid.Content = new Drawable[0][]; + backgroundFlow.Clear(); + if (value == null || !value.Any()) return; @@ -60,8 +63,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores new ScoreTableHeaderRow(value.First()).CreateDrawables().ToArray() }; - backgroundFlow.Clear(); - for (int i = 0; i < value.Count; i++) { content.Add(new ScoreTableScoreRow(i, value[i]).CreateDrawables().ToArray()); From 42c915190a968c340d6185ed10539ec2161b8c70 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 16:12:24 +0900 Subject: [PATCH 62/90] Reorder DrawableTopScore --- .../BeatmapSet/Scores/DrawableTopScore.cs | 62 +++++++++---------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 052eaf60e5..f22c6b3529 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -31,10 +31,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private const float avatar_size = 80; private const float margin = 10; - private OsuColour colours; - - private Color4 backgroundIdleColour => colours.Gray3; - private Color4 backgroundHoveredColour => colours.Gray4; + private Color4 backgroundIdleColour; + private Color4 backgroundHoveredColour; private readonly FontUsage smallStatisticsFont = OsuFont.GetFont(size: 20); private readonly FontUsage largeStatisticsFont = OsuFont.GetFont(size: 25); @@ -56,34 +54,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly ModsInfoColumn modsInfo; - private ScoreInfo score; - - public ScoreInfo Score - { - get => score; - set - { - if (score == value) - return; - - score = value; - - avatar.User = username.User = score.User; - flag.Country = score.User.Country; - date.Text = $@"achieved {score.Date.Humanize()}"; - rank.UpdateRank(score.Rank); - - totalScoreColumn.Text = $@"{score.TotalScore:N0}"; - accuracyColumn.Text = $@"{score.Accuracy:P2}"; - maxComboColumn.Text = $@"{score.MaxCombo:N0}x"; - ppColumn.Text = $@"{score.PP:N0}"; - - statisticsContainer.ChildrenEnumerable = score.Statistics.Select(kvp => new TextColumn(kvp.Key.GetDescription(), smallStatisticsFont) { Text = kvp.Value.ToString() }); - - modsInfo.Mods = score.Mods; - } - } - public DrawableTopScore() { RelativeSizeAxes = Axes.X; @@ -240,12 +210,36 @@ namespace osu.Game.Overlays.BeatmapSet.Scores [BackgroundDependencyLoader] private void load(OsuColour colours) { - this.colours = colours; - + backgroundIdleColour = colours.Gray3; + backgroundHoveredColour = colours.Gray4; rankText.Colour = colours.Yellow; + background.Colour = backgroundIdleColour; } + /// + /// Sets the score to be displayed. + /// + public ScoreInfo Score + { + set + { + avatar.User = username.User = value.User; + flag.Country = value.User.Country; + date.Text = $@"achieved {value.Date.Humanize()}"; + rank.UpdateRank(value.Rank); + + totalScoreColumn.Text = $@"{value.TotalScore:N0}"; + accuracyColumn.Text = $@"{value.Accuracy:P2}"; + maxComboColumn.Text = $@"{value.MaxCombo:N0}x"; + ppColumn.Text = $@"{value.PP:N0}"; + + statisticsContainer.ChildrenEnumerable = value.Statistics.Select(kvp => new TextColumn(kvp.Key.GetDescription(), smallStatisticsFont) { Text = kvp.Value.ToString() }); + + modsInfo.Mods = value.Mods; + } + } + protected override bool OnHover(HoverEvent e) { background.FadeColour(backgroundHoveredColour, fade_duration, Easing.OutQuint); From f8596e055ad8a4c0379666a0913add225a15c456 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 16:36:38 +0900 Subject: [PATCH 63/90] Separate into multiple files --- .../TestCaseBeatmapScoresContainer.cs | 2 + .../BeatmapSet/Scores/DrawableTopScore.cs | 329 ++---------------- .../Scores/TopScoreStatisticsSection.cs | 204 +++++++++++ .../BeatmapSet/Scores/TopScoreUserSection.cs | 181 ++++++++++ 4 files changed, 409 insertions(+), 307 deletions(-) create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs create mode 100644 osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs index b30d6b1546..0457e1469a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs @@ -25,6 +25,8 @@ namespace osu.Game.Tests.Visual.SongSelect public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableTopScore), + typeof(TopScoreUserSection), + typeof(TopScoreStatisticsSection), typeof(ScoresContainer), typeof(ScoreTable), typeof(ScoreTableRow), diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index f22c6b3529..3667fc3f9f 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -1,58 +1,29 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using Humanizer; 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.Input.Events; using osu.Game.Graphics; -using osu.Game.Online.Leaderboards; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.UI; using osu.Game.Scoring; -using osu.Game.Users; using osuTK; using osuTK.Graphics; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Extensions; -using osu.Framework.Localisation; -using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet.Scores { public class DrawableTopScore : Container { private const float fade_duration = 100; - private const float avatar_size = 80; - private const float margin = 10; private Color4 backgroundIdleColour; private Color4 backgroundHoveredColour; - private readonly FontUsage smallStatisticsFont = OsuFont.GetFont(size: 20); - private readonly FontUsage largeStatisticsFont = OsuFont.GetFont(size: 25); - private readonly Box background; - private readonly UpdateableAvatar avatar; - private readonly DrawableFlag flag; - private readonly ClickableTopScoreUsername username; - private readonly SpriteText rankText; - private readonly SpriteText date; - private readonly DrawableRank rank; - - private readonly FillFlowContainer statisticsContainer; - - private readonly TextColumn totalScoreColumn; - private readonly TextColumn accuracyColumn; - private readonly TextColumn maxComboColumn; - private readonly TextColumn ppColumn; - - private readonly ModsInfoColumn modsInfo; + private readonly TopScoreUserSection userSection; + private readonly TopScoreStatisticsSection statisticsSection; public DrawableTopScore() { @@ -79,128 +50,30 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding(margin), + Padding = new MarginPadding(10), Children = new Drawable[] { - new FillFlowContainer + new AutoSizingGrid { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(margin, 0), - Children = new Drawable[] - { - rankText = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = "#1", - Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold, italics: true) - }, - rank = new DrawableRank(ScoreRank.F) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(40), - FillMode = FillMode.Fit, - }, - avatar = new UpdateableAvatar - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(avatar_size), - Masking = true, - CornerRadius = 5, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), - Offset = new Vector2(0, 2), - Radius = 1, - }, - }, - new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 3), - Children = new Drawable[] - { - username = new ClickableTopScoreUsername - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - }, - date = new SpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) - }, - flag = new DrawableFlag - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Size = new Vector2(20, 13), - }, - } - } - } - }, - new Container - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Width = 0.65f, - Child = new FillFlowContainer + Content = new[] { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Spacing = new Vector2(margin), - Children = new Drawable[] + new Drawable[] { - new FillFlowContainer + userSection = new TopScoreUserSection { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(margin, 0), - Children = new Drawable[] - { - statisticsContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(margin, 0), - }, - ppColumn = new TextColumn("pp", smallStatisticsFont), - modsInfo = new ModsInfoColumn(), - } + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, }, - new FillFlowContainer + statisticsSection = new TopScoreStatisticsSection { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(margin, 0), - Children = new Drawable[] - { - totalScoreColumn = new TextColumn("total score", largeStatisticsFont), - accuracyColumn = new TextColumn("accuracy", largeStatisticsFont), - maxComboColumn = new TextColumn("max combo", largeStatisticsFont) - } - }, - } - } + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + } + }, + }, + ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, } } } @@ -212,7 +85,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { backgroundIdleColour = colours.Gray3; backgroundHoveredColour = colours.Gray4; - rankText.Colour = colours.Yellow; background.Colour = backgroundIdleColour; } @@ -224,19 +96,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { set { - avatar.User = username.User = value.User; - flag.Country = value.User.Country; - date.Text = $@"achieved {value.Date.Humanize()}"; - rank.UpdateRank(value.Rank); - - totalScoreColumn.Text = $@"{value.TotalScore:N0}"; - accuracyColumn.Text = $@"{value.Accuracy:P2}"; - maxComboColumn.Text = $@"{value.MaxCombo:N0}x"; - ppColumn.Text = $@"{value.PP:N0}"; - - statisticsContainer.ChildrenEnumerable = value.Statistics.Select(kvp => new TextColumn(kvp.Key.GetDescription(), smallStatisticsFont) { Text = kvp.Value.ToString() }); - - modsInfo.Mods = value.Mods; + userSection.Score = value; + statisticsSection.Score = value; } } @@ -252,157 +113,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores base.OnHoverLost(e); } - private class ClickableTopScoreUsername : ClickableUserContainer + private class AutoSizingGrid : GridContainer { - private const float username_fade_duration = 150; - - private readonly FillFlowContainer hoverContainer; - - private readonly SpriteText normalText; - private readonly SpriteText hoveredText; - - public ClickableTopScoreUsername() + public AutoSizingGrid() { - var font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true); - - Children = new Drawable[] - { - normalText = new OsuSpriteText { Font = font }, - hoverContainer = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Alpha = 0, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 1), - Children = new Drawable[] - { - hoveredText = new OsuSpriteText { Font = font }, - new Box - { - BypassAutoSizeAxes = Axes.Both, - RelativeSizeAxes = Axes.X, - Height = 1 - } - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - hoverContainer.Colour = colours.Blue; - } - - protected override void OnUserChanged(User user) => normalText.Text = hoveredText.Text = user.Username; - - protected override bool OnHover(HoverEvent e) - { - hoverContainer.FadeIn(username_fade_duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - hoverContainer.FadeOut(username_fade_duration, Easing.OutQuint); - base.OnHoverLost(e); - } - } - - private class InfoColumn : CompositeDrawable - { - private readonly Box separator; - - public InfoColumn(string title, Drawable content) - { - AutoSizeAxes = Axes.Both; - - InternalChild = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 2), - Children = new[] - { - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black), - Text = title.ToUpper() - }, - separator = new Box - { - RelativeSizeAxes = Axes.X, - Height = 2 - }, - content - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - separator.Colour = colours.Gray5; - } - } - - private class TextColumn : InfoColumn - { - private readonly SpriteText text; - - public TextColumn(string title, FontUsage font) - : this(title, new OsuSpriteText { Font = font }) - { - } - - private TextColumn(string title, SpriteText text) - : base(title, text) - { - this.text = text; - } - - public LocalisedString Text - { - get => text.Text; - set => text.Text = value; - } - } - - private class ModsInfoColumn : InfoColumn - { - private readonly FillFlowContainer modsContainer; - - public ModsInfoColumn() - : this(new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal - }) - { - } - - private ModsInfoColumn(FillFlowContainer modsContainer) - : base("mods", modsContainer) - { - this.modsContainer = modsContainer; - } - - public IEnumerable Mods - { - set - { - modsContainer.Clear(); - - foreach (Mod mod in value) - { - modsContainer.Add(new ModIcon(mod) - { - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.3f), - }); - } - } + AutoSizeAxes = Axes.Y; } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs new file mode 100644 index 0000000000..6761d0f710 --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs @@ -0,0 +1,204 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Allocation; +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.Framework.Localisation; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Scoring; +using osuTK; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class TopScoreStatisticsSection : CompositeDrawable + { + private const float margin = 10; + + private readonly FontUsage smallFont = OsuFont.GetFont(size: 20); + private readonly FontUsage largeFont = OsuFont.GetFont(size: 25); + + private readonly TextColumn totalScoreColumn; + private readonly TextColumn accuracyColumn; + private readonly TextColumn maxComboColumn; + private readonly TextColumn ppColumn; + + private readonly FillFlowContainer statisticsColumns; + private readonly ModsInfoColumn modsColumn; + + public TopScoreStatisticsSection() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + InternalChild = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(10, 0), + Children = new Drawable[] + { + new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + Children = new Drawable[] + { + statisticsColumns = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + }, + ppColumn = new TextColumn("pp", smallFont), + modsColumn = new ModsInfoColumn(), + } + }, + new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(margin, 0), + Children = new Drawable[] + { + totalScoreColumn = new TextColumn("total score", largeFont), + accuracyColumn = new TextColumn("accuracy", largeFont), + maxComboColumn = new TextColumn("max combo", largeFont) + } + }, + } + }; + } + + /// + /// Sets the score to be displayed. + /// + public ScoreInfo Score + { + set + { + totalScoreColumn.Text = $@"{value.TotalScore:N0}"; + accuracyColumn.Text = $@"{value.Accuracy:P2}"; + maxComboColumn.Text = $@"{value.MaxCombo:N0}x"; + ppColumn.Text = $@"{value.PP:N0}"; + + statisticsColumns.ChildrenEnumerable = value.Statistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value)); + modsColumn.Mods = value.Mods; + } + } + + private TextColumn createStatisticsColumn(HitResult hitResult, int count) => new TextColumn(hitResult.GetDescription(), smallFont) + { + Text = count.ToString() + }; + + private class InfoColumn : CompositeDrawable + { + private readonly Box separator; + + public InfoColumn(string title, Drawable content) + { + AutoSizeAxes = Axes.Both; + + InternalChild = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 2), + Children = new[] + { + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black), + Text = title.ToUpper() + }, + separator = new Box + { + RelativeSizeAxes = Axes.X, + Height = 2 + }, + content + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + separator.Colour = colours.Gray5; + } + } + + private class TextColumn : InfoColumn + { + private readonly SpriteText text; + + public TextColumn(string title, FontUsage font) + : this(title, new OsuSpriteText { Font = font }) + { + } + + private TextColumn(string title, SpriteText text) + : base(title, text) + { + this.text = text; + } + + public LocalisedString Text + { + set => text.Text = value; + } + } + + private class ModsInfoColumn : InfoColumn + { + private readonly FillFlowContainer modsContainer; + + public ModsInfoColumn() + : this(new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal + }) + { + } + + private ModsInfoColumn(FillFlowContainer modsContainer) + : base("mods", modsContainer) + { + this.modsContainer = modsContainer; + } + + public IEnumerable Mods + { + set + { + modsContainer.Clear(); + + foreach (Mod mod in value) + { + modsContainer.Add(new ModIcon(mod) + { + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.3f), + }); + } + } + } + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs new file mode 100644 index 0000000000..1ec4b7197d --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -0,0 +1,181 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Humanizer; +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.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Leaderboards; +using osu.Game.Scoring; +using osu.Game.Users; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.BeatmapSet.Scores +{ + public class TopScoreUserSection : CompositeDrawable + { + private readonly SpriteText rankText; + private readonly DrawableRank rank; + private readonly UpdateableAvatar avatar; + private readonly UsernameText usernameText; + private readonly SpriteText date; + private readonly DrawableFlag flag; + + public TopScoreUserSection() + { + AutoSizeAxes = Axes.Both; + + InternalChild = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Children = new Drawable[] + { + rankText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "#1", + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold, italics: true) + }, + rank = new DrawableRank(ScoreRank.F) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(40), + FillMode = FillMode.Fit, + }, + avatar = new UpdateableAvatar + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(80), + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Offset = new Vector2(0, 2), + Radius = 1, + }, + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 3), + Children = new Drawable[] + { + usernameText = new UsernameText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + date = new SpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) + }, + flag = new DrawableFlag + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Size = new Vector2(20, 13), + }, + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + rankText.Colour = colours.Yellow; + } + + /// + /// Sets the score to be displayed. + /// + public ScoreInfo Score + { + set + { + avatar.User = usernameText.User = value.User; + flag.Country = value.User.Country; + date.Text = $@"achieved {value.Date.Humanize()}"; + rank.UpdateRank(value.Rank); + } + } + + private class UsernameText : ClickableUserContainer + { + private const float username_fade_duration = 150; + + private readonly FillFlowContainer hoverContainer; + + private readonly SpriteText normalText; + private readonly SpriteText hoveredText; + + public UsernameText() + { + var font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true); + + Children = new Drawable[] + { + normalText = new OsuSpriteText { Font = font }, + hoverContainer = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 0, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 1), + Children = new Drawable[] + { + hoveredText = new OsuSpriteText { Font = font }, + new Box + { + BypassAutoSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + Height = 1 + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + hoverContainer.Colour = colours.Blue; + } + + protected override void OnUserChanged(User user) => normalText.Text = hoveredText.Text = user.Username; + + protected override bool OnHover(HoverEvent e) + { + hoverContainer.FadeIn(username_fade_duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + hoverContainer.FadeOut(username_fade_duration, Easing.OutQuint); + base.OnHoverLost(e); + } + } + } +} From 3da008d29380dac150b4cd1d6fb629cace86700c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 16:43:56 +0900 Subject: [PATCH 64/90] Add a bit of padding between the sections --- osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 3667fc3f9f..aace49e120 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -65,6 +65,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, + null, statisticsSection = new TopScoreStatisticsSection { Anchor = Anchor.CentreRight, @@ -72,7 +73,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } }, }, - ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, + ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Absolute, 20) }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, } } From 3b7d26cca805330a1a98bb1f86059890204999dc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Apr 2019 17:49:01 +0900 Subject: [PATCH 65/90] Remove custom styled text --- .../Online/TestCaseBeatmapSetOverlay.cs | 1 - .../Scores/ClickableUserContainer.cs | 51 ------------- .../BeatmapSet/Scores/ScoreTableScoreRow.cs | 74 ++++++------------- .../BeatmapSet/Scores/TopScoreUserSection.cs | 73 +++--------------- 4 files changed, 31 insertions(+), 168 deletions(-) delete mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs diff --git a/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs index 19d295cf12..9cbccbd603 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs @@ -24,7 +24,6 @@ namespace osu.Game.Tests.Visual.Online public override IReadOnlyList RequiredTypes => new[] { typeof(Header), - typeof(ClickableUserContainer), typeof(ScoreTable), typeof(ScoreTableRow), typeof(ScoreTableHeaderRow), diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs deleted file mode 100644 index 2448ae17f8..0000000000 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Input.Events; -using osu.Game.Users; - -namespace osu.Game.Overlays.BeatmapSet.Scores -{ - public abstract class ClickableUserContainer : Container - { - private UserProfileOverlay profile; - - protected ClickableUserContainer() - { - AutoSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader(true)] - private void load(UserProfileOverlay profile) - { - this.profile = profile; - } - - private User user; - - public User User - { - get => user; - set - { - if (user == value) - return; - - user = value; - - OnUserChanged(user); - } - } - - protected abstract void OnUserChanged(User user); - - protected override bool OnClick(ClickEvent e) - { - profile?.ShowUser(user); - return true; - } - } -} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs index 2cb16a5785..adb79eedfa 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs @@ -5,10 +5,10 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; using osu.Game.Online.Leaderboards; using osu.Game.Rulesets.UI; using osu.Game.Scoring; @@ -53,17 +53,27 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White }; - protected override Drawable CreatePlayerCell() => new FillFlowContainer + protected override Drawable CreatePlayerCell() { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Children = new Drawable[] + var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: TEXT_SIZE)) { - new DrawableFlag(score.User.Country) { Size = new Vector2(20, 13) }, - new ClickableScoreUsername { User = score.User } - } - }; + AutoSizeAxes = Axes.Both, + }; + + username.AddLink(score.User.Username, null, LinkAction.OpenUserProfile, score.User.Id.ToString(), "Open profile"); + + return new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + new DrawableFlag(score.User.Country) { Size = new Vector2(20, 13) }, + username + } + }; + } protected override IEnumerable CreateStatisticsCells() { @@ -100,47 +110,5 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Scale = new Vector2(0.3f) }) }; - - private class ClickableScoreUsername : ClickableUserContainer - { - private const int fade_duration = 100; - - private readonly SpriteText text; - private readonly SpriteText textBold; - - public ClickableScoreUsername() - { - Add(text = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: TEXT_SIZE) - }); - - Add(textBold = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold), - Alpha = 0, - }); - } - - protected override void OnUserChanged(User user) => text.Text = textBold.Text = user.Username; - - protected override bool OnHover(HoverEvent e) - { - textBold.Show(); - text.Hide(); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - textBold.Hide(); - text.Show(); - base.OnHoverLost(e); - } - } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 1ec4b7197d..f401dc93a7 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -6,11 +6,11 @@ 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.Input.Events; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; using osu.Game.Online.Leaderboards; using osu.Game.Scoring; using osu.Game.Users; @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly SpriteText rankText; private readonly DrawableRank rank; private readonly UpdateableAvatar avatar; - private readonly UsernameText usernameText; + private readonly LinkFlowContainer usernameText; private readonly SpriteText date; private readonly DrawableFlag flag; @@ -77,10 +77,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Spacing = new Vector2(0, 3), Children = new Drawable[] { - usernameText = new UsernameText + usernameText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true)) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.Both, }, date = new SpriteText { @@ -113,69 +114,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { set { - avatar.User = usernameText.User = value.User; + avatar.User = value.User; flag.Country = value.User.Country; date.Text = $@"achieved {value.Date.Humanize()}"; + + usernameText.Clear(); + usernameText.AddLink(value.User.Username, null, LinkAction.OpenUserProfile, value.User.Id.ToString(), "Open profile"); + rank.UpdateRank(value.Rank); } } - - private class UsernameText : ClickableUserContainer - { - private const float username_fade_duration = 150; - - private readonly FillFlowContainer hoverContainer; - - private readonly SpriteText normalText; - private readonly SpriteText hoveredText; - - public UsernameText() - { - var font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true); - - Children = new Drawable[] - { - normalText = new OsuSpriteText { Font = font }, - hoverContainer = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Alpha = 0, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 1), - Children = new Drawable[] - { - hoveredText = new OsuSpriteText { Font = font }, - new Box - { - BypassAutoSizeAxes = Axes.Both, - RelativeSizeAxes = Axes.X, - Height = 1 - } - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - hoverContainer.Colour = colours.Blue; - } - - protected override void OnUserChanged(User user) => normalText.Text = hoveredText.Text = user.Username; - - protected override bool OnHover(HoverEvent e) - { - hoverContainer.FadeIn(username_fade_duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - hoverContainer.FadeOut(username_fade_duration, Easing.OutQuint); - base.OnHoverLost(e); - } - } } } From 5d37851d34b716d361cd67fa8bef60e81e36a399 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 18:14:59 +0900 Subject: [PATCH 66/90] Rename and move test to correct location --- .../TestCaseScoresContainer.cs} | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) rename osu.Game.Tests/Visual/{SongSelect/TestCaseBeatmapScoresContainer.cs => Online/TestCaseScoresContainer.cs} (96%) diff --git a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs similarity index 96% rename from osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs rename to osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs index 0457e1469a..3d87e1743c 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs @@ -15,19 +15,16 @@ using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Users; -using NUnit.Framework; -namespace osu.Game.Tests.Visual.SongSelect +namespace osu.Game.Tests.Visual.Online { - [Description("in BeatmapOverlay")] - public class TestCaseBeatmapScoresContainer : OsuTestCase + public class TestCaseScoresContainer : OsuTestCase { public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableTopScore), typeof(TopScoreUserSection), typeof(TopScoreStatisticsSection), - typeof(ScoresContainer), typeof(ScoreTable), typeof(ScoreTableRow), typeof(ScoreTableHeaderRow), @@ -37,7 +34,7 @@ namespace osu.Game.Tests.Visual.SongSelect private readonly Box background; - public TestCaseBeatmapScoresContainer() + public TestCaseScoresContainer() { ScoresContainer scoresContainer; From 5c3c08566f4f99e6f414ae618a23739cd5a4df8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 18:20:03 +0900 Subject: [PATCH 67/90] DrawableTopScore can be composite --- osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index aace49e120..d8bd15a4a9 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -14,7 +14,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class DrawableTopScore : Container + public class DrawableTopScore : CompositeDrawable { private const float fade_duration = 100; @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Offset = new Vector2(0, 1), }; - Children = new Drawable[] + InternalChildren = new Drawable[] { background = new Box { From a15a9bd03aa95502172ac33958c2cb36e7e5c13f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 18:29:46 +0900 Subject: [PATCH 68/90] Rewrite updateDisplay logic to not fail on some cases --- .../BeatmapSet/Scores/ScoresContainer.cs | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index de080732f9..ef2b14b8f0 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -121,25 +121,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private void updateDisplay() { - scoreTable.Scores = new List(); - loading = false; - var scoreCount = scores?.Count ?? 0; + scoreTable.Scores = scores?.Count > 1 ? scores : new List(); - if (scoreCount == 0) + if (scores.Any()) { - topScore.Hide(); - return; + topScore.Score = scores.FirstOrDefault(); + topScore.Show(); } - - topScore.Score = scores.FirstOrDefault(); - topScore.Show(); - - if (scoreCount < 2) - return; - - scoreTable.Scores = scores; + else + topScore.Hide(); } protected override void Dispose(bool isDisposing) From cb417ebd777085599a2d848e631db49b13a4c8d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 18:44:19 +0900 Subject: [PATCH 69/90] Player -> User --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs | 4 ++-- osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs index c73543eb10..f6f410a729 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores protected override Drawable CreateAccuracyCell() => new CellText("accuracy"); - protected override Drawable CreatePlayerCell() => new CellText("player"); + protected override Drawable CreateUserCell() => new CellText("player"); protected override IEnumerable CreateStatisticsCells() { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs index 8efda73270..15355512ba 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Right = 20 }, - Child = CreatePlayerCell() + Child = CreateUserCell() }; foreach (var cell in CreateStatisticsCells()) @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores protected abstract Drawable CreateAccuracyCell(); - protected abstract Drawable CreatePlayerCell(); + protected abstract Drawable CreateUserCell(); protected abstract IEnumerable CreateStatisticsCells(); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs index adb79eedfa..75d45d0b23 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White }; - protected override Drawable CreatePlayerCell() + protected override Drawable CreateUserCell() { var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: TEXT_SIZE)) { From 84da708d44f2db71e7a50c93b5f49961787a8c3b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Apr 2019 18:46:08 +0900 Subject: [PATCH 70/90] Fix nullref --- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index ef2b14b8f0..8ef3f71fe3 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores scoreTable.Scores = scores?.Count > 1 ? scores : new List(); - if (scores.Any()) + if (scores?.Any() == true) { topScore.Score = scores.FirstOrDefault(); topScore.Show(); From 73c7c6c31613175bcdcfe30d4169bdd160e2b52b Mon Sep 17 00:00:00 2001 From: Samuel Van Allen Date: Wed, 3 Apr 2019 21:44:36 +0800 Subject: [PATCH 71/90] Hides "Details" button when OnlineBeatmapID is null --- .../Carousel/DrawableCarouselBeatmap.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 38ca9a9aed..a31e40dd8f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -167,16 +168,21 @@ namespace osu.Game.Screens.Select.Carousel base.ApplyState(); } - - public MenuItem[] ContextMenuItems => new MenuItem[] + public MenuItem[] ContextMenuItems { - new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap)), - new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)), - new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap)), - new OsuMenuItem("Details", MenuItemType.Standard, () => + get { - if (beatmap.OnlineBeatmapID.HasValue) beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); - }), - }; + List items = new List(); + + items.Add(new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap))); + items.Add(new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap))); + items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap))); + + if (beatmap.OnlineBeatmapID.HasValue) + items.Add(new OsuMenuItem("Details", MenuItemType.Standard, () => beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value))); + + return items.ToArray(); + } + } } } From 55a6e43778da2a932f1b7ae41e713107c7fae54e Mon Sep 17 00:00:00 2001 From: Samuel Van Allen Date: Wed, 3 Apr 2019 21:49:33 +0800 Subject: [PATCH 72/90] Check against databasedSet instead of function param --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9ab09d1122..b31b9e5e87 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -255,7 +255,7 @@ namespace osu.Game menuScreen.LoadToSolo(); // we might even already be at the song - if (Beatmap.Value.BeatmapSetInfo.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID) + if (Beatmap.Value.BeatmapSetInfo.Hash == databasedSet.Hash) { return; } From 4d60f6fb6a0cd17fb4e330a4f67177bab083d4e8 Mon Sep 17 00:00:00 2001 From: Samuel Van Allen Date: Wed, 3 Apr 2019 22:37:50 +0800 Subject: [PATCH 73/90] Use collection initializer and added missing blank line --- .../Select/Carousel/DrawableCarouselBeatmap.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index a31e40dd8f..0b60ca03a7 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -168,16 +168,18 @@ namespace osu.Game.Screens.Select.Carousel base.ApplyState(); } + public MenuItem[] ContextMenuItems { get { - List items = new List(); - - items.Add(new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap))); - items.Add(new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap))); - items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap))); - + List items = new List() + { + new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap)), + new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)), + new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap)), + }; + if (beatmap.OnlineBeatmapID.HasValue) items.Add(new OsuMenuItem("Details", MenuItemType.Standard, () => beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value))); From 36609244410b25aa4f42596d126d3a66651998e3 Mon Sep 17 00:00:00 2001 From: Samuel Van Allen Date: Wed, 3 Apr 2019 22:40:20 +0800 Subject: [PATCH 74/90] Trimmed whitespace --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 0b60ca03a7..c19fa73ab1 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -179,7 +179,7 @@ namespace osu.Game.Screens.Select.Carousel new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)), new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap)), }; - + if (beatmap.OnlineBeatmapID.HasValue) items.Add(new OsuMenuItem("Details", MenuItemType.Standard, () => beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value))); From bb516da5b6903c454c5b9197e57ab4db72b39a23 Mon Sep 17 00:00:00 2001 From: Samuel Van Allen Date: Wed, 3 Apr 2019 22:57:05 +0800 Subject: [PATCH 75/90] Removed redundant empty argument list --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index c19fa73ab1..0a20f2aa6d 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -173,7 +173,7 @@ namespace osu.Game.Screens.Select.Carousel { get { - List items = new List() + List items = new List { new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap)), new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)), From d54750aa37e5a94a6f1c34c4168c1e4876181b74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Apr 2019 17:10:29 +0900 Subject: [PATCH 76/90] Remove incorrect class --- .../Configuration/OsuConfigManager.cs | 32 ------------------- .../Configuration/OsuRulesetConfigManager.cs | 1 - 2 files changed, 33 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs deleted file mode 100644 index 492cc7cc7f..0000000000 --- a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Configuration; -using osu.Game.Rulesets.Configuration; - -namespace osu.Game.Rulesets.Osu.Configuration -{ - public class OsuConfigManager : RulesetConfigManager - { - public OsuConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) - : base(settings, ruleset, variant) - { - } - - protected override void InitialiseDefaults() - { - base.InitialiseDefaults(); - - Set(OsuSetting.SnakingInSliders, true); - Set(OsuSetting.SnakingOutSliders, true); - Set(OsuSetting.ShowCursorTrail, true); - } - } - - public enum OsuSetting - { - SnakingInSliders, - SnakingOutSliders, - ShowCursorTrail - } -} diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 872e152e0d..f76635a932 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -16,7 +16,6 @@ namespace osu.Game.Rulesets.Osu.Configuration protected override void InitialiseDefaults() { base.InitialiseDefaults(); - Set(OsuRulesetSetting.SnakingInSliders, true); Set(OsuRulesetSetting.SnakingOutSliders, true); Set(OsuRulesetSetting.ShowCursorTrail, true); From 9802d8ab1133d33e267afcb173efac0da82579e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Apr 2019 17:18:53 +0900 Subject: [PATCH 77/90] Rename setting --- osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 48eb74a74d..88adf72551 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.UI }, new SettingsCheckbox { - LabelText = "Show cursor trail", + LabelText = "Cursor trail", Bindable = config.GetBindable(OsuRulesetSetting.ShowCursorTrail) }, }; From e13fffaca3dd5b520a5073234d83a99b44f10cc3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Apr 2019 16:32:04 +0900 Subject: [PATCH 78/90] Make ScoreTable use TableContainer --- .../Online/TestCaseBeatmapSetOverlay.cs | 3 - .../Visual/Online/TestCaseScoresContainer.cs | 3 - .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 184 +++++++++++++----- .../BeatmapSet/Scores/ScoreTableHeaderRow.cs | 54 ----- .../BeatmapSet/Scores/ScoreTableRow.cs | 104 ---------- .../BeatmapSet/Scores/ScoreTableScoreRow.cs | 114 ----------- 6 files changed, 136 insertions(+), 326 deletions(-) delete mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs delete mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs delete mode 100644 osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs diff --git a/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs index 9cbccbd603..8363f8be04 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs @@ -25,9 +25,6 @@ namespace osu.Game.Tests.Visual.Online { typeof(Header), typeof(ScoreTable), - typeof(ScoreTableRow), - typeof(ScoreTableHeaderRow), - typeof(ScoreTableScoreRow), typeof(ScoreTableRowBackground), typeof(DrawableTopScore), typeof(ScoresContainer), diff --git a/osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs index 3d87e1743c..1ef4558691 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseScoresContainer.cs @@ -26,9 +26,6 @@ namespace osu.Game.Tests.Visual.Online typeof(TopScoreUserSection), typeof(TopScoreStatisticsSection), typeof(ScoreTable), - typeof(ScoreTableRow), - typeof(ScoreTableHeaderRow), - typeof(ScoreTableScoreRow), typeof(ScoreTableRowBackground), }; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 09ab0e3f6a..08e8dc7ecc 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -5,13 +5,26 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; using System.Linq; +using osu.Framework.Extensions; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; +using osu.Game.Online.Leaderboards; +using osu.Game.Rulesets.UI; using osu.Game.Scoring; +using osu.Game.Users; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Scores { - public class ScoreTable : CompositeDrawable + public class ScoreTable : TableContainer { - private readonly ScoresGrid scoresGrid; + private const float horizontal_inset = 20; + private const float row_height = 25; + private const int text_size = 14; + private readonly FillFlowContainer backgroundFlow; public ScoreTable() @@ -19,77 +32,152 @@ namespace osu.Game.Overlays.BeatmapSet.Scores RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - InternalChildren = new Drawable[] + Padding = new MarginPadding { Horizontal = horizontal_inset }; + RowSize = new Dimension(GridSizeMode.Absolute, row_height); + + AddInternal(backgroundFlow = new FillFlowContainer { - backgroundFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = 25 } - }, - scoresGrid = new ScoresGrid - { - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 40), - new Dimension(GridSizeMode.Absolute, 70), - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.Distributed, minSize: 150), - new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70), - new Dimension(GridSizeMode.Distributed, minSize: 40, maxSize: 70), - new Dimension(GridSizeMode.AutoSize), - } - } - }; + RelativeSizeAxes = Axes.Both, + Depth = 1f, + Padding = new MarginPadding { Horizontal = -horizontal_inset }, + Margin = new MarginPadding { Top = row_height } + }); } public IReadOnlyList Scores { set { - scoresGrid.Content = new Drawable[0][]; + Content = null; backgroundFlow.Clear(); if (value == null || !value.Any()) return; - var content = new List - { - new ScoreTableHeaderRow(value.First()).CreateDrawables().ToArray() - }; - for (int i = 0; i < value.Count; i++) - { - content.Add(new ScoreTableScoreRow(i, value[i]).CreateDrawables().ToArray()); backgroundFlow.Add(new ScoreTableRowBackground(i)); - } - scoresGrid.Content = content.ToArray(); + Columns = createHeaders(value[0]); + Content = value.Select((s, i) => createContent(i, s)).ToArray().ToRectangular(); } } - private class ScoresGrid : GridContainer + private TableColumn[] createHeaders(ScoreInfo score) { - public ScoresGrid() + var columns = new List { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; + new TableColumn("rank", Anchor.CentreRight, new Dimension(GridSizeMode.AutoSize)), + new TableColumn("", Anchor.Centre, new Dimension(GridSizeMode.Absolute, 70)), // grade + new TableColumn("score", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)), + new TableColumn("accuracy", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)), + new TableColumn("player", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 150)), + new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90)) + }; + + foreach (var statistic in score.Statistics) + columns.Add(new TableColumn(statistic.Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70))); + + columns.AddRange(new[] + { + new TableColumn("pp", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 40, maxSize: 70)), + new TableColumn("mods", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)), + }); + + return columns.ToArray(); + } + + private Drawable[] createContent(int index, ScoreInfo score) + { + var content = new List + { + new OsuSpriteText + { + Text = $"#{index + 1}", + Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) + }, + new DrawableRank(score.Rank) + { + Size = new Vector2(30, 20) + }, + new OsuSpriteText + { + Margin = new MarginPadding { Right = horizontal_inset }, + Text = $@"{score.TotalScore:N0}", + Font = OsuFont.GetFont(size: text_size, weight: index == 0 ? FontWeight.Bold : FontWeight.Medium) + }, + new OsuSpriteText + { + Margin = new MarginPadding { Right = horizontal_inset }, + Text = $@"{score.Accuracy:P2}", + Font = OsuFont.GetFont(size: text_size), + Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White + }, + }; + + var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: text_size)) { AutoSizeAxes = Axes.Both }; + username.AddLink(score.User.Username, null, LinkAction.OpenUserProfile, score.User.Id.ToString(), "Open profile"); + + content.AddRange(new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Right = horizontal_inset }, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + new DrawableFlag(score.User.Country) { Size = new Vector2(20, 13) }, + username + } + }, + new OsuSpriteText + { + Text = $@"{score.MaxCombo:N0}x", + Font = OsuFont.GetFont(size: text_size) + } + }); + + foreach (var kvp in score.Statistics) + { + content.Add(new OsuSpriteText + { + Text = $"{kvp.Value}", + Font = OsuFont.GetFont(size: text_size), + Colour = kvp.Value == 0 ? Color4.Gray : Color4.White + }); } - public Drawable[][] Content + content.AddRange(new Drawable[] { - get => base.Content; - set + new OsuSpriteText { - base.Content = value; + Text = $@"{score.PP:N0}", + Font = OsuFont.GetFont(size: text_size) + }, + new FillFlowContainer + { + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m) + { + AutoSizeAxes = Axes.Both, + Scale = new Vector2(0.3f) + }) + }, + }); - RowDimensions = Enumerable.Repeat(new Dimension(GridSizeMode.Absolute, 25), value.Length).ToArray(); - } + return content.ToArray(); + } + + protected override Drawable CreateHeader(int index, TableColumn column) => new HeaderText(column?.Header ?? string.Empty); + + private class HeaderText : OsuSpriteText + { + public HeaderText(string text) + { + Text = text.ToUpper(); + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs deleted file mode 100644 index f6f410a729..0000000000 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableHeaderRow.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Collections.Generic; -using osu.Framework.Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Scoring; - -namespace osu.Game.Overlays.BeatmapSet.Scores -{ - public class ScoreTableHeaderRow : ScoreTableRow - { - private readonly ScoreInfo score; - - public ScoreTableHeaderRow(ScoreInfo score) - { - this.score = score; - } - - protected override Drawable CreateIndexCell() => new CellText("rank"); - - protected override Drawable CreateRankCell() => new Container(); - - protected override Drawable CreateScoreCell() => new CellText("score"); - - protected override Drawable CreateAccuracyCell() => new CellText("accuracy"); - - protected override Drawable CreateUserCell() => new CellText("player"); - - protected override IEnumerable CreateStatisticsCells() - { - yield return new CellText("max combo"); - - foreach (var kvp in score.Statistics) - yield return new CellText(kvp.Key.GetDescription()); - } - - protected override Drawable CreatePpCell() => new CellText("pp"); - - protected override Drawable CreateModsCell() => new CellText("mods"); - - private class CellText : OsuSpriteText - { - public CellText(string text) - { - Text = text.ToUpper(); - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black); - } - } - } -} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs deleted file mode 100644 index 15355512ba..0000000000 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRow.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Collections.Generic; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Overlays.BeatmapSet.Scores -{ - public abstract class ScoreTableRow - { - protected const int TEXT_SIZE = 14; - - public IEnumerable CreateDrawables() - { - yield return new Container - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Child = CreateIndexCell() - }; - - yield return new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Child = CreateRankCell() - }; - - yield return new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Right = 20 }, - Child = CreateScoreCell() - }; - - yield return new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Right = 20 }, - Child = CreateAccuracyCell() - }; - - yield return new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Right = 20 }, - Child = CreateUserCell() - }; - - foreach (var cell in CreateStatisticsCells()) - { - yield return new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Child = cell - }; - } - - yield return new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Child = CreatePpCell() - }; - - yield return new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Right = 20 }, - Child = CreateModsCell() - }; - } - - protected abstract Drawable CreateIndexCell(); - - protected abstract Drawable CreateRankCell(); - - protected abstract Drawable CreateScoreCell(); - - protected abstract Drawable CreateAccuracyCell(); - - protected abstract Drawable CreateUserCell(); - - protected abstract IEnumerable CreateStatisticsCells(); - - protected abstract Drawable CreatePpCell(); - - protected abstract Drawable CreateModsCell(); - } -} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs deleted file mode 100644 index 75d45d0b23..0000000000 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableScoreRow.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; -using osu.Game.Online.Leaderboards; -using osu.Game.Rulesets.UI; -using osu.Game.Scoring; -using osu.Game.Users; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.BeatmapSet.Scores -{ - public class ScoreTableScoreRow : ScoreTableRow - { - private readonly int index; - private readonly ScoreInfo score; - - public ScoreTableScoreRow(int index, ScoreInfo score) - { - this.index = index; - this.score = score; - } - - protected override Drawable CreateIndexCell() => new OsuSpriteText - { - Text = $"#{index + 1}", - Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold) - }; - - protected override Drawable CreateRankCell() => new DrawableRank(score.Rank) - { - Size = new Vector2(30, 20), - }; - - protected override Drawable CreateScoreCell() => new OsuSpriteText - { - Text = $@"{score.TotalScore:N0}", - Font = OsuFont.GetFont(size: TEXT_SIZE, weight: index == 0 ? FontWeight.Bold : FontWeight.Medium) - }; - - protected override Drawable CreateAccuracyCell() => new OsuSpriteText - { - Text = $@"{score.Accuracy:P2}", - Font = OsuFont.GetFont(size: TEXT_SIZE), - Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White - }; - - protected override Drawable CreateUserCell() - { - var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: TEXT_SIZE)) - { - AutoSizeAxes = Axes.Both, - }; - - username.AddLink(score.User.Username, null, LinkAction.OpenUserProfile, score.User.Id.ToString(), "Open profile"); - - return new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Children = new Drawable[] - { - new DrawableFlag(score.User.Country) { Size = new Vector2(20, 13) }, - username - } - }; - } - - protected override IEnumerable CreateStatisticsCells() - { - yield return new OsuSpriteText - { - Text = $@"{score.MaxCombo:N0}x", - Font = OsuFont.GetFont(size: TEXT_SIZE) - }; - - foreach (var kvp in score.Statistics) - { - yield return new OsuSpriteText - { - Text = $"{kvp.Value}", - Font = OsuFont.GetFont(size: TEXT_SIZE), - Colour = kvp.Value == 0 ? Color4.Gray : Color4.White - }; - } - } - - protected override Drawable CreatePpCell() => new OsuSpriteText - { - Text = $@"{score.PP:N0}", - Font = OsuFont.GetFont(size: TEXT_SIZE) - }; - - protected override Drawable CreateModsCell() => new FillFlowContainer - { - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m) - { - AutoSizeAxes = Axes.Both, - Scale = new Vector2(0.3f) - }) - }; - } -} From a6bf076dc7fe9c9777bf546285973df963170cae Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Apr 2019 17:58:34 +0900 Subject: [PATCH 79/90] Adjust green colour --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 08e8dc7ecc..3addef854a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -27,6 +28,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly FillFlowContainer backgroundFlow; + private Color4 highAccuracyColour; + public ScoreTable() { RelativeSizeAxes = Axes.X; @@ -44,6 +47,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }); } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + highAccuracyColour = colours.GreenLight; + } + public IReadOnlyList Scores { set @@ -110,7 +119,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Margin = new MarginPadding { Right = horizontal_inset }, Text = $@"{score.Accuracy:P2}", Font = OsuFont.GetFont(size: text_size), - Colour = score.Accuracy == 1 ? Color4.GreenYellow : Color4.White + Colour = score.Accuracy == 1 ? highAccuracyColour : Color4.White }, }; From 15fbb6f176395ae2ef5cc76c9cfe12ba2c53f6e4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Apr 2019 14:15:36 +0900 Subject: [PATCH 80/90] Use common AddUserLink method --- osu.Game/Graphics/Containers/LinkFlowContainer.cs | 4 ++++ osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 3 +-- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 3 +-- osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs | 3 +-- osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs | 5 ++--- osu.Game/Screens/Multi/Match/Components/HostInfo.cs | 4 +--- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index dace873b92..eefbeea24c 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using osu.Game.Users; namespace osu.Game.Graphics.Containers { @@ -75,6 +76,9 @@ namespace osu.Game.Graphics.Containers return createLink(text, null, url, linkType, linkArgument, tooltipText); } + public IEnumerable AddUserLink(User user, Action creationParameters = null) + => createLink(AddText(user.Username, creationParameters), user.Username, null, LinkAction.OpenUserProfile, user.Id.ToString(), "View profile"); + private IEnumerable createLink(IEnumerable drawables, string text, string url = null, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action action = null) { AddInternal(new DrawableLinkCompiler(drawables.OfType().ToList()) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 3addef854a..693ce958dd 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -10,7 +10,6 @@ using osu.Framework.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; using osu.Game.Online.Leaderboards; using osu.Game.Rulesets.UI; using osu.Game.Scoring; @@ -124,7 +123,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }; var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: text_size)) { AutoSizeAxes = Axes.Both }; - username.AddLink(score.User.Username, null, LinkAction.OpenUserProfile, score.User.Id.ToString(), "Open profile"); + username.AddUserLink(score.User); content.AddRange(new Drawable[] { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index f401dc93a7..c0d9ecad3a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; using osu.Game.Online.Leaderboards; using osu.Game.Scoring; using osu.Game.Users; @@ -119,7 +118,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores date.Text = $@"achieved {value.Date.Humanize()}"; usernameText.Clear(); - usernameText.AddLink(value.User.Username, null, LinkAction.OpenUserProfile, value.User.Id.ToString(), "Open profile"); + usernameText.AddUserLink(value.User); rank.UpdateRank(value.Rank); } diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs index 23771451bd..d63f2fecd2 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Online.Chat; using osuTK; namespace osu.Game.Screens.Multi.Components @@ -60,7 +59,7 @@ namespace osu.Game.Screens.Multi.Components if (beatmap != null) { beatmapAuthor.AddText("mapped by ", s => s.Colour = OsuColour.Gray(0.8f)); - beatmapAuthor.AddLink(beatmap.Metadata.Author.Username, null, LinkAction.OpenUserProfile, beatmap.Metadata.Author.Id.ToString(), "View Profile"); + beatmapAuthor.AddUserLink(beatmap.Metadata.Author); } }, true); } diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index 40e59de25d..51d3c93624 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; using osu.Game.Users; using osuTK; @@ -95,8 +94,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components if (host.NewValue != null) { hostText.AddText("hosted by "); - hostText.AddLink(host.NewValue.Username, null, LinkAction.OpenUserProfile, host.NewValue.Id.ToString(), "Open profile", - s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true)); + hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true)); + flagContainer.Child = new DrawableFlag(host.NewValue.Country) { RelativeSizeAxes = Axes.Both }; } }, true); diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs index 02c8929f44..b898cd0466 100644 --- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs +++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Online.Chat; using osu.Game.Users; using osuTK; @@ -54,8 +53,7 @@ namespace osu.Game.Screens.Multi.Match.Components { linkContainer.AddText("hosted by"); linkContainer.NewLine(); - linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", - s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true)); + linkContainer.AddUserLink(host, s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true)); } } } From a34a511f221e5d964772228d5feb1fb331fed543 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 Apr 2019 14:55:25 +0900 Subject: [PATCH 81/90] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f3c648cf02..74ed9f91dd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 7ce7329246..9fff64c61c 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 53906e87ec35fcb657fd4700dd3039bc8d878347 Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 5 Apr 2019 00:00:21 -0700 Subject: [PATCH 82/90] Split floatingOverlayContent --- osu.Game/OsuGame.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f19860a884..bb279a0bc2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -399,7 +399,8 @@ namespace osu.Game } }, overlayContent = new Container { RelativeSizeAxes = Axes.Both }, - floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, + rightFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, + leftFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, topMostOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, idleTracker = new GameIdleTracker(6000) }); @@ -427,6 +428,7 @@ namespace osu.Game }, }, topMostOverlayContent.Add); + loadComponentSingleFile(volume = new VolumeOverlay(), rightFloatingOverlayContent.Add); loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add); loadComponentSingleFile(loginOverlay = new LoginOverlay @@ -434,7 +436,7 @@ namespace osu.Game GetToolbarHeight = () => ToolbarOffset, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }, floatingOverlayContent.Add); + }, rightFloatingOverlayContent.Add); loadComponentSingleFile(screenshotManager, Add); @@ -443,6 +445,7 @@ namespace osu.Game loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal); loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add); + loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add); loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add); @@ -451,17 +454,14 @@ namespace osu.Game GetToolbarHeight = () => ToolbarOffset, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }, floatingOverlayContent.Add); + }, rightFloatingOverlayContent.Add); loadComponentSingleFile(musicController = new MusicController { GetToolbarHeight = () => ToolbarOffset, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }, floatingOverlayContent.Add); - - loadComponentSingleFile(volume = new VolumeOverlay(), floatingOverlayContent.Add); - loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, floatingOverlayContent.Add); + }, rightFloatingOverlayContent.Add); loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add); loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add); @@ -710,7 +710,9 @@ namespace osu.Game private Container overlayContent; - private Container floatingOverlayContent; + private Container rightFloatingOverlayContent; + + private Container leftFloatingOverlayContent; private Container topMostOverlayContent; From debda7ae7de8c0b4bd57fc48a9dec0c01723dd45 Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 5 Apr 2019 00:05:42 -0700 Subject: [PATCH 83/90] Fix volume overlay container reference --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index bb279a0bc2..15cd6d73e5 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -428,7 +428,7 @@ namespace osu.Game }, }, topMostOverlayContent.Add); - loadComponentSingleFile(volume = new VolumeOverlay(), rightFloatingOverlayContent.Add); + loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add); loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add); loadComponentSingleFile(loginOverlay = new LoginOverlay From 0208526837180c9e19f7f297b7d5c49d0629398c Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 5 Apr 2019 18:21:54 +0900 Subject: [PATCH 84/90] Fix button system visual issue --- osu.Game/Screens/Menu/Button.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 794fc093d3..383150cbd3 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -63,6 +63,8 @@ namespace osu.Game.Screens.Menu { box = new Container { + // box needs to be always present to ensure the button is always sized correctly for flow + AlwaysPresent = true, Masking = true, MaskingSmoothness = 2, EdgeEffect = new EdgeEffectParameters From cb3532e7d46a7b9614a4161463ac32a7c8aa2105 Mon Sep 17 00:00:00 2001 From: theFerdi265 Date: Sat, 6 Apr 2019 00:53:02 +0200 Subject: [PATCH 85/90] BeatmapLeaderboard: fix local scores not being sorted --- osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index ebb1d78ba0..042ef0f5a1 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards { if (Scope == BeatmapLeaderboardScope.Local) { - Scores = scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID).ToArray(); + Scores = scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID).OrderBy(s => -s.TotalScore).ToArray(); PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; return null; } From d5b7865ab8c73ae2f3aad743a190ef12d5ef983c Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 6 Apr 2019 17:40:48 +0200 Subject: [PATCH 86/90] Invert notification and loginOverlay depth order --- osu.Game/OsuGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 15cd6d73e5..4f92ff831c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -431,7 +431,7 @@ namespace osu.Game loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add); loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add); - loadComponentSingleFile(loginOverlay = new LoginOverlay + loadComponentSingleFile(notifications = new NotificationOverlay { GetToolbarHeight = () => ToolbarOffset, Anchor = Anchor.TopRight, @@ -449,7 +449,7 @@ namespace osu.Game loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add); - loadComponentSingleFile(notifications = new NotificationOverlay + loadComponentSingleFile(loginOverlay = new LoginOverlay { GetToolbarHeight = () => ToolbarOffset, Anchor = Anchor.TopRight, From 59410dbe3b739a5708604dddb8dd7e5df48236be Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 6 Apr 2019 18:05:13 +0200 Subject: [PATCH 87/90] Open login overlay when notification asking for signing in to play multi is clicked --- osu.Game/Screens/Menu/ButtonSystem.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index d3cf23dab8..77be5d08d9 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -103,6 +103,9 @@ namespace osu.Game.Screens.Menu [Resolved(CanBeNull = true)] private NotificationOverlay notifications { get; set; } + [Resolved] + private LoginOverlay loginOverlay { get; set; } + [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) { @@ -134,8 +137,13 @@ namespace osu.Game.Screens.Menu { notifications?.Post(new SimpleNotification { - Text = "You gotta be logged in to multi 'yo!", - Icon = FontAwesome.Solid.Globe + Text = "You gotta be logged in to multi 'yo!", + Icon = FontAwesome.Solid.Globe, + Activated = () => + { + loginOverlay.Show(); + return true; + } }); return; From 394f14965b88c745252a3932af9337c30d17037d Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 6 Apr 2019 18:23:56 +0200 Subject: [PATCH 88/90] Make appveyor happy with whitespaces --- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 77be5d08d9..d311664737 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -137,7 +137,7 @@ namespace osu.Game.Screens.Menu { notifications?.Post(new SimpleNotification { - Text = "You gotta be logged in to multi 'yo!", + Text = "You gotta be logged in to multi 'yo!", Icon = FontAwesome.Solid.Globe, Activated = () => { From 3f2e6a9376e024ada4a91e565f7b66b3eb232439 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 6 Apr 2019 18:52:30 +0200 Subject: [PATCH 89/90] Allow loginOverlay to be null if there's no cached instance in DI (for testing cases) --- osu.Game/Screens/Menu/ButtonSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index d311664737..80fbce2cf8 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Menu [Resolved(CanBeNull = true)] private NotificationOverlay notifications { get; set; } - [Resolved] + [Resolved(CanBeNull = true)] private LoginOverlay loginOverlay { get; set; } [BackgroundDependencyLoader(true)] @@ -141,7 +141,7 @@ namespace osu.Game.Screens.Menu Icon = FontAwesome.Solid.Globe, Activated = () => { - loginOverlay.Show(); + loginOverlay?.Show(); return true; } }); From d431ca4efc2f1cf384d0cf595213130792474445 Mon Sep 17 00:00:00 2001 From: Ferdinand Bachmann Date: Sun, 7 Apr 2019 13:26:35 +0200 Subject: [PATCH 90/90] BeatmapLeaderboard: use OrderByDescending instead of negation (suggested by peppy) --- osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 042ef0f5a1..aafa6bb0eb 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards { if (Scope == BeatmapLeaderboardScope.Local) { - Scores = scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID).OrderBy(s => -s.TotalScore).ToArray(); + Scores = scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID).OrderByDescending(s => s.TotalScore).ToArray(); PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; return null; }