From f893d523f52554b57b390b3f4ee25d302bef9831 Mon Sep 17 00:00:00 2001 From: Endrik Tombak Date: Sun, 19 Apr 2020 12:23:41 +0300 Subject: [PATCH 01/75] User setting for always playing first combo break --- osu.Game/Configuration/OsuConfigManager.cs | 2 ++ .../Settings/Sections/Gameplay/GeneralSettings.cs | 6 ++++++ osu.Game/Screens/Play/ComboEffects.cs | 14 +++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 9d31bc9bba..10d11f967e 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -91,6 +91,7 @@ namespace osu.Game.Configuration Set(OsuSetting.FadePlayfieldWhenHealthLow, true); Set(OsuSetting.KeyOverlay, false); Set(OsuSetting.PositionalHitSounds, true); + Set(OsuSetting.AlwaysPlayComboBreak, false); Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth); Set(OsuSetting.FloatingComments, false); @@ -180,6 +181,7 @@ namespace osu.Game.Configuration ShowStoryboard, KeyOverlay, PositionalHitSounds, + AlwaysPlayComboBreak, ScoreMeter, FloatingComments, ShowInterface, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 93a02ea0e4..f3534e4625 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -67,6 +67,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = "Positional hitsounds", Bindable = config.GetBindable(OsuSetting.PositionalHitSounds) }, + new SettingsCheckbox + { + LabelText = "Always play first combo break sound", + Keywords = new[] { "regardless", "combobreak.wav" }, + Bindable = config.GetBindable(OsuSetting.AlwaysPlayComboBreak) + }, new SettingsEnumDropdown { LabelText = "Score meter type", diff --git a/osu.Game/Screens/Play/ComboEffects.cs b/osu.Game/Screens/Play/ComboEffects.cs index 1c4ac921f0..c56ee35cec 100644 --- a/osu.Game/Screens/Play/ComboEffects.cs +++ b/osu.Game/Screens/Play/ComboEffects.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Audio; +using osu.Game.Configuration; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; @@ -16,27 +17,34 @@ namespace osu.Game.Screens.Play private SkinnableSound comboBreakSample; + private Bindable alwaysPlay; + private bool firstTime = true; + public ComboEffects(ScoreProcessor processor) { this.processor = processor; } [BackgroundDependencyLoader] - private void load() + private void load(OsuConfigManager config) { InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak")); + alwaysPlay = config.GetBindable(OsuSetting.AlwaysPlayComboBreak); } protected override void LoadComplete() { base.LoadComplete(); - processor.Combo.BindValueChanged(onComboChange, true); + processor.Combo.BindValueChanged(onComboChange); } private void onComboChange(ValueChangedEvent combo) { - if (combo.NewValue == 0 && combo.OldValue > 20) + if (combo.NewValue == 0 && (combo.OldValue > 20 || alwaysPlay.Value && firstTime)) + { comboBreakSample?.Play(); + firstTime = false; + } } } } From 68f078c9e67d4239eaf02575e58c81b120e44197 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Sun, 5 Jan 2020 22:11:37 +0100 Subject: [PATCH 02/75] Replace logo-triangles.mp4 with shadered logo-triangles.png --- osu.Game/Screens/Menu/IntroTriangles.cs | 9 +- osu.Game/Screens/Menu/LazerLogo.cs | 109 ++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Screens/Menu/LazerLogo.cs diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 9be74a0fd9..36f00a13ef 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.IO; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -12,7 +11,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Video; using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Graphics; @@ -88,7 +86,7 @@ namespace osu.Game.Screens.Menu private RulesetFlow rulesets; private Container rulesetsScale; private Container logoContainerSecondary; - private Drawable lazerLogo; + private LazerLogo lazerLogo; private GlitchingTriangles triangles; @@ -139,10 +137,10 @@ namespace osu.Game.Screens.Menu RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Child = lazerLogo = new LazerLogo(textures.GetStream("Menu/logo-triangles.mp4")) + Child = lazerLogo = new LazerLogo() { Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Origin = Anchor.Centre } }, }; @@ -218,6 +216,7 @@ namespace osu.Game.Screens.Menu // matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5 lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint); + lazerLogo.Start(logo_1, logo_scale_duration); logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad); } diff --git a/osu.Game/Screens/Menu/LazerLogo.cs b/osu.Game/Screens/Menu/LazerLogo.cs new file mode 100644 index 0000000000..ab9c82bc58 --- /dev/null +++ b/osu.Game/Screens/Menu/LazerLogo.cs @@ -0,0 +1,109 @@ +// 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.OpenGL.Vertices; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Shaders; +using osu.Framework.Graphics.Textures; +using osu.Framework.MathUtils; +using osuTK; + +namespace osu.Game.Screens.Menu +{ + public class LazerLogo : Drawable + { + private IShader shader; + private Texture texture; + + private double startTime = -1000; + private double animationTime = -1000; + + private float animation; + private float highlight; + + public LazerLogo() + { + Size = new Vector2(960); + } + + [BackgroundDependencyLoader] + private void load(ShaderManager shaders, TextureStore textures) + { + shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LazerLogo"); + texture = textures.Get("Menu/logo-triangles.png"); + } + + public void Start(double delay, double duration) + { + startTime = Clock.CurrentTime + delay; + animationTime = duration; + } + + public override bool IsPresent => true; + + protected override void Update() + { + base.Update(); + + if (animationTime < 0) return; + + highlight = Clock.CurrentTime < startTime + 0.4 * animationTime + ? Interpolation.ValueAt(Clock.CurrentTime, 0f, 1f, startTime, startTime + animationTime * 1.07, Easing.OutCirc) + : Interpolation.ValueAt(Clock.CurrentTime, 0.6f, 1f, startTime, startTime + animationTime * 0.9); + + animation = Clock.CurrentTime < startTime + 0.5 * animationTime + ? Interpolation.ValueAt(Clock.CurrentTime, 0f, 0.8f, startTime, startTime + animationTime * 1.23, Easing.OutQuart) + : Interpolation.ValueAt(Clock.CurrentTime, 0.4f, 1f, startTime, startTime + animationTime); + } + + protected override DrawNode CreateDrawNode() => new LazerLogoDrawNode(this); + + private class LazerLogoDrawNode : DrawNode + { + protected new LazerLogo Source => (LazerLogo)base.Source; + + private IShader shader; + private Texture texture; + private Quad screenSpaceDrawQuad; + private float animation; + private float highlight; + + public LazerLogoDrawNode(LazerLogo source) + : base(source) + { + } + + public override void ApplyState() + { + base.ApplyState(); + + shader = Source.shader; + texture = Source.texture; + screenSpaceDrawQuad = Source.ScreenSpaceDrawQuad; + animation = Source.animation; + highlight = Source.highlight; + } + + protected virtual void Blit(Action vertexAction) + { + DrawQuad(texture, screenSpaceDrawQuad, DrawColourInfo.Colour, null, vertexAction); + } + + public override void Draw(Action vertexAction) + { + base.Draw(vertexAction); + + shader.Bind(); + shader.GetUniform("highlight").Value = highlight; + shader.GetUniform("animation").Value = animation; + + Blit(vertexAction); + + shader.Unbind(); + } + } + } +} From 768e28faba318a3c2ef46fbce030ffb52d98b060 Mon Sep 17 00:00:00 2001 From: jorolf Date: Wed, 24 Jun 2020 14:11:38 +0200 Subject: [PATCH 03/75] generalize and simplify animation --- .../UserInterface/TestSceneHueAnimation.cs | 29 +++++ osu.Game/Graphics/Sprites/HueAnimation.cs | 75 ++++++++++++ osu.Game/Screens/Menu/IntroTriangles.cs | 45 ++++++-- osu.Game/Screens/Menu/LazerLogo.cs | 109 ------------------ 4 files changed, 141 insertions(+), 117 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs create mode 100644 osu.Game/Graphics/Sprites/HueAnimation.cs delete mode 100644 osu.Game/Screens/Menu/LazerLogo.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs new file mode 100644 index 0000000000..582849a053 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs @@ -0,0 +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 NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Tests.Visual.UserInterface +{ + [TestFixture] + public class TestSceneHueAnimation : OsuTestScene + { + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + HueAnimation anim; + + Add(anim = new HueAnimation + { + Texture = textures.Get("Intro/Triangles/logo-triangles.png"), + Colour = Colour4.White, + }); + + AddSliderStep("Progress", 0f, 1f, 0f, newValue => anim.AnimationProgress = newValue); + } + } +} diff --git a/osu.Game/Graphics/Sprites/HueAnimation.cs b/osu.Game/Graphics/Sprites/HueAnimation.cs new file mode 100644 index 0000000000..55a167cf59 --- /dev/null +++ b/osu.Game/Graphics/Sprites/HueAnimation.cs @@ -0,0 +1,75 @@ +// 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.OpenGL.Vertices; +using osu.Framework.Graphics.Shaders; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osuTK; + +namespace osu.Game.Graphics.Sprites +{ + public class HueAnimation : Sprite + { + public HueAnimation() + { + Size = new Vector2(960); + } + + [BackgroundDependencyLoader] + private void load(ShaderManager shaders, TextureStore textures) + { + TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); + RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); // Masking isn't supported for now + } + + private float animationProgress; + + public float AnimationProgress + { + get => animationProgress; + set + { + if (animationProgress == value) return; + + animationProgress = value; + Invalidate(Invalidation.DrawInfo); + } + } + + public override bool IsPresent => true; + + protected override DrawNode CreateDrawNode() => new HueAnimationDrawNode(this); + + private class HueAnimationDrawNode : SpriteDrawNode + { + protected new HueAnimation Source => (HueAnimation)base.Source; + + private float progress; + + public HueAnimationDrawNode(HueAnimation source) + : base(source) + { + } + + public override void ApplyState() + { + base.ApplyState(); + + progress = Source.animationProgress; + } + + protected override void Blit(Action vertexAction) + { + Shader.GetUniform("progress").UpdateValue(ref progress); + + base.Blit(vertexAction); + } + + protected override bool CanDrawOpaqueInterior => false; + } + } +} diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 36f00a13ef..53eb0eb270 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -137,7 +138,7 @@ namespace osu.Game.Screens.Menu RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Child = lazerLogo = new LazerLogo() + Child = lazerLogo = new LazerLogo { Anchor = Anchor.Centre, Origin = Anchor.Centre @@ -216,7 +217,13 @@ namespace osu.Game.Screens.Menu // matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5 lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint); - lazerLogo.Start(logo_1, logo_scale_duration); + + lazerLogo.TransformTo(nameof(LazerLogo.Highlight), 0.6f, logo_scale_duration * 0.4f, Easing.OutCirc).Then() + .TransformTo(nameof(LazerLogo.Highlight), 1f, logo_scale_duration * 0.4f); + + lazerLogo.TransformTo(nameof(LazerLogo.Animation), 0.4f, logo_scale_duration * 0.5f, Easing.OutQuart).Then() + .TransformTo(nameof(LazerLogo.Animation), 1f, logo_scale_duration * 0.4f); + logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad); } @@ -258,20 +265,42 @@ namespace osu.Game.Screens.Menu private class LazerLogo : CompositeDrawable { - private readonly Stream videoStream; + private HueAnimation highlight, animation; - public LazerLogo(Stream videoStream) + public float Highlight + { + get => highlight.AnimationProgress; + set => highlight.AnimationProgress = value; + } + + public float Animation + { + get => animation.AnimationProgress; + set => animation.AnimationProgress = value; + } + + public LazerLogo() { - this.videoStream = videoStream; Size = new Vector2(960); } [BackgroundDependencyLoader] - private void load() + private void load(TextureStore textures) { - InternalChild = new Video(videoStream) + const string lazer_logo_texture = @"Intro/Triangles/logo-triangles"; + + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, + highlight = new HueAnimation + { + Texture = textures.Get(lazer_logo_texture), + Colour = OsuColour.Gray(0.6f).Opacity(0.8f), + }, + animation = new HueAnimation + { + Texture = textures.Get(lazer_logo_texture), + Colour = Color4.White.Opacity(0.8f), + }, }; } } diff --git a/osu.Game/Screens/Menu/LazerLogo.cs b/osu.Game/Screens/Menu/LazerLogo.cs deleted file mode 100644 index ab9c82bc58..0000000000 --- a/osu.Game/Screens/Menu/LazerLogo.cs +++ /dev/null @@ -1,109 +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; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.OpenGL.Vertices; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Shaders; -using osu.Framework.Graphics.Textures; -using osu.Framework.MathUtils; -using osuTK; - -namespace osu.Game.Screens.Menu -{ - public class LazerLogo : Drawable - { - private IShader shader; - private Texture texture; - - private double startTime = -1000; - private double animationTime = -1000; - - private float animation; - private float highlight; - - public LazerLogo() - { - Size = new Vector2(960); - } - - [BackgroundDependencyLoader] - private void load(ShaderManager shaders, TextureStore textures) - { - shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LazerLogo"); - texture = textures.Get("Menu/logo-triangles.png"); - } - - public void Start(double delay, double duration) - { - startTime = Clock.CurrentTime + delay; - animationTime = duration; - } - - public override bool IsPresent => true; - - protected override void Update() - { - base.Update(); - - if (animationTime < 0) return; - - highlight = Clock.CurrentTime < startTime + 0.4 * animationTime - ? Interpolation.ValueAt(Clock.CurrentTime, 0f, 1f, startTime, startTime + animationTime * 1.07, Easing.OutCirc) - : Interpolation.ValueAt(Clock.CurrentTime, 0.6f, 1f, startTime, startTime + animationTime * 0.9); - - animation = Clock.CurrentTime < startTime + 0.5 * animationTime - ? Interpolation.ValueAt(Clock.CurrentTime, 0f, 0.8f, startTime, startTime + animationTime * 1.23, Easing.OutQuart) - : Interpolation.ValueAt(Clock.CurrentTime, 0.4f, 1f, startTime, startTime + animationTime); - } - - protected override DrawNode CreateDrawNode() => new LazerLogoDrawNode(this); - - private class LazerLogoDrawNode : DrawNode - { - protected new LazerLogo Source => (LazerLogo)base.Source; - - private IShader shader; - private Texture texture; - private Quad screenSpaceDrawQuad; - private float animation; - private float highlight; - - public LazerLogoDrawNode(LazerLogo source) - : base(source) - { - } - - public override void ApplyState() - { - base.ApplyState(); - - shader = Source.shader; - texture = Source.texture; - screenSpaceDrawQuad = Source.ScreenSpaceDrawQuad; - animation = Source.animation; - highlight = Source.highlight; - } - - protected virtual void Blit(Action vertexAction) - { - DrawQuad(texture, screenSpaceDrawQuad, DrawColourInfo.Colour, null, vertexAction); - } - - public override void Draw(Action vertexAction) - { - base.Draw(vertexAction); - - shader.Bind(); - shader.GetUniform("highlight").Value = highlight; - shader.GetUniform("animation").Value = animation; - - Blit(vertexAction); - - shader.Unbind(); - } - } - } -} From 6f0ec36407510e54c49b4cef6710bf620c35a564 Mon Sep 17 00:00:00 2001 From: jorolf Date: Wed, 24 Jun 2020 16:27:00 +0200 Subject: [PATCH 04/75] remove size from hue animation --- .../Visual/UserInterface/TestSceneHueAnimation.cs | 6 ++++-- osu.Game/Graphics/Sprites/HueAnimation.cs | 6 ------ osu.Game/Screens/Menu/IntroTriangles.cs | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs index 582849a053..85ddfb08f9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs @@ -13,13 +13,15 @@ namespace osu.Game.Tests.Visual.UserInterface public class TestSceneHueAnimation : OsuTestScene { [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load(LargeTextureStore textures) { HueAnimation anim; Add(anim = new HueAnimation { - Texture = textures.Get("Intro/Triangles/logo-triangles.png"), + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Texture = textures.Get("Intro/Triangles/logo-triangles"), Colour = Colour4.White, }); diff --git a/osu.Game/Graphics/Sprites/HueAnimation.cs b/osu.Game/Graphics/Sprites/HueAnimation.cs index 55a167cf59..4f2bafe27f 100644 --- a/osu.Game/Graphics/Sprites/HueAnimation.cs +++ b/osu.Game/Graphics/Sprites/HueAnimation.cs @@ -8,17 +8,11 @@ using osu.Framework.Graphics.OpenGL.Vertices; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osuTK; namespace osu.Game.Graphics.Sprites { public class HueAnimation : Sprite { - public HueAnimation() - { - Size = new Vector2(960); - } - [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) { diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 53eb0eb270..95fc101094 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -293,11 +293,13 @@ namespace osu.Game.Screens.Menu { highlight = new HueAnimation { + RelativeSizeAxes = Axes.Both, Texture = textures.Get(lazer_logo_texture), Colour = OsuColour.Gray(0.6f).Opacity(0.8f), }, animation = new HueAnimation { + RelativeSizeAxes = Axes.Both, Texture = textures.Get(lazer_logo_texture), Colour = Color4.White.Opacity(0.8f), }, From 1409ace282035eb5c5b01e5d2e099049c0dad829 Mon Sep 17 00:00:00 2001 From: jorolf Date: Thu, 25 Jun 2020 00:59:12 +0200 Subject: [PATCH 05/75] apply suggestions --- osu.Game/Graphics/Sprites/HueAnimation.cs | 4 ++-- osu.Game/Screens/Menu/IntroTriangles.cs | 26 +++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/Sprites/HueAnimation.cs b/osu.Game/Graphics/Sprites/HueAnimation.cs index 4f2bafe27f..82ac1aad36 100644 --- a/osu.Game/Graphics/Sprites/HueAnimation.cs +++ b/osu.Game/Graphics/Sprites/HueAnimation.cs @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Sprites private class HueAnimationDrawNode : SpriteDrawNode { - protected new HueAnimation Source => (HueAnimation)base.Source; + private HueAnimation source => (HueAnimation)base.Source; private float progress; @@ -53,7 +53,7 @@ namespace osu.Game.Graphics.Sprites { base.ApplyState(); - progress = Source.animationProgress; + progress = source.animationProgress; } protected override void Blit(Action vertexAction) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 95fc101094..2074fc7081 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -218,11 +218,11 @@ namespace osu.Game.Screens.Menu // matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5 lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint); - lazerLogo.TransformTo(nameof(LazerLogo.Highlight), 0.6f, logo_scale_duration * 0.4f, Easing.OutCirc).Then() - .TransformTo(nameof(LazerLogo.Highlight), 1f, logo_scale_duration * 0.4f); + lazerLogo.TransformTo(nameof(LazerLogo.OutlineHighlight), 0.6f, logo_scale_duration * 0.4f, Easing.OutCirc).Then() + .TransformTo(nameof(LazerLogo.OutlineHighlight), 1f, logo_scale_duration * 0.4f); - lazerLogo.TransformTo(nameof(LazerLogo.Animation), 0.4f, logo_scale_duration * 0.5f, Easing.OutQuart).Then() - .TransformTo(nameof(LazerLogo.Animation), 1f, logo_scale_duration * 0.4f); + lazerLogo.TransformTo(nameof(LazerLogo.Outline), 0.4f, logo_scale_duration * 0.5f, Easing.OutQuart).Then() + .TransformTo(nameof(LazerLogo.Outline), 1f, logo_scale_duration * 0.4f); logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad); } @@ -265,18 +265,18 @@ namespace osu.Game.Screens.Menu private class LazerLogo : CompositeDrawable { - private HueAnimation highlight, animation; + private HueAnimation outlineHighlight, outline; - public float Highlight + public float OutlineHighlight { - get => highlight.AnimationProgress; - set => highlight.AnimationProgress = value; + get => outlineHighlight.AnimationProgress; + set => outlineHighlight.AnimationProgress = value; } - public float Animation + public float Outline { - get => animation.AnimationProgress; - set => animation.AnimationProgress = value; + get => outline.AnimationProgress; + set => outline.AnimationProgress = value; } public LazerLogo() @@ -291,13 +291,13 @@ namespace osu.Game.Screens.Menu InternalChildren = new Drawable[] { - highlight = new HueAnimation + outlineHighlight = new HueAnimation { RelativeSizeAxes = Axes.Both, Texture = textures.Get(lazer_logo_texture), Colour = OsuColour.Gray(0.6f).Opacity(0.8f), }, - animation = new HueAnimation + outline = new HueAnimation { RelativeSizeAxes = Axes.Both, Texture = textures.Get(lazer_logo_texture), From 820056cc4e2e1497a53a3d9af7db3594940e5fcd Mon Sep 17 00:00:00 2001 From: jorolf Date: Sun, 28 Jun 2020 17:53:53 +0200 Subject: [PATCH 06/75] update colours/transformations --- osu.Game/Screens/Menu/IntroTriangles.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 2074fc7081..8118491c36 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -218,11 +217,14 @@ namespace osu.Game.Screens.Menu // matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5 lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint); - lazerLogo.TransformTo(nameof(LazerLogo.OutlineHighlight), 0.6f, logo_scale_duration * 0.4f, Easing.OutCirc).Then() - .TransformTo(nameof(LazerLogo.OutlineHighlight), 1f, logo_scale_duration * 0.4f); + const double highlight_duration = logo_scale_duration / 1.4; - lazerLogo.TransformTo(nameof(LazerLogo.Outline), 0.4f, logo_scale_duration * 0.5f, Easing.OutQuart).Then() - .TransformTo(nameof(LazerLogo.Outline), 1f, logo_scale_duration * 0.4f); + //Since we only have one texture, roughly align it by changing the timing + lazerLogo.Outline = -0.4f; + lazerLogo.TransformTo(nameof(LazerLogo.Outline), 1f, highlight_duration * 1.4); + + lazerLogo.OutlineHighlight = 0f; + lazerLogo.TransformTo(nameof(LazerLogo.OutlineHighlight), 1f, highlight_duration); logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad); } @@ -295,13 +297,13 @@ namespace osu.Game.Screens.Menu { RelativeSizeAxes = Axes.Both, Texture = textures.Get(lazer_logo_texture), - Colour = OsuColour.Gray(0.6f).Opacity(0.8f), + Colour = OsuColour.Gray(0.8f), }, outline = new HueAnimation { RelativeSizeAxes = Axes.Both, Texture = textures.Get(lazer_logo_texture), - Colour = Color4.White.Opacity(0.8f), + Colour = OsuColour.Gray(0.6f * 0.8f), }, }; } From 79eca8e1bffed2138d9b89cb1216d013205e5a74 Mon Sep 17 00:00:00 2001 From: jorolf Date: Sun, 28 Jun 2020 17:55:01 +0200 Subject: [PATCH 07/75] remove unneeded "base." --- osu.Game/Graphics/Sprites/HueAnimation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Sprites/HueAnimation.cs b/osu.Game/Graphics/Sprites/HueAnimation.cs index 82ac1aad36..8ad68ace05 100644 --- a/osu.Game/Graphics/Sprites/HueAnimation.cs +++ b/osu.Game/Graphics/Sprites/HueAnimation.cs @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Sprites private class HueAnimationDrawNode : SpriteDrawNode { - private HueAnimation source => (HueAnimation)base.Source; + private HueAnimation source => (HueAnimation)Source; private float progress; From 18e30a7fc4123a297f271bfb8ddc4fbe06fa9f23 Mon Sep 17 00:00:00 2001 From: Shivam Date: Thu, 2 Jul 2020 19:12:45 +0200 Subject: [PATCH 08/75] Implement background switching based on the intro Only the Welcome intro has its own unique background right now --- .../Backgrounds/BackgroundScreenDefault.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 980a127cf4..ae3ad63ac8 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -22,11 +22,12 @@ namespace osu.Game.Screens.Backgrounds private int currentDisplay; private const int background_count = 7; - private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; + private string backgroundName; private Bindable user; private Bindable skin; private Bindable mode; + private Bindable introSequence; [Resolved] private IBindable beatmap { get; set; } @@ -42,11 +43,13 @@ namespace osu.Game.Screens.Backgrounds user = api.LocalUser.GetBoundCopy(); skin = skinManager.CurrentSkin.GetBoundCopy(); mode = config.GetBindable(OsuSetting.MenuBackgroundSource); + introSequence = config.GetBindable(OsuSetting.IntroSequence); user.ValueChanged += _ => Next(); skin.ValueChanged += _ => Next(); mode.ValueChanged += _ => Next(); beatmap.ValueChanged += _ => Next(); + introSequence.ValueChanged += _ => Next(); currentDisplay = RNG.Next(0, background_count); @@ -74,6 +77,17 @@ namespace osu.Game.Screens.Backgrounds { Background newBackground; + switch (introSequence.Value) + { + case IntroSequence.Welcome: + backgroundName = "Menu/menu-background-welcome"; + break; + + default: + backgroundName = $@"Menu/menu-background-{currentDisplay % background_count + 1}"; + break; + } + if (user.Value?.IsSupporter ?? false) { switch (mode.Value) From e80a5a085afe07c55c9c112450df8f173af153e2 Mon Sep 17 00:00:00 2001 From: Shivam Date: Thu, 2 Jul 2020 19:45:18 +0200 Subject: [PATCH 09/75] Make backgroundName local --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index ae3ad63ac8..2c22e60195 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -21,9 +21,6 @@ namespace osu.Game.Screens.Backgrounds private int currentDisplay; private const int background_count = 7; - - private string backgroundName; - private Bindable user; private Bindable skin; private Bindable mode; @@ -76,6 +73,7 @@ namespace osu.Game.Screens.Backgrounds private Background createBackground() { Background newBackground; + string backgroundName; switch (introSequence.Value) { From 4ded6d1913c6db7811cb3f4ac4a5037e3f843cb0 Mon Sep 17 00:00:00 2001 From: Shivam Date: Fri, 3 Jul 2020 11:36:03 +0200 Subject: [PATCH 10/75] Change background path with resource change --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 2c22e60195..ef41c5be3d 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Backgrounds switch (introSequence.Value) { case IntroSequence.Welcome: - backgroundName = "Menu/menu-background-welcome"; + backgroundName = "Intro/Welcome/menu-background"; break; default: From 52b313f2909eca32da32c66ab9bf0aad9ff09abd Mon Sep 17 00:00:00 2001 From: jorolf Date: Sat, 4 Jul 2020 19:06:26 +0200 Subject: [PATCH 11/75] change textures --- .../UserInterface/TestSceneHueAnimation.cs | 2 +- osu.Game/Screens/Menu/IntroTriangles.cs | 39 ++++++++----------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs index 85ddfb08f9..b341291c58 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.UserInterface { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, - Texture = textures.Get("Intro/Triangles/logo-triangles"), + Texture = textures.Get("Intro/Triangles/logo-background"), Colour = Colour4.White, }); diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 8118491c36..38da98220d 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -217,14 +217,8 @@ namespace osu.Game.Screens.Menu // matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5 lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint); - const double highlight_duration = logo_scale_duration / 1.4; - - //Since we only have one texture, roughly align it by changing the timing - lazerLogo.Outline = -0.4f; - lazerLogo.TransformTo(nameof(LazerLogo.Outline), 1f, highlight_duration * 1.4); - - lazerLogo.OutlineHighlight = 0f; - lazerLogo.TransformTo(nameof(LazerLogo.OutlineHighlight), 1f, highlight_duration); + lazerLogo.TransformTo(nameof(LazerLogo.Background), 1f, logo_scale_duration); + lazerLogo.TransformTo(nameof(LazerLogo.Highlight), 1f, logo_scale_duration); logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad); } @@ -267,18 +261,18 @@ namespace osu.Game.Screens.Menu private class LazerLogo : CompositeDrawable { - private HueAnimation outlineHighlight, outline; + private HueAnimation highlight, background; - public float OutlineHighlight + public float Highlight { - get => outlineHighlight.AnimationProgress; - set => outlineHighlight.AnimationProgress = value; + get => highlight.AnimationProgress; + set => highlight.AnimationProgress = value; } - public float Outline + public float Background { - get => outline.AnimationProgress; - set => outline.AnimationProgress = value; + get => background.AnimationProgress; + set => background.AnimationProgress = value; } public LazerLogo() @@ -289,21 +283,22 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(TextureStore textures) { - const string lazer_logo_texture = @"Intro/Triangles/logo-triangles"; + const string lazer_logo_background = @"Intro/Triangles/logo-background"; + const string lazer_logo_highlight = @"Intro/Triangles/logo-highlight"; InternalChildren = new Drawable[] { - outlineHighlight = new HueAnimation + highlight = new HueAnimation { RelativeSizeAxes = Axes.Both, - Texture = textures.Get(lazer_logo_texture), - Colour = OsuColour.Gray(0.8f), + Texture = textures.Get(lazer_logo_highlight), + Colour = OsuColour.Gray(1f), }, - outline = new HueAnimation + background = new HueAnimation { RelativeSizeAxes = Axes.Both, - Texture = textures.Get(lazer_logo_texture), - Colour = OsuColour.Gray(0.6f * 0.8f), + Texture = textures.Get(lazer_logo_background), + Colour = OsuColour.Gray(0.6f), }, }; } From 789c921af1869435142f77c82fbdf5227c3a7af5 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 06:47:52 +0300 Subject: [PATCH 12/75] Move replies button to a new line --- osu.Game/Overlays/Comments/DrawableComment.cs | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 46f600615a..2a63060385 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -163,20 +163,28 @@ namespace osu.Game.Overlays.Comments AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Right = 40 } }, - info = new FillFlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(10, 0), + Direction = FillDirection.Vertical, Children = new Drawable[] { - new OsuSpriteText + info = new FillFlowContainer { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: 12), - Colour = OsuColour.Gray(0.7f), - Text = HumanizerUtils.Humanize(Comment.CreatedAt) + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: 12), + Colour = OsuColour.Gray(0.7f), + Text = HumanizerUtils.Humanize(Comment.CreatedAt) + }, + } }, repliesButton = new RepliesButton(Comment.RepliesCount) { From da249abd19382e9c3c6c0deeab0529f510314bd9 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 07:47:17 +0300 Subject: [PATCH 13/75] Implement CommentRepliesButton --- .../TestSceneCommentRepliesButton.cs | 54 ++++++++++ .../Comments/Buttons/CommentRepliesButton.cs | 100 ++++++++++++++++++ .../Comments/Buttons/LoadRepliesButton.cs | 10 ++ .../Comments/Buttons/ShowRepliesButton.cs | 19 ++++ 4 files changed, 183 insertions(+) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs create mode 100644 osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs create mode 100644 osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs create mode 100644 osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs new file mode 100644 index 0000000000..b4f518a5d0 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -0,0 +1,54 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Overlays.Comments.Buttons; +using osu.Framework.Graphics; +using osu.Framework.Allocation; +using osu.Game.Overlays; +using osu.Framework.Graphics.Containers; +using osuTK; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneCommentRepliesButton : OsuTestScene + { + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + + public TestSceneCommentRepliesButton() + { + Child = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Children = new Drawable[] + { + new TestButton + { + Action = () => { } + }, + new LoadRepliesButton + { + Action = () => { } + }, + new ShowRepliesButton(1) + { + Action = () => { } + }, + new ShowRepliesButton(2) + { + Action = () => { } + } + } + }; + } + + private class TestButton : CommentRepliesButton + { + protected override string GetText() => "sample text"; + } + } +} diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs new file mode 100644 index 0000000000..13924200c2 --- /dev/null +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -0,0 +1,100 @@ +// 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.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osuTK; + +namespace osu.Game.Overlays.Comments.Buttons +{ + public abstract class CommentRepliesButton : OsuHoverContainer + { + protected override IEnumerable EffectTargets => new[] { background }; + + protected ChevronIcon Icon; + private Box background; + + public CommentRepliesButton() + { + AutoSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + Add(new CircularContainer + { + AutoSizeAxes = Axes.Both, + Masking = true, + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both + }, + new Container + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding + { + Vertical = 5, + Horizontal = 10, + }, + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(15, 0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), + Text = GetText() + }, + Icon = new ChevronIcon + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + } + } + } + } + } + }); + + IdleColour = colourProvider.Background2; + HoverColour = colourProvider.Background1; + } + + protected abstract string GetText(); + + protected class ChevronIcon : SpriteIcon + { + public ChevronIcon() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + Size = new Vector2(7.5f); + Icon = FontAwesome.Solid.ChevronDown; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + Colour = colourProvider.Foreground1; + } + } + } +} diff --git a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs new file mode 100644 index 0000000000..41cce72272 --- /dev/null +++ b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Overlays.Comments.Buttons +{ + public class LoadRepliesButton : CommentRepliesButton + { + protected override string GetText() => "load replies"; + } +} diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs new file mode 100644 index 0000000000..1e8c732453 --- /dev/null +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.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 Humanizer; + +namespace osu.Game.Overlays.Comments.Buttons +{ + public class ShowRepliesButton : CommentRepliesButton + { + private readonly int count; + + public ShowRepliesButton(int count) + { + this.count = count; + } + + protected override string GetText() => "reply".ToQuantity(count); + } +} From 0861ee0c8e985bb413681037ab54ea00f1910d82 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 07:54:37 +0300 Subject: [PATCH 14/75] Make Icon rotate when clicking ShowRepliesButton --- .../Comments/Buttons/ShowRepliesButton.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index 1e8c732453..2381727431 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs @@ -2,11 +2,17 @@ // See the LICENCE file in the repository root for full licence text. using Humanizer; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osuTK; namespace osu.Game.Overlays.Comments.Buttons { public class ShowRepliesButton : CommentRepliesButton { + public readonly BindableBool Expanded = new BindableBool(true); + private readonly int count; public ShowRepliesButton(int count) @@ -14,6 +20,23 @@ namespace osu.Game.Overlays.Comments.Buttons this.count = count; } + protected override void LoadComplete() + { + base.LoadComplete(); + Expanded.BindValueChanged(onExpandedChanged, true); + } + + private void onExpandedChanged(ValueChangedEvent expanded) + { + Icon.ScaleTo(new Vector2(1, expanded.NewValue ? -1 : 1)); + } + + protected override bool OnClick(ClickEvent e) + { + Expanded.Toggle(); + return base.OnClick(e); + } + protected override string GetText() => "reply".ToQuantity(count); } } From 42d3288f176d312833cad45f23cb69e73718e48c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 08:01:11 +0300 Subject: [PATCH 15/75] Update old buttons usage --- osu.Game/Overlays/Comments/DrawableComment.cs | 50 ++++--------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 2a63060385..7bd5e22038 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -16,12 +16,12 @@ using System.Linq; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osu.Framework.Allocation; -using osuTK.Graphics; using System.Collections.Generic; using System; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.IEnumerableExtensions; using System.Collections.Specialized; +using osu.Game.Overlays.Comments.Buttons; namespace osu.Game.Overlays.Comments { @@ -46,9 +46,9 @@ namespace osu.Game.Overlays.Comments private FillFlowContainer childCommentsVisibilityContainer; private FillFlowContainer childCommentsContainer; - private LoadMoreCommentsButton loadMoreCommentsButton; + private LoadRepliesButton loadRepliesButton; private ShowMoreButton showMoreButton; - private RepliesButton repliesButton; + private ShowRepliesButton showRepliesButton; private ChevronButton chevronButton; private DeletedCommentsCounter deletedCommentsCounter; @@ -186,11 +186,11 @@ namespace osu.Game.Overlays.Comments }, } }, - repliesButton = new RepliesButton(Comment.RepliesCount) + showRepliesButton = new ShowRepliesButton(Comment.RepliesCount) { Expanded = { BindTarget = childrenExpanded } }, - loadMoreCommentsButton = new LoadMoreCommentsButton + loadRepliesButton = new LoadRepliesButton { Action = () => RepliesRequested(this, ++currentPage) } @@ -347,14 +347,16 @@ namespace osu.Game.Overlays.Comments var loadedReplesCount = loadedReplies.Count; var hasUnloadedReplies = loadedReplesCount != Comment.RepliesCount; - loadMoreCommentsButton.FadeTo(hasUnloadedReplies && loadedReplesCount == 0 ? 1 : 0); + loadRepliesButton.FadeTo(hasUnloadedReplies && loadedReplesCount == 0 ? 1 : 0); showMoreButton.FadeTo(hasUnloadedReplies && loadedReplesCount > 0 ? 1 : 0); - repliesButton.FadeTo(loadedReplesCount != 0 ? 1 : 0); + showRepliesButton.FadeTo(loadedReplesCount != 0 ? 1 : 0); if (Comment.IsTopLevel) chevronButton.FadeTo(loadedReplesCount != 0 ? 1 : 0); - showMoreButton.IsLoading = loadMoreCommentsButton.IsLoading = false; + showMoreButton.IsLoading = false; + + //loadRepliesButton.IsLoading = false; } private class ChevronButton : ShowChildrenButton @@ -375,38 +377,6 @@ namespace osu.Game.Overlays.Comments } } - private class RepliesButton : ShowChildrenButton - { - private readonly SpriteText text; - private readonly int count; - - public RepliesButton(int count) - { - this.count = count; - - Child = text = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - }; - } - - protected override void OnExpandedChanged(ValueChangedEvent expanded) - { - text.Text = $@"{(expanded.NewValue ? "[-]" : "[+]")} replies ({count})"; - } - } - - private class LoadMoreCommentsButton : GetCommentRepliesButton - { - public LoadMoreCommentsButton() - { - IdleColour = OsuColour.Gray(0.7f); - HoverColour = Color4.White; - } - - protected override string GetText() => @"[+] load replies"; - } - private class ShowMoreButton : GetCommentRepliesButton { [BackgroundDependencyLoader] From b1b2e961bc0027b6305751ad469bf60e69186ee2 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 08:13:11 +0300 Subject: [PATCH 16/75] Update arrow colour on hover --- .../TestSceneCommentRepliesButton.cs | 18 +-- .../Comments/Buttons/CommentRepliesButton.cs | 125 ++++++++++-------- 2 files changed, 70 insertions(+), 73 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index b4f518a5d0..e62092a180 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -26,22 +26,10 @@ namespace osu.Game.Tests.Visual.UserInterface Spacing = new Vector2(0, 10), Children = new Drawable[] { - new TestButton - { - Action = () => { } - }, - new LoadRepliesButton - { - Action = () => { } - }, - new ShowRepliesButton(1) - { - Action = () => { } - }, + new TestButton(), + new LoadRepliesButton(), + new ShowRepliesButton(1), new ShowRepliesButton(2) - { - Action = () => { } - } } }; } diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index 13924200c2..7ea256d113 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -1,100 +1,109 @@ // 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; 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.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osuTK; namespace osu.Game.Overlays.Comments.Buttons { - public abstract class CommentRepliesButton : OsuHoverContainer + public abstract class CommentRepliesButton : CompositeDrawable { - protected override IEnumerable EffectTargets => new[] { background }; + public Action Action { get; set; } - protected ChevronIcon Icon; + [Resolved] + private OverlayColourProvider colourProvider { get; set; } + + protected SpriteIcon Icon; private Box background; - public CommentRepliesButton() + [BackgroundDependencyLoader] + private void load() { AutoSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - Add(new CircularContainer + InternalChildren = new Drawable[] { - AutoSizeAxes = Axes.Both, - Masking = true, - Children = new Drawable[] + new CircularContainer { - background = new Box + AutoSizeAxes = Axes.Both, + Masking = true, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both - }, - new Container - { - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding + background = new Box { - Vertical = 5, - Horizontal = 10, + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background2 }, - Child = new FillFlowContainer + new Container { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(15, 0), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] + Margin = new MarginPadding { - new OsuSpriteText + Vertical = 5, + Horizontal = 10, + }, + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(15, 0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), - Text = GetText() - }, - Icon = new ChevronIcon - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), + Text = GetText() + }, + Icon = new SpriteIcon + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Size = new Vector2(7.5f), + Icon = FontAwesome.Solid.ChevronDown, + Colour = colourProvider.Foreground1 + } } } } } - } - }); - - IdleColour = colourProvider.Background2; - HoverColour = colourProvider.Background1; + }, + new HoverClickSounds(), + }; } protected abstract string GetText(); - protected class ChevronIcon : SpriteIcon + protected override bool OnHover(HoverEvent e) { - public ChevronIcon() - { - Anchor = Anchor.Centre; - Origin = Anchor.Centre; - Size = new Vector2(7.5f); - Icon = FontAwesome.Solid.ChevronDown; - } + base.OnHover(e); + background.FadeColour(colourProvider.Background1, 200, Easing.OutQuint); + Icon.FadeColour(colourProvider.Light1, 200, Easing.OutQuint); + return true; + } - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - Colour = colourProvider.Foreground1; - } + protected override void OnHoverLost(HoverLostEvent e) + { + base.OnHoverLost(e); + background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint); + Icon.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint); + } + + protected override bool OnClick(ClickEvent e) + { + Action?.Invoke(); + return base.OnClick(e); } } } From 84392d0d130242616ded329ac711355bbc7c8c0c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 08:50:35 +0300 Subject: [PATCH 17/75] Add loading spinner --- osu.Game/Overlays/Comments/DrawableComment.cs | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 7bd5e22038..fef8194712 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -22,6 +22,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.IEnumerableExtensions; using System.Collections.Specialized; using osu.Game.Overlays.Comments.Buttons; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Comments { @@ -51,6 +52,7 @@ namespace osu.Game.Overlays.Comments private ShowRepliesButton showRepliesButton; private ChevronButton chevronButton; private DeletedCommentsCounter deletedCommentsCounter; + private Loading loading; public DrawableComment(Comment comment) { @@ -192,7 +194,12 @@ namespace osu.Game.Overlays.Comments }, loadRepliesButton = new LoadRepliesButton { - Action = () => RepliesRequested(this, ++currentPage) + Action = () => + { + RepliesRequested(this, ++currentPage); + loadRepliesButton.Hide(); + loading.Show(); + } } } } @@ -202,6 +209,11 @@ namespace osu.Game.Overlays.Comments } } }, + loading = new Loading + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, childCommentsVisibilityContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, @@ -355,8 +367,7 @@ namespace osu.Game.Overlays.Comments chevronButton.FadeTo(loadedReplesCount != 0 ? 1 : 0); showMoreButton.IsLoading = false; - - //loadRepliesButton.IsLoading = false; + loading.Hide(); } private class ChevronButton : ShowChildrenButton @@ -427,5 +438,31 @@ namespace osu.Game.Overlays.Comments return parentComment.HasMessage ? parentComment.Message : parentComment.IsDeleted ? @"deleted" : string.Empty; } } + + private class Loading : Container + { + private readonly LoadingSpinner loading; + + public Loading() + { + Child = loading = new LoadingSpinner + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Size = new Vector2(15), + Margin = new MarginPadding + { + Vertical = 5, + Left = 80 + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + loading.Show(); + } + } } } From 024ccc75eefcec4e62b5a6a79d658df8a421657b Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 11 Jul 2020 09:03:03 +0300 Subject: [PATCH 18/75] Adjust margins/paddings --- osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs | 4 ++++ osu.Game/Overlays/Comments/DrawableComment.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index 7ea256d113..f4bab3d9d7 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -29,6 +29,10 @@ namespace osu.Game.Overlays.Comments.Buttons private void load() { AutoSizeAxes = Axes.Both; + Margin = new MarginPadding + { + Vertical = 2 + }; InternalChildren = new Drawable[] { new CircularContainer diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index fef8194712..813540b28d 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Comments { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding(margin) { Left = margin + 5 }, + Padding = new MarginPadding(margin) { Left = margin + 5, Top = Comment.IsTopLevel ? 10 : 0 }, Child = content = new GridContainer { RelativeSizeAxes = Axes.X, From da40f29b4405990a3db8150fbd0fafa4f34f9f83 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 12 Jul 2020 12:27:26 +0300 Subject: [PATCH 19/75] Make button text a property --- .../TestSceneCommentRepliesButton.cs | 5 ++- .../Comments/Buttons/CommentRepliesButton.cs | 32 ++++++++++++------- .../Comments/Buttons/LoadRepliesButton.cs | 5 ++- .../Comments/Buttons/ShowRepliesButton.cs | 6 +--- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index e62092a180..baeb1ae822 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -36,7 +36,10 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestButton : CommentRepliesButton { - protected override string GetText() => "sample text"; + public TestButton() + { + Text = "sample text"; + } } } } diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index f4bab3d9d7..1121ac5327 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -19,14 +19,20 @@ namespace osu.Game.Overlays.Comments.Buttons { public Action Action { get; set; } + protected string Text + { + get => text.Text; + set => text.Text = value; + } + [Resolved] private OverlayColourProvider colourProvider { get; set; } - protected SpriteIcon Icon; - private Box background; + protected readonly SpriteIcon Icon; + private readonly Box background; + private readonly OsuSpriteText text; - [BackgroundDependencyLoader] - private void load() + public CommentRepliesButton() { AutoSizeAxes = Axes.Both; Margin = new MarginPadding @@ -43,8 +49,7 @@ namespace osu.Game.Overlays.Comments.Buttons { background = new Box { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background2 + RelativeSizeAxes = Axes.Both }, new Container { @@ -63,20 +68,18 @@ namespace osu.Game.Overlays.Comments.Buttons Origin = Anchor.Centre, Children = new Drawable[] { - new OsuSpriteText + text = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), - Text = GetText() + Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold) }, Icon = new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(7.5f), - Icon = FontAwesome.Solid.ChevronDown, - Colour = colourProvider.Foreground1 + Icon = FontAwesome.Solid.ChevronDown } } } @@ -87,7 +90,12 @@ namespace osu.Game.Overlays.Comments.Buttons }; } - protected abstract string GetText(); + [BackgroundDependencyLoader] + private void load() + { + background.Colour = colourProvider.Background2; + Icon.Colour = colourProvider.Foreground1; + } protected override bool OnHover(HoverEvent e) { diff --git a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs index 41cce72272..9387c95758 100644 --- a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs @@ -5,6 +5,9 @@ namespace osu.Game.Overlays.Comments.Buttons { public class LoadRepliesButton : CommentRepliesButton { - protected override string GetText() => "load replies"; + public LoadRepliesButton() + { + Text = "load replies"; + } } } diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index 2381727431..01c2e8a7a7 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs @@ -13,11 +13,9 @@ namespace osu.Game.Overlays.Comments.Buttons { public readonly BindableBool Expanded = new BindableBool(true); - private readonly int count; - public ShowRepliesButton(int count) { - this.count = count; + Text = "reply".ToQuantity(count); } protected override void LoadComplete() @@ -36,7 +34,5 @@ namespace osu.Game.Overlays.Comments.Buttons Expanded.Toggle(); return base.OnClick(e); } - - protected override string GetText() => "reply".ToQuantity(count); } } From c3524cbe57f60e826df8b12fdcdf5bb178497b80 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 12 Jul 2020 12:32:26 +0300 Subject: [PATCH 20/75] Make icon private but expose a protected method --- .../Comments/Buttons/CommentRepliesButton.cs | 12 +++++++----- .../Overlays/Comments/Buttons/ShowRepliesButton.cs | 9 +-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index 1121ac5327..dd02a35a06 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Comments.Buttons [Resolved] private OverlayColourProvider colourProvider { get; set; } - protected readonly SpriteIcon Icon; + private readonly SpriteIcon icon; private readonly Box background; private readonly OsuSpriteText text; @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Comments.Buttons Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold) }, - Icon = new SpriteIcon + icon = new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -94,14 +94,16 @@ namespace osu.Game.Overlays.Comments.Buttons private void load() { background.Colour = colourProvider.Background2; - Icon.Colour = colourProvider.Foreground1; + icon.Colour = colourProvider.Foreground1; } + protected void ToggleIcon(bool upwards) => icon.ScaleTo(new Vector2(1, upwards ? -1 : 1)); + protected override bool OnHover(HoverEvent e) { base.OnHover(e); background.FadeColour(colourProvider.Background1, 200, Easing.OutQuint); - Icon.FadeColour(colourProvider.Light1, 200, Easing.OutQuint); + icon.FadeColour(colourProvider.Light1, 200, Easing.OutQuint); return true; } @@ -109,7 +111,7 @@ namespace osu.Game.Overlays.Comments.Buttons { base.OnHoverLost(e); background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint); - Icon.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint); + icon.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint); } protected override bool OnClick(ClickEvent e) diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index 01c2e8a7a7..118cac5b4c 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs @@ -3,9 +3,7 @@ using Humanizer; using osu.Framework.Bindables; -using osu.Framework.Graphics; using osu.Framework.Input.Events; -using osuTK; namespace osu.Game.Overlays.Comments.Buttons { @@ -21,12 +19,7 @@ namespace osu.Game.Overlays.Comments.Buttons protected override void LoadComplete() { base.LoadComplete(); - Expanded.BindValueChanged(onExpandedChanged, true); - } - - private void onExpandedChanged(ValueChangedEvent expanded) - { - Icon.ScaleTo(new Vector2(1, expanded.NewValue ? -1 : 1)); + Expanded.BindValueChanged(expanded => ToggleIcon(expanded.NewValue), true); } protected override bool OnClick(ClickEvent e) From be36a4b7686a120641a7ec29f727a2898dd54053 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 12 Jul 2020 12:39:48 +0300 Subject: [PATCH 21/75] Make ctor protected --- osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index dd02a35a06..65648f6751 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Comments.Buttons private readonly Box background; private readonly OsuSpriteText text; - public CommentRepliesButton() + protected CommentRepliesButton() { AutoSizeAxes = Axes.Both; Margin = new MarginPadding From c9d21894e5aeba8e2ddbf7c97779584bbc95ac93 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 12 Jul 2020 13:19:28 +0300 Subject: [PATCH 22/75] Add test for icon toggle --- .../TestSceneCommentRepliesButton.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index baeb1ae822..73fe66d6eb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -7,6 +7,9 @@ using osu.Framework.Allocation; using osu.Game.Overlays; using osu.Framework.Graphics.Containers; using osuTK; +using NUnit.Framework; +using System.Linq; +using osu.Framework.Graphics.Sprites; namespace osu.Game.Tests.Visual.UserInterface { @@ -15,6 +18,8 @@ namespace osu.Game.Tests.Visual.UserInterface [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + private readonly TestButton button; + public TestSceneCommentRepliesButton() { Child = new FillFlowContainer @@ -26,7 +31,7 @@ namespace osu.Game.Tests.Visual.UserInterface Spacing = new Vector2(0, 10), Children = new Drawable[] { - new TestButton(), + button = new TestButton(), new LoadRepliesButton(), new ShowRepliesButton(1), new ShowRepliesButton(2) @@ -34,12 +39,25 @@ namespace osu.Game.Tests.Visual.UserInterface }; } + [Test] + public void TestArrowRotation() + { + AddStep("Toggle icon up", () => button.ToggleIcon(true)); + AddAssert("Icon facing upwards", () => button.Icon.Scale.Y == -1); + AddStep("Toggle icon down", () => button.ToggleIcon(false)); + AddAssert("Icon facing downwards", () => button.Icon.Scale.Y == 1); + } + private class TestButton : CommentRepliesButton { + public SpriteIcon Icon => InternalChildren.OfType().First().Children.OfType().First().Children.OfType().First().Children.OfType().First(); + public TestButton() { Text = "sample text"; } + + public new void ToggleIcon(bool upwards) => base.ToggleIcon(upwards); } } } From 0d6dbb652315f7f8e341ddf2478617308e3ac59f Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 12 Jul 2020 13:36:42 +0300 Subject: [PATCH 23/75] Clean up exposed icon for tests --- .../Visual/UserInterface/TestSceneCommentRepliesButton.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index 73fe66d6eb..7f5806705e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -10,6 +10,7 @@ using osuTK; using NUnit.Framework; using System.Linq; using osu.Framework.Graphics.Sprites; +using osu.Framework.Testing; namespace osu.Game.Tests.Visual.UserInterface { @@ -50,7 +51,7 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestButton : CommentRepliesButton { - public SpriteIcon Icon => InternalChildren.OfType().First().Children.OfType().First().Children.OfType().First().Children.OfType().First(); + public SpriteIcon Icon => this.ChildrenOfType().First(); public TestButton() { From 08696b9bca23ce188b3e6bb90fc1d11bc36cbdef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 Jul 2020 23:03:03 +0900 Subject: [PATCH 24/75] Allow pausing gameplay via middle mouse button --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 4 ++++ osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 1 + 2 files changed, 5 insertions(+) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 618798a6d8..567c81c018 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -56,6 +56,7 @@ namespace osu.Game.Input.Bindings new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit), new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed), new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed), + new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay), }; public IEnumerable AudioControlKeyBindings => new[] @@ -157,5 +158,8 @@ namespace osu.Game.Input.Bindings [Description("Home")] Home, + + [Description("Pause")] + PauseGameplay, } } diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 684834123b..81ad29107f 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -251,6 +251,7 @@ namespace osu.Game.Screens.Play.HUD switch (action) { case GlobalAction.Back: + case GlobalAction.PauseGameplay: if (!pendingAnimation) BeginConfirm(); return true; From c1aafe83fa042ac01e28631bf9bda2695a71a100 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 Jul 2020 23:05:47 +0900 Subject: [PATCH 25/75] Add note about future behaviour --- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 81ad29107f..74064c507f 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -251,7 +251,7 @@ namespace osu.Game.Screens.Play.HUD switch (action) { case GlobalAction.Back: - case GlobalAction.PauseGameplay: + case GlobalAction.PauseGameplay: // in the future this behaviour will differ for replays etc. if (!pendingAnimation) BeginConfirm(); return true; From f442df75a9bf16d463a898bc67f15acb539960dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jul 2020 09:00:10 +0900 Subject: [PATCH 26/75] Add missing released conditional --- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 74064c507f..387c0e587b 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -265,6 +265,7 @@ namespace osu.Game.Screens.Play.HUD switch (action) { case GlobalAction.Back: + case GlobalAction.PauseGameplay: AbortConfirm(); break; } From 352f59942e5aff3523582893ebad5bd78349f5e9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Jul 2020 16:50:54 +0900 Subject: [PATCH 27/75] Fix incorrect time delta in taiko strain --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs index c6fe273b50..99975d9174 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills double addition = 1; // We get an extra addition if we are not a slider or spinner - if (current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000) + if (current.LastObject is Hit && current.BaseObject is Hit && (current.BaseObject.StartTime - current.LastObject.StartTime) < 1000) { if (hasColourChange(current)) addition += 0.75; From 1116703e92c1a6ac82d4b63298780d5ea584ace8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Jul 2020 16:52:05 +0900 Subject: [PATCH 28/75] Fix potential out-of-order objects after conversion --- osu.Game/Beatmaps/BeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index 99e0bf4e33..11fee030f8 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -57,7 +57,7 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo = original.BeatmapInfo; beatmap.ControlPointInfo = original.ControlPointInfo; - beatmap.HitObjects = convertHitObjects(original.HitObjects, original); + beatmap.HitObjects = convertHitObjects(original.HitObjects, original).OrderBy(s => s.StartTime).ToList(); beatmap.Breaks = original.Breaks; return beatmap; From 0ea13dea55caca5ba2d52d330c889880c924c150 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 13 Jul 2020 17:06:00 +0900 Subject: [PATCH 29/75] Introduce legacy timing point fp errors --- .../Beatmaps/TaikoBeatmapConverter.cs | 79 +++++++++++-------- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 4 +- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 13 ++- 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 78550ed270..2a1aa5d1df 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Beatmaps.Formats; namespace osu.Game.Rulesets.Taiko.Beatmaps { @@ -82,37 +83,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps { case IHasDistance distanceData: { - // Number of spans of the object - one for the initial length and for each repeat - int spans = (obj as IHasRepeats)?.SpanCount() ?? 1; - - TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime); - DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(obj.StartTime); - - double speedAdjustment = difficultyPoint.SpeedMultiplier; - double speedAdjustedBeatLength = timingPoint.BeatLength / speedAdjustment; - - // The true distance, accounting for any repeats. This ends up being the drum roll distance later - double distance = distanceData.Distance * spans * LEGACY_VELOCITY_MULTIPLIER; - - // The velocity of the taiko hit object - calculated as the velocity of a drum roll - double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier / speedAdjustedBeatLength; - // The duration of the taiko hit object - double taikoDuration = distance / taikoVelocity; - - // The velocity of the osu! hit object - calculated as the velocity of a slider - double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier / speedAdjustedBeatLength; - // The duration of the osu! hit object - double osuDuration = distance / osuVelocity; - - // osu-stable always uses the speed-adjusted beatlength to determine the velocities, but - // only uses it for tick rate if beatmap version < 8 - if (beatmap.BeatmapInfo.BeatmapVersion >= 8) - speedAdjustedBeatLength *= speedAdjustment; - - // If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat - double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate, taikoDuration / spans); - - if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) + if (shouldConvertSliderToHits(obj, beatmap, distanceData, out var taikoDuration, out var tickSpacing)) { List> allSamples = obj is IHasPathWithRepeats curveData ? curveData.NodeSamples : new List>(new[] { samples }); @@ -184,6 +155,52 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps } } + private bool shouldConvertSliderToHits(HitObject obj, IBeatmap beatmap, IHasDistance distanceData, out double taikoDuration, out double tickSpacing) + { + // DO NOT CHANGE OR REFACTOR ANYTHING IN HERE WITHOUT TESTING AGAINST _ALL_ BEATMAPS. + // Some of these calculations look redundant, but they are not - extremely small floating point errors are introduced to maintain 1:1 compatibility with stable. + // Rounding cannot be used as an alternative since the error deltas have been observed to be between 1e-2 and 1e-6. + + // The true distance, accounting for any repeats. This ends up being the drum roll distance later + int spans = (obj as IHasRepeats)?.SpanCount() ?? 1; + double distance = distanceData.Distance * spans * LEGACY_VELOCITY_MULTIPLIER; + + TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime); + DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(obj.StartTime); + + double beatLength; +#pragma warning disable 618 + if (difficultyPoint is LegacyBeatmapDecoder.LegacyDifficultyControlPoint legacyDifficultyPoint) +#pragma warning restore 618 + beatLength = timingPoint.BeatLength * legacyDifficultyPoint.BpmMultiplier; + else + beatLength = timingPoint.BeatLength / difficultyPoint.SpeedMultiplier; + + double sliderScoringPointDistance = osu_base_scoring_distance * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier / beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate; + + // The velocity and duration of the taiko hit object - calculated as the velocity of a drum roll. + double taikoVelocity = sliderScoringPointDistance * beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate; + taikoDuration = distance / taikoVelocity * beatLength; + + if (isForCurrentRuleset) + { + tickSpacing = 0; + return false; + } + + double osuVelocity = taikoVelocity * (1000f / beatLength); + + // osu-stable always uses the speed-adjusted beatlength to determine the osu! velocity, but only uses it for conversion if beatmap version < 8 + if (beatmap.BeatmapInfo.BeatmapVersion >= 8) + beatLength = timingPoint.BeatLength; + + // If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat + tickSpacing = Math.Min(beatLength / beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate, taikoDuration / spans); + + return tickSpacing > 0 + && distance / osuVelocity * 1000 < 2 * beatLength; + } + protected override Beatmap CreateBeatmap() => new TaikoBeatmap(); } } diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index be5cd78dc8..b30ec0ca2c 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -369,7 +369,9 @@ namespace osu.Game.Beatmaps.Formats addControlPoint(time, controlPoint, true); } - addControlPoint(time, new LegacyDifficultyControlPoint +#pragma warning disable 618 + addControlPoint(time, new LegacyDifficultyControlPoint(beatLength) +#pragma warning restore 618 { SpeedMultiplier = speedMultiplier, }, timingChange); diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index a0e83554a3..44ef9bcacc 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -159,11 +159,20 @@ namespace osu.Game.Beatmaps.Formats Mania, } - internal class LegacyDifficultyControlPoint : DifficultyControlPoint + [Obsolete("Do not use unless you're a legacy ruleset and 100% sure.")] + public class LegacyDifficultyControlPoint : DifficultyControlPoint { - public LegacyDifficultyControlPoint() + /// + /// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it. + /// DO NOT USE THIS UNLESS 100% SURE. + /// + public readonly float BpmMultiplier; + + public LegacyDifficultyControlPoint(double beatLength) { SpeedMultiplierBindable.Precision = double.Epsilon; + + BpmMultiplier = beatLength < 0 ? Math.Clamp((float)-beatLength, 10, 10000) / 100f : 1; } } From b59e4f8a7ef40ece6455b20a612ff942e18917c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 08:15:14 +0900 Subject: [PATCH 30/75] Change difficulty adjust mod to match stable range of 0-10 --- osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs | 4 ++-- osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs index 8228161008..ff995e38ce 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Mods public BindableNumber CircleSize { get; } = new BindableFloat { Precision = 0.1f, - MinValue = 1, + MinValue = 0, MaxValue = 10, Default = 5, Value = 5, @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Mods public BindableNumber ApproachRate { get; } = new BindableFloat { Precision = 0.1f, - MinValue = 1, + MinValue = 0, MaxValue = 10, Default = 5, Value = 5, diff --git a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs index c3a8efdd66..165644edbe 100644 --- a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mods public BindableNumber DrainRate { get; } = new BindableFloat { Precision = 0.1f, - MinValue = 1, + MinValue = 0, MaxValue = 10, Default = 5, Value = 5, @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mods public BindableNumber OverallDifficulty { get; } = new BindableFloat { Precision = 0.1f, - MinValue = 1, + MinValue = 0, MaxValue = 10, Default = 5, Value = 5, From 56349e65f3929032561d3059622a201f87afc604 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 03:01:14 +0300 Subject: [PATCH 31/75] Rename arrow direction method --- .../Visual/UserInterface/TestSceneCommentRepliesButton.cs | 8 ++++---- .../Overlays/Comments/Buttons/CommentRepliesButton.cs | 2 +- osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index 7f5806705e..c2dc804385 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -41,11 +41,11 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] - public void TestArrowRotation() + public void TestArrowDirection() { - AddStep("Toggle icon up", () => button.ToggleIcon(true)); + AddStep("Set upwards", () => button.SetIconDirection(true)); AddAssert("Icon facing upwards", () => button.Icon.Scale.Y == -1); - AddStep("Toggle icon down", () => button.ToggleIcon(false)); + AddStep("Set downwards", () => button.SetIconDirection(false)); AddAssert("Icon facing downwards", () => button.Icon.Scale.Y == 1); } @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.UserInterface Text = "sample text"; } - public new void ToggleIcon(bool upwards) => base.ToggleIcon(upwards); + public new void SetIconDirection(bool upwards) => base.SetIconDirection(upwards); } } } diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index 65648f6751..abe80722e2 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Comments.Buttons icon.Colour = colourProvider.Foreground1; } - protected void ToggleIcon(bool upwards) => icon.ScaleTo(new Vector2(1, upwards ? -1 : 1)); + protected void SetIconDirection(bool upwards) => icon.ScaleTo(new Vector2(1, upwards ? -1 : 1)); protected override bool OnHover(HoverEvent e) { diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index 118cac5b4c..e2023c2f58 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Comments.Buttons protected override void LoadComplete() { base.LoadComplete(); - Expanded.BindValueChanged(expanded => ToggleIcon(expanded.NewValue), true); + Expanded.BindValueChanged(expanded => SetIconDirection(expanded.NewValue), true); } protected override bool OnClick(ClickEvent e) From 7c71cc6b6174a6a62a0f78cd9029bb12943ff82b Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 03:06:51 +0300 Subject: [PATCH 32/75] Remove unneeded class from DrawableComment --- osu.Game/Overlays/Comments/DrawableComment.cs | 41 +++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 813540b28d..731ebe7104 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Comments private ShowRepliesButton showRepliesButton; private ChevronButton chevronButton; private DeletedCommentsCounter deletedCommentsCounter; - private Loading loading; + private LoadingSpinner loading; public DrawableComment(Comment comment) { @@ -209,10 +209,16 @@ namespace osu.Game.Overlays.Comments } } }, - loading = new Loading + loading = new LoadingSpinner { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Size = new Vector2(15), + Margin = new MarginPadding + { + Vertical = 5, + Left = 80 + } }, childCommentsVisibilityContainer = new FillFlowContainer { @@ -368,6 +374,7 @@ namespace osu.Game.Overlays.Comments showMoreButton.IsLoading = false; loading.Hide(); + loading.FinishTransforms(); } private class ChevronButton : ShowChildrenButton @@ -438,31 +445,5 @@ namespace osu.Game.Overlays.Comments return parentComment.HasMessage ? parentComment.Message : parentComment.IsDeleted ? @"deleted" : string.Empty; } } - - private class Loading : Container - { - private readonly LoadingSpinner loading; - - public Loading() - { - Child = loading = new LoadingSpinner - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Size = new Vector2(15), - Margin = new MarginPadding - { - Vertical = 5, - Left = 80 - } - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - loading.Show(); - } - } } } From 8a77a3621e71961bbcccb0a3b38eb2e1d9e96561 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 11:03:55 +0900 Subject: [PATCH 33/75] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 1d1583c55a..8510632d45 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4295e02d24..05d6f27d40 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -25,7 +25,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 3627cc032e..af779b32fd 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -71,7 +71,7 @@ - + From e35e9df4e1a6acdeaae0a2022363d8240f9cb390 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 12:02:03 +0900 Subject: [PATCH 34/75] Fix local online cache database not being used when offline / logged out --- osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs index 3106d1143e..4de4e21b15 100644 --- a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs +++ b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs @@ -48,9 +48,6 @@ namespace osu.Game.Beatmaps public Task UpdateAsync(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) { - if (api?.State != APIState.Online) - return Task.CompletedTask; - LogForModel(beatmapSet, "Performing online lookups..."); return Task.WhenAll(beatmapSet.Beatmaps.Select(b => UpdateAsync(beatmapSet, b, cancellationToken)).ToArray()); } From 7fe69bb1996e83fd70417670a709a67d3cb2a1c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 13:07:17 +0900 Subject: [PATCH 35/75] Fix some web requests retrieving the user too early --- osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs | 7 +++---- osu.Game/Online/API/APIRequest.cs | 7 +++++++ osu.Game/Online/API/Requests/JoinChannelRequest.cs | 7 ++----- osu.Game/Online/API/Requests/JoinRoomRequest.cs | 7 ++----- osu.Game/Online/API/Requests/LeaveChannelRequest.cs | 7 ++----- osu.Game/Online/API/Requests/PartRoomRequest.cs | 7 ++----- osu.Game/Online/Chat/ChannelManager.cs | 4 ++-- osu.Game/Screens/Multi/RoomManager.cs | 4 ++-- 8 files changed, 22 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs b/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs index 1e77d50115..42948c3731 100644 --- a/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs +++ b/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs @@ -8,7 +8,6 @@ using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Tests.Visual; -using osu.Game.Users; namespace osu.Game.Tests.Online { @@ -55,7 +54,7 @@ namespace osu.Game.Tests.Online AddStep("fire request", () => { gotResponse = false; - request = new LeaveChannelRequest(new Channel(), new User()); + request = new LeaveChannelRequest(new Channel()); request.Success += () => gotResponse = true; API.Queue(request); }); @@ -74,7 +73,7 @@ namespace osu.Game.Tests.Online AddStep("fire request", () => { gotResponse = false; - request = new LeaveChannelRequest(new Channel(), new User()); + request = new LeaveChannelRequest(new Channel()); request.Success += () => gotResponse = true; API.Perform(request); }); @@ -93,7 +92,7 @@ namespace osu.Game.Tests.Online AddStep("fire request", () => { gotResponse = false; - request = new LeaveChannelRequest(new Channel(), new User()); + request = new LeaveChannelRequest(new Channel()); request.Success += () => gotResponse = true; API.PerformAsync(request); }); diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 0f8acbb7af..2115326cc2 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -5,6 +5,7 @@ using System; using Newtonsoft.Json; using osu.Framework.IO.Network; using osu.Framework.Logging; +using osu.Game.Users; namespace osu.Game.Online.API { @@ -61,6 +62,11 @@ namespace osu.Game.Online.API protected APIAccess API; protected WebRequest WebRequest; + /// + /// The currently logged in user. Note that this will only be populated during . + /// + protected User User { get; private set; } + /// /// Invoked on successful completion of an API request. /// This will be scheduled to the API's internal scheduler (run on update thread automatically). @@ -86,6 +92,7 @@ namespace osu.Game.Online.API } API = apiAccess; + User = apiAccess.LocalUser.Value; if (checkAndScheduleFailure()) return; diff --git a/osu.Game/Online/API/Requests/JoinChannelRequest.cs b/osu.Game/Online/API/Requests/JoinChannelRequest.cs index f6ed5f22c9..33eab7e355 100644 --- a/osu.Game/Online/API/Requests/JoinChannelRequest.cs +++ b/osu.Game/Online/API/Requests/JoinChannelRequest.cs @@ -4,19 +4,16 @@ using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; -using osu.Game.Users; namespace osu.Game.Online.API.Requests { public class JoinChannelRequest : APIRequest { private readonly Channel channel; - private readonly User user; - public JoinChannelRequest(Channel channel, User user) + public JoinChannelRequest(Channel channel) { this.channel = channel; - this.user = user; } protected override WebRequest CreateWebRequest() @@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests return req; } - protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; + protected override string Target => $@"chat/channels/{channel.Id}/users/{User.Id}"; } } diff --git a/osu.Game/Online/API/Requests/JoinRoomRequest.cs b/osu.Game/Online/API/Requests/JoinRoomRequest.cs index 36b275236c..b0808afa45 100644 --- a/osu.Game/Online/API/Requests/JoinRoomRequest.cs +++ b/osu.Game/Online/API/Requests/JoinRoomRequest.cs @@ -4,19 +4,16 @@ using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Multiplayer; -using osu.Game.Users; namespace osu.Game.Online.API.Requests { public class JoinRoomRequest : APIRequest { private readonly Room room; - private readonly User user; - public JoinRoomRequest(Room room, User user) + public JoinRoomRequest(Room room) { this.room = room; - this.user = user; } protected override WebRequest CreateWebRequest() @@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests return req; } - protected override string Target => $"rooms/{room.RoomID.Value}/users/{user.Id}"; + protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}"; } } diff --git a/osu.Game/Online/API/Requests/LeaveChannelRequest.cs b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs index f2ae3926bd..7dfc9a0aed 100644 --- a/osu.Game/Online/API/Requests/LeaveChannelRequest.cs +++ b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs @@ -4,19 +4,16 @@ using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; -using osu.Game.Users; namespace osu.Game.Online.API.Requests { public class LeaveChannelRequest : APIRequest { private readonly Channel channel; - private readonly User user; - public LeaveChannelRequest(Channel channel, User user) + public LeaveChannelRequest(Channel channel) { this.channel = channel; - this.user = user; } protected override WebRequest CreateWebRequest() @@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests return req; } - protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; + protected override string Target => $@"chat/channels/{channel.Id}/users/{User.Id}"; } } diff --git a/osu.Game/Online/API/Requests/PartRoomRequest.cs b/osu.Game/Online/API/Requests/PartRoomRequest.cs index e1550cb2e0..c988cd5c9e 100644 --- a/osu.Game/Online/API/Requests/PartRoomRequest.cs +++ b/osu.Game/Online/API/Requests/PartRoomRequest.cs @@ -4,19 +4,16 @@ using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Multiplayer; -using osu.Game.Users; namespace osu.Game.Online.API.Requests { public class PartRoomRequest : APIRequest { private readonly Room room; - private readonly User user; - public PartRoomRequest(Room room, User user) + public PartRoomRequest(Room room) { this.room = room; - this.user = user; } protected override WebRequest CreateWebRequest() @@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests return req; } - protected override string Target => $"rooms/{room.RoomID.Value}/users/{user.Id}"; + protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}"; } } diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 3b336fef4f..f7ed57f207 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -381,7 +381,7 @@ namespace osu.Game.Online.Chat break; default: - var req = new JoinChannelRequest(channel, api.LocalUser.Value); + var req = new JoinChannelRequest(channel); req.Success += () => joinChannel(channel, fetchInitialMessages); req.Failure += ex => LeaveChannel(channel); api.Queue(req); @@ -410,7 +410,7 @@ namespace osu.Game.Online.Chat if (channel.Joined.Value) { - api.Queue(new LeaveChannelRequest(channel, api.LocalUser.Value)); + api.Queue(new LeaveChannelRequest(channel)); channel.Joined.Value = false; } } diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs index ac1f74b6a6..491be2e946 100644 --- a/osu.Game/Screens/Multi/RoomManager.cs +++ b/osu.Game/Screens/Multi/RoomManager.cs @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Multi public void JoinRoom(Room room, Action onSuccess = null, Action onError = null) { currentJoinRoomRequest?.Cancel(); - currentJoinRoomRequest = new JoinRoomRequest(room, api.LocalUser.Value); + currentJoinRoomRequest = new JoinRoomRequest(room); currentJoinRoomRequest.Success += () => { @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Multi if (joinedRoom == null) return; - api.Queue(new PartRoomRequest(joinedRoom, api.LocalUser.Value)); + api.Queue(new PartRoomRequest(joinedRoom)); joinedRoom = null; } From 1a2f5cb477a2c13d095fd63b998a4ea3f53b8829 Mon Sep 17 00:00:00 2001 From: Joehu Date: Mon, 13 Jul 2020 23:59:20 -0700 Subject: [PATCH 36/75] Add OnBackButton bool to OsuScreen --- osu.Game/OsuGame.cs | 4 +++- osu.Game/Screens/IOsuScreen.cs | 2 ++ osu.Game/Screens/OsuScreen.cs | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 47a7c2ae11..618049e72c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -573,7 +573,9 @@ namespace osu.Game Origin = Anchor.BottomLeft, Action = () => { - if ((ScreenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true) + var currentScreen = ScreenStack.CurrentScreen as IOsuScreen; + + if (currentScreen?.AllowBackButton == true && !currentScreen.OnBackButton()) ScreenStack.Exit(); } }, diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index 22fe0ad816..6ed04291ce 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -56,5 +56,7 @@ namespace osu.Game.Screens /// Whether mod rate adjustments are allowed to be applied. /// bool AllowRateAdjustments { get; } + + bool OnBackButton(); } } diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 35bb4fa34f..872a1cd39a 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -258,5 +258,7 @@ namespace osu.Game.Screens /// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause. /// protected virtual BackgroundScreen CreateBackground() => null; + + public virtual bool OnBackButton() => false; } } From 4caf4d31d4a9fb0b56ce528c3b5fac6194718ca3 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 00:00:10 -0700 Subject: [PATCH 37/75] Fix mod select blocking home and alt f4 in song select --- osu.Game/Screens/Select/SongSelect.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e3705b15fa..74a5ee8309 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -599,12 +599,6 @@ namespace osu.Game.Screens.Select public override bool OnExiting(IScreen next) { - if (ModSelect.State.Value == Visibility.Visible) - { - ModSelect.Hide(); - return true; - } - if (base.OnExiting(next)) return true; @@ -620,6 +614,17 @@ namespace osu.Game.Screens.Select return false; } + public override bool OnBackButton() + { + if (ModSelect.State.Value == Visibility.Visible) + { + ModSelect.Hide(); + return true; + } + + return false; + } + protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From daa7430fd8d07befdcf2544143ccfe7ef1cd6316 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 00:00:43 -0700 Subject: [PATCH 38/75] Fix statistics screen blocking retry, home, and alt f4 --- osu.Game/Screens/Ranking/ResultsScreen.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 49ce07b708..44458d8c8e 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -194,6 +194,13 @@ namespace osu.Game.Screens.Ranking } public override bool OnExiting(IScreen next) + { + Background.FadeTo(1, 250); + + return base.OnExiting(next); + } + + public override bool OnBackButton() { if (statisticsPanel.State.Value == Visibility.Visible) { @@ -201,9 +208,7 @@ namespace osu.Game.Screens.Ranking return true; } - Background.FadeTo(1, 250); - - return base.OnExiting(next); + return false; } private void addScore(ScoreInfo score) From 3573460d9c05aebe54995c72ea16e231f0e91dc8 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 00:02:01 -0700 Subject: [PATCH 39/75] Fix multiplayer screens blocking home and alt f4 --- osu.Game/Screens/Multi/Multiplayer.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 3178e35581..067a42d57d 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -250,12 +250,6 @@ namespace osu.Game.Screens.Multi { roomManager.PartRoom(); - if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen)) - { - screenStack.Exit(); - return true; - } - waves.Hide(); this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut(); @@ -269,6 +263,17 @@ namespace osu.Game.Screens.Multi return false; } + public override bool OnBackButton() + { + if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen)) + { + screenStack.Exit(); + return true; + } + + return false; + } + protected override void LogoExiting(OsuLogo logo) { base.LogoExiting(logo); From 8ace06fcc5c47b1c5f67c659cd8e205a1954f2a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 16:03:40 +0900 Subject: [PATCH 40/75] Fix continuations attaching to the BeatmapOnlineLookupQueue scheduler --- osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs index 4de4e21b15..16207c7d2a 100644 --- a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs +++ b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps // todo: expose this when we need to do individual difficulty lookups. protected Task UpdateAsync(BeatmapSetInfo beatmapSet, BeatmapInfo beatmap, CancellationToken cancellationToken) - => Task.Factory.StartNew(() => lookup(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); + => Task.Factory.StartNew(() => lookup(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler); private void lookup(BeatmapSetInfo set, BeatmapInfo beatmap) { From 36041fc2453832976cad0b6c89a0ec0979dae68b Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 00:29:57 -0700 Subject: [PATCH 41/75] Fix back button not working correctly with multi song select's mod select --- osu.Game/Screens/Multi/Multiplayer.cs | 12 ++++++++++-- osu.Game/Screens/Select/SongSelect.cs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 067a42d57d..2a73b53199 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -20,9 +20,9 @@ using osu.Game.Online.Multiplayer; using osu.Game.Screens.Menu; using osu.Game.Screens.Multi.Components; using osu.Game.Screens.Multi.Lounge; -using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Screens.Multi.Match; using osu.Game.Screens.Multi.Match.Components; +using osu.Game.Screens.Select; using osuTK; namespace osu.Game.Screens.Multi @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Multi private readonly Bindable selectedRoom = new Bindable(); [Cached] - private readonly Bindable currentFilter = new Bindable(new FilterCriteria()); + private readonly Bindable currentFilter = new Bindable(new Lounge.Components.FilterCriteria()); [Cached(Type = typeof(IRoomManager))] private RoomManager roomManager; @@ -265,6 +265,14 @@ namespace osu.Game.Screens.Multi public override bool OnBackButton() { + var songSelect = screenStack.CurrentScreen as MatchSongSelect; + + if (songSelect?.ModSelect.State.Value == Visibility.Visible) + { + songSelect.ModSelect.Hide(); + return true; + } + if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen)) { screenStack.Exit(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 74a5ee8309..87fad66b66 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Select [Resolved] private BeatmapManager beatmaps { get; set; } - protected ModSelectOverlay ModSelect { get; private set; } + public ModSelectOverlay ModSelect { get; private set; } protected SampleChannel SampleConfirm { get; private set; } From 304e518f7ba48d32dc426a0bf959d5481cb30f12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 17:30:20 +0900 Subject: [PATCH 42/75] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 8510632d45..85d154f2e2 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,6 +52,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 05d6f27d40..b8e73262c4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -24,7 +24,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index af779b32fd..1faf60b1d9 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -80,7 +80,7 @@ - + From c7d3b025ada6692d159182bc42fbd9d1e844931f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 20:11:54 +0900 Subject: [PATCH 43/75] Rename variable and change default to true --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- .../Overlays/Settings/Sections/Gameplay/GeneralSettings.cs | 2 +- osu.Game/Screens/Play/ComboEffects.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 10d11f967e..268328272c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -91,7 +91,7 @@ namespace osu.Game.Configuration Set(OsuSetting.FadePlayfieldWhenHealthLow, true); Set(OsuSetting.KeyOverlay, false); Set(OsuSetting.PositionalHitSounds, true); - Set(OsuSetting.AlwaysPlayComboBreak, false); + Set(OsuSetting.AlwaysPlayFirstComboBreak, true); Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth); Set(OsuSetting.FloatingComments, false); @@ -181,7 +181,7 @@ namespace osu.Game.Configuration ShowStoryboard, KeyOverlay, PositionalHitSounds, - AlwaysPlayComboBreak, + AlwaysPlayFirstComboBreak, ScoreMeter, FloatingComments, ShowInterface, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index f3534e4625..d79f1ba583 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { LabelText = "Always play first combo break sound", Keywords = new[] { "regardless", "combobreak.wav" }, - Bindable = config.GetBindable(OsuSetting.AlwaysPlayComboBreak) + Bindable = config.GetBindable(OsuSetting.AlwaysPlayFirstComboBreak) }, new SettingsEnumDropdown { diff --git a/osu.Game/Screens/Play/ComboEffects.cs b/osu.Game/Screens/Play/ComboEffects.cs index c56ee35cec..a836b6137e 100644 --- a/osu.Game/Screens/Play/ComboEffects.cs +++ b/osu.Game/Screens/Play/ComboEffects.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config) { InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak")); - alwaysPlay = config.GetBindable(OsuSetting.AlwaysPlayComboBreak); + alwaysPlay = config.GetBindable(OsuSetting.AlwaysPlayFirstComboBreak); } protected override void LoadComplete() From 956980ee9055738a73dd9791ca52ff1a3de2ab18 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 20:12:58 +0900 Subject: [PATCH 44/75] Remove setting from gameplay settings screen --- .../Overlays/Settings/Sections/Gameplay/GeneralSettings.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index d79f1ba583..93a02ea0e4 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -67,12 +67,6 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = "Positional hitsounds", Bindable = config.GetBindable(OsuSetting.PositionalHitSounds) }, - new SettingsCheckbox - { - LabelText = "Always play first combo break sound", - Keywords = new[] { "regardless", "combobreak.wav" }, - Bindable = config.GetBindable(OsuSetting.AlwaysPlayFirstComboBreak) - }, new SettingsEnumDropdown { LabelText = "Score meter type", From 2626ab41c3e38b775896c652c59f7b4b0ee335d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jul 2020 20:15:29 +0900 Subject: [PATCH 45/75] Add implicit braces for clarity --- osu.Game/Screens/Play/ComboEffects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ComboEffects.cs b/osu.Game/Screens/Play/ComboEffects.cs index a836b6137e..5bcda50399 100644 --- a/osu.Game/Screens/Play/ComboEffects.cs +++ b/osu.Game/Screens/Play/ComboEffects.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Play private void onComboChange(ValueChangedEvent combo) { - if (combo.NewValue == 0 && (combo.OldValue > 20 || alwaysPlay.Value && firstTime)) + if (combo.NewValue == 0 && (combo.OldValue > 20 || (alwaysPlay.Value && firstTime))) { comboBreakSample?.Play(); firstTime = false; From b64ddf061ea5ba2aa1aa479ccbbba148df5018d9 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 14 Jul 2020 20:37:21 +0900 Subject: [PATCH 46/75] Remove whitespace --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 08b2acc2ef..6ae420b162 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -162,7 +162,7 @@ namespace osu.Game.Input.Bindings [Description("Toggle notifications")] ToggleNotifications, - + [Description("Pause")] PauseGameplay, } From 4c2294f0cd65ebce410d979af5f3b7b395da64ef Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 15:02:29 +0300 Subject: [PATCH 47/75] Refactor LoadRepliesButton to inherit LoadingButton --- .../TestSceneCommentRepliesButton.cs | 5 +++- .../Comments/Buttons/CommentRepliesButton.cs | 12 +++------- .../Comments/Buttons/LoadRepliesButton.cs | 23 ++++++++++++++++-- .../Comments/Buttons/ShowRepliesButton.cs | 4 ++++ osu.Game/Overlays/Comments/DrawableComment.cs | 24 ++----------------- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index c2dc804385..c2ac5179c9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -33,7 +33,10 @@ namespace osu.Game.Tests.Visual.UserInterface Children = new Drawable[] { button = new TestButton(), - new LoadRepliesButton(), + new LoadRepliesButton + { + Action = () => { } + }, new ShowRepliesButton(1), new ShowRepliesButton(2) } diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index abe80722e2..f7e0cb0a6c 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.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 System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,8 +16,6 @@ namespace osu.Game.Overlays.Comments.Buttons { public abstract class CommentRepliesButton : CompositeDrawable { - public Action Action { get; set; } - protected string Text { get => text.Text; @@ -72,6 +69,7 @@ namespace osu.Game.Overlays.Comments.Buttons { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, + AlwaysPresent = true, Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold) }, icon = new SpriteIcon @@ -99,6 +97,8 @@ namespace osu.Game.Overlays.Comments.Buttons protected void SetIconDirection(bool upwards) => icon.ScaleTo(new Vector2(1, upwards ? -1 : 1)); + public void ToggleTextVisibility(bool visible) => text.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint); + protected override bool OnHover(HoverEvent e) { base.OnHover(e); @@ -113,11 +113,5 @@ namespace osu.Game.Overlays.Comments.Buttons background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint); icon.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint); } - - protected override bool OnClick(ClickEvent e) - { - Action?.Invoke(); - return base.OnClick(e); - } } } diff --git a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs index 9387c95758..4998e5391e 100644 --- a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs @@ -1,13 +1,32 @@ // 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.Graphics.UserInterface; + namespace osu.Game.Overlays.Comments.Buttons { - public class LoadRepliesButton : CommentRepliesButton + public class LoadRepliesButton : LoadingButton { + private ButtonContent content; + public LoadRepliesButton() { - Text = "load replies"; + AutoSizeAxes = Axes.Both; + } + + protected override Drawable CreateContent() => content = new ButtonContent(); + + protected override void OnLoadStarted() => content.ToggleTextVisibility(false); + + protected override void OnLoadFinished() => content.ToggleTextVisibility(true); + + private class ButtonContent : CommentRepliesButton + { + public ButtonContent() + { + Text = "load replies"; + } } } } diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index e2023c2f58..aeb33e6756 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.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 System; using Humanizer; using osu.Framework.Bindables; using osu.Framework.Input.Events; @@ -9,6 +10,8 @@ namespace osu.Game.Overlays.Comments.Buttons { public class ShowRepliesButton : CommentRepliesButton { + public Action Action; + public readonly BindableBool Expanded = new BindableBool(true); public ShowRepliesButton(int count) @@ -25,6 +28,7 @@ namespace osu.Game.Overlays.Comments.Buttons protected override bool OnClick(ClickEvent e) { Expanded.Toggle(); + Action?.Invoke(); return base.OnClick(e); } } diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 731ebe7104..3cdc0a0cbd 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -22,7 +22,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.IEnumerableExtensions; using System.Collections.Specialized; using osu.Game.Overlays.Comments.Buttons; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Comments { @@ -52,7 +51,6 @@ namespace osu.Game.Overlays.Comments private ShowRepliesButton showRepliesButton; private ChevronButton chevronButton; private DeletedCommentsCounter deletedCommentsCounter; - private LoadingSpinner loading; public DrawableComment(Comment comment) { @@ -194,12 +192,7 @@ namespace osu.Game.Overlays.Comments }, loadRepliesButton = new LoadRepliesButton { - Action = () => - { - RepliesRequested(this, ++currentPage); - loadRepliesButton.Hide(); - loading.Show(); - } + Action = () => RepliesRequested(this, ++currentPage) } } } @@ -209,17 +202,6 @@ namespace osu.Game.Overlays.Comments } } }, - loading = new LoadingSpinner - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Size = new Vector2(15), - Margin = new MarginPadding - { - Vertical = 5, - Left = 80 - } - }, childCommentsVisibilityContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, @@ -372,9 +354,7 @@ namespace osu.Game.Overlays.Comments if (Comment.IsTopLevel) chevronButton.FadeTo(loadedReplesCount != 0 ? 1 : 0); - showMoreButton.IsLoading = false; - loading.Hide(); - loading.FinishTransforms(); + showMoreButton.IsLoading = loadRepliesButton.IsLoading = false; } private class ChevronButton : ShowChildrenButton From 28006ac33f7f71fefd1dafdf490a760d260f661a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 15:12:18 +0300 Subject: [PATCH 48/75] Remove unnecessary action from ShowRepliesButton --- osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index aeb33e6756..e2023c2f58 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.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 System; using Humanizer; using osu.Framework.Bindables; using osu.Framework.Input.Events; @@ -10,8 +9,6 @@ namespace osu.Game.Overlays.Comments.Buttons { public class ShowRepliesButton : CommentRepliesButton { - public Action Action; - public readonly BindableBool Expanded = new BindableBool(true); public ShowRepliesButton(int count) @@ -28,7 +25,6 @@ namespace osu.Game.Overlays.Comments.Buttons protected override bool OnClick(ClickEvent e) { Expanded.Toggle(); - Action?.Invoke(); return base.OnClick(e); } } From c2c80d2a9891acd9959f3598249ca5cfabaf1b9c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 17:34:01 +0300 Subject: [PATCH 49/75] Refactor SpotlightSelector layout --- .../Overlays/Rankings/SpotlightSelector.cs | 75 ++++++++++++------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index f019b50ae8..4d07d6c118 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -50,10 +50,11 @@ namespace osu.Game.Overlays.Rankings public SpotlightSelector() { RelativeSizeAxes = Axes.X; - Height = 100; + AutoSizeAxes = Axes.Y; Add(content = new Container { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Children = new Drawable[] { background = new Box @@ -62,31 +63,52 @@ namespace osu.Game.Overlays.Rankings }, new Container { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 }, - Children = new Drawable[] + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN }, + Child = new FillFlowContainer { - dropdown = new SpotlightsDropdown + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - Current = Current, - Depth = -float.MaxValue - }, - new FillFlowContainer - { - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(15, 0), - Children = new Drawable[] + new Container { - startDateColumn = new InfoColumn(@"Start Date"), - endDateColumn = new InfoColumn(@"End Date"), - mapCountColumn = new InfoColumn(@"Map Count"), - participantsColumn = new InfoColumn(@"Participants") + Margin = new MarginPadding { Vertical = 20 }, + RelativeSizeAxes = Axes.X, + Height = 40, + Depth = -float.MaxValue, + Child = dropdown = new SpotlightsDropdown + { + RelativeSizeAxes = Axes.X, + Current = Current + } + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Margin = new MarginPadding { Vertical = 5 }, + Children = new Drawable[] + { + startDateColumn = new InfoColumn(@"Start Date"), + endDateColumn = new InfoColumn(@"End Date"), + mapCountColumn = new InfoColumn(@"Map Count"), + participantsColumn = new InfoColumn(@"Participants") + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Vertical = 20 }, + Child = new RankingsSortTabControl + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight + } } } } @@ -128,12 +150,13 @@ namespace osu.Game.Overlays.Rankings { AutoSizeAxes = Axes.Both; Direction = FillDirection.Vertical; + Margin = new MarginPadding { Vertical = 10 }; Children = new Drawable[] { new OsuSpriteText { Text = name, - Font = OsuFont.GetFont(size: 10), + Font = OsuFont.GetFont(size: 10, weight: FontWeight.Regular), }, new Container { @@ -143,7 +166,7 @@ namespace osu.Game.Overlays.Rankings { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Font = OsuFont.GetFont(size: 18, weight: FontWeight.Light), + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Light), } } }; From 3d9e174ae8369f6a655e7781ea4af73470a585bb Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 18:09:09 +0300 Subject: [PATCH 50/75] Make sort changes affect request result --- .../Visual/Online/TestSceneRankingsTables.cs | 3 ++- .../API/Requests/GetSpotlightRankingsRequest.cs | 6 +++++- osu.Game/Overlays/Rankings/SpotlightSelector.cs | 11 ++++++----- osu.Game/Overlays/Rankings/SpotlightsLayout.cs | 10 +++++++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index a3b102dc76..ee109189c7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Catch; using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; +using osu.Game.Overlays.Rankings; namespace osu.Game.Tests.Visual.Online { @@ -105,7 +106,7 @@ namespace osu.Game.Tests.Visual.Online { onLoadStarted(); - request = new GetSpotlightRankingsRequest(ruleset, spotlight); + request = new GetSpotlightRankingsRequest(ruleset, spotlight, RankingsSortCriteria.All); ((GetSpotlightRankingsRequest)request).Success += rankings => Schedule(() => { var table = new ScoresTable(1, rankings.Users); diff --git a/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs b/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs index a279db134f..25e6b3f1af 100644 --- a/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.IO.Network; +using osu.Game.Overlays.Rankings; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests @@ -9,11 +10,13 @@ namespace osu.Game.Online.API.Requests public class GetSpotlightRankingsRequest : GetRankingsRequest { private readonly int spotlight; + private readonly RankingsSortCriteria sort; - public GetSpotlightRankingsRequest(RulesetInfo ruleset, int spotlight) + public GetSpotlightRankingsRequest(RulesetInfo ruleset, int spotlight, RankingsSortCriteria sort) : base(ruleset, 1) { this.spotlight = spotlight; + this.sort = sort; } protected override WebRequest CreateWebRequest() @@ -21,6 +24,7 @@ namespace osu.Game.Online.API.Requests var req = base.CreateWebRequest(); req.AddParameter("spotlight", spotlight.ToString()); + req.AddParameter("filter", sort.ToString().ToLower()); return req; } diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index 4d07d6c118..fbea53782b 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -22,10 +22,8 @@ namespace osu.Game.Overlays.Rankings { private const int duration = 300; - private readonly Box background; - private readonly SpotlightsDropdown dropdown; - private readonly BindableWithCurrent current = new BindableWithCurrent(); + public readonly Bindable Sort = new Bindable(); public Bindable Current { @@ -41,11 +39,13 @@ namespace osu.Game.Overlays.Rankings protected override bool StartHidden => true; + private readonly Box background; + private readonly Container content; + private readonly SpotlightsDropdown dropdown; private readonly InfoColumn startDateColumn; private readonly InfoColumn endDateColumn; private readonly InfoColumn mapCountColumn; private readonly InfoColumn participantsColumn; - private readonly Container content; public SpotlightSelector() { @@ -107,7 +107,8 @@ namespace osu.Game.Overlays.Rankings Child = new RankingsSortTabControl { Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight + Origin = Anchor.CentreRight, + Current = Sort } } } diff --git a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs index 917509e842..0f9b07bf89 100644 --- a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs +++ b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs @@ -24,6 +24,7 @@ namespace osu.Game.Overlays.Rankings public readonly Bindable Ruleset = new Bindable(); private readonly Bindable selectedSpotlight = new Bindable(); + private readonly Bindable sort = new Bindable(); [Resolved] private IAPIProvider api { get; set; } @@ -72,6 +73,8 @@ namespace osu.Game.Overlays.Rankings } } }; + + sort.BindTo(selector.Sort); } protected override void LoadComplete() @@ -80,7 +83,8 @@ namespace osu.Game.Overlays.Rankings selector.Show(); - selectedSpotlight.BindValueChanged(onSpotlightChanged); + selectedSpotlight.BindValueChanged(_ => onSpotlightChanged()); + sort.BindValueChanged(_ => onSpotlightChanged()); Ruleset.BindValueChanged(onRulesetChanged); getSpotlights(); @@ -101,14 +105,14 @@ namespace osu.Game.Overlays.Rankings selectedSpotlight.TriggerChange(); } - private void onSpotlightChanged(ValueChangedEvent spotlight) + private void onSpotlightChanged() { loading.Show(); cancellationToken?.Cancel(); getRankingsRequest?.Cancel(); - getRankingsRequest = new GetSpotlightRankingsRequest(Ruleset.Value, spotlight.NewValue.Id); + getRankingsRequest = new GetSpotlightRankingsRequest(Ruleset.Value, selectedSpotlight.Value.Id, sort.Value); getRankingsRequest.Success += onSuccess; api.Queue(getRankingsRequest); } From 85c875757219da92b49e4d3582def1653ae2c8f6 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 14 Jul 2020 21:18:46 +0300 Subject: [PATCH 51/75] Return true on click --- osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index e2023c2f58..04e7e25cc5 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Comments.Buttons protected override bool OnClick(ClickEvent e) { Expanded.Toggle(); - return base.OnClick(e); + return true; } } } From 21ed9df1ea49fe4c97b9156f737ab62adea4711d Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 13:14:59 -0700 Subject: [PATCH 52/75] Add xmldoc for OnBackButton --- osu.Game/Screens/IOsuScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index 6ed04291ce..5f9f611a24 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -57,6 +57,9 @@ namespace osu.Game.Screens /// bool AllowRateAdjustments { get; } + /// + /// Whether there are sub overlays/screens that need closing with the back button before this can be exited. + /// bool OnBackButton(); } } From 73e1bf0d89ec605011cb6e7270cc4c2b3ca31307 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 13:19:48 -0700 Subject: [PATCH 53/75] Check sub screen's OnBackButton instead --- osu.Game/Screens/Multi/Multiplayer.cs | 11 +++-------- osu.Game/Screens/Select/SongSelect.cs | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 2a73b53199..951f21dc2d 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -20,9 +20,9 @@ using osu.Game.Online.Multiplayer; using osu.Game.Screens.Menu; using osu.Game.Screens.Multi.Components; using osu.Game.Screens.Multi.Lounge; +using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Screens.Multi.Match; using osu.Game.Screens.Multi.Match.Components; -using osu.Game.Screens.Select; using osuTK; namespace osu.Game.Screens.Multi @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Multi private readonly Bindable selectedRoom = new Bindable(); [Cached] - private readonly Bindable currentFilter = new Bindable(new Lounge.Components.FilterCriteria()); + private readonly Bindable currentFilter = new Bindable(new FilterCriteria()); [Cached(Type = typeof(IRoomManager))] private RoomManager roomManager; @@ -265,13 +265,8 @@ namespace osu.Game.Screens.Multi public override bool OnBackButton() { - var songSelect = screenStack.CurrentScreen as MatchSongSelect; - - if (songSelect?.ModSelect.State.Value == Visibility.Visible) - { - songSelect.ModSelect.Hide(); + if ((screenStack.CurrentScreen as IMultiplayerSubScreen).OnBackButton()) return true; - } if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen)) { diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 87fad66b66..74a5ee8309 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Select [Resolved] private BeatmapManager beatmaps { get; set; } - public ModSelectOverlay ModSelect { get; private set; } + protected ModSelectOverlay ModSelect { get; private set; } protected SampleChannel SampleConfirm { get; private set; } From 79f6092344f01b3bb263c769af4d281edb6dd213 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 13:31:15 -0700 Subject: [PATCH 54/75] Fix back button not glowing when closing mod select with escape --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 3d0ad1a594..c4a59b57cb 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Input.Bindings; using osu.Game.Overlays.Mods.Sections; using osu.Game.Rulesets.Mods; using osu.Game.Screens; @@ -489,5 +490,7 @@ namespace osu.Game.Overlays.Mods } #endregion + + public override bool OnPressed(GlobalAction action) => false; // handled by back button } } From ecbd8067e9f513682a5ae9cb1fcf9cf1d3dc7a57 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 20:18:47 -0700 Subject: [PATCH 55/75] Add ability to seek replays/auto with arrow keys --- osu.Game/Screens/Play/SongProgressBar.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 5052b32335..939b5fad1f 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -57,6 +57,8 @@ namespace osu.Game.Screens.Play set => CurrentNumber.Value = value; } + protected override bool AllowKeyboardInputWhenNotHovered => true; + public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) { CurrentNumber.MinValue = 0; From 350a4a153bc88948bf47763ee42d635b19d642fd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 12:59:31 +0900 Subject: [PATCH 56/75] Fix possible nullref --- osu.Game/Screens/Multi/Multiplayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 951f21dc2d..269eab5772 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -265,7 +265,7 @@ namespace osu.Game.Screens.Multi public override bool OnBackButton() { - if ((screenStack.CurrentScreen as IMultiplayerSubScreen).OnBackButton()) + if ((screenStack.CurrentScreen as IMultiplayerSubScreen)?.OnBackButton() == true) return true; if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen)) From e2c043737dbe4c95f8273488cfdac437474072fd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 13:08:57 +0900 Subject: [PATCH 57/75] Reword xmldoc to specify intended usage --- osu.Game/Screens/IOsuScreen.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index 5f9f611a24..761f842c22 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -58,8 +58,12 @@ namespace osu.Game.Screens bool AllowRateAdjustments { get; } /// - /// Whether there are sub overlays/screens that need closing with the back button before this can be exited. + /// Invoked when the back button has been pressed to close any overlays before exiting this . /// + /// + /// Return true to block this from being exited after closing an overlay. + /// Return false if this should continue exiting. + /// bool OnBackButton(); } } From d8ebb8e3eb0385fb6046e78b41268ebf56c261c1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 13:17:22 +0900 Subject: [PATCH 58/75] Move override to a bit better location --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index c4a59b57cb..8a5e4d2683 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -404,6 +404,8 @@ namespace osu.Game.Overlays.Mods return base.OnKeyDown(e); } + public override bool OnPressed(GlobalAction action) => false; // handled by back button + private void availableModsChanged(ValueChangedEvent>> mods) { if (mods.NewValue == null) return; @@ -490,7 +492,5 @@ namespace osu.Game.Overlays.Mods } #endregion - - public override bool OnPressed(GlobalAction action) => false; // handled by back button } } From d1aedd15c4817bce96567768e33ae9e3606357bb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 13:35:40 +0900 Subject: [PATCH 59/75] Add noto-thai font --- osu.Game/OsuGameBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c79f710151..dd120937af 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -152,6 +152,7 @@ namespace osu.Game AddFont(Resources, @"Fonts/Noto-Hangul"); AddFont(Resources, @"Fonts/Noto-CJK-Basic"); AddFont(Resources, @"Fonts/Noto-CJK-Compatibility"); + AddFont(Resources, @"Fonts/Noto-Thai"); AddFont(Resources, @"Fonts/Venera-Light"); AddFont(Resources, @"Fonts/Venera-Bold"); From ec3fe8d34660ea5bc4d8cb3187f925c7423dfcb0 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 14 Jul 2020 21:59:26 -0700 Subject: [PATCH 60/75] Add test for arrow key seeking --- osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs index 0be949650e..067fa5ae96 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs @@ -11,6 +11,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; using osu.Game.Screens.Play.Break; using osu.Game.Screens.Ranking; +using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay { @@ -34,6 +35,8 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType().Single().AccuracyDisplay.Current.Value == 1); AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000)); AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0)); + AddStep("seek with right arrow key", () => press(Key.Right)); + AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2)); seekToBreak(0); seekToBreak(1); @@ -54,5 +57,11 @@ namespace osu.Game.Tests.Visual.Gameplay BreakPeriod destBreak() => Beatmap.Value.Beatmap.Breaks.ElementAt(breakIndex); } + + private void press(Key key) + { + InputManager.PressKey(key); + InputManager.ReleaseKey(key); + } } } From 0043bd74bac5e8b0e68b7cb68b7d6ecd8be3e492 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 15 Jul 2020 08:27:46 +0300 Subject: [PATCH 61/75] Rework SpotlightSelector header layout --- .../Overlays/Rankings/SpotlightSelector.cs | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index fbea53782b..f112c1ec43 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -85,30 +85,32 @@ namespace osu.Game.Overlays.Rankings Current = Current } }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(10, 0), - Margin = new MarginPadding { Vertical = 5 }, - Children = new Drawable[] - { - startDateColumn = new InfoColumn(@"Start Date"), - endDateColumn = new InfoColumn(@"End Date"), - mapCountColumn = new InfoColumn(@"Map Count"), - participantsColumn = new InfoColumn(@"Participants") - } - }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Vertical = 20 }, - Child = new RankingsSortTabControl + Children = new Drawable[] { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Current = Sort + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Margin = new MarginPadding { Bottom = 5 }, + Children = new Drawable[] + { + startDateColumn = new InfoColumn(@"Start Date"), + endDateColumn = new InfoColumn(@"End Date"), + mapCountColumn = new InfoColumn(@"Map Count"), + participantsColumn = new InfoColumn(@"Participants") + } + }, + new RankingsSortTabControl + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Current = Sort + } } } } From 0125a7ef3b5dc15c3b49de6990b1b04bc5809bbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jul 2020 15:36:17 +0900 Subject: [PATCH 62/75] Fix single-frame glitch in SS grade display animation --- .../Screens/Ranking/Expanded/Accuracy/RankText.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs index 8343716e7e..cc732382f4 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs @@ -77,11 +77,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy Origin = Anchor.Centre, BlurSigma = new Vector2(35), BypassAutoSizeAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, + Size = new Vector2(200), CacheDrawnFrameBuffer = true, Blending = BlendingParameters.Additive, Alpha = 0, - Size = new Vector2(2f), // increase buffer size to allow for scale Scale = new Vector2(1.8f), Children = new[] { @@ -122,15 +121,18 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } flash.Colour = OsuColour.ForRank(rank); - flash.FadeIn().Then().FadeOut(1200, Easing.OutQuint); if (rank >= ScoreRank.S) rankText.ScaleTo(1.05f).ScaleTo(1, 3000, Easing.OutQuint); if (rank >= ScoreRank.X) { - flash.FadeIn().Then().FadeOut(3000); - superFlash.FadeIn().Then().FadeOut(800, Easing.OutQuint); + flash.FadeOutFromOne(3000); + superFlash.FadeOutFromOne(800, Easing.OutQuint); + } + else + { + flash.FadeOutFromOne(1200, Easing.OutQuint); } } } From fa407d2c7b5312d274334be3567a4f52feb95708 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jul 2020 16:42:37 +0900 Subject: [PATCH 63/75] Make tests better --- osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs index 067fa5ae96..4743317fdd 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs @@ -35,8 +35,18 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType().Single().AccuracyDisplay.Current.Value == 1); AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000)); AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0)); + + double? time = null; + + AddStep("store time", () => time = Player.GameplayClockContainer.GameplayClock.CurrentTime); + + // test seek via keyboard AddStep("seek with right arrow key", () => press(Key.Right)); - AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2)); + AddAssert("time seeked forward", () => Player.GameplayClockContainer.GameplayClock.CurrentTime > time + 2000); + + AddStep("store time", () => time = Player.GameplayClockContainer.GameplayClock.CurrentTime); + AddStep("seek with left arrow key", () => press(Key.Left)); + AddAssert("time seeked backward", () => Player.GameplayClockContainer.GameplayClock.CurrentTime < time); seekToBreak(0); seekToBreak(1); From e95a1beaef5cda4fab4977612546f4211d04accd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 16:53:27 +0900 Subject: [PATCH 64/75] Update state after applying hitobject --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 44afb7a227..b633cb0860 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -147,8 +147,9 @@ namespace osu.Game.Rulesets.Objects.Drawables samplesBindable = HitObject.SamplesBindable.GetBoundCopy(); samplesBindable.CollectionChanged += (_, __) => loadSamples(); - updateState(ArmedState.Idle, true); apply(HitObject); + + updateState(ArmedState.Idle, true); } private void loadSamples() From f13bde68e665088021ee1db2c43565557b30b6e8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 16:53:36 +0900 Subject: [PATCH 65/75] Add test for catch hidden mod --- .../TestSceneCatchModHidden.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs new file mode 100644 index 0000000000..f15da29993 --- /dev/null +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs @@ -0,0 +1,56 @@ +// 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 NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Testing; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Rulesets.Catch.Mods; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.Objects.Drawables; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Tests.Visual; +using osuTK; + +namespace osu.Game.Rulesets.Catch.Tests +{ + public class TestSceneCatchModHidden : ModTestScene + { + [BackgroundDependencyLoader] + private void load() + { + LocalConfig.Set(OsuSetting.IncreaseFirstObjectVisibility, false); + } + + [Test] + public void TestJuiceStream() + { + CreateModTest(new ModTestData + { + Beatmap = new Beatmap + { + HitObjects = new List + { + new JuiceStream + { + StartTime = 1000, + Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(0, -192) }), + X = CatchPlayfield.WIDTH / 2 + } + } + }, + Mod = new CatchModHidden(), + PassCondition = () => Player.Results.Count > 0 + && Player.ChildrenOfType().Single().Alpha > 0 + && Player.ChildrenOfType().Last().Alpha > 0 + }); + } + + protected override Ruleset CreatePlayerRuleset() => new CatchRuleset(); + } +} From 19ab973bb99bdcfc0cb0ff25bc64fcf0875d417d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jul 2020 18:48:20 +0900 Subject: [PATCH 66/75] Add second layer to test scene --- .../UserInterface/TestSceneHueAnimation.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs index b341291c58..9c5888d072 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Tests.Visual.UserInterface @@ -15,6 +16,16 @@ namespace osu.Game.Tests.Visual.UserInterface [BackgroundDependencyLoader] private void load(LargeTextureStore textures) { + HueAnimation anim2; + + Add(anim2 = new HueAnimation + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Texture = textures.Get("Intro/Triangles/logo-highlight"), + Colour = Colour4.White, + }); + HueAnimation anim; Add(anim = new HueAnimation @@ -22,10 +33,14 @@ namespace osu.Game.Tests.Visual.UserInterface RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Texture = textures.Get("Intro/Triangles/logo-background"), - Colour = Colour4.White, + Colour = OsuColour.Gray(0.6f), }); - AddSliderStep("Progress", 0f, 1f, 0f, newValue => anim.AnimationProgress = newValue); + AddSliderStep("Progress", 0f, 1f, 0f, newValue => + { + anim2.AnimationProgress = newValue; + anim.AnimationProgress = newValue; + }); } } } From 675544ec2f63d06994659eb259fc39dac4e108d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jul 2020 19:03:59 +0900 Subject: [PATCH 67/75] Tidy up colour and variable usage --- osu.Game/Screens/Menu/IntroTriangles.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 38da98220d..5c8e7049f0 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -283,21 +283,18 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(TextureStore textures) { - const string lazer_logo_background = @"Intro/Triangles/logo-background"; - const string lazer_logo_highlight = @"Intro/Triangles/logo-highlight"; - InternalChildren = new Drawable[] { highlight = new HueAnimation { RelativeSizeAxes = Axes.Both, - Texture = textures.Get(lazer_logo_highlight), - Colour = OsuColour.Gray(1f), + Texture = textures.Get(@"Intro/Triangles/logo-highlight"), + Colour = Color4.White, }, background = new HueAnimation { RelativeSizeAxes = Axes.Both, - Texture = textures.Get(lazer_logo_background), + Texture = textures.Get(@"Intro/Triangles/logo-background"), Colour = OsuColour.Gray(0.6f), }, }; From 53a46400f50a47b3d5399ffb0444ffc84ffbbe52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jul 2020 19:06:40 +0900 Subject: [PATCH 68/75] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 85d154f2e2..71d4e5aacf 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b8e73262c4..2f3d08c528 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -25,7 +25,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 1faf60b1d9..2bb3914c25 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -71,7 +71,7 @@ - + From 94834e4920200417848944b318f58e5e46c1f043 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 19:35:52 +0900 Subject: [PATCH 69/75] Select mods via exact types --- osu.Game/Overlays/Mods/ModSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 7235a18a23..3701f9ecab 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Mods { foreach (var button in buttons) { - int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t.IsInstanceOfType(m))); + int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t == m.GetType())); if (i >= 0) button.SelectAt(i); From 87f7d8744de0bd3219e728f013942616c2138aa1 Mon Sep 17 00:00:00 2001 From: jorolf Date: Wed, 15 Jul 2020 12:40:46 +0200 Subject: [PATCH 70/75] simplify transform --- osu.Game/Screens/Menu/IntroTriangles.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 5c8e7049f0..b56ba6c8a4 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -217,8 +217,7 @@ namespace osu.Game.Screens.Menu // matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5 lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint); - lazerLogo.TransformTo(nameof(LazerLogo.Background), 1f, logo_scale_duration); - lazerLogo.TransformTo(nameof(LazerLogo.Highlight), 1f, logo_scale_duration); + lazerLogo.TransformTo(nameof(LazerLogo.Progress), 1f, logo_scale_duration); logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad); } @@ -263,16 +262,14 @@ namespace osu.Game.Screens.Menu { private HueAnimation highlight, background; - public float Highlight - { - get => highlight.AnimationProgress; - set => highlight.AnimationProgress = value; - } - - public float Background + public float Progress { get => background.AnimationProgress; - set => background.AnimationProgress = value; + set + { + background.AnimationProgress = value; + highlight.AnimationProgress = value; + } } public LazerLogo() From 1a6ae3194e795bf011b903ff41f4e994744ad691 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Jul 2020 19:45:48 +0900 Subject: [PATCH 71/75] Add test --- .../Mods/ManiaModFadeIn.cs | 9 +-------- .../TestSceneModSelectOverlay.cs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs index 4c125ad6ef..bdc8cb31e5 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs @@ -1,23 +1,16 @@ // 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.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Rulesets.Mania.Objects; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods { - public class ManiaModFadeIn : Mod + public class ManiaModFadeIn : ManiaModHidden { public override string Name => "Fade In"; public override string Acronym => "FI"; public override IconUsage? Icon => OsuIcon.ModHidden; - public override ModType Type => ModType.DifficultyIncrease; public override string Description => @"Keys appear out of nowhere!"; - public override double ScoreMultiplier => 1; - public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) }; } } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index ce691bff70..6f083f4ab6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -13,6 +13,8 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mania; +using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; @@ -99,6 +101,12 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestManiaMods() { changeRuleset(3); + + var mania = new ManiaRuleset(); + + testModsWithSameBaseType( + mania.GetAllMods().Single(m => m.GetType() == typeof(ManiaModFadeIn)), + mania.GetAllMods().Single(m => m.GetType() == typeof(ManiaModHidden))); } [Test] @@ -197,6 +205,18 @@ namespace osu.Game.Tests.Visual.UserInterface checkLabelColor(() => Color4.White); } + private void testModsWithSameBaseType(Mod modA, Mod modB) + { + selectNext(modA); + checkSelected(modA); + selectNext(modB); + checkSelected(modB); + + // Backwards + selectPrevious(modA); + checkSelected(modA); + } + private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1)); private void selectPrevious(Mod mod) => AddStep($"right click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(-1)); From dcd345eed95228cfa729483e657290b4a059f7bc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 01:20:32 +0900 Subject: [PATCH 72/75] Add a few tests --- .../TaikoBeatmapConversionTest.cs | 2 + ...er-conversion-v14-expected-conversion.json | 379 ++++++++++++++++++ .../Beatmaps/slider-conversion-v14.osu | 32 ++ ...der-conversion-v6-expected-conversion.json | 137 +++++++ .../Testing/Beatmaps/slider-conversion-v6.osu | 20 + 5 files changed, 570 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14-expected-conversion.json create mode 100644 osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14.osu create mode 100644 osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6-expected-conversion.json create mode 100644 osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6.osu diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs index f7729138ff..d0c57b20c0 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs @@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Taiko.Tests [TestCase("basic")] [TestCase("slider-generating-drumroll")] [TestCase("sample-to-type-conversions")] + [TestCase("slider-conversion-v6")] + [TestCase("slider-conversion-v14")] public void Test(string name) => base.Test(name); protected override IEnumerable CreateConvertValue(HitObject hitObject) diff --git a/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14-expected-conversion.json b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14-expected-conversion.json new file mode 100644 index 0000000000..6a6063cb74 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14-expected-conversion.json @@ -0,0 +1,379 @@ +{ + "Mappings": [{ + "StartTime": 2000, + "Objects": [{ + "StartTime": 2000, + "EndTime": 2000, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + }, + { + "StartTime": 2173, + "EndTime": 2173, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + } + ] + }, + { + "StartTime": 4000, + "Objects": [{ + "StartTime": 4000, + "EndTime": 4000, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 4173, + "EndTime": 4173, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + } + ] + }, + { + "StartTime": 6000, + "Objects": [{ + "StartTime": 6000, + "EndTime": 6000, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 6271, + "EndTime": 6271, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 6542, + "EndTime": 6542, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + } + ] + }, + { + "StartTime": 8000, + "Objects": [{ + "StartTime": 8000, + "EndTime": 8000, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8026, + "EndTime": 8026, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8053, + "EndTime": 8053, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8080, + "EndTime": 8080, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8107, + "EndTime": 8107, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8133, + "EndTime": 8133, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8160, + "EndTime": 8160, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8187, + "EndTime": 8187, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8214, + "EndTime": 8214, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8241, + "EndTime": 8241, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8267, + "EndTime": 8267, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8294, + "EndTime": 8294, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8321, + "EndTime": 8321, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8348, + "EndTime": 8348, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8374, + "EndTime": 8374, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8401, + "EndTime": 8401, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8428, + "EndTime": 8428, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8455, + "EndTime": 8455, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8482, + "EndTime": 8482, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8508, + "EndTime": 8508, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8535, + "EndTime": 8535, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8562, + "EndTime": 8562, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8589, + "EndTime": 8589, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8615, + "EndTime": 8615, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8642, + "EndTime": 8642, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8669, + "EndTime": 8669, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8696, + "EndTime": 8696, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8723, + "EndTime": 8723, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8749, + "EndTime": 8749, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8776, + "EndTime": 8776, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8803, + "EndTime": 8803, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8830, + "EndTime": 8830, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 8857, + "EndTime": 8857, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + } + ] + } + ] +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14.osu b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14.osu new file mode 100644 index 0000000000..4c8fb1fde6 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v14.osu @@ -0,0 +1,32 @@ +osu file format v14 + +[General] +Mode: 0 + +[Difficulty] +HPDrainRate:7 +CircleSize:4 +OverallDifficulty:8 +ApproachRate:9.2 +SliderMultiplier:2.3 +SliderTickRate:1 + +[TimingPoints] +0,333.333333333333,4,1,0,50,1,0 +2000,-100,4,2,0,80,0,0 + +6000,389.61038961039,4,2,1,60,1,0 + +8000,428.571428571429,4,3,1,65,1,0 +8000,-133.333333333333,4,1,1,45,0,0 + +[HitObjects] +// Should convert. +48,32,2000,6,0,B|168:32,1,120,4|2 +312,68,4000,2,0,B|288:52|256:44|216:52|200:68,1,120,0|8 + +// Should convert. +184,224,6000,2,0,L|336:308,2,160,2|2|0,0:0|0:0|0:0,0:0:0:0: + +// Should convert. +328,36,8000,6,0,L|332:16,32,10.7812504112721,0|0,0:0,0:0:0:0: diff --git a/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6-expected-conversion.json b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6-expected-conversion.json new file mode 100644 index 0000000000..c3d3c52ebd --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6-expected-conversion.json @@ -0,0 +1,137 @@ +{ + "Mappings": [{ + "StartTime": 0, + "Objects": [{ + "StartTime": 0, + "EndTime": 0, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + }, + { + "StartTime": 162, + "EndTime": 162, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 325, + "EndTime": 325, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + }, + { + "StartTime": 487, + "EndTime": 487, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 650, + "EndTime": 650, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + }, + { + "StartTime": 813, + "EndTime": 813, + "IsRim": false, + "IsCentre": true, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 975, + "EndTime": 975, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + } + ] + }, + { + "StartTime": 2000, + "Objects": [{ + "StartTime": 2000, + "EndTime": 2000, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 2162, + "EndTime": 2162, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 2325, + "EndTime": 2325, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + }, + { + "StartTime": 2487, + "EndTime": 2487, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 2650, + "EndTime": 2650, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + }, + { + "StartTime": 2813, + "EndTime": 2813, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": true + }, + { + "StartTime": 2975, + "EndTime": 2975, + "IsRim": true, + "IsCentre": false, + "IsDrumRoll": false, + "IsSwell": false, + "IsStrong": false + } + ] + } + ] +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6.osu b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6.osu new file mode 100644 index 0000000000..c1e4c3bbd7 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/slider-conversion-v6.osu @@ -0,0 +1,20 @@ +osu file format v6 + +[General] +Mode: 0 + +[Difficulty] +HPDrainRate:3 +CircleSize:4 +OverallDifficulty:1 +SliderMultiplier:1.2 +SliderTickRate:3 + +[TimingPoints] +0,487.884208814441,4,1,0,60,1,0 +2000,-100,4,1,0,65,0,1 + +[HitObjects] +// Should convert. +376,64,0,6,0,B|256:32|136:64,1,240,6|0 +256,120,2000,6,8,C|264:192|336:192,2,120,8|8|6 \ No newline at end of file From 0a1e6a82739101f3c2db1b6b8a859cfe3dcddec7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jul 2020 14:25:45 +0900 Subject: [PATCH 73/75] Fix storyboard video playback when not starting at beginning of beatmap --- osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs index a85936edf7..4ea582ca4a 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs @@ -55,10 +55,11 @@ namespace osu.Game.Storyboards.Drawables if (video == null) return; - video.PlaybackPosition = Clock.CurrentTime - Video.StartTime; - - using (video.BeginAbsoluteSequence(0)) + using (video.BeginAbsoluteSequence(Video.StartTime)) + { + Schedule(() => video.PlaybackPosition = Time.Current - Video.StartTime); video.FadeIn(500); + } } } } From 87713215dcae650a2209bcb5f9e5dd85eadc7c6f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 14:30:17 +0900 Subject: [PATCH 74/75] Remove redundant parens --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs index 99975d9174..2c1885ae1a 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills double addition = 1; // We get an extra addition if we are not a slider or spinner - if (current.LastObject is Hit && current.BaseObject is Hit && (current.BaseObject.StartTime - current.LastObject.StartTime) < 1000) + if (current.LastObject is Hit && current.BaseObject is Hit && current.BaseObject.StartTime - current.LastObject.StartTime < 1000) { if (hasColourChange(current)) addition += 0.75; From 96724bde32d07c286fdbd81717afccd7bc531194 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 15:05:01 +0900 Subject: [PATCH 75/75] Fix chat name backgrounds not dimming --- osu.Game/Overlays/Chat/ChatLine.cs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 496986dc56..4eb348ae33 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Effects; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -114,21 +115,26 @@ namespace osu.Game.Overlays.Chat Colour = Color4.Black.Opacity(0.3f), Type = EdgeEffectType.Shadow, }, - // Drop shadow effect Child = new Container { AutoSizeAxes = Axes.Both, + Y = 3, Masking = true, CornerRadius = 4, - EdgeEffect = new EdgeEffectParameters + Children = new Drawable[] { - Radius = 1, - Colour = Color4Extensions.FromHex(message.Sender.Colour), - Type = EdgeEffectType.Shadow, - }, - Padding = new MarginPadding { Left = 3, Right = 3, Bottom = 1, Top = -3 }, - Y = 3, - Child = username, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4Extensions.FromHex(message.Sender.Colour), + }, + new Container + { + AutoSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 4, Right = 4, Bottom = 1, Top = -2 }, + Child = username + } + } } }; }