From 5024770544999feda8849f7463102b1db5fe2283 Mon Sep 17 00:00:00 2001
From: LeNitrous
Date: Mon, 23 Sep 2019 20:52:44 +0800
Subject: [PATCH 001/373] move common logic to IntroScreen
---
osu.Game/Screens/Menu/IntroCircles.cs | 74 ++++++-----------------
osu.Game/Screens/Menu/IntroScreen.cs | 80 +++++++++++++++++++++++--
osu.Game/Screens/Menu/IntroTriangles.cs | 65 ++++----------------
3 files changed, 104 insertions(+), 115 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs
index c069f82134..d5d7f5cb7a 100644
--- a/osu.Game/Screens/Menu/IntroCircles.cs
+++ b/osu.Game/Screens/Menu/IntroCircles.cs
@@ -2,86 +2,46 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Framework.Audio.Sample;
-using osu.Framework.Audio.Track;
-using osu.Framework.Bindables;
+using osu.Framework.Audio;
using osu.Framework.Screens;
using osu.Framework.Graphics;
-using osu.Framework.MathUtils;
-using osu.Game.Beatmaps;
-using osu.Game.Configuration;
-using osu.Game.IO.Archives;
namespace osu.Game.Screens.Menu
{
public class IntroCircles : IntroScreen
{
- private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
+ protected override string BeatmapHash => "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
- private SampleChannel welcome;
-
- private Bindable menuMusic;
-
- private Track track;
-
- private WorkingBeatmap introBeatmap;
-
- [BackgroundDependencyLoader]
- private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, ISampleStore samples)
- {
- menuMusic = config.GetBindable(OsuSetting.MenuMusic);
-
- BeatmapSetInfo setInfo = null;
-
- if (!menuMusic.Value)
- {
- var sets = beatmaps.GetAllUsableBeatmapSets();
- if (sets.Count > 0)
- setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
- }
-
- if (setInfo == null)
- {
- setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash);
-
- if (setInfo == null)
- {
- // we need to import the default menu background beatmap
- setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"), "circles.osz")).Result;
-
- setInfo.Protected = true;
- beatmaps.Update(setInfo);
- }
- }
-
- introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
- track = introBeatmap.Track;
-
- if (config.Get(OsuSetting.MenuVoice))
- welcome = samples.Get(@"welcome");
- }
+ protected override string BeatmapFile => "circles.osz";
private const double delay_step_one = 2300;
private const double delay_step_two = 600;
+ [BackgroundDependencyLoader]
+ private void load(AudioManager audio)
+ {
+ if (MenuVoice.Value)
+ SetWelcome();
+ }
+
protected override void LogoArriving(OsuLogo logo, bool resuming)
{
base.LogoArriving(logo, resuming);
if (!resuming)
{
- Beatmap.Value = introBeatmap;
- introBeatmap = null;
+ Beatmap.Value = IntroBeatmap;
+ IntroBeatmap = null;
- welcome?.Play();
+ Welcome?.Play();
Scheduler.AddDelayed(delegate
{
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
- if (menuMusic.Value)
+ if (MenuMusic.Value)
{
- track.Restart();
- track = null;
+ Track.Restart();
+ Track = null;
}
PrepareMenuLoad();
@@ -97,7 +57,7 @@ namespace osu.Game.Screens.Menu
public override void OnSuspending(IScreen next)
{
- track = null;
+ Track = null;
this.FadeOut(300);
base.OnSuspending(next);
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index 4d0f7ff87a..651fa7583d 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -4,12 +4,19 @@
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
+using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
+using osu.Framework.MathUtils;
using osu.Framework.Screens;
+using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
+using osu.Game.IO.Archives;
using osu.Game.Screens.Backgrounds;
+using osu.Game.Skinning;
+using osu.Game.Online.API;
+using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
@@ -17,6 +24,10 @@ namespace osu.Game.Screens.Menu
{
public abstract class IntroScreen : StartupScreen
{
+ protected abstract string BeatmapHash { get; }
+
+ protected abstract string BeatmapFile { get; }
+
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
public const int EXIT_DELAY = 3000;
@@ -24,24 +35,83 @@ namespace osu.Game.Screens.Menu
[Resolved]
private AudioManager audio { get; set; }
+ protected SampleChannel Welcome;
+
private SampleChannel seeya;
- private Bindable menuVoice;
+ protected Bindable MenuVoice;
+
+ protected Bindable MenuMusic;
+
+ protected Track Track;
+
+ protected WorkingBeatmap IntroBeatmap;
private LeasedBindable beatmap;
public new Bindable Beatmap => beatmap;
+ protected Bindable User;
+
+ protected Bindable Skin;
+
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
[BackgroundDependencyLoader]
- private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
+ private void load(OsuConfigManager config, IAPIProvider api, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
{
// prevent user from changing beatmap while the intro is still runnning.
beatmap = base.Beatmap.BeginLease(false);
- menuVoice = config.GetBindable(OsuSetting.MenuVoice);
- seeya = audio.Samples.Get(@"seeya");
+ MenuVoice = config.GetBindable(OsuSetting.MenuVoice);
+ MenuMusic = config.GetBindable(OsuSetting.MenuMusic);
+
+ User = api.LocalUser.GetBoundCopy();
+ Skin = skinManager.CurrentSkin.GetBoundCopy();
+
+ Skin.BindValueChanged(_ => updateSeeya(), true);
+
+ BeatmapSetInfo setInfo = null;
+
+ if (!MenuMusic.Value)
+ {
+ var sets = beatmaps.GetAllUsableBeatmapSets();
+ if (sets.Count > 0)
+ setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
+ }
+
+ if (setInfo == null)
+ {
+ setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
+
+ if (setInfo == null)
+ {
+ // we need to import the default menu background beatmap
+ setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).Result;
+
+ setInfo.Protected = true;
+ beatmaps.Update(setInfo);
+ }
+ }
+
+ IntroBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
+ Track = IntroBeatmap.Track;
+ }
+
+ private void updateSeeya()
+ {
+ if (User.Value?.IsSupporter ?? false)
+ seeya = Skin.Value.GetSample(new SampleInfo("seeya")) ?? audio.Samples.Get(@"seeya");
+ else
+ seeya = audio.Samples.Get(@"seeya");
+ }
+
+ protected void SetWelcome()
+ {
+ if (User.Value?.IsSupporter ?? false)
+ Welcome = Skin.Value.GetSample(new SampleInfo("welcome")) ?? audio.Samples.Get(@"welcome");
+ else
+ Welcome = audio.Samples.Get(@"welcome");
}
///
@@ -61,7 +131,7 @@ namespace osu.Game.Screens.Menu
double fadeOutTime = EXIT_DELAY;
//we also handle the exit transition.
- if (menuVoice.Value)
+ if (MenuVoice.Value)
seeya.Play();
else
fadeOutTime = 500;
diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs
index db970dd76e..77700900a8 100644
--- a/osu.Game/Screens/Menu/IntroTriangles.cs
+++ b/osu.Game/Screens/Menu/IntroTriangles.cs
@@ -6,9 +6,6 @@ using System.Collections.Generic;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Audio;
-using osu.Framework.Audio.Sample;
-using osu.Framework.Audio.Track;
-using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -17,12 +14,9 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Video;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
-using osu.Game.Beatmaps;
-using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
-using osu.Game.IO.Archives;
using osu.Game.Rulesets;
using osu.Game.Screens.Backgrounds;
using osuTK;
@@ -32,9 +26,9 @@ namespace osu.Game.Screens.Menu
{
public class IntroTriangles : IntroScreen
{
- private const string menu_music_beatmap_hash = "a1556d0801b3a6b175dda32ef546f0ec812b400499f575c44fccbe9c67f9b1e5";
+ protected override string BeatmapHash => "a1556d0801b3a6b175dda32ef546f0ec812b400499f575c44fccbe9c67f9b1e5";
- private SampleChannel welcome;
+ protected override string BeatmapFile => "triangles.osz";
protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenDefault(false)
{
@@ -44,48 +38,13 @@ namespace osu.Game.Screens.Menu
[Resolved]
private AudioManager audio { get; set; }
- private Bindable menuMusic;
- private Track track;
- private WorkingBeatmap introBeatmap;
-
private BackgroundScreenDefault background;
[BackgroundDependencyLoader]
- private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
+ private void load(AudioManager audio)
{
- menuMusic = config.GetBindable(OsuSetting.MenuMusic);
-
- BeatmapSetInfo setInfo = null;
-
- if (!menuMusic.Value)
- {
- var sets = beatmaps.GetAllUsableBeatmapSets();
- if (sets.Count > 0)
- setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
- }
-
- if (setInfo == null)
- {
- setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash);
-
- if (setInfo == null)
- {
- // we need to import the default menu background beatmap
- setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/triangles.osz"), "triangles.osz")).Result;
-
- setInfo.Protected = true;
- beatmaps.Update(setInfo);
- }
- }
-
- introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
-
- track = introBeatmap.Track;
- track.Reset();
-
- if (config.Get(OsuSetting.MenuVoice) && !menuMusic.Value)
- // triangles has welcome sound included in the track. only play this if the user doesn't want menu music.
- welcome = audio.Samples.Get(@"welcome");
+ if (MenuVoice.Value && !MenuMusic.Value)
+ SetWelcome();
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
@@ -96,24 +55,24 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
- Beatmap.Value = introBeatmap;
- introBeatmap = null;
+ Beatmap.Value = IntroBeatmap;
+ IntroBeatmap = null;
PrepareMenuLoad();
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
{
RelativeSizeAxes = Axes.Both,
- Clock = new FramedClock(menuMusic.Value ? track : null),
+ Clock = new FramedClock(MenuMusic.Value ? Track : null),
LoadMenu = LoadMenu
}, t =>
{
AddInternal(t);
- welcome?.Play();
+ Welcome?.Play();
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
- if (menuMusic.Value)
- track.Start();
+ if (MenuMusic.Value)
+ Track.Start();
});
}
}
@@ -126,7 +85,7 @@ namespace osu.Game.Screens.Menu
public override void OnSuspending(IScreen next)
{
- track = null;
+ Track = null;
base.OnSuspending(next);
}
From ec78889e94178357e1d18303ca0f7164f5e31955 Mon Sep 17 00:00:00 2001
From: LeNitrous
Date: Tue, 24 Sep 2019 08:14:20 +0800
Subject: [PATCH 002/373] remove unused dependencies
---
osu.Game/Screens/Menu/IntroCircles.cs | 3 +--
osu.Game/Screens/Menu/IntroTriangles.cs | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs
index d5d7f5cb7a..a861d54663 100644
--- a/osu.Game/Screens/Menu/IntroCircles.cs
+++ b/osu.Game/Screens/Menu/IntroCircles.cs
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Framework.Audio;
using osu.Framework.Screens;
using osu.Framework.Graphics;
@@ -18,7 +17,7 @@ namespace osu.Game.Screens.Menu
private const double delay_step_two = 600;
[BackgroundDependencyLoader]
- private void load(AudioManager audio)
+ private void load()
{
if (MenuVoice.Value)
SetWelcome();
diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs
index 77700900a8..5b49a81a5a 100644
--- a/osu.Game/Screens/Menu/IntroTriangles.cs
+++ b/osu.Game/Screens/Menu/IntroTriangles.cs
@@ -41,7 +41,7 @@ namespace osu.Game.Screens.Menu
private BackgroundScreenDefault background;
[BackgroundDependencyLoader]
- private void load(AudioManager audio)
+ private void load()
{
if (MenuVoice.Value && !MenuMusic.Value)
SetWelcome();
From afa043aa7de522e6436276d2c000f9820800b970 Mon Sep 17 00:00:00 2001
From: LeNitrous
Date: Tue, 24 Sep 2019 18:17:27 +0800
Subject: [PATCH 003/373] always use default samples
---
osu.Game/Screens/Menu/IntroCircles.cs | 5 +++--
osu.Game/Screens/Menu/IntroScreen.cs | 30 ++-----------------------
osu.Game/Screens/Menu/IntroTriangles.cs | 4 ++--
3 files changed, 7 insertions(+), 32 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs
index a861d54663..6c643860a0 100644
--- a/osu.Game/Screens/Menu/IntroCircles.cs
+++ b/osu.Game/Screens/Menu/IntroCircles.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
+using osu.Framework.Audio;
using osu.Framework.Screens;
using osu.Framework.Graphics;
@@ -17,10 +18,10 @@ namespace osu.Game.Screens.Menu
private const double delay_step_two = 600;
[BackgroundDependencyLoader]
- private void load()
+ private void load(AudioManager audio)
{
if (MenuVoice.Value)
- SetWelcome();
+ Welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index 651fa7583d..c81fef6436 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -9,14 +9,11 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Screens;
-using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.IO.Archives;
using osu.Game.Screens.Backgrounds;
using osu.Game.Skinning;
-using osu.Game.Online.API;
-using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
@@ -51,14 +48,10 @@ namespace osu.Game.Screens.Menu
public new Bindable Beatmap => beatmap;
- protected Bindable User;
-
- protected Bindable Skin;
-
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
[BackgroundDependencyLoader]
- private void load(OsuConfigManager config, IAPIProvider api, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
+ private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
{
// prevent user from changing beatmap while the intro is still runnning.
beatmap = base.Beatmap.BeginLease(false);
@@ -66,10 +59,7 @@ namespace osu.Game.Screens.Menu
MenuVoice = config.GetBindable(OsuSetting.MenuVoice);
MenuMusic = config.GetBindable(OsuSetting.MenuMusic);
- User = api.LocalUser.GetBoundCopy();
- Skin = skinManager.CurrentSkin.GetBoundCopy();
-
- Skin.BindValueChanged(_ => updateSeeya(), true);
+ seeya = audio.Samples.Get(@"seeya");
BeatmapSetInfo setInfo = null;
@@ -98,22 +88,6 @@ namespace osu.Game.Screens.Menu
Track = IntroBeatmap.Track;
}
- private void updateSeeya()
- {
- if (User.Value?.IsSupporter ?? false)
- seeya = Skin.Value.GetSample(new SampleInfo("seeya")) ?? audio.Samples.Get(@"seeya");
- else
- seeya = audio.Samples.Get(@"seeya");
- }
-
- protected void SetWelcome()
- {
- if (User.Value?.IsSupporter ?? false)
- Welcome = Skin.Value.GetSample(new SampleInfo("welcome")) ?? audio.Samples.Get(@"welcome");
- else
- Welcome = audio.Samples.Get(@"welcome");
- }
-
///
/// Whether we have loaded the menu previously.
///
diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs
index 5b49a81a5a..590069ab43 100644
--- a/osu.Game/Screens/Menu/IntroTriangles.cs
+++ b/osu.Game/Screens/Menu/IntroTriangles.cs
@@ -41,10 +41,10 @@ namespace osu.Game.Screens.Menu
private BackgroundScreenDefault background;
[BackgroundDependencyLoader]
- private void load()
+ private void load(AudioManager audio)
{
if (MenuVoice.Value && !MenuMusic.Value)
- SetWelcome();
+ Welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
From 67bed57cbdf3f0921a6a721c74cc28317afc74c7 Mon Sep 17 00:00:00 2001
From: iiSaLMaN
Date: Fri, 27 Sep 2019 08:46:49 +0300
Subject: [PATCH 004/373] Bind value changed event of cursor trail appearence
outside BDL
https://github.com/ppy/osu/pull/6270#discussion_r328899728
---
osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index a944ff88c6..6dbdf0114d 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -40,6 +40,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private void load(OsuRulesetConfigManager config)
{
config?.BindWith(OsuRulesetSetting.ShowCursorTrail, showTrail);
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
showTrail.BindValueChanged(v => cursorTrail.FadeTo(v.NewValue ? 1 : 0, 200), true);
}
From f64fe22f3669cd2117a295d490ecd6a9f14b8f0e Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 27 Sep 2019 18:00:24 +0900
Subject: [PATCH 005/373] Remove bindables from osu! selection blueprints
---
.../HitCircles/Components/HitCirclePiece.cs | 10 +++++++---
.../Edit/Blueprints/HitObjectPiece.cs | 19 ++-----------------
.../Edit/Blueprints/SliderPiece.cs | 17 +++--------------
.../Components/PathControlPointVisualiser.cs | 9 ++-------
.../Sliders/Components/SliderBodyPiece.cs | 6 +++---
.../Sliders/Components/SliderCirclePiece.cs | 12 ------------
.../Spinners/Components/SpinnerPiece.cs | 12 +++++++-----
7 files changed, 24 insertions(+), 61 deletions(-)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
index fe11ead94d..99928cdad9 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
@@ -31,10 +31,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
private void load(OsuColour colours)
{
Colour = colours.Yellow;
+ }
- PositionBindable.BindValueChanged(_ => UpdatePosition(), true);
- StackHeightBindable.BindValueChanged(_ => UpdatePosition());
- ScaleBindable.BindValueChanged(scale => Scale = new Vector2(scale.NewValue), true);
+ protected override void Update()
+ {
+ base.Update();
+
+ UpdatePosition();
+ Scale = new Vector2(hitCircle.Scale);
}
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
index 315a5a2b9d..3d7d609c6b 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
@@ -1,11 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
-using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Objects;
-using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
@@ -14,23 +11,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints
///
public abstract class HitObjectPiece : CompositeDrawable
{
- protected readonly IBindable PositionBindable = new Bindable();
- protected readonly IBindable StackHeightBindable = new Bindable();
- protected readonly IBindable ScaleBindable = new Bindable();
-
- private readonly OsuHitObject hitObject;
+ protected readonly OsuHitObject HitObject;
protected HitObjectPiece(OsuHitObject hitObject)
{
- this.hitObject = hitObject;
- }
-
- [BackgroundDependencyLoader]
- private void load()
- {
- PositionBindable.BindTo(hitObject.PositionBindable);
- StackHeightBindable.BindTo(hitObject.StackHeightBindable);
- ScaleBindable.BindTo(hitObject.ScaleBindable);
+ HitObject = hitObject;
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
index 8fd1d6d6f9..e0fcf8a000 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
@@ -1,32 +1,21 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
-using osu.Framework.Bindables;
-using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
///
- /// A piece of a blueprint which responds to changes in the state of a .
+ /// A piece of a blueprint which responds to changes in the state of a .
///
public abstract class SliderPiece : HitObjectPiece
{
- protected readonly IBindable PathBindable = new Bindable();
-
- private readonly Slider slider;
+ protected readonly Slider Slider;
protected SliderPiece(Slider slider)
: base(slider)
{
- this.slider = slider;
- }
-
- [BackgroundDependencyLoader]
- private void load()
- {
- PathBindable.BindTo(slider.PathBindable);
+ Slider = slider;
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
index df846b5d5b..3d8e014551 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Objects;
@@ -22,14 +21,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both };
}
- [BackgroundDependencyLoader]
- private void load()
+ protected override void Update()
{
- PathBindable.BindValueChanged(_ => updatePathControlPoints(), true);
- }
+ base.Update();
- private void updatePathControlPoints()
- {
while (slider.Path.ControlPoints.Length > pieces.Count)
pieces.Add(new PathControlPointPiece(slider, pieces.Count));
while (slider.Path.ControlPoints.Length < pieces.Count)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
index f1f55731b6..aea17a4b8f 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
@@ -31,9 +31,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
private void load(OsuColour colours)
{
body.BorderColour = colours.Yellow;
-
- PositionBindable.BindValueChanged(_ => updatePosition(), true);
- ScaleBindable.BindValueChanged(scale => body.PathRadius = scale.NewValue * OsuHitObject.OBJECT_RADIUS, true);
}
private void updatePosition() => Position = slider.StackedPosition;
@@ -42,6 +39,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
base.Update();
+ Position = slider.StackedPosition;
+ body.PathRadius = HitObject.Scale * OsuHitObject.OBJECT_RADIUS;
+
var vertices = new List();
slider.Path.GetPathToProgress(vertices, 0, 1);
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
index 2ecfea2e3e..ec3a1d0034 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
@@ -1,9 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
-using osu.Framework.Bindables;
-using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
@@ -11,8 +8,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class SliderCirclePiece : HitCirclePiece
{
- private readonly IBindable pathBindable = new Bindable();
-
private readonly Slider slider;
private readonly SliderPosition position;
@@ -23,13 +18,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
this.position = position;
}
- [BackgroundDependencyLoader]
- private void load()
- {
- pathBindable.BindTo(slider.PathBindable);
- pathBindable.BindValueChanged(_ => UpdatePosition(), true);
- }
-
protected override void UpdatePosition()
{
switch (position)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
index ae94848c81..e2084bbb7c 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
@@ -52,13 +52,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
private void load(OsuColour colours)
{
Colour = colours.Yellow;
-
- PositionBindable.BindValueChanged(_ => updatePosition(), true);
- StackHeightBindable.BindValueChanged(_ => updatePosition());
- ScaleBindable.BindValueChanged(scale => ring.Scale = new Vector2(scale.NewValue), true);
}
- private void updatePosition() => Position = spinner.Position;
+ protected override void Update()
+ {
+ base.Update();
+
+ Position = spinner.Position;
+ ring.Scale = new Vector2(spinner.Scale);
+ }
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos);
}
From 4fc37d11376980b2fc34c616b247e8fbaca8b640 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 27 Sep 2019 18:01:55 +0900
Subject: [PATCH 006/373] Remove SliderPiece + HitObjectPiece
---
.../HitCircles/Components/HitCirclePiece.cs | 4 ++--
.../Edit/Blueprints/HitObjectPiece.cs | 21 -------------------
.../Edit/Blueprints/SliderPiece.cs | 21 -------------------
.../Components/PathControlPointVisualiser.cs | 3 +--
.../Sliders/Components/SliderBodyPiece.cs | 6 +++---
.../Spinners/Components/SpinnerPiece.cs | 3 +--
6 files changed, 7 insertions(+), 51 deletions(-)
delete mode 100644 osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
delete mode 100644 osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
index 99928cdad9..5e46b3ace4 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
@@ -3,6 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
@@ -10,12 +11,11 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
{
- public class HitCirclePiece : HitObjectPiece
+ public class HitCirclePiece : CompositeDrawable
{
private readonly HitCircle hitCircle;
public HitCirclePiece(HitCircle hitCircle)
- : base(hitCircle)
{
this.hitCircle = hitCircle;
Origin = Anchor.Centre;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
deleted file mode 100644
index 3d7d609c6b..0000000000
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Framework.Graphics.Containers;
-using osu.Game.Rulesets.Osu.Objects;
-
-namespace osu.Game.Rulesets.Osu.Edit.Blueprints
-{
- ///
- /// A piece of a blueprint which responds to changes in the state of a .
- ///
- public abstract class HitObjectPiece : CompositeDrawable
- {
- protected readonly OsuHitObject HitObject;
-
- protected HitObjectPiece(OsuHitObject hitObject)
- {
- HitObject = hitObject;
- }
- }
-}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
deleted file mode 100644
index e0fcf8a000..0000000000
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Game.Rulesets.Osu.Objects;
-
-namespace osu.Game.Rulesets.Osu.Edit.Blueprints
-{
- ///
- /// A piece of a blueprint which responds to changes in the state of a .
- ///
- public abstract class SliderPiece : HitObjectPiece
- {
- protected readonly Slider Slider;
-
- protected SliderPiece(Slider slider)
- : base(slider)
- {
- Slider = slider;
- }
- }
-}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
index 3d8e014551..24fcc460d1 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -7,14 +7,13 @@ using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class PathControlPointVisualiser : SliderPiece
+ public class PathControlPointVisualiser : CompositeDrawable
{
private readonly Slider slider;
private readonly Container pieces;
public PathControlPointVisualiser(Slider slider)
- : base(slider)
{
this.slider = slider;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
index aea17a4b8f..239feee431 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
@@ -11,13 +12,12 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class SliderBodyPiece : SliderPiece
+ public class SliderBodyPiece : CompositeDrawable
{
private readonly Slider slider;
private readonly ManualSliderBody body;
public SliderBodyPiece(Slider slider)
- : base(slider)
{
this.slider = slider;
@@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
base.Update();
Position = slider.StackedPosition;
- body.PathRadius = HitObject.Scale * OsuHitObject.OBJECT_RADIUS;
+ body.PathRadius = slider.Scale * OsuHitObject.OBJECT_RADIUS;
var vertices = new List();
slider.Path.GetPathToProgress(vertices, 0, 1);
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
index e2084bbb7c..5dab501a24 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
@@ -12,14 +12,13 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
{
- public class SpinnerPiece : HitObjectPiece
+ public class SpinnerPiece : CompositeDrawable
{
private readonly Spinner spinner;
private readonly CircularContainer circle;
private readonly RingPiece ring;
public SpinnerPiece(Spinner spinner)
- : base(spinner)
{
this.spinner = spinner;
From bddaead72e5b650b4e2e0205572b3ac232c865bf Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 27 Sep 2019 18:45:22 +0900
Subject: [PATCH 007/373] Make hitobject pieces able to update dynamically
---
.../Edit/Blueprints/BlueprintPiece.cs | 25 +++++++++++++
.../HitCircles/Components/HitCirclePiece.cs | 18 +++-------
.../HitCircles/HitCirclePlacementBlueprint.cs | 11 +++++-
.../HitCircles/HitCircleSelectionBlueprint.cs | 13 +++++--
.../Edit/Blueprints/OsuSelectionBlueprint.cs | 7 ++--
.../Components/PathControlPointPiece.cs | 2 +-
.../Sliders/Components/SliderBodyPiece.cs | 21 ++++-------
.../Sliders/Components/SliderCirclePiece.cs | 35 -------------------
.../Sliders/SliderCircleSelectionBlueprint.cs | 21 ++++++++---
.../Sliders/SliderPlacementBlueprint.cs | 15 ++++++--
.../Sliders/SliderSelectionBlueprint.cs | 16 ++++++---
.../Spinners/Components/SpinnerPiece.cs | 16 +++------
.../Spinners/SpinnerPlacementBlueprint.cs | 9 ++++-
.../Spinners/SpinnerSelectionBlueprint.cs | 11 ++++--
14 files changed, 125 insertions(+), 95 deletions(-)
create mode 100644 osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs
delete mode 100644 osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs
new file mode 100644
index 0000000000..95e926fdfa
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs
@@ -0,0 +1,25 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics.Containers;
+using osu.Game.Rulesets.Osu.Objects;
+
+namespace osu.Game.Rulesets.Osu.Edit.Blueprints
+{
+ ///
+ /// A piece of a selection or placement blueprint which visualises an .
+ ///
+ /// The type of which this visualises.
+ public abstract class BlueprintPiece : CompositeDrawable
+ where T : OsuHitObject
+ {
+ ///
+ /// Updates this using the properties of a .
+ ///
+ /// The to reference properties from.
+ public virtual void UpdateFrom(T hitObject)
+ {
+ Position = hitObject.Position;
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
index 5e46b3ace4..2b6b93a590 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
@@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
@@ -11,17 +10,13 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
{
- public class HitCirclePiece : CompositeDrawable
+ public class HitCirclePiece : BlueprintPiece
{
- private readonly HitCircle hitCircle;
-
- public HitCirclePiece(HitCircle hitCircle)
+ public HitCirclePiece()
{
- this.hitCircle = hitCircle;
Origin = Anchor.Centre;
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
- Scale = new Vector2(hitCircle.Scale);
CornerRadius = Size.X / 2;
InternalChild = new RingPiece();
@@ -33,14 +28,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
Colour = colours.Yellow;
}
- protected override void Update()
+ public override void UpdateFrom(HitCircle hitObject)
{
- base.Update();
+ base.UpdateFrom(hitObject);
- UpdatePosition();
- Scale = new Vector2(hitCircle.Scale);
+ Scale = new Vector2(hitObject.Scale);
}
-
- protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
index a4050f0c31..cccef52737 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
@@ -13,10 +13,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
public new HitCircle HitObject => (HitCircle)base.HitObject;
+ private readonly HitCirclePiece circlePiece;
+
public HitCirclePlacementBlueprint()
: base(new HitCircle())
{
- InternalChild = new HitCirclePiece(HitObject);
+ InternalChild = circlePiece = new HitCirclePiece();
}
protected override void LoadComplete()
@@ -27,6 +29,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero;
}
+ protected override void Update()
+ {
+ base.Update();
+
+ circlePiece.UpdateFrom(HitObject);
+ }
+
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
index 83787e2219..430d4a0222 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
@@ -7,12 +7,21 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
- public class HitCircleSelectionBlueprint : OsuSelectionBlueprint
+ public class HitCircleSelectionBlueprint : OsuSelectionBlueprint
{
+ private readonly HitCirclePiece circlePiece;
+
public HitCircleSelectionBlueprint(DrawableHitCircle hitCircle)
: base(hitCircle)
{
- InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject);
+ InternalChild = circlePiece = new HitCirclePiece();
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ circlePiece.UpdateFrom(HitObject);
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
index dd524252f3..2e4b990db8 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
@@ -7,11 +7,12 @@ using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
- public class OsuSelectionBlueprint : SelectionBlueprint
+ public abstract class OsuSelectionBlueprint : SelectionBlueprint
+ where T : OsuHitObject
{
- protected OsuHitObject OsuObject => (OsuHitObject)HitObject.HitObject;
+ protected new T HitObject => (T)base.HitObject.HitObject;
- public OsuSelectionBlueprint(DrawableHitObject hitObject)
+ protected OsuSelectionBlueprint(DrawableHitObject hitObject)
: base(hitObject)
{
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
index e257369ad9..3aec7c2872 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
@@ -14,7 +14,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class PathControlPointPiece : CompositeDrawable
+ public class PathControlPointPiece : BlueprintPiece
{
private readonly Slider slider;
private readonly int index;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
index 239feee431..d28cf7b492 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
-using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
@@ -12,18 +11,15 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class SliderBodyPiece : CompositeDrawable
+ public class SliderBodyPiece : BlueprintPiece
{
- private readonly Slider slider;
private readonly ManualSliderBody body;
- public SliderBodyPiece(Slider slider)
+ public SliderBodyPiece()
{
- this.slider = slider;
-
InternalChild = body = new ManualSliderBody
{
- AccentColour = Color4.Transparent,
+ AccentColour = Color4.Transparent
};
}
@@ -33,17 +29,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
body.BorderColour = colours.Yellow;
}
- private void updatePosition() => Position = slider.StackedPosition;
-
- protected override void Update()
+ public override void UpdateFrom(Slider hitObject)
{
- base.Update();
+ base.UpdateFrom(hitObject);
- Position = slider.StackedPosition;
- body.PathRadius = slider.Scale * OsuHitObject.OBJECT_RADIUS;
+ body.PathRadius = hitObject.Scale * OsuHitObject.OBJECT_RADIUS;
var vertices = new List();
- slider.Path.GetPathToProgress(vertices, 0, 1);
+ hitObject.Path.GetPathToProgress(vertices, 0, 1);
body.SetVertices(vertices);
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
deleted file mode 100644
index ec3a1d0034..0000000000
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
-using osu.Game.Rulesets.Osu.Objects;
-
-namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
-{
- public class SliderCirclePiece : HitCirclePiece
- {
- private readonly Slider slider;
- private readonly SliderPosition position;
-
- public SliderCirclePiece(Slider slider, SliderPosition position)
- : base(slider.HeadCircle)
- {
- this.slider = slider;
- this.position = position;
- }
-
- protected override void UpdatePosition()
- {
- switch (position)
- {
- case SliderPosition.Start:
- Position = slider.StackedPosition + slider.Path.PositionAt(0);
- break;
-
- case SliderPosition.End:
- Position = slider.StackedPosition + slider.Path.PositionAt(1);
- break;
- }
- }
- }
-}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
index c9f005495c..8f9a9c3a64 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
@@ -1,22 +1,33 @@
// 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.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
+using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
- public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint
+ public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint
{
- public SliderCircleSelectionBlueprint(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position)
- : base(hitObject)
+ private readonly SliderPosition position;
+ private readonly HitCirclePiece circlePiece;
+
+ public SliderCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position)
+ : base(slider)
{
- InternalChild = new SliderCirclePiece(slider, position);
+ this.position = position;
+ InternalChild = circlePiece = new HitCirclePiece();
Select();
}
+ protected override void Update()
+ {
+ base.Update();
+
+ circlePiece.UpdateFrom(position == SliderPosition.Start ? HitObject.HeadCircle : HitObject.TailCircle);
+ }
+
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
public override bool HandlePositionalInput => false;
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
index 55de626d7d..4c281a0e7d 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
@@ -11,6 +11,7 @@ using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
+using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osuTK;
using osuTK.Input;
@@ -21,6 +22,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public new Objects.Slider HitObject => (Objects.Slider)base.HitObject;
+ private SliderBodyPiece bodyPiece;
+ private HitCirclePiece headCirclePiece;
+ private HitCirclePiece tailCirclePiece;
+
private readonly List segments = new List();
private Vector2 cursor;
@@ -38,9 +43,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
InternalChildren = new Drawable[]
{
- new SliderBodyPiece(HitObject),
- new SliderCirclePiece(HitObject, SliderPosition.Start),
- new SliderCirclePiece(HitObject, SliderPosition.End),
+ bodyPiece = new SliderBodyPiece(),
+ headCirclePiece = new HitCirclePiece(),
+ tailCirclePiece = new HitCirclePiece(),
new PathControlPointVisualiser(HitObject),
};
@@ -130,6 +135,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
var newControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToArray();
HitObject.Path = new SliderPath(newControlPoints.Length > 2 ? PathType.Bezier : PathType.Linear, newControlPoints);
+
+ bodyPiece.UpdateFrom(HitObject);
+ headCirclePiece.UpdateFrom(HitObject.HeadCircle);
+ tailCirclePiece.UpdateFrom(HitObject.TailCircle);
}
private void setState(PlacementState newState)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
index fb8c081ff7..bc760c9456 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
@@ -9,8 +9,9 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
- public class SliderSelectionBlueprint : OsuSelectionBlueprint
+ public class SliderSelectionBlueprint : OsuSelectionBlueprint
{
+ private readonly SliderBodyPiece bodyPiece;
private readonly SliderCircleSelectionBlueprint headBlueprint;
public SliderSelectionBlueprint(DrawableSlider slider)
@@ -20,13 +21,20 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
InternalChildren = new Drawable[]
{
- new SliderBodyPiece(sliderObject),
- headBlueprint = new SliderCircleSelectionBlueprint(slider.HeadCircle, sliderObject, SliderPosition.Start),
- new SliderCircleSelectionBlueprint(slider.TailCircle, sliderObject, SliderPosition.End),
+ bodyPiece = new SliderBodyPiece(),
+ headBlueprint = new SliderCircleSelectionBlueprint(slider, SliderPosition.Start),
+ new SliderCircleSelectionBlueprint(slider, SliderPosition.End),
new PathControlPointVisualiser(sliderObject),
};
}
+ protected override void Update()
+ {
+ base.Update();
+
+ bodyPiece.UpdateFrom(HitObject);
+ }
+
public override Vector2 SelectionPoint => headBlueprint.SelectionPoint;
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
index 5dab501a24..65c8720031 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
@@ -12,16 +12,13 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
{
- public class SpinnerPiece : CompositeDrawable
+ public class SpinnerPiece : BlueprintPiece
{
- private readonly Spinner spinner;
private readonly CircularContainer circle;
private readonly RingPiece ring;
- public SpinnerPiece(Spinner spinner)
+ public SpinnerPiece()
{
- this.spinner = spinner;
-
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
@@ -43,8 +40,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
Origin = Anchor.Centre
}
};
-
- ring.Scale = new Vector2(spinner.Scale);
}
[BackgroundDependencyLoader]
@@ -53,12 +48,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
Colour = colours.Yellow;
}
- protected override void Update()
+ public override void UpdateFrom(Spinner hitObject)
{
- base.Update();
+ base.UpdateFrom(hitObject);
- Position = spinner.Position;
- ring.Scale = new Vector2(spinner.Scale);
+ ring.Scale = new Vector2(hitObject.Scale);
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos);
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
index 03d761c67f..8d9dea736b 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
@@ -21,7 +21,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
public SpinnerPlacementBlueprint()
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
{
- InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };
+ InternalChild = piece = new SpinnerPiece { Alpha = 0.5f };
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ piece.UpdateFrom(HitObject);
}
protected override bool OnClick(ClickEvent e)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
index 25cef3b251..f05d4f8435 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
@@ -8,14 +8,21 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
- public class SpinnerSelectionBlueprint : OsuSelectionBlueprint
+ public class SpinnerSelectionBlueprint : OsuSelectionBlueprint
{
private readonly SpinnerPiece piece;
public SpinnerSelectionBlueprint(DrawableSpinner spinner)
: base(spinner)
{
- InternalChild = piece = new SpinnerPiece((Spinner)spinner.HitObject);
+ InternalChild = piece = new SpinnerPiece();
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ piece.UpdateFrom(HitObject);
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => piece.ReceivePositionalInputAt(screenSpacePos);
From 42d1379848fa03611cda80eb2336838ddf3165d3 Mon Sep 17 00:00:00 2001
From: miterosan
Date: Sun, 29 Sep 2019 20:40:10 +0200
Subject: [PATCH 008/373] Load the rulesets lasily
---
osu.Game/Rulesets/RulesetStore.cs | 95 ++++++++++++++++---------------
1 file changed, 49 insertions(+), 46 deletions(-)
diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs
index 2d8c9f5b49..6392f982fb 100644
--- a/osu.Game/Rulesets/RulesetStore.cs
+++ b/osu.Game/Rulesets/RulesetStore.cs
@@ -16,17 +16,11 @@ namespace osu.Game.Rulesets
///
public class RulesetStore : DatabaseBackedStore
{
- private static readonly Dictionary loaded_assemblies = new Dictionary();
+ private static readonly Lazy> loaded_assemblies = new Lazy>(() => loadRulesets());
static RulesetStore()
{
AppDomain.CurrentDomain.AssemblyResolve += currentDomain_AssemblyResolve;
-
- // On android in release configuration assemblies are loaded from the apk directly into memory.
- // We cannot read assemblies from cwd, so should check loaded assemblies instead.
- loadFromAppDomain();
-
- loadFromDisk();
}
public RulesetStore(IDatabaseContextFactory factory)
@@ -54,7 +48,7 @@ namespace osu.Game.Rulesets
///
public IEnumerable AvailableRulesets { get; private set; }
- private static Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args) => loaded_assemblies.Keys.FirstOrDefault(a => a.FullName == args.Name);
+ private static Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args) => loaded_assemblies.Value.Keys.FirstOrDefault(a => a.FullName == args.Name);
private const string ruleset_library_prefix = "osu.Game.Rulesets";
@@ -64,7 +58,7 @@ namespace osu.Game.Rulesets
{
var context = usage.Context;
- var instances = loaded_assemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r, (RulesetInfo)null)).ToList();
+ var instances = loaded_assemblies.Value.Values.Select(r => (Ruleset)Activator.CreateInstance(r, (RulesetInfo)null)).ToList();
//add all legacy modes in correct order
foreach (var r in instances.Where(r => r.LegacyID != null).OrderBy(r => r.LegacyID))
@@ -113,8 +107,39 @@ namespace osu.Game.Rulesets
}
}
- private static void loadFromAppDomain()
+ ///
+ /// Loads the rulesets that are in the current appdomain an in the current directory.
+ ///
+ /// The rulesets that were loaded.
+ private static Dictionary loadRulesets()
{
+ var rulesets = new Dictionary();
+
+ foreach (var rulesetAssembly in getRulesetAssemblies())
+ {
+ try
+ {
+ rulesets[rulesetAssembly] = rulesetAssembly.GetTypes().First(t => t.IsPublic && t.IsSubclassOf(typeof(Ruleset)));
+ }
+ catch (Exception e)
+ {
+ Logger.Error(e, $"Failed to add ruleset {rulesetAssembly}");
+ }
+ }
+
+ return rulesets;
+ }
+
+ ///
+ /// Scans the current appdomain and current directory for ruleset assemblies.
+ /// Rulesets that were found in the current directory are automaticly loaded.
+ ///
+ /// The ruleset assemblies that were found in the current appdomain or in the current directory.
+ private static IEnumerable getRulesetAssemblies()
+ {
+ var rulesetAssemblies = new HashSet();
+
+ // load from appdomain
foreach (var ruleset in AppDomain.CurrentDomain.GetAssemblies())
{
string rulesetName = ruleset.GetName().Name;
@@ -122,55 +147,33 @@ namespace osu.Game.Rulesets
if (!rulesetName.StartsWith(ruleset_library_prefix, StringComparison.InvariantCultureIgnoreCase) || ruleset.GetName().Name.Contains("Tests"))
continue;
- addRuleset(ruleset);
+ rulesetAssemblies.Add(ruleset);
}
- }
- private static void loadFromDisk()
- {
+ // load from current directory
try
{
string[] files = Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll");
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
- loadRulesetFromFile(file);
+ {
+ try
+ {
+ rulesetAssemblies.Add(Assembly.LoadFrom(file));
+ }
+ catch (Exception e)
+ {
+ Logger.Error(e, $"Failed to load ruleset assembly {Path.GetFileNameWithoutExtension(file)}");
+ return null;
+ }
+ }
}
catch
{
Logger.Log($"Could not load rulesets from directory {Environment.CurrentDirectory}");
}
- }
- private static void loadRulesetFromFile(string file)
- {
- var filename = Path.GetFileNameWithoutExtension(file);
-
- if (loaded_assemblies.Values.Any(t => t.Namespace == filename))
- return;
-
- try
- {
- addRuleset(Assembly.LoadFrom(file));
- }
- catch (Exception e)
- {
- Logger.Error(e, $"Failed to load ruleset {filename}");
- }
- }
-
- private static void addRuleset(Assembly assembly)
- {
- if (loaded_assemblies.ContainsKey(assembly))
- return;
-
- try
- {
- loaded_assemblies[assembly] = assembly.GetTypes().First(t => t.IsPublic && t.IsSubclassOf(typeof(Ruleset)));
- }
- catch (Exception e)
- {
- Logger.Error(e, $"Failed to add ruleset {assembly}");
- }
+ return rulesetAssemblies;
}
}
}
From a310c4b65f220afef633a4dc6ff9d8c58c89f0d2 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Tue, 1 Oct 2019 19:32:47 +0900
Subject: [PATCH 009/373] Make selection blueprints a bit more testable
---
.../TestSceneHoldNoteSelectionBlueprint.cs | 4 ++-
.../TestSceneNoteSelectionBlueprint.cs | 8 +++---
.../TestSceneSpinnerSelectionBlueprint.cs | 9 ++++---
.../Visual/SelectionBlueprintTestScene.cs | 26 +++++--------------
4 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
index 622d840a0c..5507ca2ba0 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
@@ -39,6 +39,8 @@ namespace osu.Game.Rulesets.Mania.Tests
AccentColour = { Value = OsuColour.Gray(0.3f) }
}
};
+
+ AddBlueprint(new HoldNoteSelectionBlueprint(drawableObject));
}
protected override void Update()
@@ -52,6 +54,6 @@ namespace osu.Game.Rulesets.Mania.Tests
}
}
- protected override SelectionBlueprint CreateBlueprint() => new HoldNoteSelectionBlueprint(drawableObject);
+ protected override SelectionBlueprint CreateBlueprint() => new HoldNoteSelectionBlueprint(null);
}
}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
index 6bb344f977..c0482e2150 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
@@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Mania.Tests
{
public class TestSceneNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
{
- private readonly DrawableNote drawableObject;
-
protected override Container Content => content ?? base.Content;
private readonly Container content;
@@ -27,6 +25,8 @@ namespace osu.Game.Rulesets.Mania.Tests
var note = new Note { Column = 0 };
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
+ DrawableNote drawableObject;
+
base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
{
Anchor = Anchor.Centre,
@@ -34,8 +34,10 @@ namespace osu.Game.Rulesets.Mania.Tests
Size = new Vector2(50, 20),
Child = drawableObject = new DrawableNote(note)
};
+
+ AddBlueprint(new NoteSelectionBlueprint(drawableObject));
}
- protected override SelectionBlueprint CreateBlueprint() => new NoteSelectionBlueprint(drawableObject);
+ protected override SelectionBlueprint CreateBlueprint() => new NoteSelectionBlueprint(null);
}
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
index c5cea76b14..1c195311a4 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
@@ -25,8 +25,6 @@ namespace osu.Game.Rulesets.Osu.Tests
typeof(SpinnerPiece)
};
- private readonly DrawableSpinner drawableSpinner;
-
public TestSceneSpinnerSelectionBlueprint()
{
var spinner = new Spinner
@@ -35,16 +33,21 @@ namespace osu.Game.Rulesets.Osu.Tests
StartTime = -1000,
EndTime = 2000
};
+
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
+ DrawableSpinner drawableSpinner;
+
Add(new Container
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f),
Child = drawableSpinner = new DrawableSpinner(spinner)
});
+
+ AddBlueprint(new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) });
}
- protected override SelectionBlueprint CreateBlueprint() => new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) };
+ protected override SelectionBlueprint CreateBlueprint() => new SpinnerSelectionBlueprint(null) { Size = new Vector2(0.5f) };
}
}
diff --git a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
index df3af2cc43..55dda03b16 100644
--- a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
+++ b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
@@ -1,10 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
@@ -12,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
public abstract class SelectionBlueprintTestScene : OsuTestScene
{
- private SelectionBlueprint blueprint;
-
protected override Container Content => content ?? base.Content;
private readonly Container content;
@@ -26,23 +22,13 @@ namespace osu.Game.Tests.Visual
});
}
- [BackgroundDependencyLoader]
- private void load()
+ protected void AddBlueprint(SelectionBlueprint blueprint)
{
- blueprint = CreateBlueprint();
- blueprint.Depth = float.MinValue;
- blueprint.SelectionRequested += (_, __) => blueprint.Select();
-
- Add(blueprint);
-
- AddStep("Select", () => blueprint.Select());
- AddStep("Deselect", () => blueprint.Deselect());
- }
-
- protected override bool OnClick(ClickEvent e)
- {
- blueprint.Deselect();
- return true;
+ Add(blueprint.With(d =>
+ {
+ d.Depth = float.MinValue;
+ d.Select();
+ }));
}
protected abstract SelectionBlueprint CreateBlueprint();
From ba5c9547e14a74af6cee3cbfd61a9066bb944734 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Tue, 1 Oct 2019 19:33:08 +0900
Subject: [PATCH 010/373] Add more tests for hitcircle selection blueprint
---
.../TestSceneHitCircleSelectionBlueprint.cs | 45 +++++++++++++++++--
.../HitCircles/HitCircleSelectionBlueprint.cs | 6 +--
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
index 32043bf5d7..7278d923c1 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
@@ -1,10 +1,12 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
+using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
@@ -14,16 +16,53 @@ namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneHitCircleSelectionBlueprint : SelectionBlueprintTestScene
{
- private readonly DrawableHitCircle drawableObject;
+ private HitCircle hitCircle;
+ private DrawableHitCircle drawableObject;
+ private TestBlueprint blueprint;
- public TestSceneHitCircleSelectionBlueprint()
+ [SetUp]
+ public void Setup() => Schedule(() =>
{
- var hitCircle = new HitCircle { Position = new Vector2(256, 192) };
+ Clear();
+
+ hitCircle = new HitCircle { Position = new Vector2(256, 192) };
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
Add(drawableObject = new DrawableHitCircle(hitCircle));
+ AddBlueprint(blueprint = new TestBlueprint(drawableObject));
+ });
+
+ [Test]
+ public void TestInitialState()
+ {
+ AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
+ }
+
+ [Test]
+ public void TestMoveHitObject()
+ {
+ AddStep("move hitobject", () => hitCircle.Position = new Vector2(300, 225));
+ AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
+ }
+
+ [Test]
+ public void TestMoveAfterApplyingDefaults()
+ {
+ AddStep("apply defaults", () => hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }));
+ AddStep("move hitobject", () => hitCircle.Position = new Vector2(300, 225));
+ AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
}
protected override SelectionBlueprint CreateBlueprint() => new HitCircleSelectionBlueprint(drawableObject);
+
+ private class TestBlueprint : HitCircleSelectionBlueprint
+ {
+ public new HitCirclePiece CirclePiece => base.CirclePiece;
+
+ public TestBlueprint(DrawableHitCircle hitCircle)
+ : base(hitCircle)
+ {
+ }
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
index 430d4a0222..a191dba8ff 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
@@ -9,19 +9,19 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
public class HitCircleSelectionBlueprint : OsuSelectionBlueprint
{
- private readonly HitCirclePiece circlePiece;
+ protected readonly HitCirclePiece CirclePiece;
public HitCircleSelectionBlueprint(DrawableHitCircle hitCircle)
: base(hitCircle)
{
- InternalChild = circlePiece = new HitCirclePiece();
+ InternalChild = CirclePiece = new HitCirclePiece();
}
protected override void Update()
{
base.Update();
- circlePiece.UpdateFrom(HitObject);
+ CirclePiece.UpdateFrom(HitObject);
}
}
}
From 90ad1c5166fdc4dd116ff89554a585c28853774b Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Tue, 1 Oct 2019 19:33:24 +0900
Subject: [PATCH 011/373] Add more tests for slider selection blueprint
---
.../TestSceneSliderSelectionBlueprint.cs | 79 ++++++++++++++++++-
.../Sliders/SliderCircleSelectionBlueprint.cs | 7 +-
.../Sliders/SliderSelectionBlueprint.cs | 17 ++--
3 files changed, 90 insertions(+), 13 deletions(-)
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
index 8cf5a2f33e..61c8316ed9 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
@@ -3,11 +3,14 @@
using System;
using System.Collections.Generic;
+using NUnit.Framework;
+using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
+using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
@@ -29,11 +32,16 @@ namespace osu.Game.Rulesets.Osu.Tests
typeof(PathControlPointPiece)
};
- private readonly DrawableSlider drawableObject;
+ private Slider slider;
+ private DrawableSlider drawableObject;
+ private TestSliderBlueprint blueprint;
- public TestSceneSliderSelectionBlueprint()
+ [SetUp]
+ public void Setup() => Schedule(() =>
{
- var slider = new Slider
+ Clear();
+
+ slider = new Slider
{
Position = new Vector2(256, 192),
Path = new SliderPath(PathType.Bezier, new[]
@@ -47,8 +55,73 @@ namespace osu.Game.Rulesets.Osu.Tests
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
Add(drawableObject = new DrawableSlider(slider));
+ AddBlueprint(blueprint = new TestSliderBlueprint(drawableObject));
+ });
+
+ [Test]
+ public void TestInitialState()
+ {
+ checkPositions();
+ }
+
+ [Test]
+ public void TestMoveHitObject()
+ {
+ moveHitObject();
+ checkPositions();
+ }
+
+ [Test]
+ public void TestMoveAfterApplyingDefaults()
+ {
+ AddStep("apply defaults", () => slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }));
+ moveHitObject();
+ checkPositions();
+ }
+
+ private void moveHitObject()
+ {
+ AddStep("move hitobject", () =>
+ {
+ slider.Position = new Vector2(300, 225);
+ });
+ }
+
+ private void checkPositions()
+ {
+ AddAssert("body positioned correctly", () => blueprint.BodyPiece.Position == slider.Position);
+
+ AddAssert("head positioned correctly",
+ () => Precision.AlmostEquals(blueprint.HeadBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
+
+ AddAssert("tail positioned correctly",
+ () => Precision.AlmostEquals(blueprint.TailBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
}
protected override SelectionBlueprint CreateBlueprint() => new SliderSelectionBlueprint(drawableObject);
+
+ private class TestSliderBlueprint : SliderSelectionBlueprint
+ {
+ public new SliderBodyPiece BodyPiece => base.BodyPiece;
+ public new TestSliderCircleBlueprint HeadBlueprint => (TestSliderCircleBlueprint)base.HeadBlueprint;
+ public new TestSliderCircleBlueprint TailBlueprint => (TestSliderCircleBlueprint)base.TailBlueprint;
+
+ public TestSliderBlueprint(DrawableSlider slider)
+ : base(slider)
+ {
+ }
+
+ protected override SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new TestSliderCircleBlueprint(slider, position);
+ }
+
+ private class TestSliderCircleBlueprint : SliderCircleSelectionBlueprint
+ {
+ public new HitCirclePiece CirclePiece => base.CirclePiece;
+
+ public TestSliderCircleBlueprint(DrawableSlider slider, SliderPosition position)
+ : base(slider, position)
+ {
+ }
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
index 8f9a9c3a64..f09279ed73 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
@@ -9,14 +9,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint
{
+ protected readonly HitCirclePiece CirclePiece;
+
private readonly SliderPosition position;
- private readonly HitCirclePiece circlePiece;
public SliderCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position)
: base(slider)
{
this.position = position;
- InternalChild = circlePiece = new HitCirclePiece();
+ InternalChild = CirclePiece = new HitCirclePiece();
Select();
}
@@ -25,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
base.Update();
- circlePiece.UpdateFrom(position == SliderPosition.Start ? HitObject.HeadCircle : HitObject.TailCircle);
+ CirclePiece.UpdateFrom(position == SliderPosition.Start ? HitObject.HeadCircle : HitObject.TailCircle);
}
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
index bc760c9456..fdeffc6f8a 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
@@ -11,8 +11,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public class SliderSelectionBlueprint : OsuSelectionBlueprint
{
- private readonly SliderBodyPiece bodyPiece;
- private readonly SliderCircleSelectionBlueprint headBlueprint;
+ protected readonly SliderBodyPiece BodyPiece;
+ protected readonly SliderCircleSelectionBlueprint HeadBlueprint;
+ protected readonly SliderCircleSelectionBlueprint TailBlueprint;
public SliderSelectionBlueprint(DrawableSlider slider)
: base(slider)
@@ -21,9 +22,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
InternalChildren = new Drawable[]
{
- bodyPiece = new SliderBodyPiece(),
- headBlueprint = new SliderCircleSelectionBlueprint(slider, SliderPosition.Start),
- new SliderCircleSelectionBlueprint(slider, SliderPosition.End),
+ BodyPiece = new SliderBodyPiece(),
+ HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
+ TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
new PathControlPointVisualiser(sliderObject),
};
}
@@ -32,9 +33,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
base.Update();
- bodyPiece.UpdateFrom(HitObject);
+ BodyPiece.UpdateFrom(HitObject);
}
- public override Vector2 SelectionPoint => headBlueprint.SelectionPoint;
+ public override Vector2 SelectionPoint => HeadBlueprint.SelectionPoint;
+
+ protected virtual SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new SliderCircleSelectionBlueprint(slider, position);
}
}
From c5540048ab1608873b6377f2fa15bbd4b5b7ab01 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Tue, 1 Oct 2019 19:39:06 +0900
Subject: [PATCH 012/373] Fix tail circle not moving with slider position
changes
---
osu.Game.Rulesets.Osu/Objects/Slider.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs
index d8514092bc..3ed1f2cdde 100644
--- a/osu.Game.Rulesets.Osu/Objects/Slider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs
@@ -54,13 +54,13 @@ namespace osu.Game.Rulesets.Osu.Objects
{
base.Position = value;
+ endPositionCache.Invalidate();
+
if (HeadCircle != null)
HeadCircle.Position = value;
if (TailCircle != null)
TailCircle.Position = EndPosition;
-
- endPositionCache.Invalidate();
}
}
From 652acac87fa69d2debfd9ee18872e08379c4ad0e Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 16:14:42 +0900
Subject: [PATCH 013/373] Move placement movement event to BlueprintContainer
---
.../Blueprints/HoldNotePlacementBlueprint.cs | 11 ++++------
.../Blueprints/ManiaPlacementBlueprint.cs | 9 ++++----
.../HitCircles/HitCirclePlacementBlueprint.cs | 13 ++---------
.../Sliders/SliderPlacementBlueprint.cs | 20 +++++------------
.../Spinners/SpinnerPlacementBlueprint.cs | 5 +++++
osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 8 ++++++-
.../Compose/Components/BlueprintContainer.cs | 22 ++++++++++++++++++-
7 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs
index 26115311f7..bcbc1ee527 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs
@@ -3,7 +3,6 @@
using System;
using osu.Framework.Graphics;
-using osu.Framework.Input.Events;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects;
using osuTK;
@@ -49,13 +48,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
private double originalStartTime;
- protected override bool OnMouseMove(MouseMoveEvent e)
+ public override void UpdatePosition(Vector2 screenSpacePosition)
{
- base.OnMouseMove(e);
+ base.UpdatePosition(screenSpacePosition);
if (PlacementBegun)
{
- var endTime = TimeAt(e.ScreenSpaceMousePosition);
+ var endTime = TimeAt(screenSpacePosition);
HitObject.StartTime = endTime < originalStartTime ? endTime : originalStartTime;
HitObject.Duration = Math.Abs(endTime - originalStartTime);
@@ -65,10 +64,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
headPiece.Width = tailPiece.Width = SnappedWidth;
headPiece.X = tailPiece.X = SnappedMousePosition.X;
- originalStartTime = HitObject.StartTime = TimeAt(e.ScreenSpaceMousePosition);
+ originalStartTime = HitObject.StartTime = TimeAt(screenSpacePosition);
}
-
- return true;
}
}
}
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
index d3779e2e18..7ad38860dd 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
@@ -62,19 +62,18 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
return base.OnMouseUp(e);
}
- protected override bool OnMouseMove(MouseMoveEvent e)
+ public override void UpdatePosition(Vector2 screenSpacePosition)
{
if (!PlacementBegun)
- Column = ColumnAt(e.ScreenSpaceMousePosition);
+ Column = ColumnAt(screenSpacePosition);
- if (Column == null) return false;
+ if (Column == null) return;
SnappedWidth = Column.DrawWidth;
// Snap to the column
var parentPos = Parent.ToLocalSpace(Column.ToScreenSpace(new Vector2(Column.DrawWidth / 2, 0)));
- SnappedMousePosition = new Vector2(parentPos.X, e.MousePosition.Y);
- return true;
+ SnappedMousePosition = new Vector2(parentPos.X, Parent.ToLocalSpace(screenSpacePosition).Y);
}
protected double TimeAt(Vector2 screenSpacePosition)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
index a4050f0c31..0f6bee19bb 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
@@ -19,14 +19,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
InternalChild = new HitCirclePiece(HitObject);
}
- protected override void LoadComplete()
- {
- base.LoadComplete();
-
- // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
- HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero;
- }
-
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
@@ -34,10 +26,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
return true;
}
- protected override bool OnMouseMove(MouseMoveEvent e)
+ public override void UpdatePosition(Vector2 screenSpacePosition)
{
- HitObject.Position = e.MousePosition;
- return true;
+ HitObject.Position = ToLocalSpace(screenSpacePosition);
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
index 55de626d7d..62c879b05e 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
@@ -47,28 +47,18 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
setState(PlacementState.Initial);
}
- protected override void LoadComplete()
- {
- base.LoadComplete();
-
- // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
- HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero;
- }
-
- protected override bool OnMouseMove(MouseMoveEvent e)
+ public override void UpdatePosition(Vector2 screenSpacePosition)
{
switch (state)
{
case PlacementState.Initial:
- HitObject.Position = e.MousePosition;
- return true;
+ HitObject.Position = ToLocalSpace(screenSpacePosition);
+ break;
case PlacementState.Body:
- cursor = e.MousePosition - HitObject.Position;
- return true;
+ cursor = ToLocalSpace(screenSpacePosition) - HitObject.Position;
+ break;
}
-
- return false;
}
protected override bool OnClick(ClickEvent e)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
index 03d761c67f..730b8448de 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
@@ -7,6 +7,7 @@ using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
@@ -43,5 +44,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
return true;
}
+
+ public override void UpdatePosition(Vector2 screenSpacePosition)
+ {
+ }
}
}
diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
index 757c269358..290fd8d27d 100644
--- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
+++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
@@ -108,6 +108,12 @@ namespace osu.Game.Rulesets.Edit
placementHandler.EndPlacement(HitObject);
}
+ ///
+ /// Updates the position of this to a new screen-space position.
+ ///
+ /// The screen-space position.
+ public abstract void UpdatePosition(Vector2 screenSpacePosition);
+
///
/// Invokes ,
/// refreshing and parameters for the .
@@ -125,7 +131,7 @@ namespace osu.Game.Rulesets.Edit
case ScrollEvent _:
return false;
- case MouseEvent _:
+ case MouseButtonEvent _:
return true;
default:
diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
index 7d25fd5283..d96d88c2b9 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
@@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
+using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Rulesets.Edit;
@@ -22,8 +23,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
private Container placementBlueprintContainer;
private PlacementBlueprint currentPlacement;
-
private SelectionHandler selectionHandler;
+ private InputManager inputManager;
private IEnumerable selections => selectionBlueprints.Children.Where(c => c.IsAlive);
@@ -66,6 +67,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
beatmap.HitObjectAdded += addBlueprintFor;
beatmap.HitObjectRemoved += removeBlueprintFor;
+
+ inputManager = GetContainingInputManager();
}
private HitObjectCompositionTool currentTool;
@@ -136,6 +139,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
return true;
}
+ protected override bool OnMouseMove(MouseMoveEvent e)
+ {
+ if (currentPlacement != null)
+ {
+ currentPlacement.UpdatePosition(e.ScreenSpaceMousePosition);
+ return true;
+ }
+
+ return base.OnMouseMove(e);
+ }
+
protected override void Update()
{
base.Update();
@@ -158,8 +172,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
currentPlacement = null;
var blueprint = CurrentTool?.CreatePlacementBlueprint();
+
if (blueprint != null)
+ {
placementBlueprintContainer.Child = currentPlacement = blueprint;
+
+ // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
+ blueprint.UpdatePosition(inputManager.CurrentState.Mouse.Position);
+ }
}
///
From f2ba87a1d2a2f66fa423a682a0eb2ef0f7edef9c Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 16:28:56 +0900
Subject: [PATCH 014/373] Fix placement blueprint test scenes not working
---
.../Visual/PlacementBlueprintTestScene.cs | 34 +++++++++++++++++--
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs
index 2b177e264f..0688620b8e 100644
--- a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs
+++ b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs
@@ -4,6 +4,8 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Input;
+using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
@@ -18,16 +20,17 @@ namespace osu.Game.Tests.Visual
protected Container HitObjectContainer;
private PlacementBlueprint currentBlueprint;
+ private InputManager inputManager;
+
protected PlacementBlueprintTestScene()
{
- Add(HitObjectContainer = CreateHitObjectContainer());
+ Add(HitObjectContainer = CreateHitObjectContainer().With(c => c.Clock = new FramedClock(new StopwatchClock())));
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
- Add(currentBlueprint = CreateBlueprint());
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
@@ -38,6 +41,14 @@ namespace osu.Game.Tests.Visual
return dependencies;
}
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ inputManager = GetContainingInputManager();
+ Add(currentBlueprint = CreateBlueprint());
+ }
+
public void BeginPlacement(HitObject hitObject)
{
}
@@ -54,10 +65,27 @@ namespace osu.Game.Tests.Visual
{
}
- protected virtual Container CreateHitObjectContainer() => new Container { RelativeSizeAxes = Axes.Both };
+ protected override bool OnMouseMove(MouseMoveEvent e)
+ {
+ currentBlueprint.UpdatePosition(e.ScreenSpaceMousePosition);
+ return true;
+ }
+
+ public override void Add(Drawable drawable)
+ {
+ base.Add(drawable);
+
+ if (drawable is PlacementBlueprint blueprint)
+ {
+ blueprint.Show();
+ blueprint.UpdatePosition(inputManager.CurrentState.Mouse.Position);
+ }
+ }
protected virtual void AddHitObject(DrawableHitObject hitObject) => HitObjectContainer.Add(hitObject);
+ protected virtual Container CreateHitObjectContainer() => new Container { RelativeSizeAxes = Axes.Both };
+
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
protected abstract PlacementBlueprint CreateBlueprint();
}
From ee34c5ccb457e582868ced659a6d0f952cb98665 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:21:00 +0900
Subject: [PATCH 015/373] Add a flip step to mania placement test scenes
---
.../ManiaPlacementBlueprintTestScene.cs | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs b/osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs
index 4b3786c30a..afde1c9521 100644
--- a/osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs
+++ b/osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs
@@ -27,8 +27,13 @@ namespace osu.Game.Rulesets.Mania.Tests
[Cached(typeof(IReadOnlyList))]
private IReadOnlyList mods { get; set; } = Array.Empty();
+ [Cached(typeof(IScrollingInfo))]
+ private IScrollingInfo scrollingInfo;
+
protected ManiaPlacementBlueprintTestScene()
{
+ scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo;
+
Add(column = new Column(0)
{
Anchor = Anchor.Centre,
@@ -36,15 +41,8 @@ namespace osu.Game.Rulesets.Mania.Tests
AccentColour = Color4.OrangeRed,
Clock = new FramedClock(new StopwatchClock()), // No scroll
});
- }
- protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
- {
- var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
-
- dependencies.CacheAs(((ScrollingTestContainer)HitObjectContainer).ScrollingInfo);
-
- return dependencies;
+ AddStep("change direction", () => ((ScrollingTestContainer)HitObjectContainer).Flip());
}
protected override Container CreateHitObjectContainer() => new ScrollingTestContainer(ScrollingDirection.Down) { RelativeSizeAxes = Axes.Both };
From 754fbc59e1a96f2dc7da030dce850a0cb5231e78 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:21:36 +0900
Subject: [PATCH 016/373] Fix note placement being offset
---
.../Edit/Blueprints/ManiaPlacementBlueprint.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
index d3779e2e18..f7d21ddf55 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
@@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
// If we're scrolling downwards, a position of 0 is actually further away from the hit target
// so we need to flip the vertical coordinate in the hitobject container's space
- var hitObjectPos = Column.HitObjectContainer.ToLocalSpace(applyPositionOffset(screenSpacePosition, false)).Y;
+ var hitObjectPos = applyPositionOffset(Column.HitObjectContainer.ToLocalSpace(screenSpacePosition), false).Y;
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
hitObjectPos = hitObjectContainer.DrawHeight - hitObjectPos;
From 0a409075be251fbc1acbebfdfa80f81204d8f0a6 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:21:50 +0900
Subject: [PATCH 017/373] Fix note placement offset not working for down-scroll
---
.../Blueprints/ManiaPlacementBlueprint.cs | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
index f7d21ddf55..83282f9990 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
@@ -111,8 +111,23 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
private Vector2 applyPositionOffset(Vector2 position, bool reverse)
{
- position.Y += (scrollingInfo.Direction.Value == ScrollingDirection.Up && !reverse ? -1 : 1) * NotePiece.NOTE_HEIGHT / 2;
- return position;
+ float offset = 0;
+
+ switch (scrollingInfo.Direction.Value)
+ {
+ case ScrollingDirection.Up:
+ offset = -NotePiece.NOTE_HEIGHT / 2;
+ break;
+
+ case ScrollingDirection.Down:
+ offset = NotePiece.NOTE_HEIGHT / 2;
+ break;
+ }
+
+ if (reverse)
+ offset = -offset;
+
+ return new Vector2(position.X, position.Y + offset);
}
}
}
From 39369620fa530000cf22dc6b1643b932b738dda1 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:22:06 +0900
Subject: [PATCH 018/373] Remove position offset from ColumnAt
---
.../Edit/Blueprints/ManiaPlacementBlueprint.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
index 83282f9990..a0feecee3b 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
@@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
}
protected Column ColumnAt(Vector2 screenSpacePosition)
- => composer.ColumnAt(applyPositionOffset(screenSpacePosition, false));
+ => composer.ColumnAt(screenSpacePosition);
private Vector2 applyPositionOffset(Vector2 position, bool reverse)
{
From f1ff22cf8bc1612aef947df2bdafd4e0e0d2cafd Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:23:13 +0900
Subject: [PATCH 019/373] Fix hold note blueprint placing in the wrong
direction
---
.../Edit/Blueprints/ManiaPlacementBlueprint.cs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
index a0feecee3b..4a187b1942 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
@@ -103,6 +103,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
scrollingInfo.TimeRange.Value,
Column.HitObjectContainer.DrawHeight);
+ if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
+ pos = Column.HitObjectContainer.DrawHeight - pos;
+
return applyPositionOffset(Column.HitObjectContainer.ToSpaceOfOtherDrawable(new Vector2(0, pos), Parent), true).Y;
}
From 80585d446c108268e3261933caf9ef2f3d56f1c6 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:27:39 +0900
Subject: [PATCH 020/373] Split applyPositionOffset into two methods and add
xmldocs
---
.../Blueprints/ManiaPlacementBlueprint.cs | 44 ++++++++++++++-----
1 file changed, 34 insertions(+), 10 deletions(-)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
index 4a187b1942..e83c85b40e 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs
@@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
// If we're scrolling downwards, a position of 0 is actually further away from the hit target
// so we need to flip the vertical coordinate in the hitobject container's space
- var hitObjectPos = applyPositionOffset(Column.HitObjectContainer.ToLocalSpace(screenSpacePosition), false).Y;
+ var hitObjectPos = mouseToHitObjectPosition(Column.HitObjectContainer.ToLocalSpace(screenSpacePosition)).Y;
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
hitObjectPos = hitObjectContainer.DrawHeight - hitObjectPos;
@@ -106,31 +106,55 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
pos = Column.HitObjectContainer.DrawHeight - pos;
- return applyPositionOffset(Column.HitObjectContainer.ToSpaceOfOtherDrawable(new Vector2(0, pos), Parent), true).Y;
+ return hitObjectToMousePosition(Column.HitObjectContainer.ToSpaceOfOtherDrawable(new Vector2(0, pos), Parent)).Y;
}
protected Column ColumnAt(Vector2 screenSpacePosition)
=> composer.ColumnAt(screenSpacePosition);
- private Vector2 applyPositionOffset(Vector2 position, bool reverse)
+ ///
+ /// Converts a mouse position to a hitobject position.
+ ///
+ ///
+ /// Blueprints are centred on the mouse position, such that the hitobject position is anchored at the top or bottom of the blueprint depending on the scroll direction.
+ ///
+ /// The mouse position.
+ /// The resulting hitobject position, acnhored at the top or bottom of the blueprint depending on the scroll direction.
+ private Vector2 mouseToHitObjectPosition(Vector2 mousePosition)
{
- float offset = 0;
-
switch (scrollingInfo.Direction.Value)
{
case ScrollingDirection.Up:
- offset = -NotePiece.NOTE_HEIGHT / 2;
+ mousePosition.Y -= NotePiece.NOTE_HEIGHT / 2;
break;
case ScrollingDirection.Down:
- offset = NotePiece.NOTE_HEIGHT / 2;
+ mousePosition.Y += NotePiece.NOTE_HEIGHT / 2;
break;
}
- if (reverse)
- offset = -offset;
+ return mousePosition;
+ }
- return new Vector2(position.X, position.Y + offset);
+ ///
+ /// Converts a hitobject position to a mouse position.
+ ///
+ /// The hitobject position.
+ /// The resulting mouse position, anchored at the centre of the hitobject.
+ private Vector2 hitObjectToMousePosition(Vector2 hitObjectPosition)
+ {
+ switch (scrollingInfo.Direction.Value)
+ {
+ case ScrollingDirection.Up:
+ hitObjectPosition.Y += NotePiece.NOTE_HEIGHT / 2;
+ break;
+
+ case ScrollingDirection.Down:
+ hitObjectPosition.Y -= NotePiece.NOTE_HEIGHT / 2;
+ break;
+ }
+
+ return hitObjectPosition;
}
}
}
From 2d0c52239893526a28be0e01eacf74b18bab0ee3 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 3 Oct 2019 18:43:46 +0900
Subject: [PATCH 021/373] Remove unused method
---
.../TestSceneHoldNoteSelectionBlueprint.cs | 3 ---
.../TestSceneNoteSelectionBlueprint.cs | 3 ---
.../TestSceneHitCircleSelectionBlueprint.cs | 3 ---
.../TestSceneSliderSelectionBlueprint.cs | 3 ---
.../TestSceneSpinnerSelectionBlueprint.cs | 3 ---
osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs | 2 --
6 files changed, 17 deletions(-)
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
index 5507ca2ba0..90394f3d1b 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
@@ -6,7 +6,6 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
-using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
@@ -53,7 +52,5 @@ namespace osu.Game.Rulesets.Mania.Tests
nested.Y = (float)(-finalPosition * content.DrawHeight);
}
}
-
- protected override SelectionBlueprint CreateBlueprint() => new HoldNoteSelectionBlueprint(null);
}
}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
index c0482e2150..1514bdf0bd 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
@@ -5,7 +5,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
@@ -37,7 +36,5 @@ namespace osu.Game.Rulesets.Mania.Tests
AddBlueprint(new NoteSelectionBlueprint(drawableObject));
}
-
- protected override SelectionBlueprint CreateBlueprint() => new NoteSelectionBlueprint(null);
}
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
index 7278d923c1..d4cdabdb07 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
@@ -53,8 +52,6 @@ namespace osu.Game.Rulesets.Osu.Tests
AddAssert("blueprint positioned over hitobject", () => blueprint.CirclePiece.Position == hitCircle.Position);
}
- protected override SelectionBlueprint CreateBlueprint() => new HitCircleSelectionBlueprint(drawableObject);
-
private class TestBlueprint : HitCircleSelectionBlueprint
{
public new HitCirclePiece CirclePiece => base.CirclePiece;
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
index 61c8316ed9..ec23ec31b2 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
@@ -7,7 +7,6 @@ using NUnit.Framework;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
@@ -98,8 +97,6 @@ namespace osu.Game.Rulesets.Osu.Tests
() => Precision.AlmostEquals(blueprint.TailBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
}
- protected override SelectionBlueprint CreateBlueprint() => new SliderSelectionBlueprint(drawableObject);
-
private class TestSliderBlueprint : SliderSelectionBlueprint
{
public new SliderBodyPiece BodyPiece => base.BodyPiece;
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
index 1c195311a4..d777ca3610 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
@@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
@@ -47,7 +46,5 @@ namespace osu.Game.Rulesets.Osu.Tests
AddBlueprint(new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) });
}
-
- protected override SelectionBlueprint CreateBlueprint() => new SpinnerSelectionBlueprint(null) { Size = new Vector2(0.5f) };
}
}
diff --git a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
index 55dda03b16..f53c12b047 100644
--- a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
+++ b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
@@ -30,7 +30,5 @@ namespace osu.Game.Tests.Visual
d.Select();
}));
}
-
- protected abstract SelectionBlueprint CreateBlueprint();
}
}
From d2c9a29c0d4bf8f805dbead933156a57ea466d75 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Fri, 4 Oct 2019 10:45:18 +0800
Subject: [PATCH 022/373] Remove unnecessary local assign
---
osu.Game/Screens/Select/SongSelect.cs | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 5ab49fa2b9..e97fac96c5 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -66,11 +66,7 @@ namespace osu.Game.Screens.Select
///
protected readonly Container FooterPanels;
- protected override BackgroundScreen CreateBackground()
- {
- var background = new BackgroundScreenBeatmap();
- return background;
- }
+ protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
protected readonly BeatmapCarousel Carousel;
private readonly BeatmapInfoWedge beatmapInfoWedge;
From 7b414092afd261c953fd9f51f9bdf93632021523 Mon Sep 17 00:00:00 2001
From: iiSaLMaN
Date: Fri, 4 Oct 2019 17:35:41 +0300
Subject: [PATCH 023/373] Implement beatmap ruleset selector
---
.../BeatmapSet/BeatmapRulesetSelector.cs | 50 ++++++
.../BeatmapSet/BeatmapRulesetTabItem.cs | 148 ++++++++++++++++++
2 files changed, 198 insertions(+)
create mode 100644 osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
create mode 100644 osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
new file mode 100644
index 0000000000..0847272e1f
--- /dev/null
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
@@ -0,0 +1,50 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.UserInterface;
+using osu.Game.Beatmaps;
+using osu.Game.Rulesets;
+using osuTK;
+using System.Linq;
+
+namespace osu.Game.Overlays.BeatmapSet
+{
+ public class BeatmapRulesetSelector : RulesetSelector
+ {
+ private BeatmapSetInfo beatmapSet;
+
+ public BeatmapSetInfo BeatmapSet
+ {
+ get => beatmapSet;
+ set
+ {
+ if (value == beatmapSet)
+ return;
+
+ beatmapSet = value;
+
+ foreach (BeatmapRulesetTabItem tab in TabContainer.TabItems)
+ tab.SetBeatmaps(beatmapSet?.Beatmaps.FindAll(b => b.Ruleset.Equals(tab.Value)));
+
+ var firstRuleset = beatmapSet?.Beatmaps.OrderBy(b => b.Ruleset.ID).FirstOrDefault()?.Ruleset;
+ SelectTab(TabContainer.TabItems.FirstOrDefault(t => t.Value.Equals(firstRuleset)));
+ }
+ }
+
+ public BeatmapRulesetSelector()
+ {
+ AutoSizeAxes = Axes.Both;
+ TabContainer.Spacing = new Vector2(10, 0);
+ }
+
+ protected override TabItem CreateTabItem(RulesetInfo value) => new BeatmapRulesetTabItem(value);
+
+ protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
+ {
+ Direction = FillDirection.Horizontal,
+ AutoSizeAxes = Axes.Both,
+ };
+ }
+}
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs
new file mode 100644
index 0000000000..19c9af13d5
--- /dev/null
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs
@@ -0,0 +1,148 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Input.Events;
+using osu.Game.Beatmaps;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Rulesets;
+using osuTK;
+using osuTK.Graphics;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace osu.Game.Overlays.BeatmapSet
+{
+ public class BeatmapRulesetTabItem : TabItem
+ {
+ private readonly OsuSpriteText name, count;
+ private readonly Box bar;
+
+ public override bool PropagatePositionalInputSubTree => Enabled.Value && !Active.Value && base.PropagatePositionalInputSubTree;
+
+ public BeatmapRulesetTabItem(RulesetInfo value)
+ : base(value)
+ {
+ AutoSizeAxes = Axes.Both;
+ Masking = true;
+
+ FillFlowContainer nameContainer;
+
+ Children = new Drawable[]
+ {
+ nameContainer = new FillFlowContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Margin = new MarginPadding { Bottom = 7.5f },
+ Spacing = new Vector2(2.5f),
+ Children = new Drawable[]
+ {
+ name = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Text = value.Name,
+ Font = OsuFont.Default.With(size: 18),
+ },
+ new Container
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Both,
+ Masking = true,
+ CornerRadius = 4f,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black.Opacity(0.5f),
+ },
+ count = new OsuSpriteText
+ {
+ Alpha = 0,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Margin = new MarginPadding { Horizontal = 5f },
+ Font = OsuFont.Default.With(weight: FontWeight.SemiBold),
+ }
+ }
+ }
+ }
+ },
+ bar = new Box
+ {
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
+ RelativeSizeAxes = Axes.X,
+ Height = 4f,
+ },
+ new HoverClickSounds(),
+ };
+
+ Enabled.BindValueChanged(v => nameContainer.Alpha = v.NewValue ? 1f : 0.5f, true);
+ }
+
+ [Resolved]
+ private OsuColour colour { get; set; }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ count.Colour = colour.Gray9;
+ bar.Colour = colour.Blue;
+
+ updateState();
+ }
+
+ public void SetBeatmaps(List beatmaps)
+ {
+ Trace.Assert(beatmaps?.TrueForAll(b => b.Ruleset.Equals(Value)) ?? true, "A beatmap has a ruleset not of this tab value");
+
+ count.Text = beatmaps?.Count.ToString();
+
+ var hasBeatmaps = (beatmaps?.Count ?? 0) > 0;
+ count.Alpha = hasBeatmaps ? 1f : 0f;
+ Enabled.Value = hasBeatmaps;
+ }
+
+ private void updateState()
+ {
+ var isHoveredOrActive = IsHovered || Active.Value;
+ name.Colour = isHoveredOrActive ? colour.GrayE : colour.GrayC;
+ bar.MoveToY(isHoveredOrActive ? 0f : bar.Height, 120);
+
+ name.Font = name.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Regular);
+ }
+
+ #region Hovering and activation logic
+
+ protected override void OnActivated() => updateState();
+
+ protected override void OnDeactivated() => updateState();
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ updateState();
+ return false;
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ updateState();
+ }
+
+ #endregion
+ }
+}
From edddbdb7845a250002ee5dd111750b3290a29401 Mon Sep 17 00:00:00 2001
From: iiSaLMaN
Date: Fri, 4 Oct 2019 17:37:09 +0300
Subject: [PATCH 024/373] Add tests for beatmap ruleset selector
---
.../Online/TestSceneBeatmapRulesetSelector.cs | 102 ++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100644 osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs
new file mode 100644
index 0000000000..1f8df438fb
--- /dev/null
+++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs
@@ -0,0 +1,102 @@
+// 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.UserInterface;
+using osu.Game.Beatmaps;
+using osu.Game.Overlays.BeatmapSet;
+using osu.Game.Rulesets;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace osu.Game.Tests.Visual.Online
+{
+ public class TestSceneBeatmapRulesetSelector : OsuTestScene
+ {
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(BeatmapRulesetSelector),
+ typeof(BeatmapRulesetTabItem),
+ };
+
+ private readonly TestRulesetSelector selector;
+
+ public TestSceneBeatmapRulesetSelector()
+ {
+ Add(selector = new TestRulesetSelector());
+ }
+
+ [Resolved]
+ private RulesetStore rulesets { get; set; }
+
+ [Test]
+ public void TestMultipleRulesetsBeatmapSet()
+ {
+ var enabledRulesets = rulesets.AvailableRulesets.Skip(1).Take(2);
+
+ AddStep("load multiple rulesets beatmapset", () =>
+ {
+ selector.BeatmapSet = new BeatmapSetInfo
+ {
+ Beatmaps = enabledRulesets.Select(r => new BeatmapInfo { Ruleset = r }).ToList()
+ };
+ });
+
+ var tabItems = selector.TabContainer.TabItems;
+ AddAssert("other rulesets disabled", () => tabItems.Except(tabItems.Where(t => enabledRulesets.Any(r => r.Equals(t.Value)))).All(t => !t.Enabled.Value));
+ AddAssert("left-most ruleset selected", () => tabItems.First(t => t.Enabled.Value).Active.Value);
+ }
+
+ [Test]
+ public void TestSingleRulesetBeatmapSet()
+ {
+ var enabledRuleset = rulesets.AvailableRulesets.Last();
+
+ AddStep("load single ruleset beatmapset", () =>
+ {
+ selector.BeatmapSet = new BeatmapSetInfo
+ {
+ Beatmaps = new List
+ {
+ new BeatmapInfo
+ {
+ Ruleset = enabledRuleset
+ }
+ }
+ };
+ });
+
+ AddAssert("single ruleset selected", () => selector.SelectedTab.Value.Equals(enabledRuleset));
+ }
+
+ [Test]
+ public void TestEmptyBeatmapSet()
+ {
+ AddStep("load empty beatmapset", () => selector.BeatmapSet = new BeatmapSetInfo
+ {
+ Beatmaps = new List()
+ });
+
+ AddAssert("no ruleset selected", () => selector.SelectedTab == null);
+ AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value));
+ }
+
+ [Test]
+ public void TestNullBeatmapSet()
+ {
+ AddStep("load null beatmapset", () => selector.BeatmapSet = null);
+
+ AddAssert("no ruleset selected", () => selector.SelectedTab == null);
+ AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value));
+ }
+
+ private class TestRulesetSelector : BeatmapRulesetSelector
+ {
+ public new TabItem SelectedTab => base.SelectedTab;
+
+ public new TabFillFlowContainer TabContainer => base.TabContainer;
+ }
+ }
+}
From 76c74719a44f2aa461cebf93cd2b71e476663632 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Fri, 4 Oct 2019 17:00:51 +0200
Subject: [PATCH 025/373] Add test for fallback decoder overwrite
LegacyDifficultyCalculatorBeatmapDecoder was registered as a fallback
decoder in commit ffde389 for future use in the server-side difficulty
calculation components. Due to the pre-existing fallback registrations
this causes a runtime crash when the diffcalc components are started.
Add a test reproducing this scenario to prevent the issue from
resurfacing in the future.
---
.../Formats/LegacyBeatmapDecoderTest.cs | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
index f6c0dbbecf..de516d3142 100644
--- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
@@ -591,5 +591,27 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.Throws(() => Decoder.GetDecoder(stream));
}
}
+
+ [Test]
+ public void TestAllowFallbackDecoderOverwrite()
+ {
+ Decoder decoder = null;
+
+ using (var resStream = TestResources.OpenResource("corrupted-header.osu"))
+ using (var stream = new LineBufferedReader(resStream))
+ {
+ Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder(stream));
+ Assert.IsInstanceOf(decoder);
+ }
+
+ Assert.DoesNotThrow(LegacyDifficultyCalculatorBeatmapDecoder.Register);
+
+ using (var resStream = TestResources.OpenResource("corrupted-header.osu"))
+ using (var stream = new LineBufferedReader(resStream))
+ {
+ Assert.DoesNotThrow(() => decoder = Decoder.GetDecoder(stream));
+ Assert.IsInstanceOf(decoder);
+ }
+ }
}
}
From 0c4f24825969c64775705b8feb9297af2f4fc9ac Mon Sep 17 00:00:00 2001
From: iiSaLMaN
Date: Fri, 4 Oct 2019 18:02:13 +0300
Subject: [PATCH 026/373] Fix CI issues
---
osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
index 0847272e1f..1abe103fc8 100644
--- a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
@@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet
beatmapSet = value;
- foreach (BeatmapRulesetTabItem tab in TabContainer.TabItems)
+ foreach (var tab in TabContainer.TabItems.OfType())
tab.SetBeatmaps(beatmapSet?.Beatmaps.FindAll(b => b.Ruleset.Equals(tab.Value)));
var firstRuleset = beatmapSet?.Beatmaps.OrderBy(b => b.Ruleset.ID).FirstOrDefault()?.Ruleset;
From 7c2c537bc9cca82740ea9df51f65c3f8047de372 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Fri, 4 Oct 2019 17:23:33 +0200
Subject: [PATCH 027/373] Allow fallback decoder overwrite
To fix the runtime crashes in difficulty calculation components, remove
the check for pre-existing fallback registration along with
the exception. The xmldoc for the registration function has been
extended to make users aware of possible consequences of calling it.
---
osu.Game/Beatmaps/Formats/Decoder.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs
index 045eb2d14d..40c329eb7e 100644
--- a/osu.Game/Beatmaps/Formats/Decoder.cs
+++ b/osu.Game/Beatmaps/Formats/Decoder.cs
@@ -93,14 +93,12 @@ namespace osu.Game.Beatmaps.Formats
///
/// Registers a fallback decoder instantiation function.
/// The fallback will be returned if the first non-empty line of the decoded stream does not match any known magic.
+ /// Calling this method will overwrite any existing global fallback registration for type - use with caution.
///
/// Type of object being decoded.
/// A function that constructs the fallback.
protected static void SetFallbackDecoder(Func constructor)
{
- if (fallback_decoders.ContainsKey(typeof(T)))
- throw new InvalidOperationException($"A fallback decoder was already added for type {typeof(T)}.");
-
fallback_decoders[typeof(T)] = constructor;
}
}
From 6985249d90e63e8e18ca92dd31c056eed82f35af Mon Sep 17 00:00:00 2001
From: iiSaLMaN
Date: Fri, 4 Oct 2019 21:18:03 +0300
Subject: [PATCH 028/373] Simplify properties
---
osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
index 1abe103fc8..bfb188a83b 100644
--- a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
@@ -36,15 +36,15 @@ namespace osu.Game.Overlays.BeatmapSet
public BeatmapRulesetSelector()
{
AutoSizeAxes = Axes.Both;
- TabContainer.Spacing = new Vector2(10, 0);
}
protected override TabItem CreateTabItem(RulesetInfo value) => new BeatmapRulesetTabItem(value);
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
- Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(10, 0),
};
}
}
From e7ba6ef5c43fcf1c55d93a86cb0773ea4d8070f2 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Fri, 4 Oct 2019 14:32:43 -0700
Subject: [PATCH 029/373] Fix keybinding order of beatmap options
---
osu.Game/Screens/Select/PlaySongSelect.cs | 2 +-
osu.Game/Screens/Select/SongSelect.cs | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs
index 4df6e6a3f3..9368bac69f 100644
--- a/osu.Game/Screens/Select/PlaySongSelect.cs
+++ b/osu.Game/Screens/Select/PlaySongSelect.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select
{
ValidForResume = false;
Edit();
- }, Key.Number3);
+ }, Key.Number4);
}
public override void OnResuming(IScreen last)
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 452c63a18c..ee2e40dcd9 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -230,9 +230,9 @@ namespace osu.Game.Screens.Select
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
- BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
- BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
- BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
+ BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number1, float.MaxValue);
+ BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number2);
+ BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number3);
}
if (this.beatmaps == null)
From 5d460eaf6b8a9c05d54c61f2cd01cfddb2636386 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Fri, 4 Oct 2019 17:14:19 -0700
Subject: [PATCH 030/373] Remove depth specification and button order
regression
---
osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs | 5 ++---
osu.Game/Screens/Select/SongSelect.cs | 6 +++---
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
index ede526f9da..b831ae274c 100644
--- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
+++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
@@ -93,7 +93,7 @@ namespace osu.Game.Screens.Select.Options
/// Lower depth to be put on the left, and higher to be put on the right.
/// Notice this is different to !
///
- public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action, Key? hotkey = null, float depth = 0)
+ public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action, Key? hotkey = null)
{
var button = new BeatmapOptionsButton
{
@@ -101,7 +101,6 @@ namespace osu.Game.Screens.Select.Options
SecondLineText = secondLine,
Icon = icon,
ButtonColour = colour,
- Depth = depth,
Action = () =>
{
Hide();
@@ -110,7 +109,7 @@ namespace osu.Game.Screens.Select.Options
HotKey = hotkey
};
- buttonsContainer.Insert((int)depth, button);
+ buttonsContainer.Add(button);
}
}
}
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index ee2e40dcd9..59a143728c 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -230,9 +230,9 @@ namespace osu.Game.Screens.Select
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
- BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number1, float.MaxValue);
- BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number2);
- BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number3);
+ BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
+ BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
+ BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number3);
}
if (this.beatmaps == null)
From de658c932e6ef23ce6511d15cabf28b836f94416 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Fri, 4 Oct 2019 17:22:42 -0700
Subject: [PATCH 031/373] Fix test regression
---
.../Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs
index ecdc484887..f55c099d83 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs
@@ -18,8 +18,8 @@ namespace osu.Game.Tests.Visual.SongSelect
overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, Color4.Purple, null, Key.Number1);
overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, Color4.Purple, null, Key.Number2);
- overlay.AddButton(@"Edit", @"Beatmap", FontAwesome.Solid.PencilAlt, Color4.Yellow, null, Key.Number3);
- overlay.AddButton(@"Delete", @"Beatmap", FontAwesome.Solid.Trash, Color4.Pink, null, Key.Number4, float.MaxValue);
+ overlay.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, Color4.Pink, null, Key.Number3);
+ overlay.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, Color4.Yellow, null, Key.Number4);
Add(overlay);
From a71db11ea544cacf62fdd22da93a9f89a6523f5c Mon Sep 17 00:00:00 2001
From: Joehu
Date: Fri, 4 Oct 2019 18:38:44 -0700
Subject: [PATCH 032/373] Remove depth parameter description
---
osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs | 4 ----
1 file changed, 4 deletions(-)
diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
index b831ae274c..c01970f536 100644
--- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
+++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
@@ -89,10 +89,6 @@ namespace osu.Game.Screens.Select.Options
/// Icon of the button.
/// Hotkey of the button.
/// Binding the button does.
- ///
- /// Lower depth to be put on the left, and higher to be put on the right.
- /// Notice this is different to !
- ///
public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action, Key? hotkey = null)
{
var button = new BeatmapOptionsButton
From e257f4ca04481e6b43ef8ec52337c7c364218b56 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Sat, 5 Oct 2019 10:31:44 -0700
Subject: [PATCH 033/373] Resume music to same position when exiting gameplay
---
osu.Game/Screens/Select/SongSelect.cs | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 59a143728c..d9ddfa2a94 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -413,7 +413,7 @@ namespace osu.Game.Screens.Select
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, previous);
if (this.IsCurrentScreen() && Beatmap.Value?.Track != previous?.Track)
- ensurePlayingSelected();
+ ensurePlayingSelected(true);
if (beatmap != null)
{
@@ -585,18 +585,14 @@ namespace osu.Game.Screens.Select
{
Track track = Beatmap.Value.Track;
- if (!track.IsRunning || restart)
+ if (!track.IsRunning)
{
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
- if (music != null)
- {
- // use the global music controller (when available) to cancel a potential local user paused state.
- music.SeekTo(track.RestartPoint);
- music.Play();
- }
- else
+ if (restart)
track.Restart();
+ else
+ track.Start();
}
}
From bdea75b99584c2624cfc9acff6fc811f332ebc07 Mon Sep 17 00:00:00 2001
From: Roman Kapustin
Date: Sat, 5 Oct 2019 23:53:05 +0300
Subject: [PATCH 034/373] Autoscroll playlist on song change
---
osu.Game/Configuration/OsuConfigManager.cs | 5 +++-
osu.Game/Overlays/Music/PlaylistList.cs | 11 +++++++-
.../Sections/Audio/PlaylistSettings.cs | 27 +++++++++++++++++++
.../Settings/Sections/AudioSection.cs | 1 +
4 files changed, 42 insertions(+), 2 deletions(-)
create mode 100644 osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs
diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs
index c0ce08ba08..75cc961a9e 100644
--- a/osu.Game/Configuration/OsuConfigManager.cs
+++ b/osu.Game/Configuration/OsuConfigManager.cs
@@ -117,6 +117,8 @@ namespace osu.Game.Configuration
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
+
+ Set(OsuSetting.FollowPlayback, true);
}
public OsuConfigManager(Storage storage)
@@ -186,6 +188,7 @@ namespace osu.Game.Configuration
UIScale,
IntroSequence,
UIHoldActivationDelay,
- HitLighting
+ HitLighting,
+ FollowPlayback
}
}
diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs
index 5b528c5ab2..95b4a28125 100644
--- a/osu.Game/Overlays/Music/PlaylistList.cs
+++ b/osu.Game/Overlays/Music/PlaylistList.cs
@@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
+using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osuTK;
@@ -52,6 +53,8 @@ namespace osu.Game.Overlays.Music
private IBindableList beatmaps;
+ private IBindable followPlayback;
+
[Resolved]
private MusicController musicController { get; set; }
@@ -76,8 +79,10 @@ namespace osu.Game.Overlays.Music
}
[BackgroundDependencyLoader]
- private void load(IBindable beatmap)
+ private void load(IBindable beatmap, OsuConfigManager configManager)
{
+ followPlayback = configManager.GetBindable(OsuSetting.FollowPlayback);
+
beatmaps = musicController.BeatmapSets.GetBoundCopy();
beatmaps.ItemsAdded += i => i.ForEach(addBeatmapSet);
beatmaps.ItemsRemoved += i => i.ForEach(removeBeatmapSet);
@@ -109,7 +114,11 @@ namespace osu.Game.Overlays.Music
private void updateSelectedSet()
{
foreach (PlaylistItem s in items.Children)
+ {
s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo?.ID;
+ if (s.Selected && followPlayback.Value)
+ ScrollIntoView(s);
+ }
}
public string SearchTerm
diff --git a/osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs
new file mode 100644
index 0000000000..5de99e24af
--- /dev/null
+++ b/osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs
@@ -0,0 +1,27 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Game.Configuration;
+
+namespace osu.Game.Overlays.Settings.Sections.Audio
+{
+ public class PlaylistSettings : SettingsSubsection
+ {
+ protected override string Header => "Playlist";
+
+ [BackgroundDependencyLoader]
+ private void load(OsuConfigManager config)
+ {
+ Children = new Drawable[]
+ {
+ new SettingsCheckbox
+ {
+ LabelText = "Follow playback",
+ Bindable = config.GetBindable(OsuSetting.FollowPlayback)
+ }
+ };
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Settings/Sections/AudioSection.cs b/osu.Game/Overlays/Settings/Sections/AudioSection.cs
index 772f5c2039..dd67493a75 100644
--- a/osu.Game/Overlays/Settings/Sections/AudioSection.cs
+++ b/osu.Game/Overlays/Settings/Sections/AudioSection.cs
@@ -20,6 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections
new VolumeSettings(),
new OffsetSettings(),
new MainMenuSettings(),
+ new PlaylistSettings()
};
}
}
From eda4a27b45e66c8231c7aeea7c9c2915bbfca74b Mon Sep 17 00:00:00 2001
From: Roman Kapustin
Date: Sun, 6 Oct 2019 15:06:25 +0300
Subject: [PATCH 035/373] Move FollowPlayback setting to User Interface
subsection
---
.../Sections/Audio/PlaylistSettings.cs | 27 -------------------
.../Settings/Sections/AudioSection.cs | 3 +--
.../Graphics/UserInterfaceSettings.cs | 5 ++++
3 files changed, 6 insertions(+), 29 deletions(-)
delete mode 100644 osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs
diff --git a/osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs
deleted file mode 100644
index 5de99e24af..0000000000
--- a/osu.Game/Overlays/Settings/Sections/Audio/PlaylistSettings.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Framework.Allocation;
-using osu.Framework.Graphics;
-using osu.Game.Configuration;
-
-namespace osu.Game.Overlays.Settings.Sections.Audio
-{
- public class PlaylistSettings : SettingsSubsection
- {
- protected override string Header => "Playlist";
-
- [BackgroundDependencyLoader]
- private void load(OsuConfigManager config)
- {
- Children = new Drawable[]
- {
- new SettingsCheckbox
- {
- LabelText = "Follow playback",
- Bindable = config.GetBindable(OsuSetting.FollowPlayback)
- }
- };
- }
- }
-}
diff --git a/osu.Game/Overlays/Settings/Sections/AudioSection.cs b/osu.Game/Overlays/Settings/Sections/AudioSection.cs
index dd67493a75..7ca313a751 100644
--- a/osu.Game/Overlays/Settings/Sections/AudioSection.cs
+++ b/osu.Game/Overlays/Settings/Sections/AudioSection.cs
@@ -19,8 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections
new AudioDevicesSettings(),
new VolumeSettings(),
new OffsetSettings(),
- new MainMenuSettings(),
- new PlaylistSettings()
+ new MainMenuSettings()
};
}
}
diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs
index a8953ac3a2..2678d4c11a 100644
--- a/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs
@@ -17,6 +17,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
{
Children = new Drawable[]
{
+ new SettingsCheckbox
+ {
+ LabelText = "Scroll playlist on song change",
+ Bindable = config.GetBindable(OsuSetting.FollowPlayback)
+ },
new SettingsCheckbox
{
LabelText = "Rotate cursor when dragging",
From 38c1cee5fdbb913c771ddbf373ca3fea3d062235 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Sun, 6 Oct 2019 10:22:55 -0700
Subject: [PATCH 036/373] Fix tab controls overflowing
---
.../Overlays/Chat/Tabs/ChannelTabControl.cs | 13 ++-----------
osu.Game/Overlays/ChatOverlay.cs | 9 +++++++++
.../SearchableListFilterControl.cs | 10 +++++++++-
.../Select/BeatmapDetailAreaTabControl.cs | 18 +++++++++++++++---
4 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
index 612379d339..8b88d81b88 100644
--- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
@@ -9,7 +9,6 @@ using osuTK;
using System;
using System.Linq;
using osu.Framework.Bindables;
-using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Chat.Tabs
{
@@ -25,19 +24,11 @@ namespace osu.Game.Overlays.Chat.Tabs
public ChannelTabControl()
{
- TabContainer.Margin = new MarginPadding { Left = 50 };
+ Padding = new MarginPadding { Left = 50 };
+
TabContainer.Spacing = new Vector2(-SHEAR_WIDTH, 0);
TabContainer.Masking = false;
- AddInternal(new SpriteIcon
- {
- Icon = FontAwesome.Solid.Comments,
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Size = new Vector2(20),
- Margin = new MarginPadding(10),
- });
-
AddTabItem(selectorTab = new ChannelSelectorTabItem());
ChannelSelectorActive.BindTo(selectorTab.Active);
diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs
index 0cadbdfd31..33bcc4c139 100644
--- a/osu.Game/Overlays/ChatOverlay.cs
+++ b/osu.Game/Overlays/ChatOverlay.cs
@@ -21,6 +21,7 @@ using osu.Game.Overlays.Chat;
using osu.Game.Overlays.Chat.Selection;
using osu.Game.Overlays.Chat.Tabs;
using osuTK.Input;
+using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays
{
@@ -156,6 +157,14 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
+ new SpriteIcon
+ {
+ Icon = FontAwesome.Solid.Comments,
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Size = new Vector2(20),
+ Margin = new MarginPadding(10),
+ },
ChannelTabControl = CreateChannelTabControl().With(d =>
{
d.Anchor = Anchor.BottomLeft;
diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
index a0c4e9a080..d72e99289e 100644
--- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
+++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
@@ -18,6 +18,7 @@ namespace osu.Game.Overlays.SearchableList
private const float padding = 10;
private readonly Container filterContainer;
+ private readonly Container tabsContainer;
private readonly Box tabStrip;
public readonly SearchTextBox Search;
@@ -85,9 +86,14 @@ namespace osu.Game.Overlays.SearchableList
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = controls != null ? padding : 0 },
},
- Tabs = new PageTabControl
+ tabsContainer = new Container
{
RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Child = Tabs = new PageTabControl
+ {
+ RelativeSizeAxes = Axes.X,
+ },
},
new Box //keep the tab strip part of autosize, but don't put it in the flow container
{
@@ -127,6 +133,8 @@ namespace osu.Game.Overlays.SearchableList
Height = filterContainer.Height;
DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING };
+
+ tabsContainer.Padding = new MarginPadding { Right = DisplayStyleControl.Width };
}
private class FilterSearchTextBox : SearchTextBox
diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
index 6caef8e2aa..4ca629fee9 100644
--- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
+++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
@@ -20,6 +20,7 @@ namespace osu.Game.Screens.Select
public static readonly float HEIGHT = 24;
private readonly OsuTabControlCheckbox modsCheckbox;
private readonly OsuTabControl tabs;
+ private readonly Container tabsContainer;
public Action OnFilter; //passed the selected tab and if mods is checked
@@ -39,11 +40,15 @@ namespace osu.Game.Screens.Select
Height = 1,
Colour = Color4.White.Opacity(0.2f),
},
- tabs = new OsuTabControl
+ tabsContainer = new Container
{
- Anchor = Anchor.BottomLeft,
- Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
+ Child = tabs = new OsuTabControl
+ {
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
+ RelativeSizeAxes = Axes.Both,
+ },
},
modsCheckbox = new OsuTabControlCheckbox
{
@@ -69,6 +74,13 @@ namespace osu.Game.Screens.Select
tabs.Current.TriggerChange();
}
+ protected override void Update()
+ {
+ base.Update();
+
+ tabsContainer.Padding = new MarginPadding { Right = modsCheckbox.Width };
+ }
+
private void invokeOnFilter()
{
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);
From 11d937beab1708fb1354994b017e08e98cb5cc78 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Sun, 6 Oct 2019 10:24:33 -0700
Subject: [PATCH 037/373] Fix beatmap detail area tab dropdown being blocked by
content
---
osu.Game/Screens/Select/BeatmapDetailArea.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs
index 5348de68d6..71733c9f06 100644
--- a/osu.Game/Screens/Select/BeatmapDetailArea.cs
+++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs
@@ -36,6 +36,11 @@ namespace osu.Game.Screens.Select
{
AddRangeInternal(new Drawable[]
{
+ content = new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
+ },
new BeatmapDetailAreaTabControl
{
RelativeSizeAxes = Axes.X,
@@ -58,11 +63,6 @@ namespace osu.Game.Screens.Select
}
},
},
- content = new Container
- {
- RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
- },
});
AddRange(new Drawable[]
From 62c4c1266ef8c1dc71324021bd4808abbb7b6205 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 7 Oct 2019 14:45:26 +0900
Subject: [PATCH 038/373] Move private functions to bottom
---
.../SongSelect/TestSceneBeatmapCarousel.cs | 202 +++++++++---------
1 file changed, 101 insertions(+), 101 deletions(-)
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
index 6bdd94db21..527367fdb8 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
@@ -58,107 +58,6 @@ namespace osu.Game.Tests.Visual.SongSelect
});
}
- private void loadBeatmaps(List beatmapSets = null)
- {
- if (beatmapSets == null)
- {
- beatmapSets = new List();
-
- for (int i = 1; i <= set_count; i++)
- beatmapSets.Add(createTestBeatmapSet(i));
- }
-
- bool changed = false;
- AddStep($"Load {beatmapSets.Count} Beatmaps", () =>
- {
- carousel.Filter(new FilterCriteria());
- carousel.BeatmapSetsChanged = () => changed = true;
- carousel.BeatmapSets = beatmapSets;
- });
-
- AddUntilStep("Wait for load", () => changed);
- }
-
- private void ensureRandomFetchSuccess() =>
- AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
-
- private void waitForSelection(int set, int? diff = null) =>
- AddUntilStep($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
- {
- if (diff != null)
- return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First();
-
- return carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Contains(carousel.SelectedBeatmap);
- });
-
- private void setSelected(int set, int diff) =>
- AddStep($"select set{set} diff{diff}", () =>
- carousel.SelectBeatmap(carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff - 1).First()));
-
- private void advanceSelection(bool diff, int direction = 1, int count = 1)
- {
- if (count == 1)
- AddStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
- carousel.SelectNext(direction, !diff));
- else
- {
- AddRepeatStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
- carousel.SelectNext(direction, !diff), count);
- }
- }
-
- private void checkVisibleItemCount(bool diff, int count) =>
- AddAssert($"{count} {(diff ? "diffs" : "sets")} visible", () =>
- carousel.Items.Count(s => (diff ? s.Item is CarouselBeatmap : s.Item is CarouselBeatmapSet) && s.Item.Visible) == count);
-
- private void checkNoSelection() => AddAssert("Selection is null", () => currentSelection == null);
-
- private void nextRandom() =>
- AddStep("select random next", () =>
- {
- carousel.RandomAlgorithm.Value = RandomSelectAlgorithm.RandomPermutation;
-
- if (!selectedSets.Any() && carousel.SelectedBeatmap != null)
- selectedSets.Push(carousel.SelectedBeatmapSet);
-
- carousel.SelectNextRandom();
- selectedSets.Push(carousel.SelectedBeatmapSet);
- });
-
- private void ensureRandomDidntRepeat() =>
- AddAssert("ensure no repeats", () => selectedSets.Distinct().Count() == selectedSets.Count);
-
- private void prevRandom() => AddStep("select random last", () =>
- {
- carousel.SelectPreviousRandom();
- selectedSets.Pop();
- });
-
- private bool selectedBeatmapVisible()
- {
- var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State.Value == CarouselItemState.Selected);
- if (currentlySelected == null)
- return true;
-
- return currentlySelected.Item.Visible;
- }
-
- private void checkInvisibleDifficultiesUnselectable()
- {
- nextRandom();
- AddAssert("Selection is visible", selectedBeatmapVisible);
- }
-
- private void checkNonmatchingFilter()
- {
- AddStep("Toggle non-matching filter", () =>
- {
- carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false);
- carousel.Filter(new FilterCriteria(), false);
- eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID);
- });
- }
-
///
/// Test keyboard traversal
///
@@ -482,6 +381,107 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("Selection was random", () => eagerSelectedIDs.Count > 1);
}
+ private void loadBeatmaps(List beatmapSets = null)
+ {
+ if (beatmapSets == null)
+ {
+ beatmapSets = new List();
+
+ for (int i = 1; i <= set_count; i++)
+ beatmapSets.Add(createTestBeatmapSet(i));
+ }
+
+ bool changed = false;
+ AddStep($"Load {beatmapSets.Count} Beatmaps", () =>
+ {
+ carousel.Filter(new FilterCriteria());
+ carousel.BeatmapSetsChanged = () => changed = true;
+ carousel.BeatmapSets = beatmapSets;
+ });
+
+ AddUntilStep("Wait for load", () => changed);
+ }
+
+ private void ensureRandomFetchSuccess() =>
+ AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
+
+ private void waitForSelection(int set, int? diff = null) =>
+ AddUntilStep($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
+ {
+ if (diff != null)
+ return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First();
+
+ return carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Contains(carousel.SelectedBeatmap);
+ });
+
+ private void setSelected(int set, int diff) =>
+ AddStep($"select set{set} diff{diff}", () =>
+ carousel.SelectBeatmap(carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff - 1).First()));
+
+ private void advanceSelection(bool diff, int direction = 1, int count = 1)
+ {
+ if (count == 1)
+ AddStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
+ carousel.SelectNext(direction, !diff));
+ else
+ {
+ AddRepeatStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
+ carousel.SelectNext(direction, !diff), count);
+ }
+ }
+
+ private void checkVisibleItemCount(bool diff, int count) =>
+ AddAssert($"{count} {(diff ? "diffs" : "sets")} visible", () =>
+ carousel.Items.Count(s => (diff ? s.Item is CarouselBeatmap : s.Item is CarouselBeatmapSet) && s.Item.Visible) == count);
+
+ private void checkNoSelection() => AddAssert("Selection is null", () => currentSelection == null);
+
+ private void nextRandom() =>
+ AddStep("select random next", () =>
+ {
+ carousel.RandomAlgorithm.Value = RandomSelectAlgorithm.RandomPermutation;
+
+ if (!selectedSets.Any() && carousel.SelectedBeatmap != null)
+ selectedSets.Push(carousel.SelectedBeatmapSet);
+
+ carousel.SelectNextRandom();
+ selectedSets.Push(carousel.SelectedBeatmapSet);
+ });
+
+ private void ensureRandomDidntRepeat() =>
+ AddAssert("ensure no repeats", () => selectedSets.Distinct().Count() == selectedSets.Count);
+
+ private void prevRandom() => AddStep("select random last", () =>
+ {
+ carousel.SelectPreviousRandom();
+ selectedSets.Pop();
+ });
+
+ private bool selectedBeatmapVisible()
+ {
+ var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State.Value == CarouselItemState.Selected);
+ if (currentlySelected == null)
+ return true;
+
+ return currentlySelected.Item.Visible;
+ }
+
+ private void checkInvisibleDifficultiesUnselectable()
+ {
+ nextRandom();
+ AddAssert("Selection is visible", selectedBeatmapVisible);
+ }
+
+ private void checkNonmatchingFilter()
+ {
+ AddStep("Toggle non-matching filter", () =>
+ {
+ carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false);
+ carousel.Filter(new FilterCriteria(), false);
+ eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID);
+ });
+ }
+
private BeatmapSetInfo createTestBeatmapSet(int id)
{
return new BeatmapSetInfo
From 46d6c5ec3b6832d353f033d9284d761f423943db Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 7 Oct 2019 15:13:58 +0900
Subject: [PATCH 039/373] Add failing test
---
.../SongSelect/TestSceneBeatmapCarousel.cs | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
index 527367fdb8..f87d6ebebb 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
@@ -245,6 +245,30 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!"));
}
+ [Test]
+ public void TestSortingWithFiltered()
+ {
+ List sets = new List();
+
+ for (int i = 0; i < 3; i++)
+ {
+ var set = createTestBeatmapSet(i);
+ set.Beatmaps[0].StarDifficulty = 3 - i;
+ set.Beatmaps[2].StarDifficulty = 6 + i;
+ sets.Add(set);
+ }
+
+ loadBeatmaps(sets);
+
+ AddStep("Filter to normal", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Normal" }, false));
+ AddAssert("Check first set at end", () => carousel.BeatmapSets.First() == sets.Last());
+ AddAssert("Check last set at start", () => carousel.BeatmapSets.Last() == sets.First());
+
+ AddStep("Filter to insane", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Insane" }, false));
+ AddAssert("Check first set at start", () => carousel.BeatmapSets.First() == sets.First());
+ AddAssert("Check last set at end", () => carousel.BeatmapSets.Last() == sets.Last());
+ }
+
[Test]
public void TestRemoveAll()
{
From f15953d65ce00c38a2544234c426c33f55429cb0 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 7 Oct 2019 15:16:26 +0900
Subject: [PATCH 040/373] Fix carousel including filtered difficulties in sort
comparisons
---
.../Select/Carousel/CarouselBeatmapSet.cs | 23 ++++++++++++++++---
.../Screens/Select/Carousel/CarouselGroup.cs | 2 +-
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
index 5a3996bb49..35816fe620 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
@@ -49,16 +49,33 @@ namespace osu.Game.Screens.Select.Carousel
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
case SortMode.BPM:
- return BeatmapSet.MaxBPM.CompareTo(otherSet.BeatmapSet.MaxBPM);
+ return compareUsingAggregateMax(otherSet, b => b.BPM);
case SortMode.Length:
- return BeatmapSet.MaxLength.CompareTo(otherSet.BeatmapSet.MaxLength);
+ return compareUsingAggregateMax(otherSet, b => b.Length);
case SortMode.Difficulty:
- return BeatmapSet.MaxStarDifficulty.CompareTo(otherSet.BeatmapSet.MaxStarDifficulty);
+ return compareUsingAggregateMax(otherSet, b => b.StarDifficulty);
}
}
+ ///
+ /// All beatmaps which are not filtered and valid for display.
+ ///
+ protected IEnumerable ValidBeatmaps => Beatmaps.Where(b => !b.Filtered.Value).Select(b => b.Beatmap);
+
+ private int compareUsingAggregateMax(CarouselBeatmapSet other, Func func)
+ {
+ var ourBeatmaps = ValidBeatmaps.Any();
+ var otherBeatmaps = other.ValidBeatmaps.Any();
+
+ if (!ourBeatmaps && !otherBeatmaps) return 0;
+ if (!ourBeatmaps) return -1;
+ if (!otherBeatmaps) return 1;
+
+ return ValidBeatmaps.Max(func).CompareTo(other.ValidBeatmaps.Max(func));
+ }
+
public override void Filter(FilterCriteria criteria)
{
base.Filter(criteria);
diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
index 6ebd2d41cc..09b728abeb 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
@@ -83,8 +83,8 @@ namespace osu.Game.Screens.Select.Carousel
var children = new List(InternalChildren);
- children.Sort((x, y) => x.CompareTo(criteria, y));
children.ForEach(c => c.Filter(criteria));
+ children.Sort((x, y) => x.CompareTo(criteria, y));
InternalChildren = children;
}
From e265beb289a3d1df5c5d0645526884e85c410ac9 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Mon, 7 Oct 2019 18:49:59 +0900
Subject: [PATCH 041/373] Fix merge error
---
.../Blueprints/HitCircles/HitCirclePlacementBlueprint.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
index 38584ce898..6c08990ad6 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
@@ -21,6 +21,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
InternalChild = circlePiece = new HitCirclePiece();
}
+ protected override void Update()
+ {
+ base.Update();
+
+ circlePiece.UpdateFrom(HitObject);
+ }
+
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
From 76db200bd3efd8f3f1a93820e852cbdb9e54fdc8 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Mon, 7 Oct 2019 16:48:05 +0300
Subject: [PATCH 042/373] Implement GetCommentsRequest
---
.../Online/API/Requests/GetCommentsRequest.cs | 53 ++++++++++++++++++
.../API/Requests/Responses/APIComments.cs | 36 ++++++++++++
.../Online/API/Requests/Responses/Comment.cs | 56 +++++++++++++++++++
3 files changed, 145 insertions(+)
create mode 100644 osu.Game/Online/API/Requests/GetCommentsRequest.cs
create mode 100644 osu.Game/Online/API/Requests/Responses/APIComments.cs
create mode 100644 osu.Game/Online/API/Requests/Responses/Comment.cs
diff --git a/osu.Game/Online/API/Requests/GetCommentsRequest.cs b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
new file mode 100644
index 0000000000..279a1905da
--- /dev/null
+++ b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
@@ -0,0 +1,53 @@
+// 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.IO.Network;
+using Humanizer;
+using osu.Game.Online.API.Requests.Responses;
+
+namespace osu.Game.Online.API.Requests
+{
+ public class GetCommentsRequest : APIRequest
+ {
+ private readonly long id;
+ private readonly int page;
+ private readonly CommentableType type;
+ private readonly SortCommentsBy sort;
+
+ public GetCommentsRequest(CommentableType type, long id, SortCommentsBy sort = SortCommentsBy.New, int page = 1)
+ {
+ this.type = type;
+ this.sort = sort;
+ this.id = id;
+ this.page = page;
+ }
+
+ protected override WebRequest CreateWebRequest()
+ {
+ var req = base.CreateWebRequest();
+
+ req.AddParameter("commentable_type", type.ToString().Underscore().ToLowerInvariant());
+ req.AddParameter("commentable_id", id.ToString());
+ req.AddParameter("sort", sort.ToString());
+ req.AddParameter("page", page.ToString());
+
+ return req;
+ }
+
+ protected override string Target => "comments";
+ }
+
+ public enum CommentableType
+ {
+ Build,
+ Beatmapset,
+ NewsPost
+ }
+
+ public enum SortCommentsBy
+ {
+ New,
+ Old,
+ Top
+ }
+}
diff --git a/osu.Game/Online/API/Requests/Responses/APIComments.cs b/osu.Game/Online/API/Requests/Responses/APIComments.cs
new file mode 100644
index 0000000000..158430a5b6
--- /dev/null
+++ b/osu.Game/Online/API/Requests/Responses/APIComments.cs
@@ -0,0 +1,36 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using Newtonsoft.Json;
+using osu.Game.Users;
+using System.Collections.Generic;
+
+namespace osu.Game.Online.API.Requests.Responses
+{
+ public class APIComments
+ {
+ [JsonProperty(@"comments")]
+ public List Comments { get; set; }
+
+ [JsonProperty(@"has_more")]
+ public bool HasMore { get; set; }
+
+ [JsonProperty(@"has_more_id")]
+ public long HasMoreId { get; set; }
+
+ [JsonProperty(@"user_follow")]
+ public bool UserFollow { get; set; }
+
+ [JsonProperty(@"included_comments")]
+ public List IncludedComments { get; set; }
+
+ [JsonProperty(@"users")]
+ public List Users { get; set; }
+
+ [JsonProperty(@"total")]
+ public int Total { get; set; }
+
+ [JsonProperty(@"top_level_count")]
+ public int TopLevelCount { get; set; }
+ }
+}
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
new file mode 100644
index 0000000000..e157a10f8a
--- /dev/null
+++ b/osu.Game/Online/API/Requests/Responses/Comment.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 Newtonsoft.Json;
+using System;
+
+namespace osu.Game.Online.API.Requests.Responses
+{
+ public class Comment
+ {
+ [JsonProperty(@"id")]
+ public long Id { get; set; }
+
+ [JsonProperty(@"parent_id")]
+ public long ParentId { get; set; }
+
+ [JsonProperty(@"user_id")]
+ public long UserId { get; set; }
+
+ [JsonProperty(@"message")]
+ public string Message { get; set; }
+
+ [JsonProperty(@"message_html")]
+ public string MessageHTML { get; set; }
+
+ [JsonProperty(@"replies_count")]
+ public int RepliesCount { get; set; }
+
+ [JsonProperty(@"votes_count")]
+ public int VotesCount { get; set; }
+
+ [JsonProperty(@"commenatble_type")]
+ public string CommentableType { get; set; }
+
+ [JsonProperty(@"commentable_id")]
+ public int CommentableId { get; set; }
+
+ [JsonProperty(@"legacy_name")]
+ public string LegacyName { get; set; }
+
+ [JsonProperty(@"created_at")]
+ public DateTimeOffset CreatedAt { get; set; }
+
+ [JsonProperty(@"updated_at")]
+ public DateTimeOffset UpdatedAt { get; set; }
+
+ [JsonProperty(@"deleted_at")]
+ public DateTimeOffset DeletedAt { get; set; }
+
+ [JsonProperty(@"edited_at")]
+ public DateTimeOffset EditedAt { get; set; }
+
+ [JsonProperty(@"edited_by_id")]
+ public long EditedById { get; set; }
+ }
+}
From 738580ec617a23789236575f2525606a6a4d227e Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Mon, 7 Oct 2019 16:58:24 +0300
Subject: [PATCH 043/373] Add IsTopLevel property
---
osu.Game/Online/API/Requests/Responses/Comment.cs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index e157a10f8a..6edf13d2da 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -11,8 +11,18 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"id")]
public long Id { get; set; }
+ private long? parentId;
+
[JsonProperty(@"parent_id")]
- public long ParentId { get; set; }
+ public long? ParentId
+ {
+ get => parentId;
+ set
+ {
+ parentId = value;
+ IsTopLevel = value != null;
+ }
+ }
[JsonProperty(@"user_id")]
public long UserId { get; set; }
@@ -52,5 +62,7 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"edited_by_id")]
public long EditedById { get; set; }
+
+ public bool IsTopLevel { get; set; }
}
}
From e772822bd5ee46afddc5bc14398e73f84ff84564 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Mon, 7 Oct 2019 17:49:20 +0300
Subject: [PATCH 044/373] Basic implementation
---
.../Online/TestSceneCommentsContainer.cs | 29 +++++
osu.Game/Overlays/CommentsContainer.cs | 110 ++++++++++++++++++
2 files changed, 139 insertions(+)
create mode 100644 osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
create mode 100644 osu.Game/Overlays/CommentsContainer.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
new file mode 100644
index 0000000000..c99062d59b
--- /dev/null
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.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 System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using osu.Game.Overlays;
+using osu.Game.Online.API.Requests;
+
+namespace osu.Game.Tests.Visual.Online
+{
+ [TestFixture]
+ public class TestSceneCommentsContainer : OsuTestScene
+ {
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(CommentsContainer),
+ };
+
+ public TestSceneCommentsContainer()
+ {
+ AddStep("Big Black comments", () =>
+ {
+ Clear();
+ Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
+ });
+ }
+ }
+}
diff --git a/osu.Game/Overlays/CommentsContainer.cs b/osu.Game/Overlays/CommentsContainer.cs
new file mode 100644
index 0000000000..8ed6fd0878
--- /dev/null
+++ b/osu.Game/Overlays/CommentsContainer.cs
@@ -0,0 +1,110 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Online.API;
+using osu.Game.Online.API.Requests;
+using osu.Framework.Graphics;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osuTK;
+
+namespace osu.Game.Overlays
+{
+ public class CommentsContainer : CompositeDrawable
+ {
+ private readonly CommentableType type;
+ private readonly long id;
+
+ public readonly Bindable Sort = new Bindable();
+
+ [Resolved]
+ private IAPIProvider api { get; set; }
+
+ private readonly CommentsHeader header;
+ private readonly Box background;
+
+ public CommentsContainer(CommentableType type, long id)
+ {
+ this.type = type;
+ this.id = id;
+
+ RelativeSizeAxes = Axes.X;
+ AutoSizeAxes = Axes.Y;
+ AddRangeInternal(new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ header = new CommentsHeader
+ {
+ Sort = { BindTarget = Sort }
+ }
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Gray3;
+ }
+
+ private class CommentsHeader : CompositeDrawable
+ {
+ private const int height = 40;
+ private const int spacing = 10;
+ private const int padding = 50;
+
+ public readonly Bindable Sort = new Bindable();
+
+ private readonly Box background;
+
+ public CommentsHeader()
+ {
+ RelativeSizeAxes = Axes.X;
+ Height = height;
+ AddRangeInternal(new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Horizontal = padding },
+ Children = new Drawable[]
+ {
+ new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Font = OsuFont.GetFont(size: 14),
+ Text = @"Sort by"
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Gray4;
+ }
+ }
+ }
+}
From aa8df0fa20426b0beec6997a2f2a07895cdddbaf Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Mon, 7 Oct 2019 18:26:07 +0300
Subject: [PATCH 045/373] Hook up api and implement some visual comments
representation
---
.../Online/TestSceneCommentsContainer.cs | 15 +++-
.../API/Requests/Responses/APIComments.cs | 2 +-
.../Online/API/Requests/Responses/Comment.cs | 8 +-
osu.Game/Overlays/CommentsContainer.cs | 84 ++++++++++++++++++-
4 files changed, 99 insertions(+), 10 deletions(-)
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index c99062d59b..bf4117189a 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -6,6 +6,8 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Overlays;
using osu.Game.Online.API.Requests;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
namespace osu.Game.Tests.Visual.Online
{
@@ -17,12 +19,21 @@ namespace osu.Game.Tests.Visual.Online
typeof(CommentsContainer),
};
+ protected override bool UseOnlineAPI => true;
+
public TestSceneCommentsContainer()
{
+ BasicScrollContainer scrollFlow;
+
+ Add(scrollFlow = new BasicScrollContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ });
+
AddStep("Big Black comments", () =>
{
- Clear();
- Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
+ scrollFlow.Clear();
+ scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
});
}
}
diff --git a/osu.Game/Online/API/Requests/Responses/APIComments.cs b/osu.Game/Online/API/Requests/Responses/APIComments.cs
index 158430a5b6..af7650e512 100644
--- a/osu.Game/Online/API/Requests/Responses/APIComments.cs
+++ b/osu.Game/Online/API/Requests/Responses/APIComments.cs
@@ -16,7 +16,7 @@ namespace osu.Game.Online.API.Requests.Responses
public bool HasMore { get; set; }
[JsonProperty(@"has_more_id")]
- public long HasMoreId { get; set; }
+ public long? HasMoreId { get; set; }
[JsonProperty(@"user_follow")]
public bool UserFollow { get; set; }
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index 6edf13d2da..df5c812fa0 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -52,16 +52,16 @@ namespace osu.Game.Online.API.Requests.Responses
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty(@"updated_at")]
- public DateTimeOffset UpdatedAt { get; set; }
+ public DateTimeOffset? UpdatedAt { get; set; }
[JsonProperty(@"deleted_at")]
- public DateTimeOffset DeletedAt { get; set; }
+ public DateTimeOffset? DeletedAt { get; set; }
[JsonProperty(@"edited_at")]
- public DateTimeOffset EditedAt { get; set; }
+ public DateTimeOffset? EditedAt { get; set; }
[JsonProperty(@"edited_by_id")]
- public long EditedById { get; set; }
+ public long? EditedById { get; set; }
public bool IsTopLevel { get; set; }
}
diff --git a/osu.Game/Overlays/CommentsContainer.cs b/osu.Game/Overlays/CommentsContainer.cs
index 8ed6fd0878..fce9b3f03b 100644
--- a/osu.Game/Overlays/CommentsContainer.cs
+++ b/osu.Game/Overlays/CommentsContainer.cs
@@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
+using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays
{
@@ -24,8 +25,14 @@ namespace osu.Game.Overlays
[Resolved]
private IAPIProvider api { get; set; }
+ [Resolved]
+ private OsuColour colours { get; set; }
+
+ private GetCommentsRequest request;
+
private readonly CommentsHeader header;
private readonly Box background;
+ private readonly FillFlowContainer content;
public CommentsContainer(CommentableType type, long id)
{
@@ -40,15 +47,86 @@ namespace osu.Game.Overlays
{
RelativeSizeAxes = Axes.Both,
},
- header = new CommentsHeader
+ new FillFlowContainer
{
- Sort = { BindTarget = Sort }
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ header = new CommentsHeader
+ {
+ Sort = { BindTarget = Sort }
+ },
+ content = new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ }
+ }
+ }
+ });
+ }
+
+ protected override void LoadComplete()
+ {
+ Sort.BindValueChanged(onSortChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onSortChanged(ValueChangedEvent sort) => getComments();
+
+ private void getComments()
+ {
+ request?.Cancel();
+ request = new GetCommentsRequest(type, id, Sort.Value);
+ request.Success += onSuccess;
+ api.Queue(request);
+ }
+
+ private void onSuccess(APIComments response)
+ {
+ content.Clear();
+
+ foreach (var c in response.Comments)
+ {
+ createDrawableComment(c);
+ }
+ }
+
+ private void createDrawableComment(Comment comment)
+ {
+ content.Add(new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ Height = 70,
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Text = comment.MessageHTML,
+ },
+ new Container
+ {
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
+ RelativeSizeAxes = Axes.X,
+ Height = 1,
+ Child = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = colours.Gray1,
+ }
+ }
}
});
}
[BackgroundDependencyLoader]
- private void load(OsuColour colours)
+ private void load()
{
background.Colour = colours.Gray3;
}
From cc6bf2f173b4d53c9fb568963c4685e133417254 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Mon, 7 Oct 2019 18:45:22 +0300
Subject: [PATCH 046/373] Add IsDeleted property
---
.../Online/API/Requests/Responses/Comment.cs | 16 ++++++++++++++--
osu.Game/Overlays/CommentsContainer.cs | 6 +++---
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index df5c812fa0..e4b66ddeee 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -20,7 +20,7 @@ namespace osu.Game.Online.API.Requests.Responses
set
{
parentId = value;
- IsTopLevel = value != null;
+ IsTopLevel = value == null;
}
}
@@ -54,8 +54,18 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"updated_at")]
public DateTimeOffset? UpdatedAt { get; set; }
+ private DateTimeOffset? deletedAt;
+
[JsonProperty(@"deleted_at")]
- public DateTimeOffset? DeletedAt { get; set; }
+ public DateTimeOffset? DeletedAt
+ {
+ get => deletedAt;
+ set
+ {
+ deletedAt = value;
+ IsDeleted = value != null;
+ }
+ }
[JsonProperty(@"edited_at")]
public DateTimeOffset? EditedAt { get; set; }
@@ -64,5 +74,7 @@ namespace osu.Game.Online.API.Requests.Responses
public long? EditedById { get; set; }
public bool IsTopLevel { get; set; }
+
+ public bool IsDeleted { get; set; }
}
}
diff --git a/osu.Game/Overlays/CommentsContainer.cs b/osu.Game/Overlays/CommentsContainer.cs
index fce9b3f03b..b22fefb3de 100644
--- a/osu.Game/Overlays/CommentsContainer.cs
+++ b/osu.Game/Overlays/CommentsContainer.cs
@@ -30,7 +30,6 @@ namespace osu.Game.Overlays
private GetCommentsRequest request;
- private readonly CommentsHeader header;
private readonly Box background;
private readonly FillFlowContainer content;
@@ -54,7 +53,7 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
- header = new CommentsHeader
+ new CommentsHeader
{
Sort = { BindTarget = Sort }
},
@@ -91,7 +90,8 @@ namespace osu.Game.Overlays
foreach (var c in response.Comments)
{
- createDrawableComment(c);
+ if (!c.IsDeleted)
+ createDrawableComment(c);
}
}
From e00992dfd8f18cc9e99724099e75eae42d0a1424 Mon Sep 17 00:00:00 2001
From: Roman Kapustin
Date: Mon, 7 Oct 2019 19:44:22 +0300
Subject: [PATCH 047/373] Remove FollowPlayback setting
---
osu.Game/Configuration/OsuConfigManager.cs | 5 +----
osu.Game/Overlays/Music/PlaylistList.cs | 9 ++-------
.../Settings/Sections/Graphics/UserInterfaceSettings.cs | 5 -----
3 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs
index 75cc961a9e..c0ce08ba08 100644
--- a/osu.Game/Configuration/OsuConfigManager.cs
+++ b/osu.Game/Configuration/OsuConfigManager.cs
@@ -117,8 +117,6 @@ namespace osu.Game.Configuration
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
-
- Set(OsuSetting.FollowPlayback, true);
}
public OsuConfigManager(Storage storage)
@@ -188,7 +186,6 @@ namespace osu.Game.Configuration
UIScale,
IntroSequence,
UIHoldActivationDelay,
- HitLighting,
- FollowPlayback
+ HitLighting
}
}
diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs
index 95b4a28125..f497bd5b8d 100644
--- a/osu.Game/Overlays/Music/PlaylistList.cs
+++ b/osu.Game/Overlays/Music/PlaylistList.cs
@@ -11,7 +11,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
-using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osuTK;
@@ -53,8 +52,6 @@ namespace osu.Game.Overlays.Music
private IBindableList beatmaps;
- private IBindable followPlayback;
-
[Resolved]
private MusicController musicController { get; set; }
@@ -79,10 +76,8 @@ namespace osu.Game.Overlays.Music
}
[BackgroundDependencyLoader]
- private void load(IBindable beatmap, OsuConfigManager configManager)
+ private void load(IBindable beatmap)
{
- followPlayback = configManager.GetBindable(OsuSetting.FollowPlayback);
-
beatmaps = musicController.BeatmapSets.GetBoundCopy();
beatmaps.ItemsAdded += i => i.ForEach(addBeatmapSet);
beatmaps.ItemsRemoved += i => i.ForEach(removeBeatmapSet);
@@ -116,7 +111,7 @@ namespace osu.Game.Overlays.Music
foreach (PlaylistItem s in items.Children)
{
s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo?.ID;
- if (s.Selected && followPlayback.Value)
+ if (s.Selected)
ScrollIntoView(s);
}
}
diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs
index 2678d4c11a..a8953ac3a2 100644
--- a/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Graphics/UserInterfaceSettings.cs
@@ -17,11 +17,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
{
Children = new Drawable[]
{
- new SettingsCheckbox
- {
- LabelText = "Scroll playlist on song change",
- Bindable = config.GetBindable(OsuSetting.FollowPlayback)
- },
new SettingsCheckbox
{
LabelText = "Rotate cursor when dragging",
From 8e6e90eaecf467b2764f3b2497acac12d4977c30 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Mon, 7 Oct 2019 16:11:40 -0700
Subject: [PATCH 048/373] Use fixed numbers for padding instead
---
.../SearchableList/SearchableListFilterControl.cs | 6 ++----
.../Screens/Select/BeatmapDetailAreaTabControl.cs | 11 ++---------
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
index d72e99289e..372da94b37 100644
--- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
+++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
@@ -18,7 +18,6 @@ namespace osu.Game.Overlays.SearchableList
private const float padding = 10;
private readonly Container filterContainer;
- private readonly Container tabsContainer;
private readonly Box tabStrip;
public readonly SearchTextBox Search;
@@ -86,10 +85,11 @@ namespace osu.Game.Overlays.SearchableList
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = controls != null ? padding : 0 },
},
- tabsContainer = new Container
+ new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
+ Padding = new MarginPadding { Right = 225 },
Child = Tabs = new PageTabControl
{
RelativeSizeAxes = Axes.X,
@@ -133,8 +133,6 @@ namespace osu.Game.Overlays.SearchableList
Height = filterContainer.Height;
DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING };
-
- tabsContainer.Padding = new MarginPadding { Right = DisplayStyleControl.Width };
}
private class FilterSearchTextBox : SearchTextBox
diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
index 4ca629fee9..38b1c6411b 100644
--- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
+++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
@@ -20,7 +20,6 @@ namespace osu.Game.Screens.Select
public static readonly float HEIGHT = 24;
private readonly OsuTabControlCheckbox modsCheckbox;
private readonly OsuTabControl tabs;
- private readonly Container tabsContainer;
public Action OnFilter; //passed the selected tab and if mods is checked
@@ -40,9 +39,10 @@ namespace osu.Game.Screens.Select
Height = 1,
Colour = Color4.White.Opacity(0.2f),
},
- tabsContainer = new Container
+ new Container
{
RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Right = 100 },
Child = tabs = new OsuTabControl
{
Anchor = Anchor.BottomLeft,
@@ -74,13 +74,6 @@ namespace osu.Game.Screens.Select
tabs.Current.TriggerChange();
}
- protected override void Update()
- {
- base.Update();
-
- tabsContainer.Padding = new MarginPadding { Right = modsCheckbox.Width };
- }
-
private void invokeOnFilter()
{
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);
From 9fdbe583262411aa5f863aec924459420e373c26 Mon Sep 17 00:00:00 2001
From: Joehu
Date: Mon, 7 Oct 2019 16:17:58 -0700
Subject: [PATCH 049/373] Fix dropdown header padding when selected mod filter
is hidden
---
osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
index 38b1c6411b..bba72c7ee1 100644
--- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
+++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs
@@ -20,6 +20,7 @@ namespace osu.Game.Screens.Select
public static readonly float HEIGHT = 24;
private readonly OsuTabControlCheckbox modsCheckbox;
private readonly OsuTabControl tabs;
+ private readonly Container tabsContainer;
public Action OnFilter; //passed the selected tab and if mods is checked
@@ -39,10 +40,9 @@ namespace osu.Game.Screens.Select
Height = 1,
Colour = Color4.White.Opacity(0.2f),
},
- new Container
+ tabsContainer = new Container
{
RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Right = 100 },
Child = tabs = new OsuTabControl
{
Anchor = Anchor.BottomLeft,
@@ -79,6 +79,8 @@ namespace osu.Game.Screens.Select
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);
modsCheckbox.FadeTo(tabs.Current.Value == BeatmapDetailTab.Details ? 0 : 1, 200, Easing.OutQuint);
+
+ tabsContainer.Padding = new MarginPadding { Right = tabs.Current.Value == BeatmapDetailTab.Details ? 0 : 100 };
}
}
From 3ec78388e896e6b5bf1fe1f2fa3869545c6759c0 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 11:02:54 +0900
Subject: [PATCH 050/373] Avoid excess background updates in playlist overlay
---
osu.Game/Overlays/Music/PlaylistList.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs
index 5b528c5ab2..e8c2537c43 100644
--- a/osu.Game/Overlays/Music/PlaylistList.cs
+++ b/osu.Game/Overlays/Music/PlaylistList.cs
@@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Music
beatmaps.ForEach(addBeatmapSet);
beatmapBacking.BindTo(beatmap);
- beatmapBacking.ValueChanged += _ => updateSelectedSet();
+ beatmapBacking.ValueChanged += _ => Scheduler.AddOnce(updateSelectedSet);
}
private void addBeatmapSet(BeatmapSetInfo obj)
From e7fc5e556c79f154b334545b2d367e712c0154e7 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 10:40:52 +0900
Subject: [PATCH 051/373] Fix song select not correctly playing tracks in some
cases
---
osu.Game/Screens/Select/SongSelect.cs | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index d9ddfa2a94..04a686f481 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -412,9 +412,6 @@ namespace osu.Game.Screens.Select
WorkingBeatmap previous = Beatmap.Value;
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, previous);
- if (this.IsCurrentScreen() && Beatmap.Value?.Track != previous?.Track)
- ensurePlayingSelected(true);
-
if (beatmap != null)
{
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
@@ -424,6 +421,9 @@ namespace osu.Game.Screens.Select
}
}
+ if (this.IsCurrentScreen())
+ ensurePlayingSelected();
+
UpdateBeatmap(Beatmap.Value);
}
}
@@ -581,19 +581,14 @@ namespace osu.Game.Screens.Select
beatmap.Track.Looping = true;
}
- private void ensurePlayingSelected(bool restart = false)
+ private void ensurePlayingSelected()
{
Track track = Beatmap.Value.Track;
- if (!track.IsRunning)
- {
- track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
+ track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
- if (restart)
- track.Restart();
- else
- track.Start();
- }
+ if (!track.IsRunning)
+ track.Restart();
}
private void onBeatmapSetAdded(BeatmapSetInfo s) => Carousel.UpdateBeatmapSet(s);
From 3c0b1be7f48c32db7714b04ce6fda76ffeefdcb8 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 11:52:16 +0900
Subject: [PATCH 052/373] Add xmldoc where applicable
---
osu.Game/Screens/Menu/IntroScreen.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index c81fef6436..1052ebdd5b 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -21,8 +21,15 @@ namespace osu.Game.Screens.Menu
{
public abstract class IntroScreen : StartupScreen
{
+ ///
+ /// A hash used to find the associated beatmap if already imported.
+ ///
protected abstract string BeatmapHash { get; }
+ ///
+ /// A source file to use as an import source if the intro beatmap is not yet present.
+ /// Should be within the "Tracks" namespace of game resources.
+ ///
protected abstract string BeatmapFile { get; }
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
From c3d56088d87d8f12fe7abbe2912b8a6f89e73bc1 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 11:54:39 +0900
Subject: [PATCH 053/373] Make constant private
---
osu.Game/Screens/Menu/IntroScreen.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index 1052ebdd5b..5d560c0c2a 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -34,7 +34,7 @@ namespace osu.Game.Screens.Menu
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
- public const int EXIT_DELAY = 3000;
+ private const int exit_delay = 3000;
[Resolved]
private AudioManager audio { get; set; }
@@ -110,7 +110,7 @@ namespace osu.Game.Screens.Menu
{
this.FadeIn(300);
- double fadeOutTime = EXIT_DELAY;
+ double fadeOutTime = exit_delay;
//we also handle the exit transition.
if (MenuVoice.Value)
seeya.Play();
@@ -151,8 +151,8 @@ namespace osu.Game.Screens.Menu
.ScaleTo(1, initialMovementTime, Easing.OutQuint)
.FadeIn(quick_appear, Easing.OutQuint)
.Then()
- .RotateTo(20, EXIT_DELAY * 1.5f)
- .FadeOut(EXIT_DELAY);
+ .RotateTo(20, exit_delay * 1.5f)
+ .FadeOut(exit_delay);
}
}
From 449e53ee6d5c57db401884b9924eb4d5158dda20 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:03:42 +0900
Subject: [PATCH 054/373] Centralise track handling
---
osu.Game/Screens/Menu/IntroCircles.cs | 12 +-----------
osu.Game/Screens/Menu/IntroScreen.cs | 18 +++++++++++++++++-
osu.Game/Screens/Menu/IntroTriangles.cs | 13 +------------
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs
index 6c643860a0..8f3b4f43c5 100644
--- a/osu.Game/Screens/Menu/IntroCircles.cs
+++ b/osu.Game/Screens/Menu/IntroCircles.cs
@@ -30,19 +30,11 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
- Beatmap.Value = IntroBeatmap;
- IntroBeatmap = null;
-
Welcome?.Play();
Scheduler.AddDelayed(delegate
{
- // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
- if (MenuMusic.Value)
- {
- Track.Restart();
- Track = null;
- }
+ StartTrack();
PrepareMenuLoad();
@@ -57,8 +49,6 @@ namespace osu.Game.Screens.Menu
public override void OnSuspending(IScreen next)
{
- Track = null;
-
this.FadeOut(300);
base.OnSuspending(next);
}
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index 5d560c0c2a..c00d105e12 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -47,7 +47,7 @@ namespace osu.Game.Screens.Menu
protected Bindable MenuMusic;
- protected Track Track;
+ protected Track Track { get; private set; }
protected WorkingBeatmap IntroBeatmap;
@@ -57,6 +57,13 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
+ protected void StartTrack()
+ {
+ // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
+ if (MenuMusic.Value)
+ Track.Restart();
+ }
+
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
{
@@ -136,6 +143,9 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
+ Beatmap.Value = IntroBeatmap;
+ IntroBeatmap = null;
+
logo.MoveTo(new Vector2(0.5f));
logo.ScaleTo(Vector2.One);
logo.Hide();
@@ -156,6 +166,12 @@ namespace osu.Game.Screens.Menu
}
}
+ public override void OnSuspending(IScreen next)
+ {
+ base.OnSuspending(next);
+ Track = null;
+ }
+
private MainMenu mainMenu;
protected void PrepareMenuLoad()
diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs
index 590069ab43..08941eca37 100644
--- a/osu.Game/Screens/Menu/IntroTriangles.cs
+++ b/osu.Game/Screens/Menu/IntroTriangles.cs
@@ -55,9 +55,6 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
- Beatmap.Value = IntroBeatmap;
- IntroBeatmap = null;
-
PrepareMenuLoad();
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
@@ -70,9 +67,7 @@ namespace osu.Game.Screens.Menu
AddInternal(t);
Welcome?.Play();
- // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
- if (MenuMusic.Value)
- Track.Start();
+ StartTrack();
});
}
}
@@ -83,12 +78,6 @@ namespace osu.Game.Screens.Menu
background.FadeOut(100);
}
- public override void OnSuspending(IScreen next)
- {
- Track = null;
- base.OnSuspending(next);
- }
-
private class TrianglesIntroSequence : CompositeDrawable
{
private readonly OsuLogo logo;
From a0bb19334219edf1f37282a95aa11893cb2fd954 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:04:13 +0900
Subject: [PATCH 055/373] Remove unnecessary beatmap storage
---
osu.Game/Screens/Menu/IntroScreen.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index c00d105e12..ccb7b8ef3d 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -53,8 +53,6 @@ namespace osu.Game.Screens.Menu
private LeasedBindable beatmap;
- public new Bindable Beatmap => beatmap;
-
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
protected void StartTrack()
@@ -68,7 +66,7 @@ namespace osu.Game.Screens.Menu
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
{
// prevent user from changing beatmap while the intro is still runnning.
- beatmap = base.Beatmap.BeginLease(false);
+ beatmap = Beatmap.BeginLease(false);
MenuVoice = config.GetBindable(OsuSetting.MenuVoice);
MenuMusic = config.GetBindable(OsuSetting.MenuMusic);
From 4ba2dccde30caac207687d4bff7bbb62a2d770cb Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:05:52 +0900
Subject: [PATCH 056/373] Reorder file contents
---
osu.Game/Screens/Menu/IntroScreen.cs | 73 +++++++++++++---------------
1 file changed, 33 insertions(+), 40 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index ccb7b8ef3d..c638d4f3c9 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -21,6 +21,11 @@ namespace osu.Game.Screens.Menu
{
public abstract class IntroScreen : StartupScreen
{
+ ///
+ /// Whether we have loaded the menu previously.
+ ///
+ public bool DidLoadMenu { get; private set; }
+
///
/// A hash used to find the associated beatmap if already imported.
///
@@ -32,35 +37,28 @@ namespace osu.Game.Screens.Menu
///
protected abstract string BeatmapFile { get; }
- private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
-
- private const int exit_delay = 3000;
-
- [Resolved]
- private AudioManager audio { get; set; }
-
protected SampleChannel Welcome;
- private SampleChannel seeya;
-
protected Bindable MenuVoice;
protected Bindable MenuMusic;
+ protected WorkingBeatmap IntroBeatmap;
+
protected Track Track { get; private set; }
- protected WorkingBeatmap IntroBeatmap;
+ private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
+
+ private const int exit_delay = 3000;
+
+ private SampleChannel seeya;
private LeasedBindable beatmap;
- protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
+ private MainMenu mainMenu;
- protected void StartTrack()
- {
- // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
- if (MenuMusic.Value)
- Track.Restart();
- }
+ [Resolved]
+ private AudioManager audio { get; set; }
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
@@ -100,16 +98,7 @@ namespace osu.Game.Screens.Menu
Track = IntroBeatmap.Track;
}
- ///
- /// Whether we have loaded the menu previously.
- ///
- public bool DidLoadMenu { get; private set; }
-
- public override bool OnExiting(IScreen next)
- {
- //cancel exiting if we haven't loaded the menu yet.
- return !DidLoadMenu;
- }
+ public override bool OnExiting(IScreen next) => !DidLoadMenu;
public override void OnResuming(IScreen last)
{
@@ -131,6 +120,21 @@ namespace osu.Game.Screens.Menu
base.OnResuming(last);
}
+ public override void OnSuspending(IScreen next)
+ {
+ base.OnSuspending(next);
+ Track = null;
+ }
+
+ protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
+
+ protected void StartTrack()
+ {
+ // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
+ if (MenuMusic.Value)
+ Track.Restart();
+ }
+
protected override void LogoArriving(OsuLogo logo, bool resuming)
{
base.LogoArriving(logo, resuming);
@@ -151,7 +155,7 @@ namespace osu.Game.Screens.Menu
else
{
const int quick_appear = 350;
- int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
+ var initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
@@ -164,18 +168,7 @@ namespace osu.Game.Screens.Menu
}
}
- public override void OnSuspending(IScreen next)
- {
- base.OnSuspending(next);
- Track = null;
- }
-
- private MainMenu mainMenu;
-
- protected void PrepareMenuLoad()
- {
- LoadComponentAsync(mainMenu = new MainMenu());
- }
+ protected void PrepareMenuLoad() => LoadComponentAsync(mainMenu = new MainMenu());
protected void LoadMenu()
{
From b8b2ff2674001e9bc3334a7799a8931b5004e7d9 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:07:59 +0900
Subject: [PATCH 057/373] Move welcome to local usages
---
osu.Game/Screens/Menu/IntroCircles.cs | 7 +++++--
osu.Game/Screens/Menu/IntroScreen.cs | 2 --
osu.Game/Screens/Menu/IntroTriangles.cs | 7 +++++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs
index 8f3b4f43c5..aa9cee969c 100644
--- a/osu.Game/Screens/Menu/IntroCircles.cs
+++ b/osu.Game/Screens/Menu/IntroCircles.cs
@@ -3,6 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Audio;
+using osu.Framework.Audio.Sample;
using osu.Framework.Screens;
using osu.Framework.Graphics;
@@ -17,11 +18,13 @@ namespace osu.Game.Screens.Menu
private const double delay_step_one = 2300;
private const double delay_step_two = 600;
+ private SampleChannel welcome;
+
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
if (MenuVoice.Value)
- Welcome = audio.Samples.Get(@"welcome");
+ welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
@@ -30,7 +33,7 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
- Welcome?.Play();
+ welcome?.Play();
Scheduler.AddDelayed(delegate
{
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index c638d4f3c9..0c192552eb 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -37,8 +37,6 @@ namespace osu.Game.Screens.Menu
///
protected abstract string BeatmapFile { get; }
- protected SampleChannel Welcome;
-
protected Bindable MenuVoice;
protected Bindable MenuMusic;
diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs
index 08941eca37..c86f1393a4 100644
--- a/osu.Game/Screens/Menu/IntroTriangles.cs
+++ b/osu.Game/Screens/Menu/IntroTriangles.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Audio;
+using osu.Framework.Audio.Sample;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -40,11 +41,13 @@ namespace osu.Game.Screens.Menu
private BackgroundScreenDefault background;
+ private SampleChannel welcome;
+
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
if (MenuVoice.Value && !MenuMusic.Value)
- Welcome = audio.Samples.Get(@"welcome");
+ welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
@@ -65,7 +68,7 @@ namespace osu.Game.Screens.Menu
}, t =>
{
AddInternal(t);
- Welcome?.Play();
+ welcome?.Play();
StartTrack();
});
From c280bee894df7e9c01c88332df579d2964f401e1 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:08:47 +0900
Subject: [PATCH 058/373] Protect configuration bindables
---
osu.Game/Screens/Menu/IntroScreen.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index 0c192552eb..feb472ba88 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -37,9 +37,9 @@ namespace osu.Game.Screens.Menu
///
protected abstract string BeatmapFile { get; }
- protected Bindable MenuVoice;
+ protected IBindable MenuVoice { get; private set; }
- protected Bindable MenuMusic;
+ protected IBindable MenuMusic { get; private set; }
protected WorkingBeatmap IntroBeatmap;
From cbb120cd3874044673e3197a9fc78942433a3edd Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:09:42 +0900
Subject: [PATCH 059/373] Switch beatmap to private
---
osu.Game/Screens/Menu/IntroScreen.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index feb472ba88..f5ef839b06 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -41,7 +41,7 @@ namespace osu.Game.Screens.Menu
protected IBindable MenuMusic { get; private set; }
- protected WorkingBeatmap IntroBeatmap;
+ private WorkingBeatmap introBeatmap;
protected Track Track { get; private set; }
@@ -92,8 +92,8 @@ namespace osu.Game.Screens.Menu
}
}
- IntroBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
- Track = IntroBeatmap.Track;
+ introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
+ Track = introBeatmap.Track;
}
public override bool OnExiting(IScreen next) => !DidLoadMenu;
@@ -143,8 +143,8 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
- Beatmap.Value = IntroBeatmap;
- IntroBeatmap = null;
+ Beatmap.Value = introBeatmap;
+ introBeatmap = null;
logo.MoveTo(new Vector2(0.5f));
logo.ScaleTo(Vector2.One);
From 52770f803d8844c135c3cfb05a4abb1d119e087c Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:14:53 +0900
Subject: [PATCH 060/373] Fix incorrect beatmap usage
---
osu.Game/Screens/Menu/IntroScreen.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
index f5ef839b06..df83e98494 100644
--- a/osu.Game/Screens/Menu/IntroScreen.cs
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -143,7 +143,7 @@ namespace osu.Game.Screens.Menu
if (!resuming)
{
- Beatmap.Value = introBeatmap;
+ beatmap.Value = introBeatmap;
introBeatmap = null;
logo.MoveTo(new Vector2(0.5f));
From 5472029ffed6681a327eeacad42577da0306e0e6 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:27:51 +0900
Subject: [PATCH 061/373] Fix editor defaulting to 0.5x playback speed
---
osu.Game/Screens/Edit/Components/PlaybackControl.cs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs
index 8d4ad0efa9..62d6c4648b 100644
--- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs
+++ b/osu.Game/Screens/Edit/Components/PlaybackControl.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.Linq;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
@@ -105,6 +106,8 @@ namespace osu.Game.Screens.Edit.Components
TabContainer.Spacing = Vector2.Zero;
tempo_values.ForEach(AddItem);
+
+ Current.Value = tempo_values.Last();
}
public class PlaybackTabItem : TabItem
From 24269c0384f6ebaa5c09ce52c6a4d404bf23fb7e Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 12:52:34 +0900
Subject: [PATCH 062/373] Fix skins not being displayed correctly in the editor
---
osu.Game/Screens/Edit/Compose/ComposeScreen.cs | 13 ++++++++++++-
osu.Game/Skinning/SkinProvidingContainer.cs | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
index ec4dda5c23..bd7e8e44e5 100644
--- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
+++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
@@ -11,6 +11,7 @@ using osu.Framework.Logging;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
+using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Compose
@@ -115,7 +116,17 @@ namespace osu.Game.Screens.Edit.Compose
return;
}
- composerContainer.Child = composer;
+ var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
+
+ // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
+ // full access to all skin sources.
+ var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider));
+
+ // load the skinning hierarchy first.
+ // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
+ composerContainer.Add(
+ beatmapSkinProvider.WithChild(
+ rulesetSkinProvider.WithChild(composer)));
}
}
}
diff --git a/osu.Game/Skinning/SkinProvidingContainer.cs b/osu.Game/Skinning/SkinProvidingContainer.cs
index ef7f5f381b..1c01bbf1ab 100644
--- a/osu.Game/Skinning/SkinProvidingContainer.cs
+++ b/osu.Game/Skinning/SkinProvidingContainer.cs
@@ -53,7 +53,7 @@ namespace osu.Game.Skinning
if (AllowTextureLookup(componentName) && (sourceTexture = skin?.GetTexture(componentName)) != null)
return sourceTexture;
- return fallbackSource.GetTexture(componentName);
+ return fallbackSource?.GetTexture(componentName);
}
public SampleChannel GetSample(ISampleInfo sampleInfo)
From 63bf8ff832ba04886bb2b60f83247f4b30e3073d Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 14:23:13 +0900
Subject: [PATCH 063/373] Better signify under construction screens in editor
---
.../Screens/Edit/Compose/ComposeScreen.cs | 41 ++--
osu.Game/Screens/Edit/Design/DesignScreen.cs | 41 +---
osu.Game/Screens/Edit/Editor.cs | 10 +
osu.Game/Screens/Edit/Setup/SetupScreen.cs | 13 ++
osu.Game/Screens/Edit/Timing/SetupScreen.cs | 13 ++
osu.Game/Screens/ScreenWhiteBox.cs | 200 ++++++++++--------
6 files changed, 169 insertions(+), 149 deletions(-)
create mode 100644 osu.Game/Screens/Edit/Setup/SetupScreen.cs
create mode 100644 osu.Game/Screens/Edit/Timing/SetupScreen.cs
diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
index bd7e8e44e5..2a99d81516 100644
--- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
+++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
@@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
-using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Skinning;
@@ -23,8 +22,6 @@ namespace osu.Game.Screens.Edit.Compose
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
- private HitObjectComposer composer;
-
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
{
@@ -107,26 +104,32 @@ namespace osu.Game.Screens.Edit.Compose
return;
}
- composer = ruleset.CreateHitObjectComposer();
+ var composer = ruleset.CreateHitObjectComposer();
- if (composer == null)
+ Drawable content;
+
+ if (composer != null)
{
- Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition.");
- // ExitRequested?.Invoke();
- return;
+ var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
+
+ // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
+ // full access to all skin sources.
+ var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider));
+
+ // load the skinning hierarchy first.
+ // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
+ content = beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer()));
+ }
+ else
+ {
+ content = new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer");
}
- var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
-
- // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
- // full access to all skin sources.
- var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider));
-
- // load the skinning hierarchy first.
- // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
- composerContainer.Add(
- beatmapSkinProvider.WithChild(
- rulesetSkinProvider.WithChild(composer)));
+ LoadComponentAsync(content, _ =>
+ {
+ composerContainer.Add(content);
+ content.FadeInFromZero(300, Easing.OutQuint);
+ });
}
}
}
diff --git a/osu.Game/Screens/Edit/Design/DesignScreen.cs b/osu.Game/Screens/Edit/Design/DesignScreen.cs
index 2a334e1b30..9f1fcf55b2 100644
--- a/osu.Game/Screens/Edit/Design/DesignScreen.cs
+++ b/osu.Game/Screens/Edit/Design/DesignScreen.cs
@@ -1,52 +1,13 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Shapes;
-using osu.Game.Graphics.Sprites;
-using osuTK.Graphics;
-
namespace osu.Game.Screens.Edit.Design
{
public class DesignScreen : EditorScreen
{
public DesignScreen()
{
- Add(new Container
- {
- RelativeSizeAxes = Axes.Both,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black,
- Alpha = 0.35f
- },
- new Container
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- AutoSizeAxes = Axes.Both,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black,
- Alpha = 0.5f
- },
- new Container
- {
- AutoSizeAxes = Axes.Both,
- Padding = new MarginPadding(20),
- Child = new OsuSpriteText { Text = "Design screen" }
- }
- }
- }
- }
- });
+ Child = new ScreenWhiteBox.UnderConstructionMessage("Design mode");
}
}
}
diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs
index 8cc227d9be..9ebe3bc26a 100644
--- a/osu.Game/Screens/Edit/Editor.cs
+++ b/osu.Game/Screens/Edit/Editor.cs
@@ -26,6 +26,8 @@ using System.Collections.Generic;
using osu.Framework;
using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings;
+using osu.Game.Screens.Edit.Setup;
+using osu.Game.Screens.Edit.Timing;
using osu.Game.Users;
namespace osu.Game.Screens.Edit
@@ -258,6 +260,10 @@ namespace osu.Game.Screens.Edit
switch (e.NewValue)
{
+ case EditorScreenMode.SongSetup:
+ currentScreen = new SetupScreen();
+ break;
+
case EditorScreenMode.Compose:
currentScreen = new ComposeScreen();
break;
@@ -266,6 +272,10 @@ namespace osu.Game.Screens.Edit
currentScreen = new DesignScreen();
break;
+ case EditorScreenMode.Timing:
+ currentScreen = new TimingScreen();
+ break;
+
default:
currentScreen = new EditorScreen();
break;
diff --git a/osu.Game/Screens/Edit/Setup/SetupScreen.cs b/osu.Game/Screens/Edit/Setup/SetupScreen.cs
new file mode 100644
index 0000000000..758dbc6e16
--- /dev/null
+++ b/osu.Game/Screens/Edit/Setup/SetupScreen.cs
@@ -0,0 +1,13 @@
+// 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.Screens.Edit.Setup
+{
+ public class SetupScreen : EditorScreen
+ {
+ public SetupScreen()
+ {
+ Child = new ScreenWhiteBox.UnderConstructionMessage("Setup mode");
+ }
+ }
+}
diff --git a/osu.Game/Screens/Edit/Timing/SetupScreen.cs b/osu.Game/Screens/Edit/Timing/SetupScreen.cs
new file mode 100644
index 0000000000..9ded4207e5
--- /dev/null
+++ b/osu.Game/Screens/Edit/Timing/SetupScreen.cs
@@ -0,0 +1,13 @@
+// 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.Screens.Edit.Timing
+{
+ public class TimingScreen : EditorScreen
+ {
+ public TimingScreen()
+ {
+ Child = new ScreenWhiteBox.UnderConstructionMessage("Timing mode");
+ }
+ }
+}
diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs
index 6c5854d17e..e4971221c4 100644
--- a/osu.Game/Screens/ScreenWhiteBox.cs
+++ b/osu.Game/Screens/ScreenWhiteBox.cs
@@ -20,38 +20,17 @@ namespace osu.Game.Screens
{
public class ScreenWhiteBox : OsuScreen
{
+ private readonly UnderConstructionMessage message;
+
private const double transition_time = 1000;
protected virtual IEnumerable PossibleChildren => null;
- private readonly FillFlowContainer textContainer;
- private readonly Container boxContainer;
-
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
- public override void OnEntering(IScreen last)
- {
- base.OnEntering(last);
-
- Alpha = 0;
- textContainer.Position = new Vector2(DrawSize.X / 16, 0);
-
- boxContainer.ScaleTo(0.2f);
- boxContainer.RotateTo(-20);
-
- using (BeginDelayedSequence(300, true))
- {
- boxContainer.ScaleTo(1, transition_time, Easing.OutElastic);
- boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint);
-
- textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
- this.FadeIn(transition_time, Easing.OutExpo);
- }
- }
-
public override bool OnExiting(IScreen next)
{
- textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo);
+ message.TextContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo);
this.FadeOut(transition_time, Easing.OutExpo);
return base.OnExiting(next);
@@ -61,7 +40,7 @@ namespace osu.Game.Screens
{
base.OnSuspending(next);
- textContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo);
+ message.TextContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo);
this.FadeOut(transition_time, Easing.OutExpo);
}
@@ -69,7 +48,7 @@ namespace osu.Game.Screens
{
base.OnResuming(last);
- textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
+ message.TextContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
this.FadeIn(transition_time, Easing.OutExpo);
}
@@ -79,65 +58,7 @@ namespace osu.Game.Screens
InternalChildren = new Drawable[]
{
- boxContainer = new Container
- {
- Size = new Vector2(0.3f),
- RelativeSizeAxes = Axes.Both,
- CornerRadius = 20,
- Masking = true,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
-
- Colour = getColourFor(GetType()),
- Alpha = 0.2f,
- Blending = BlendingParameters.Additive,
- },
- textContainer = new FillFlowContainer
- {
- AutoSizeAxes = Axes.Both,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Direction = FillDirection.Vertical,
- Children = new Drawable[]
- {
- new SpriteIcon
- {
- Icon = FontAwesome.Solid.UniversalAccess,
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- Size = new Vector2(50),
- },
- new OsuSpriteText
- {
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- Text = GetType().Name,
- Colour = getColourFor(GetType()).Lighten(0.8f),
- Font = OsuFont.GetFont(size: 50),
- },
- new OsuSpriteText
- {
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- Text = "is not yet ready for use!",
- Font = OsuFont.GetFont(size: 20),
- },
- new OsuSpriteText
- {
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- Text = "please check back a bit later.",
- Font = OsuFont.GetFont(size: 14),
- },
- }
- },
- }
- },
+ message = new UnderConstructionMessage(GetType().Name),
childModeButtons = new FillFlowContainer
{
Direction = FillDirection.Vertical,
@@ -155,24 +76,24 @@ namespace osu.Game.Screens
childModeButtons.Add(new ChildModeButton
{
Text = $@"{t.Name}",
- BackgroundColour = getColourFor(t),
- HoverColour = getColourFor(t).Lighten(0.2f),
+ BackgroundColour = getColourFor(t.Name),
+ HoverColour = getColourFor(t.Name).Lighten(0.2f),
Action = delegate { this.Push(Activator.CreateInstance(t) as Screen); }
});
}
}
}
- private Color4 getColourFor(Type type)
+ private static Color4 getColourFor(object type)
{
- int hash = type.Name.GetHashCode();
+ int hash = type.GetHashCode();
byte r = (byte)MathHelper.Clamp(((hash & 0xFF0000) >> 16) * 0.8f, 20, 255);
byte g = (byte)MathHelper.Clamp(((hash & 0x00FF00) >> 8) * 0.8f, 20, 255);
byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
return new Color4(r, g, b, 255);
}
- public class ChildModeButton : TwoLayerButton
+ private class ChildModeButton : TwoLayerButton
{
public ChildModeButton()
{
@@ -181,5 +102,104 @@ namespace osu.Game.Screens
Origin = Anchor.BottomRight;
}
}
+
+ public class UnderConstructionMessage : CompositeDrawable
+ {
+ public FillFlowContainer TextContainer { get; }
+
+ private readonly Container boxContainer;
+
+ public UnderConstructionMessage(string name)
+ {
+ RelativeSizeAxes = Axes.Both;
+ Size = new Vector2(0.3f);
+ Anchor = Anchor.Centre;
+ Origin = Anchor.Centre;
+
+ var colour = getColourFor(name);
+
+ InternalChildren = new Drawable[]
+ {
+ boxContainer = new Container
+ {
+ CornerRadius = 20,
+ Masking = true,
+ RelativeSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+
+ Colour = colour,
+ Alpha = 0.2f,
+ Blending = BlendingParameters.Additive,
+ },
+ TextContainer = new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ new SpriteIcon
+ {
+ Icon = FontAwesome.Solid.UniversalAccess,
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ Size = new Vector2(50),
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ Text = name,
+ Colour = colour.Lighten(0.8f),
+ Font = OsuFont.GetFont(size: 36),
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ Text = "is not yet ready for use!",
+ Font = OsuFont.GetFont(size: 20),
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ Text = "please check back a bit later.",
+ Font = OsuFont.GetFont(size: 14),
+ },
+ }
+ },
+ }
+ },
+ };
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ TextContainer.Position = new Vector2(DrawSize.X / 16, 0);
+
+ boxContainer.Hide();
+ boxContainer.ScaleTo(0.2f);
+ boxContainer.RotateTo(-20);
+
+ using (BeginDelayedSequence(300, true))
+ {
+ boxContainer.ScaleTo(1, transition_time, Easing.OutElastic);
+ boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint);
+
+ TextContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
+ boxContainer.FadeIn(transition_time, Easing.OutExpo);
+ }
+ }
+ }
}
}
From 3e904b4838b9169b80b0f6fc2381f0de6a47a6cc Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 14:37:56 +0900
Subject: [PATCH 064/373] Fix naming of file
---
osu.Game/Screens/Edit/Timing/{SetupScreen.cs => TimingScreen.cs} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename osu.Game/Screens/Edit/Timing/{SetupScreen.cs => TimingScreen.cs} (100%)
diff --git a/osu.Game/Screens/Edit/Timing/SetupScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs
similarity index 100%
rename from osu.Game/Screens/Edit/Timing/SetupScreen.cs
rename to osu.Game/Screens/Edit/Timing/TimingScreen.cs
From 4e026b163ccd15556945a8d769cad3b5c0a8ac34 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Tue, 8 Oct 2019 15:03:48 +0900
Subject: [PATCH 065/373] Don't resume playback when user has paused and track
hasn't changed
---
osu.Game/Screens/Select/SongSelect.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 04a686f481..6c5f64ed6c 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -581,14 +581,24 @@ namespace osu.Game.Screens.Select
beatmap.Track.Looping = true;
}
+ private readonly WeakReference
")).Substring(65);
+ }
}
}
diff --git a/osu.Game/Overlays/CommentsContainer.cs b/osu.Game/Overlays/CommentsContainer.cs
index b22fefb3de..1b4bbee6a1 100644
--- a/osu.Game/Overlays/CommentsContainer.cs
+++ b/osu.Game/Overlays/CommentsContainer.cs
@@ -107,7 +107,7 @@ namespace osu.Game.Overlays
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Text = comment.MessageHTML,
+ Text = comment.GetMessage(),
},
new Container
{
From 801b5b474e300343bafc0defc0a8818e3516919d Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 13:45:13 +0300
Subject: [PATCH 075/373] Add a User property to the comment for easy access
---
.../API/Requests/Responses/APIComments.cs | 20 ++++++++++++++++-
.../Online/API/Requests/Responses/Comment.cs | 3 +++
osu.Game/Overlays/CommentsContainer.cs | 22 +++++++++++++++++--
3 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/osu.Game/Online/API/Requests/Responses/APIComments.cs b/osu.Game/Online/API/Requests/Responses/APIComments.cs
index af7650e512..86bbf0358a 100644
--- a/osu.Game/Online/API/Requests/Responses/APIComments.cs
+++ b/osu.Game/Online/API/Requests/Responses/APIComments.cs
@@ -24,8 +24,26 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"included_comments")]
public List IncludedComments { get; set; }
+ private List users;
+
[JsonProperty(@"users")]
- public List Users { get; set; }
+ public List Users
+ {
+ get => users;
+ set
+ {
+ users = value;
+
+ value.ForEach(u =>
+ {
+ Comments.ForEach(c =>
+ {
+ if (c.UserId == u.Id)
+ c.User = u;
+ });
+ });
+ }
+ }
[JsonProperty(@"total")]
public int Total { get; set; }
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index ba71faa843..46212dd50f 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json;
+using osu.Game.Users;
using System;
namespace osu.Game.Online.API.Requests.Responses
@@ -27,6 +28,8 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"user_id")]
public long UserId { get; set; }
+ public User User { get; set; }
+
[JsonProperty(@"message")]
public string Message { get; set; }
diff --git a/osu.Game/Overlays/CommentsContainer.cs b/osu.Game/Overlays/CommentsContainer.cs
index 1b4bbee6a1..c871810d8a 100644
--- a/osu.Game/Overlays/CommentsContainer.cs
+++ b/osu.Game/Overlays/CommentsContainer.cs
@@ -103,11 +103,29 @@ namespace osu.Game.Overlays
Height = 70,
Children = new Drawable[]
{
- new SpriteText
+ new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Text = comment.GetMessage(),
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Spacing = new Vector2(0, 3),
+ Children = new[]
+ {
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Text = $"user: {comment.User.Username}",
+ },
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Text = $"message: {comment.GetMessage()}",
+ },
+ }
},
new Container
{
From 1c89841949e025fe693aab73a97dd9a93c78b85b Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 14:51:12 +0300
Subject: [PATCH 076/373] Move all the logic to it's own namespace
---
.../Online/TestSceneCommentsContainer.cs | 2 +-
.../{ => Comments}/CommentsContainer.cs | 67 +++----------
osu.Game/Overlays/Comments/DrawableComment.cs | 99 +++++++++++++++++++
3 files changed, 116 insertions(+), 52 deletions(-)
rename osu.Game/Overlays/{ => Comments}/CommentsContainer.cs (73%)
create mode 100644 osu.Game/Overlays/Comments/DrawableComment.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index bf4117189a..e6f9582910 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -4,10 +4,10 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
-using osu.Game.Overlays;
using osu.Game.Online.API.Requests;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
+using osu.Game.Overlays.Comments;
namespace osu.Game.Tests.Visual.Online
{
diff --git a/osu.Game/Overlays/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
similarity index 73%
rename from osu.Game/Overlays/CommentsContainer.cs
rename to osu.Game/Overlays/Comments/CommentsContainer.cs
index c871810d8a..60b22428f0 100644
--- a/osu.Game/Overlays/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -13,7 +13,7 @@ using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Game.Online.API.Requests.Responses;
-namespace osu.Game.Overlays
+namespace osu.Game.Overlays.Comments
{
public class CommentsContainer : CompositeDrawable
{
@@ -90,59 +90,24 @@ namespace osu.Game.Overlays
foreach (var c in response.Comments)
{
- if (!c.IsDeleted)
- createDrawableComment(c);
+ if (!c.IsDeleted && c.IsTopLevel)
+ content.AddRange(new Drawable[]
+ {
+ new DrawableComment(c),
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ Height = 1,
+ Child = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = colours.Gray1,
+ }
+ }
+ });
}
}
- private void createDrawableComment(Comment comment)
- {
- content.Add(new Container
- {
- RelativeSizeAxes = Axes.X,
- Height = 70,
- Children = new Drawable[]
- {
- new FillFlowContainer
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Vertical,
- Spacing = new Vector2(0, 3),
- Children = new[]
- {
- new SpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Text = $"user: {comment.User.Username}",
- },
- new SpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Text = $"message: {comment.GetMessage()}",
- },
- }
- },
- new Container
- {
- Anchor = Anchor.BottomCentre,
- Origin = Anchor.BottomCentre,
- RelativeSizeAxes = Axes.X,
- Height = 1,
- Child = new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = colours.Gray1,
- }
- }
- }
- });
- }
-
[BackgroundDependencyLoader]
private void load()
{
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
new file mode 100644
index 0000000000..bbb804dc5b
--- /dev/null
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -0,0 +1,99 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Game.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osuTK;
+using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Users.Drawables;
+using osu.Game.Graphics.Containers;
+using osu.Game.Utils;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class DrawableComment : CompositeDrawable
+ {
+ private const int avatar_size = 40;
+ private const int margin = 10;
+
+ public DrawableComment(Comment comment)
+ {
+ LinkFlowContainer username;
+
+ RelativeSizeAxes = Axes.X;
+ AutoSizeAxes = Axes.Y;
+ InternalChild = new GridContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Margin = new MarginPadding(margin),
+ ColumnDimensions = new[]
+ {
+ new Dimension(GridSizeMode.AutoSize),
+ new Dimension(),
+ },
+ RowDimensions = new[]
+ {
+ new Dimension(GridSizeMode.AutoSize),
+ new Dimension(GridSizeMode.AutoSize)
+ },
+ Content = new[]
+ {
+ new Drawable[]
+ {
+ new UpdateableAvatar(comment.User)
+ {
+ Size = new Vector2(avatar_size),
+ Margin = new MarginPadding { Horizontal = margin },
+ Masking = true,
+ CornerRadius = avatar_size / 2,
+ },
+ new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Spacing = new Vector2(0, 2),
+ Children = new Drawable[]
+ {
+ username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ AutoSizeAxes = Axes.Both,
+ },
+ new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 18))
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Text = comment.GetMessage()
+ }
+ }
+ }
+ },
+ new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 12),
+ Text = HumanizerUtils.Humanize(comment.CreatedAt)
+ }
+ }
+ }
+ };
+
+ username.AddUserLink(comment.User);
+ }
+ }
+}
From 2564214a72b70007368fa3c5763c407fab2192ac Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 15:01:18 +0300
Subject: [PATCH 077/373] Fix some padding issues with the big comments
---
osu.Game/Overlays/Comments/DrawableComment.cs | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index bbb804dc5b..6f3d92c7fd 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -54,21 +54,16 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
+ Margin = new MarginPadding { Top = margin / 2 },
Spacing = new Vector2(0, 2),
Children = new Drawable[]
{
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
{
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
},
- new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 18))
+ new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = comment.GetMessage()
From 451a7342ce7459ae42562521e549af8e7e8a1d5b Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 15:39:03 +0300
Subject: [PATCH 078/373] Parse child comments
---
.../API/Requests/Responses/APIComments.cs | 22 +++-
.../Online/API/Requests/Responses/Comment.cs | 3 +
.../Overlays/Comments/CommentsContainer.cs | 4 +-
osu.Game/Overlays/Comments/DrawableComment.cs | 106 +++++++++++-------
4 files changed, 92 insertions(+), 43 deletions(-)
diff --git a/osu.Game/Online/API/Requests/Responses/APIComments.cs b/osu.Game/Online/API/Requests/Responses/APIComments.cs
index 86bbf0358a..9a12fb613e 100644
--- a/osu.Game/Online/API/Requests/Responses/APIComments.cs
+++ b/osu.Game/Online/API/Requests/Responses/APIComments.cs
@@ -9,8 +9,28 @@ namespace osu.Game.Online.API.Requests.Responses
{
public class APIComments
{
+ private List comments;
+
[JsonProperty(@"comments")]
- public List Comments { get; set; }
+ public List Comments
+ {
+ get => comments;
+ set
+ {
+ comments = value;
+ comments.ForEach(child =>
+ {
+ if (child.ParentId != null)
+ {
+ comments.ForEach(parent =>
+ {
+ if (parent.Id == child.ParentId)
+ parent.ChildComments.Add(child);
+ });
+ }
+ });
+ }
+ }
[JsonProperty(@"has_more")]
public bool HasMore { get; set; }
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index 46212dd50f..cdc3c3204b 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -4,6 +4,7 @@
using Newtonsoft.Json;
using osu.Game.Users;
using System;
+using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses
{
@@ -25,6 +26,8 @@ namespace osu.Game.Online.API.Requests.Responses
}
}
+ public List ChildComments = new List();
+
[JsonProperty(@"user_id")]
public long UserId { get; set; }
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 60b22428f0..d02e74a5a4 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -17,6 +17,8 @@ namespace osu.Game.Overlays.Comments
{
public class CommentsContainer : CompositeDrawable
{
+ private const float separator_height = 1.5f;
+
private readonly CommentableType type;
private readonly long id;
@@ -97,7 +99,7 @@ namespace osu.Game.Overlays.Comments
new Container
{
RelativeSizeAxes = Axes.X,
- Height = 1,
+ Height = separator_height,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 6f3d92c7fd..53366be878 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -17,78 +17,102 @@ namespace osu.Game.Overlays.Comments
{
private const int avatar_size = 40;
private const int margin = 10;
+ private const int child_margin = 20;
public DrawableComment(Comment comment)
{
LinkFlowContainer username;
+ FillFlowContainer childCommentsContainer;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
- InternalChild = new GridContainer
+ InternalChild = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Margin = new MarginPadding(margin),
- ColumnDimensions = new[]
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
{
- new Dimension(GridSizeMode.AutoSize),
- new Dimension(),
- },
- RowDimensions = new[]
- {
- new Dimension(GridSizeMode.AutoSize),
- new Dimension(GridSizeMode.AutoSize)
- },
- Content = new[]
- {
- new Drawable[]
+ new GridContainer
{
- new UpdateableAvatar(comment.User)
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Margin = new MarginPadding(margin),
+ ColumnDimensions = new[]
{
- Size = new Vector2(avatar_size),
- Margin = new MarginPadding { Horizontal = margin },
- Masking = true,
- CornerRadius = avatar_size / 2,
+ new Dimension(GridSizeMode.AutoSize),
+ new Dimension(),
},
- new FillFlowContainer
+ RowDimensions = new[]
{
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Margin = new MarginPadding { Top = margin / 2 },
- Spacing = new Vector2(0, 2),
- Children = new Drawable[]
+ new Dimension(GridSizeMode.AutoSize),
+ new Dimension(GridSizeMode.AutoSize)
+ },
+ Content = new[]
+ {
+ new Drawable[]
{
- username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ new UpdateableAvatar(comment.User)
{
- AutoSizeAxes = Axes.Both,
+ Size = new Vector2(avatar_size),
+ Margin = new MarginPadding { Horizontal = margin },
+ Masking = true,
+ CornerRadius = avatar_size / 2,
},
- new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
+ new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Text = comment.GetMessage()
+ Margin = new MarginPadding { Top = margin / 2 },
+ Spacing = new Vector2(0, 2),
+ Children = new Drawable[]
+ {
+ username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ {
+ AutoSizeAxes = Axes.Both,
+ },
+ new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Text = comment.GetMessage()
+ }
+ }
+ }
+ },
+ new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 12),
+ Text = HumanizerUtils.Humanize(comment.CreatedAt)
}
}
}
},
- new Drawable[]
+ childCommentsContainer = new FillFlowContainer
{
- new Container
- {
- RelativeSizeAxes = Axes.Both,
- },
- new SpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: 12),
- Text = HumanizerUtils.Humanize(comment.CreatedAt)
- }
+ Margin = new MarginPadding { Left = child_margin },
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical
}
}
};
username.AddUserLink(comment.User);
+
+ comment.ChildComments.ForEach(c =>
+ {
+ if (!c.IsDeleted)
+ childCommentsContainer.Add(new DrawableComment(c));
+ });
}
}
}
From 9c7e403cf8ca62b83ded5505c030b77f8ee0a81b Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 16:00:34 +0300
Subject: [PATCH 079/373] Implement replies button
---
osu.Game/Overlays/Comments/DrawableComment.cs | 98 +++++++++++++++++--
1 file changed, 90 insertions(+), 8 deletions(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 53366be878..9879995b00 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -10,6 +10,8 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users.Drawables;
using osu.Game.Graphics.Containers;
using osu.Game.Utils;
+using osu.Framework.Input.Events;
+using System;
namespace osu.Game.Overlays.Comments
{
@@ -18,11 +20,39 @@ namespace osu.Game.Overlays.Comments
private const int avatar_size = 40;
private const int margin = 10;
private const int child_margin = 20;
+ private const int duration = 200;
+
+ private bool childExpanded = true;
+
+ public bool ChildExpanded
+ {
+ get => childExpanded;
+ set
+ {
+ if (childExpanded == value)
+ return;
+
+ childExpanded = value;
+
+ childCommentsVisibilityContainer.ClearTransforms();
+
+ if (childExpanded)
+ childCommentsVisibilityContainer.AutoSizeAxes = Axes.Y;
+ else
+ {
+ childCommentsVisibilityContainer.AutoSizeAxes = Axes.None;
+ childCommentsVisibilityContainer.ResizeHeightTo(0, duration, Easing.OutQuint);
+ }
+ }
+ }
+
+ private readonly Container childCommentsVisibilityContainer;
public DrawableComment(Comment comment)
{
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
+ RepliesButton replies;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
@@ -86,22 +116,40 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.Both,
},
- new SpriteText
+ new FillFlowContainer
{
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: 12),
- Text = HumanizerUtils.Humanize(comment.CreatedAt)
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(5, 0),
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 12),
+ Text = HumanizerUtils.Humanize(comment.CreatedAt)
+ },
+ replies = new RepliesButton(comment.RepliesCount),
+ }
}
}
}
},
- childCommentsContainer = new FillFlowContainer
+ childCommentsVisibilityContainer = new Container
{
- Margin = new MarginPadding { Left = child_margin },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Vertical
+ AutoSizeDuration = duration,
+ AutoSizeEasing = Easing.OutQuint,
+ Masking = true,
+ Child = childCommentsContainer = new FillFlowContainer
+ {
+ Margin = new MarginPadding { Left = child_margin },
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical
+ }
}
}
};
@@ -113,6 +161,40 @@ namespace osu.Game.Overlays.Comments
if (!c.IsDeleted)
childCommentsContainer.Add(new DrawableComment(c));
});
+
+ replies.Action += expanded => ChildExpanded = expanded;
+ }
+
+ private class RepliesButton : Container
+ {
+ private readonly SpriteText text;
+ private bool expanded;
+ private readonly int count;
+
+ public Action Action;
+
+ public RepliesButton(int count)
+ {
+ this.count = count;
+
+ AutoSizeAxes = Axes.Both;
+ Alpha = count == 0 ? 0 : 1;
+ Child = text = new SpriteText
+ {
+ Font = OsuFont.GetFont(size: 12),
+ Text = $@"[-] replies ({count})"
+ };
+
+ expanded = true;
+ }
+
+ protected override bool OnClick(ClickEvent e)
+ {
+ text.Text = $@"{(expanded ? "[+]" : "[-]")} replies ({count})";
+ expanded = !expanded;
+ Action?.Invoke(expanded);
+ return base.OnClick(e);
+ }
}
}
}
From 3f8fecbc5034d2b601ea6e6bc3643e25b8e13fc6 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 16:04:52 +0300
Subject: [PATCH 080/373] Adjust spacing
---
osu.Game/Overlays/Comments/DrawableComment.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 9879995b00..f3d8d2f577 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -120,7 +120,7 @@ namespace osu.Game.Overlays.Comments
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
- Spacing = new Vector2(5, 0),
+ Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new SpriteText
From 000e4a563cf4389d9fc86683838ece2e8251230b Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 19:09:02 +0300
Subject: [PATCH 081/373] Parse parent comments
---
.../API/Requests/Responses/APIComments.cs | 3 ++
.../Online/API/Requests/Responses/Comment.cs | 2 +
osu.Game/Overlays/Comments/DrawableComment.cs | 45 ++++++++++++++++++-
3 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/osu.Game/Online/API/Requests/Responses/APIComments.cs b/osu.Game/Online/API/Requests/Responses/APIComments.cs
index 9a12fb613e..f454d4052f 100644
--- a/osu.Game/Online/API/Requests/Responses/APIComments.cs
+++ b/osu.Game/Online/API/Requests/Responses/APIComments.cs
@@ -25,7 +25,10 @@ namespace osu.Game.Online.API.Requests.Responses
comments.ForEach(parent =>
{
if (parent.Id == child.ParentId)
+ {
parent.ChildComments.Add(child);
+ child.ParentComment = parent;
+ }
});
}
});
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index cdc3c3204b..e5d3f14d27 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -28,6 +28,8 @@ namespace osu.Game.Online.API.Requests.Responses
public List ChildComments = new List();
+ public Comment ParentComment { get; set; }
+
[JsonProperty(@"user_id")]
public long UserId { get; set; }
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index f3d8d2f577..dea14f22c8 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -12,6 +12,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Utils;
using osu.Framework.Input.Events;
using System;
+using osu.Framework.Graphics.Cursor;
namespace osu.Game.Overlays.Comments
{
@@ -97,9 +98,19 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(0, 2),
Children = new Drawable[]
{
- username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(7, 0),
+ Children = new Drawable[]
+ {
+ username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ {
+ AutoSizeAxes = Axes.Both,
+ },
+ new ParentUsername(comment)
+ }
},
new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
@@ -196,5 +207,37 @@ namespace osu.Game.Overlays.Comments
return base.OnClick(e);
}
}
+
+ private class ParentUsername : FillFlowContainer, IHasTooltip
+ {
+ private const int spacing = 3;
+
+ public string TooltipText => comment.ParentComment?.GetMessage() ?? "";
+
+ private readonly Comment comment;
+
+ public ParentUsername(Comment comment)
+ {
+ this.comment = comment;
+
+ AutoSizeAxes = Axes.Both;
+ Direction = FillDirection.Horizontal;
+ Spacing = new Vector2(spacing, 0);
+ Alpha = comment.ParentId == null ? 0 : 1;
+ Children = new Drawable[]
+ {
+ new SpriteIcon
+ {
+ Icon = FontAwesome.Solid.Reply,
+ Size = new Vector2(14),
+ },
+ new SpriteText
+ {
+ Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
+ Text = comment.ParentComment?.User?.Username
+ }
+ };
+ }
+ }
}
}
From 341702b91d084207316711e6f43e33afa3fadcc6 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 19:18:46 +0300
Subject: [PATCH 082/373] Use Bindable for expansion logic
---
osu.Game/Overlays/Comments/DrawableComment.cs | 68 +++++++++----------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index dea14f22c8..bf24cbb70d 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -11,8 +11,8 @@ using osu.Game.Users.Drawables;
using osu.Game.Graphics.Containers;
using osu.Game.Utils;
using osu.Framework.Input.Events;
-using System;
using osu.Framework.Graphics.Cursor;
+using osu.Framework.Bindables;
namespace osu.Game.Overlays.Comments
{
@@ -23,29 +23,7 @@ namespace osu.Game.Overlays.Comments
private const int child_margin = 20;
private const int duration = 200;
- private bool childExpanded = true;
-
- public bool ChildExpanded
- {
- get => childExpanded;
- set
- {
- if (childExpanded == value)
- return;
-
- childExpanded = value;
-
- childCommentsVisibilityContainer.ClearTransforms();
-
- if (childExpanded)
- childCommentsVisibilityContainer.AutoSizeAxes = Axes.Y;
- else
- {
- childCommentsVisibilityContainer.AutoSizeAxes = Axes.None;
- childCommentsVisibilityContainer.ResizeHeightTo(0, duration, Easing.OutQuint);
- }
- }
- }
+ private readonly BindableBool childExpanded = new BindableBool(true);
private readonly Container childCommentsVisibilityContainer;
@@ -53,7 +31,6 @@ namespace osu.Game.Overlays.Comments
{
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
- RepliesButton replies;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
@@ -141,7 +118,8 @@ namespace osu.Game.Overlays.Comments
Font = OsuFont.GetFont(size: 12),
Text = HumanizerUtils.Humanize(comment.CreatedAt)
},
- replies = new RepliesButton(comment.RepliesCount),
+ new RepliesButton(comment.RepliesCount)
+ { Expanded = { BindTarget = childExpanded } },
}
}
}
@@ -172,17 +150,33 @@ namespace osu.Game.Overlays.Comments
if (!c.IsDeleted)
childCommentsContainer.Add(new DrawableComment(c));
});
+ }
- replies.Action += expanded => ChildExpanded = expanded;
+ protected override void LoadComplete()
+ {
+ childExpanded.BindValueChanged(onChildExpandedChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onChildExpandedChanged(ValueChangedEvent expanded)
+ {
+ childCommentsVisibilityContainer.ClearTransforms();
+
+ if (expanded.NewValue)
+ childCommentsVisibilityContainer.AutoSizeAxes = Axes.Y;
+ else
+ {
+ childCommentsVisibilityContainer.AutoSizeAxes = Axes.None;
+ childCommentsVisibilityContainer.ResizeHeightTo(0, duration, Easing.OutQuint);
+ }
}
private class RepliesButton : Container
{
private readonly SpriteText text;
- private bool expanded;
private readonly int count;
- public Action Action;
+ public readonly BindableBool Expanded = new BindableBool(true);
public RepliesButton(int count)
{
@@ -193,17 +187,23 @@ namespace osu.Game.Overlays.Comments
Child = text = new SpriteText
{
Font = OsuFont.GetFont(size: 12),
- Text = $@"[-] replies ({count})"
};
+ }
- expanded = true;
+ protected override void LoadComplete()
+ {
+ Expanded.BindValueChanged(onExpandedChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onExpandedChanged(ValueChangedEvent expanded)
+ {
+ text.Text = $@"{(expanded.NewValue ? "[+]" : "[-]")} replies ({count})";
}
protected override bool OnClick(ClickEvent e)
{
- text.Text = $@"{(expanded ? "[+]" : "[-]")} replies ({count})";
- expanded = !expanded;
- Action?.Invoke(expanded);
+ Expanded.Value = !Expanded.Value;
return base.OnClick(e);
}
}
From 4230b00110768023bd1cf9d0e1fc098d5b273224 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 19:22:23 +0300
Subject: [PATCH 083/373] Rename APIComments to APICommentsController
---
osu.Game/Online/API/Requests/GetCommentsRequest.cs | 2 +-
.../Responses/{APIComments.cs => APICommentsController.cs} | 2 +-
osu.Game/Overlays/Comments/CommentsContainer.cs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename osu.Game/Online/API/Requests/Responses/{APIComments.cs => APICommentsController.cs} (98%)
diff --git a/osu.Game/Online/API/Requests/GetCommentsRequest.cs b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
index 279a1905da..5a2b61b4d0 100644
--- a/osu.Game/Online/API/Requests/GetCommentsRequest.cs
+++ b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
@@ -7,7 +7,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
- public class GetCommentsRequest : APIRequest
+ public class GetCommentsRequest : APIRequest
{
private readonly long id;
private readonly int page;
diff --git a/osu.Game/Online/API/Requests/Responses/APIComments.cs b/osu.Game/Online/API/Requests/Responses/APICommentsController.cs
similarity index 98%
rename from osu.Game/Online/API/Requests/Responses/APIComments.cs
rename to osu.Game/Online/API/Requests/Responses/APICommentsController.cs
index f454d4052f..cf2e5e8a35 100644
--- a/osu.Game/Online/API/Requests/Responses/APIComments.cs
+++ b/osu.Game/Online/API/Requests/Responses/APICommentsController.cs
@@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses
{
- public class APIComments
+ public class APICommentsController
{
private List comments;
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index d02e74a5a4..abbd2cdbde 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Comments
api.Queue(request);
}
- private void onSuccess(APIComments response)
+ private void onSuccess(APICommentsController response)
{
content.Clear();
From 35cfb16c8d21594237251fbf63d4fd69491efc3f Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 19:56:43 +0300
Subject: [PATCH 084/373] Implement VotePill component
---
osu.Game/Overlays/Comments/DrawableComment.cs | 55 +++++++++++++++++--
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index bf24cbb70d..ce60d905ad 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -13,6 +13,8 @@ using osu.Game.Utils;
using osu.Framework.Input.Events;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Bindables;
+using osu.Framework.Graphics.Shapes;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Comments
{
@@ -60,12 +62,28 @@ namespace osu.Game.Overlays.Comments
{
new Drawable[]
{
- new UpdateableAvatar(comment.User)
+ new FillFlowContainer
{
- Size = new Vector2(avatar_size),
+ AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Horizontal = margin },
- Masking = true,
- CornerRadius = avatar_size / 2,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(5, 0),
+ Children = new Drawable[]
+ {
+ new VotePill(comment.VotesCount)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ },
+ new UpdateableAvatar(comment.User)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(avatar_size),
+ Masking = true,
+ CornerRadius = avatar_size / 2,
+ },
+ }
},
new FillFlowContainer
{
@@ -239,5 +257,34 @@ namespace osu.Game.Overlays.Comments
};
}
}
+
+ private class VotePill : CircularContainer
+ {
+ private const int height = 20;
+ private const int margin = 10;
+
+ public VotePill(int count)
+ {
+ AutoSizeAxes = Axes.X;
+ Height = height;
+ Masking = true;
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black
+ },
+ new SpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Margin = new MarginPadding { Horizontal = margin },
+ Font = OsuFont.GetFont(size: 14),
+ Text = $"+{count}"
+ }
+ };
+ }
+ }
}
}
From b6047e46135cd099a1d21ebcd492d38cac7f5a3b Mon Sep 17 00:00:00 2001
From: HoLLy-HaCKeR
Date: Tue, 8 Oct 2019 19:39:54 +0200
Subject: [PATCH 085/373] Move OsuCursor resize logic to OsuCursorContainer
---
osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs | 36 ++-----------------
.../UI/Cursor/OsuCursorContainer.cs | 34 ++++++++++++++++--
2 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
index 41a02deaca..0aa8661fd3 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
@@ -2,14 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
-using osu.Game.Beatmaps;
-using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.Skinning;
using osu.Game.Skinning;
using osuTK;
@@ -23,12 +20,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private bool cursorExpand;
- private Bindable cursorScale;
- private Bindable autoCursorScale;
- private readonly IBindable beatmap = new Bindable();
-
private Container expandTarget;
- private Drawable scaleTarget;
public OsuCursor()
{
@@ -43,43 +35,19 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
}
[BackgroundDependencyLoader]
- private void load(OsuConfigManager config, IBindable beatmap)
+ private void load()
{
InternalChild = expandTarget = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
- Child = scaleTarget = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.Cursor), _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
+ Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.Cursor), _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
};
-
- this.beatmap.BindTo(beatmap);
- this.beatmap.ValueChanged += _ => calculateScale();
-
- cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize);
- cursorScale.ValueChanged += _ => calculateScale();
-
- autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize);
- autoCursorScale.ValueChanged += _ => calculateScale();
-
- calculateScale();
- }
-
- private void calculateScale()
- {
- float scale = cursorScale.Value;
-
- if (autoCursorScale.Value && beatmap.Value != null)
- {
- // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
- scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
- }
-
- scaleTarget.Scale = new Vector2(scale);
}
private const float pressed_scale = 1.2f;
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index 6dbdf0114d..e24ab3a7cb 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -8,6 +8,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings;
+using osu.Game.Beatmaps;
+using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.Configuration;
using osu.Game.Rulesets.UI;
using osu.Game.Skinning;
@@ -27,6 +29,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Drawable cursorTrail;
+ private Bindable cursorScale;
+ private Bindable autoCursorScale;
+ private readonly IBindable beatmap = new Bindable();
+
public OsuCursorContainer()
{
InternalChild = fadeContainer = new Container
@@ -37,9 +43,33 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
}
[BackgroundDependencyLoader(true)]
- private void load(OsuRulesetConfigManager config)
+ private void load(OsuConfigManager config, OsuRulesetConfigManager rulesetConfig, IBindable beatmap)
{
- config?.BindWith(OsuRulesetSetting.ShowCursorTrail, showTrail);
+ rulesetConfig?.BindWith(OsuRulesetSetting.ShowCursorTrail, showTrail);
+
+ this.beatmap.BindTo(beatmap);
+ this.beatmap.ValueChanged += _ => calculateScale();
+
+ cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize);
+ cursorScale.ValueChanged += _ => calculateScale();
+
+ autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize);
+ autoCursorScale.ValueChanged += _ => calculateScale();
+
+ calculateScale();
+ }
+
+ private void calculateScale()
+ {
+ float scale = cursorScale.Value;
+
+ if (autoCursorScale.Value && beatmap.Value != null)
+ {
+ // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
+ scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
+ }
+
+ ActiveCursor.Scale = new Vector2(scale);
}
protected override void LoadComplete()
From 1c22fb485fa2cc8b75f230c5a5ddcd40fa090534 Mon Sep 17 00:00:00 2001
From: HoLLy-HaCKeR
Date: Tue, 8 Oct 2019 19:40:46 +0200
Subject: [PATCH 086/373] Scale cursortrail along with cursor
---
osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index e24ab3a7cb..371c2983fc 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
}
- ActiveCursor.Scale = new Vector2(scale);
+ ActiveCursor.Scale = cursorTrail.Scale = new Vector2(scale);
}
protected override void LoadComplete()
From 9ab309fc0ef387e2226991c7f010e75f52fe1a19 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 20:44:01 +0300
Subject: [PATCH 087/373] Use bold font for replies button
---
osu.Game/Overlays/Comments/DrawableComment.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index ce60d905ad..ce78dfec9f 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -204,7 +204,7 @@ namespace osu.Game.Overlays.Comments
Alpha = count == 0 ? 0 : 1;
Child = text = new SpriteText
{
- Font = OsuFont.GetFont(size: 12),
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
};
}
From b9ad079bf8b077ae7a9aa53bdb2da1e6dcc0993e Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 20:57:55 +0300
Subject: [PATCH 088/373] Move CommentsHeader to it's own file
---
.../Online/TestSceneCommentsContainer.cs | 2 +
.../Overlays/Comments/CommentsContainer.cs | 56 ---------------
osu.Game/Overlays/Comments/CommentsHeader.cs | 69 +++++++++++++++++++
3 files changed, 71 insertions(+), 56 deletions(-)
create mode 100644 osu.Game/Overlays/Comments/CommentsHeader.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index e6f9582910..c8d16bdf21 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -17,6 +17,8 @@ namespace osu.Game.Tests.Visual.Online
public override IReadOnlyList RequiredTypes => new[]
{
typeof(CommentsContainer),
+ typeof(CommentsHeader),
+ typeof(DrawableComment),
};
protected override bool UseOnlineAPI => true;
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index abbd2cdbde..f8783952d1 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -9,8 +9,6 @@ using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
-using osu.Framework.Graphics.Sprites;
-using osuTK;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Comments
@@ -115,59 +113,5 @@ namespace osu.Game.Overlays.Comments
{
background.Colour = colours.Gray3;
}
-
- private class CommentsHeader : CompositeDrawable
- {
- private const int height = 40;
- private const int spacing = 10;
- private const int padding = 50;
-
- public readonly Bindable Sort = new Bindable();
-
- private readonly Box background;
-
- public CommentsHeader()
- {
- RelativeSizeAxes = Axes.X;
- Height = height;
- AddRangeInternal(new Drawable[]
- {
- background = new Box
- {
- RelativeSizeAxes = Axes.Both,
- },
- new Container
- {
- RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Horizontal = padding },
- Children = new Drawable[]
- {
- new FillFlowContainer
- {
- AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Spacing = new Vector2(spacing, 0),
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Children = new Drawable[]
- {
- new SpriteText
- {
- Font = OsuFont.GetFont(size: 14),
- Text = @"Sort by"
- }
- }
- }
- }
- }
- });
- }
-
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
- {
- background.Colour = colours.Gray4;
- }
- }
}
}
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
new file mode 100644
index 0000000000..9ebd257a5d
--- /dev/null
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -0,0 +1,69 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Online.API.Requests;
+using osu.Framework.Graphics;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osuTK;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class CommentsHeader : CompositeDrawable
+ {
+ private const int height = 40;
+ private const int spacing = 10;
+ private const int padding = 50;
+
+ public readonly Bindable Sort = new Bindable();
+
+ private readonly Box background;
+
+ public CommentsHeader()
+ {
+ RelativeSizeAxes = Axes.X;
+ Height = height;
+ AddRangeInternal(new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Horizontal = padding },
+ Children = new Drawable[]
+ {
+ new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Font = OsuFont.GetFont(size: 14),
+ Text = @"Sort by"
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Gray4;
+ }
+ }
+}
From 574170124cff05070833415e324f77a2e5fe88ef Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 21:38:19 +0300
Subject: [PATCH 089/373] Implement HeaderButton component
---
.../Online/TestSceneCommentsContainer.cs | 1 +
osu.Game/Overlays/Comments/CommentsHeader.cs | 63 ++++++++++++++++-
osu.Game/Overlays/Comments/HeaderButton.cs | 68 +++++++++++++++++++
3 files changed, 131 insertions(+), 1 deletion(-)
create mode 100644 osu.Game/Overlays/Comments/HeaderButton.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index c8d16bdf21..f5205552e0 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -19,6 +19,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(CommentsContainer),
typeof(CommentsHeader),
typeof(DrawableComment),
+ typeof(HeaderButton),
};
protected override bool UseOnlineAPI => true;
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index 9ebd257a5d..b9dee7935e 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
+using osu.Framework.Input.Events;
namespace osu.Game.Overlays.Comments
{
@@ -18,8 +19,10 @@ namespace osu.Game.Overlays.Comments
private const int height = 40;
private const int spacing = 10;
private const int padding = 50;
+ private const int text_size = 14;
public readonly Bindable Sort = new Bindable();
+ public readonly BindableBool ShowDeleted = new BindableBool();
private readonly Box background;
@@ -50,10 +53,16 @@ namespace osu.Game.Overlays.Comments
{
new SpriteText
{
- Font = OsuFont.GetFont(size: 14),
+ Font = OsuFont.GetFont(size: text_size),
Text = @"Sort by"
}
}
+ },
+ new ShowDeletedButton
+ {
+ Anchor = Anchor.CentreRight,
+ Origin = Anchor.CentreRight,
+ Checked = { BindTarget = ShowDeleted }
}
}
}
@@ -65,5 +74,57 @@ namespace osu.Game.Overlays.Comments
{
background.Colour = colours.Gray4;
}
+
+ private class ShowDeletedButton : HeaderButton
+ {
+ private const int spacing = 5;
+
+ public readonly BindableBool Checked = new BindableBool();
+
+ private readonly SpriteIcon checkboxIcon;
+
+ public ShowDeletedButton()
+ {
+ Add(new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ Children = new Drawable[]
+ {
+ checkboxIcon = new SpriteIcon
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Size = new Vector2(10),
+ },
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: text_size),
+ Text = @"Show deleted"
+ }
+ },
+ });
+ }
+
+ protected override void LoadComplete()
+ {
+ Checked.BindValueChanged(onCheckedChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onCheckedChanged(ValueChangedEvent isChecked)
+ {
+ checkboxIcon.Icon = isChecked.NewValue ? FontAwesome.Solid.CheckSquare : FontAwesome.Regular.Square;
+ }
+
+ protected override bool OnClick(ClickEvent e)
+ {
+ Checked.Value = !Checked.Value;
+ return base.OnClick(e);
+ }
+ }
}
}
diff --git a/osu.Game/Overlays/Comments/HeaderButton.cs b/osu.Game/Overlays/Comments/HeaderButton.cs
new file mode 100644
index 0000000000..db8ea92a1a
--- /dev/null
+++ b/osu.Game/Overlays/Comments/HeaderButton.cs
@@ -0,0 +1,68 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osu.Framework.Input.Events;
+using osu.Game.Graphics.UserInterface;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class HeaderButton : Container
+ {
+ private const int height = 20;
+ private const int corner_radius = 3;
+ private const int margin = 10;
+ private const int duration = 200;
+
+ protected override Container Content => content;
+
+ private readonly Box background;
+ private readonly Container content;
+
+ public HeaderButton()
+ {
+ AutoSizeAxes = Axes.X;
+ Height = height;
+ Masking = true;
+ CornerRadius = corner_radius;
+ AddRangeInternal(new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0,
+ },
+ content = new Container
+ {
+ AutoSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Margin = new MarginPadding { Horizontal = margin }
+ },
+ new HoverClickSounds(),
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Gray6;
+ }
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ background.FadeIn(duration, Easing.OutQuint);
+ return base.OnHover(e);
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ base.OnHoverLost(e);
+ background.FadeOut(duration, Easing.OutQuint);
+ }
+ }
+}
From 29b0eacc821b5091c0251d6066e2e52296d8c279 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Tue, 8 Oct 2019 22:46:42 +0300
Subject: [PATCH 090/373] Implement SortSelector component
---
.../Online/TestSceneCommentsContainer.cs | 1 +
.../Online/API/Requests/GetCommentsRequest.cs | 2 +-
.../Online/API/Requests/Responses/Comment.cs | 2 +-
.../Overlays/Comments/CommentsContainer.cs | 3 +-
osu.Game/Overlays/Comments/CommentsHeader.cs | 8 ++
osu.Game/Overlays/Comments/DrawableComment.cs | 9 ++-
osu.Game/Overlays/Comments/HeaderButton.cs | 8 +-
osu.Game/Overlays/Comments/SortSelector.cs | 75 +++++++++++++++++++
8 files changed, 101 insertions(+), 7 deletions(-)
create mode 100644 osu.Game/Overlays/Comments/SortSelector.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index f5205552e0..7fbe9d7e8b 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -20,6 +20,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(CommentsHeader),
typeof(DrawableComment),
typeof(HeaderButton),
+ typeof(SortSelector)
};
protected override bool UseOnlineAPI => true;
diff --git a/osu.Game/Online/API/Requests/GetCommentsRequest.cs b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
index 5a2b61b4d0..02a36f7aa2 100644
--- a/osu.Game/Online/API/Requests/GetCommentsRequest.cs
+++ b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Online.API.Requests
req.AddParameter("commentable_type", type.ToString().Underscore().ToLowerInvariant());
req.AddParameter("commentable_id", id.ToString());
- req.AddParameter("sort", sort.ToString());
+ req.AddParameter("sort", sort.ToString().ToLowerInvariant());
req.AddParameter("page", page.ToString());
return req;
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index e5d3f14d27..30aca3c2ea 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -31,7 +31,7 @@ namespace osu.Game.Online.API.Requests.Responses
public Comment ParentComment { get; set; }
[JsonProperty(@"user_id")]
- public long UserId { get; set; }
+ public long? UserId { get; set; }
public User User { get; set; }
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index f8783952d1..5be1b6c1c4 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -79,6 +79,7 @@ namespace osu.Game.Overlays.Comments
private void getComments()
{
request?.Cancel();
+ content.Clear();
request = new GetCommentsRequest(type, id, Sort.Value);
request.Success += onSuccess;
api.Queue(request);
@@ -86,8 +87,6 @@ namespace osu.Game.Overlays.Comments
private void onSuccess(APICommentsController response)
{
- content.Clear();
-
foreach (var c in response.Comments)
{
if (!c.IsDeleted && c.IsTopLevel)
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index b9dee7935e..90a6f44d6b 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -53,8 +53,16 @@ namespace osu.Game.Overlays.Comments
{
new SpriteText
{
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: text_size),
Text = @"Sort by"
+ },
+ new SortSelector
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Current = { BindTarget = Sort }
}
}
},
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index ce78dfec9f..41b30513a1 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -161,7 +161,14 @@ namespace osu.Game.Overlays.Comments
}
};
- username.AddUserLink(comment.User);
+ if (comment.UserId == null)
+ {
+ username.AddText(comment.LegacyName);
+ }
+ else
+ {
+ username.AddUserLink(comment.User);
+ }
comment.ChildComments.ForEach(c =>
{
diff --git a/osu.Game/Overlays/Comments/HeaderButton.cs b/osu.Game/Overlays/Comments/HeaderButton.cs
index db8ea92a1a..e3729b3b05 100644
--- a/osu.Game/Overlays/Comments/HeaderButton.cs
+++ b/osu.Game/Overlays/Comments/HeaderButton.cs
@@ -55,14 +55,18 @@ namespace osu.Game.Overlays.Comments
protected override bool OnHover(HoverEvent e)
{
- background.FadeIn(duration, Easing.OutQuint);
+ FadeInBackground();
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
- background.FadeOut(duration, Easing.OutQuint);
+ FadeOutBackground();
}
+
+ public void FadeInBackground() => background.FadeIn(duration, Easing.OutQuint);
+
+ public void FadeOutBackground() => background.FadeOut(duration, Easing.OutQuint);
}
}
diff --git a/osu.Game/Overlays/Comments/SortSelector.cs b/osu.Game/Overlays/Comments/SortSelector.cs
new file mode 100644
index 0000000000..4425145c3e
--- /dev/null
+++ b/osu.Game/Overlays/Comments/SortSelector.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 osu.Game.Online.API.Requests;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Graphics;
+using osuTK;
+using osu.Game.Graphics.UserInterface;
+using osu.Framework.Input.Events;
+using osu.Framework.Bindables;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class SortSelector : OsuTabControl
+ {
+ private const int spacing = 5;
+
+ protected override Dropdown CreateDropdown() => null;
+
+ protected override TabItem CreateTabItem(SortCommentsBy value) => new SortTabItem(value);
+
+ protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ };
+
+ public SortSelector()
+ {
+ AutoSizeAxes = Axes.Both;
+ }
+
+ private class SortTabItem : TabItem
+ {
+ private readonly TabContent content;
+
+ public SortTabItem(SortCommentsBy value)
+ : base(value)
+ {
+ AutoSizeAxes = Axes.Both;
+ Child = content = new TabContent(value)
+ { Active = { BindTarget = Active } };
+ }
+
+ protected override void OnActivated() => content.FadeInBackground();
+
+ protected override void OnDeactivated() => content.FadeOutBackground();
+
+ private class TabContent : HeaderButton
+ {
+ private const int text_size = 14;
+
+ public readonly BindableBool Active = new BindableBool();
+
+ public TabContent(SortCommentsBy value)
+ {
+ Add(new SpriteText
+ {
+ Font = OsuFont.GetFont(size: text_size),
+ Text = value.ToString()
+ });
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ if (!Active.Value) base.OnHoverLost(e);
+ }
+ }
+ }
+ }
+}
From 3dd2b18ff0d32cb717bddd6c982e42ca3a7a723f Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 16:04:58 +0900
Subject: [PATCH 091/373] Make EditorScreen abstract
---
osu.Game/Screens/Edit/Editor.cs | 6 +-----
osu.Game/Screens/Edit/EditorScreen.cs | 15 +++++----------
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs
index 9ebe3bc26a..7f08c2f8b9 100644
--- a/osu.Game/Screens/Edit/Editor.cs
+++ b/osu.Game/Screens/Edit/Editor.cs
@@ -19,13 +19,13 @@ using osu.Framework.Timing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Menus;
-using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Design;
using osuTK.Input;
using System.Collections.Generic;
using osu.Framework;
using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings;
+using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Edit.Timing;
using osu.Game.Users;
@@ -275,10 +275,6 @@ namespace osu.Game.Screens.Edit
case EditorScreenMode.Timing:
currentScreen = new TimingScreen();
break;
-
- default:
- currentScreen = new EditorScreen();
- break;
}
LoadComponentAsync(currentScreen, screenContainer.Add);
diff --git a/osu.Game/Screens/Edit/EditorScreen.cs b/osu.Game/Screens/Edit/EditorScreen.cs
index 045e5a1226..1b57c703ae 100644
--- a/osu.Game/Screens/Edit/EditorScreen.cs
+++ b/osu.Game/Screens/Edit/EditorScreen.cs
@@ -10,16 +10,17 @@ using osu.Game.Beatmaps;
namespace osu.Game.Screens.Edit
{
///
- /// TODO: eventually make this inherit Screen and add a local scren stack inside the Editor.
+ /// TODO: eventually make this inherit Screen and add a local screen stack inside the Editor.
///
- public class EditorScreen : Container
+ public abstract class EditorScreen : Container
{
- protected readonly IBindable Beatmap = new Bindable();
+ [Resolved]
+ protected IBindable Beatmap { get; private set; }
protected override Container Content => content;
private readonly Container content;
- public EditorScreen()
+ protected EditorScreen()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
@@ -28,12 +29,6 @@ namespace osu.Game.Screens.Edit
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
}
- [BackgroundDependencyLoader]
- private void load(IBindable beatmap)
- {
- Beatmap.BindTo(beatmap);
- }
-
protected override void LoadComplete()
{
base.LoadComplete();
From f2adae8fd167195b667989d30d7bc99b09e12ba3 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 16:05:38 +0900
Subject: [PATCH 092/373] Rename test case to better match underlying class
---
...{TestSceneEditorCompose.cs => TestSceneComposeScreen.cs} | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
rename osu.Game.Tests/Visual/Editor/{TestSceneEditorCompose.cs => TestSceneComposeScreen.cs} (72%)
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs b/osu.Game.Tests/Visual/Editor/TestSceneComposeScreen.cs
similarity index 72%
rename from osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs
rename to osu.Game.Tests/Visual/Editor/TestSceneComposeScreen.cs
index 608df1965e..9f16e1d781 100644
--- a/osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs
+++ b/osu.Game.Tests/Visual/Editor/TestSceneComposeScreen.cs
@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
-using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Osu;
@@ -11,10 +9,8 @@ using osu.Game.Screens.Edit.Compose;
namespace osu.Game.Tests.Visual.Editor
{
[TestFixture]
- public class TestSceneEditorCompose : EditorClockTestScene
+ public class TestSceneComposeScreen : EditorClockTestScene
{
- public override IReadOnlyList RequiredTypes => new[] { typeof(ComposeScreen) };
-
[BackgroundDependencyLoader]
private void load()
{
From 2d8e5615e4970fc1f47a94ed2690d6f2c0cb8a99 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 16:05:55 +0900
Subject: [PATCH 093/373] Extract timeline and layout logic from ComposeScreen
---
.../Screens/Edit/Compose/ComposeScreen.cs | 111 +-----------------
.../Screens/Edit/EditorScreenWithTimeline.cs | 107 +++++++++++++++++
2 files changed, 112 insertions(+), 106 deletions(-)
create mode 100644 osu.Game/Screens/Edit/EditorScreenWithTimeline.cs
diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
index 2a99d81516..1d93c6d4a4 100644
--- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
+++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
@@ -1,112 +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 JetBrains.Annotations;
-using osu.Framework.Allocation;
-using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Shapes;
-using osu.Framework.Logging;
-using osu.Game.Screens.Edit.Compose.Components;
-using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Skinning;
-using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Compose
{
- public class ComposeScreen : EditorScreen
+ public class ComposeScreen : EditorScreenWithTimeline
{
- private const float vertical_margins = 10;
- private const float horizontal_margins = 20;
-
- private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
-
- [BackgroundDependencyLoader(true)]
- private void load([CanBeNull] BindableBeatDivisor beatDivisor)
+ protected override Drawable CreateMainContent()
{
- if (beatDivisor != null)
- this.beatDivisor.BindTo(beatDivisor);
-
- Container composerContainer;
-
- Children = new Drawable[]
- {
- new GridContainer
- {
- RelativeSizeAxes = Axes.Both,
- Content = new[]
- {
- new Drawable[]
- {
- new Container
- {
- Name = "Timeline",
- RelativeSizeAxes = Axes.Both,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black.Opacity(0.5f)
- },
- new Container
- {
- Name = "Timeline content",
- RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
- Child = new GridContainer
- {
- RelativeSizeAxes = Axes.Both,
- Content = new[]
- {
- new Drawable[]
- {
- new Container
- {
- RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Right = 5 },
- Child = new TimelineArea { RelativeSizeAxes = Axes.Both }
- },
- new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
- },
- },
- ColumnDimensions = new[]
- {
- new Dimension(),
- new Dimension(GridSizeMode.Absolute, 90),
- }
- },
- }
- }
- }
- },
- new Drawable[]
- {
- composerContainer = new Container
- {
- Name = "Composer content",
- RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
- }
- }
- },
- RowDimensions = new[] { new Dimension(GridSizeMode.Absolute, 110) }
- },
- };
-
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
- if (ruleset == null)
- {
- Logger.Log("Beatmap doesn't have a ruleset assigned.");
- // ExitRequested?.Invoke();
- return;
- }
-
- var composer = ruleset.CreateHitObjectComposer();
-
- Drawable content;
+ var composer = ruleset?.CreateHitObjectComposer();
if (composer != null)
{
@@ -118,18 +25,10 @@ namespace osu.Game.Screens.Edit.Compose
// load the skinning hierarchy first.
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
- content = beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer()));
- }
- else
- {
- content = new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer");
+ return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer()));
}
- LoadComponentAsync(content, _ =>
- {
- composerContainer.Add(content);
- content.FadeInFromZero(300, Easing.OutQuint);
- });
+ return new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer");
}
}
}
diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs
new file mode 100644
index 0000000000..752356e8c4
--- /dev/null
+++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs
@@ -0,0 +1,107 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using JetBrains.Annotations;
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Screens.Edit.Compose.Components;
+using osu.Game.Screens.Edit.Compose.Components.Timeline;
+using osuTK.Graphics;
+
+namespace osu.Game.Screens.Edit
+{
+ public abstract class EditorScreenWithTimeline : EditorScreen
+ {
+ private const float vertical_margins = 10;
+ private const float horizontal_margins = 20;
+
+ private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
+
+ [BackgroundDependencyLoader(true)]
+ private void load([CanBeNull] BindableBeatDivisor beatDivisor)
+ {
+ if (beatDivisor != null)
+ this.beatDivisor.BindTo(beatDivisor);
+
+ Container mainContent;
+
+ Children = new Drawable[]
+ {
+ new GridContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ Content = new[]
+ {
+ new Drawable[]
+ {
+ new Container
+ {
+ Name = "Timeline",
+ RelativeSizeAxes = Axes.Both,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black.Opacity(0.5f)
+ },
+ new Container
+ {
+ Name = "Timeline content",
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
+ Child = new GridContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ Content = new[]
+ {
+ new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Right = 5 },
+ Child = CreateTimeline()
+ },
+ new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
+ },
+ },
+ ColumnDimensions = new[]
+ {
+ new Dimension(),
+ new Dimension(GridSizeMode.Absolute, 90),
+ }
+ },
+ }
+ }
+ }
+ },
+ new Drawable[]
+ {
+ mainContent = new Container
+ {
+ Name = "Main content",
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
+ }
+ }
+ },
+ RowDimensions = new[] { new Dimension(GridSizeMode.Absolute, 110) }
+ },
+ };
+
+ LoadComponentAsync(CreateMainContent(), content =>
+ {
+ mainContent.Add(content);
+ content.FadeInFromZero(300, Easing.OutQuint);
+ });
+ }
+
+ protected abstract Drawable CreateMainContent();
+
+ protected virtual Drawable CreateTimeline() => new TimelineArea { RelativeSizeAxes = Axes.Both };
+ }
+}
From faef4d932d08cc7ef5fde89d88953b3c21cd7ac6 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 10:17:14 +0300
Subject: [PATCH 094/373] Improve message parsing
---
osu.Game/Online/API/Requests/Responses/Comment.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index 30aca3c2ea..fb0aad0e0b 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -87,8 +87,7 @@ namespace osu.Game.Online.API.Requests.Responses
public string GetMessage()
{
- //temporary fix until HTML parsing will be implemented
- return MessageHTML.Remove(MessageHTML.LastIndexOf("")).Substring(65);
+ return MessageHTML.Replace("", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "");
}
}
}
From 4462d454e87fba91a25b92b3bc4fef0a9ba6007c Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 10:34:17 +0300
Subject: [PATCH 095/373] Message padding improvements
---
osu.Game/Overlays/Comments/CommentsContainer.cs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 5be1b6c1c4..b9effb39e8 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -16,6 +16,7 @@ namespace osu.Game.Overlays.Comments
public class CommentsContainer : CompositeDrawable
{
private const float separator_height = 1.5f;
+ private const int padding = 40;
private readonly CommentableType type;
private readonly long id;
@@ -92,7 +93,13 @@ namespace osu.Game.Overlays.Comments
if (!c.IsDeleted && c.IsTopLevel)
content.AddRange(new Drawable[]
{
- new DrawableComment(c),
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Padding = new MarginPadding { Right = padding },
+ Child = new DrawableComment(c)
+ },
new Container
{
RelativeSizeAxes = Axes.X,
From 0681bb9a2b27f063ae0153ca204b25a895334db1 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 16:49:10 +0900
Subject: [PATCH 096/373] Fix potential nullref
---
osu.Game/Screens/Edit/Compose/ComposeScreen.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
index 1d93c6d4a4..2e9094ebe6 100644
--- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
+++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Screens.Edit.Compose
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer()));
}
- return new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer");
+ return new ScreenWhiteBox.UnderConstructionMessage(ruleset == null ? "This beatmap" : $"{ruleset.Description}'s composer");
}
}
}
From 0a56b041fdf7116ceb72d8a7251383f912961f5f Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 11:07:56 +0300
Subject: [PATCH 097/373] Implement ShowChildsButton
---
.../Online/TestSceneCommentsContainer.cs | 3 +-
.../Online/API/Requests/Responses/Comment.cs | 2 +-
.../Overlays/Comments/CommentsContainer.cs | 9 +--
osu.Game/Overlays/Comments/DrawableComment.cs | 72 ++++++++++++-------
.../Overlays/Comments/ShowChildsButton.cs | 34 +++++++++
5 files changed, 85 insertions(+), 35 deletions(-)
create mode 100644 osu.Game/Overlays/Comments/ShowChildsButton.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index 7fbe9d7e8b..4187771963 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -20,7 +20,8 @@ namespace osu.Game.Tests.Visual.Online
typeof(CommentsHeader),
typeof(DrawableComment),
typeof(HeaderButton),
- typeof(SortSelector)
+ typeof(SortSelector),
+ typeof(ShowChildsButton)
};
protected override bool UseOnlineAPI => true;
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index fb0aad0e0b..9a3dee30b4 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -87,7 +87,7 @@ namespace osu.Game.Online.API.Requests.Responses
public string GetMessage()
{
- return MessageHTML.Replace("", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "");
+ return MessageHTML.Replace("", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace(""", "\"");
}
}
}
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index b9effb39e8..5be1b6c1c4 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Comments
public class CommentsContainer : CompositeDrawable
{
private const float separator_height = 1.5f;
- private const int padding = 40;
private readonly CommentableType type;
private readonly long id;
@@ -93,13 +92,7 @@ namespace osu.Game.Overlays.Comments
if (!c.IsDeleted && c.IsTopLevel)
content.AddRange(new Drawable[]
{
- new Container
- {
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Padding = new MarginPadding { Right = padding },
- Child = new DrawableComment(c)
- },
+ new DrawableComment(c),
new Container
{
RelativeSizeAxes = Axes.X,
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 41b30513a1..a66b8fcd44 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -10,11 +10,11 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users.Drawables;
using osu.Game.Graphics.Containers;
using osu.Game.Utils;
-using osu.Framework.Input.Events;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
+using System.Linq;
namespace osu.Game.Overlays.Comments
{
@@ -23,6 +23,8 @@ namespace osu.Game.Overlays.Comments
private const int avatar_size = 40;
private const int margin = 10;
private const int child_margin = 20;
+ private const int chevron_margin = 30;
+ private const int message_padding = 40;
private const int duration = 200;
private readonly BindableBool childExpanded = new BindableBool(true);
@@ -93,25 +95,41 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(0, 2),
Children = new Drawable[]
{
- new FillFlowContainer
+ new Container
{
- AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Spacing = new Vector2(7, 0),
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
- username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(7, 0),
+ Children = new Drawable[]
+ {
+ username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
+ {
+ AutoSizeAxes = Axes.Both,
+ },
+ new ParentUsername(comment)
+ }
},
- new ParentUsername(comment)
+ new ChevronButton(comment)
+ {
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ Margin = new MarginPadding { Right = chevron_margin },
+ Expanded = { BindTarget = childExpanded }
+ }
}
},
new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Text = comment.GetMessage()
+ Text = comment.GetMessage(),
+ Padding = new MarginPadding { Right = message_padding }
}
}
}
@@ -196,18 +214,34 @@ namespace osu.Game.Overlays.Comments
}
}
- private class RepliesButton : Container
+ private class ChevronButton : ShowChildsButton
+ {
+ private readonly SpriteIcon icon;
+
+ public ChevronButton(Comment comment)
+ {
+ Alpha = comment.IsTopLevel && comment.ChildComments.Any() ? 1 : 0;
+ Child = icon = new SpriteIcon
+ {
+ Size = new Vector2(12),
+ };
+ }
+
+ protected override void OnExpandedChanged(ValueChangedEvent expanded)
+ {
+ icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
+ }
+ }
+
+ private class RepliesButton : ShowChildsButton
{
private readonly SpriteText text;
private readonly int count;
- public readonly BindableBool Expanded = new BindableBool(true);
-
public RepliesButton(int count)
{
this.count = count;
- AutoSizeAxes = Axes.Both;
Alpha = count == 0 ? 0 : 1;
Child = text = new SpriteText
{
@@ -215,22 +249,10 @@ namespace osu.Game.Overlays.Comments
};
}
- protected override void LoadComplete()
- {
- Expanded.BindValueChanged(onExpandedChanged, true);
- base.LoadComplete();
- }
-
- private void onExpandedChanged(ValueChangedEvent expanded)
+ protected override void OnExpandedChanged(ValueChangedEvent expanded)
{
text.Text = $@"{(expanded.NewValue ? "[+]" : "[-]")} replies ({count})";
}
-
- protected override bool OnClick(ClickEvent e)
- {
- Expanded.Value = !Expanded.Value;
- return base.OnClick(e);
- }
}
private class ParentUsername : FillFlowContainer, IHasTooltip
diff --git a/osu.Game/Overlays/Comments/ShowChildsButton.cs b/osu.Game/Overlays/Comments/ShowChildsButton.cs
new file mode 100644
index 0000000000..81280a71b5
--- /dev/null
+++ b/osu.Game/Overlays/Comments/ShowChildsButton.cs
@@ -0,0 +1,34 @@
+// 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.Containers;
+using osu.Framework.Input.Events;
+using osu.Framework.Bindables;
+
+namespace osu.Game.Overlays.Comments
+{
+ public abstract class ShowChildsButton : OsuHoverContainer
+ {
+ public readonly BindableBool Expanded = new BindableBool(true);
+
+ public ShowChildsButton()
+ {
+ AutoSizeAxes = Axes.Both;
+ }
+
+ protected override void LoadComplete()
+ {
+ Expanded.BindValueChanged(OnExpandedChanged, true);
+ base.LoadComplete();
+ }
+
+ protected abstract void OnExpandedChanged(ValueChangedEvent expanded);
+
+ protected override bool OnClick(ClickEvent e)
+ {
+ Expanded.Value = !Expanded.Value;
+ return base.OnClick(e);
+ }
+ }
+}
From a0dfbfe1488e9cbb66ad068828fdbf88069b24ec Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 11:18:26 +0300
Subject: [PATCH 098/373] Handle parent usernames for legacy comments
---
osu.Game/Overlays/Comments/DrawableComment.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index a66b8fcd44..6215f5e108 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -281,7 +281,7 @@ namespace osu.Game.Overlays.Comments
new SpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
- Text = comment.ParentComment?.User?.Username
+ Text = comment.ParentComment?.User?.Username ?? comment.ParentComment?.LegacyName
}
};
}
From ad99a3236f052d2f2130a8c3559093f5c3c3699d Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 11:32:17 +0300
Subject: [PATCH 099/373] Handle edited comments
---
.../Requests/Responses/APICommentsController.cs | 3 +++
osu.Game/Online/API/Requests/Responses/Comment.cs | 2 ++
osu.Game/Overlays/Comments/DrawableComment.cs | 14 +++++++++++++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/osu.Game/Online/API/Requests/Responses/APICommentsController.cs b/osu.Game/Online/API/Requests/Responses/APICommentsController.cs
index cf2e5e8a35..ca6062e371 100644
--- a/osu.Game/Online/API/Requests/Responses/APICommentsController.cs
+++ b/osu.Game/Online/API/Requests/Responses/APICommentsController.cs
@@ -63,6 +63,9 @@ namespace osu.Game.Online.API.Requests.Responses
{
if (c.UserId == u.Id)
c.User = u;
+
+ if (c.EditedById == u.Id)
+ c.EditedUser = u;
});
});
}
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index 9a3dee30b4..e420a585fe 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -81,6 +81,8 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"edited_by_id")]
public long? EditedById { get; set; }
+ public User EditedUser { get; set; }
+
public bool IsTopLevel { get; set; }
public bool IsDeleted { get; set; }
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 6215f5e108..92b59a985b 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -35,6 +35,7 @@ namespace osu.Game.Overlays.Comments
{
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
+ FillFlowContainer info;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
@@ -140,7 +141,7 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.Both,
},
- new FillFlowContainer
+ info = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
@@ -188,6 +189,17 @@ namespace osu.Game.Overlays.Comments
username.AddUserLink(comment.User);
}
+ if (comment.EditedAt.HasValue)
+ {
+ info.Add(new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 12),
+ Text = $@"edited {HumanizerUtils.Humanize(comment.EditedAt.Value)} by {comment.EditedUser.Username}"
+ });
+ }
+
comment.ChildComments.ForEach(c =>
{
if (!c.IsDeleted)
From b2bd78308dc4473d89d89244b873e5bd97b9f54f Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 12:18:49 +0300
Subject: [PATCH 100/373] Handle deleted comments
---
.../Online/API/Requests/Responses/Comment.cs | 2 +-
.../Overlays/Comments/CommentsContainer.cs | 24 +--
osu.Game/Overlays/Comments/DrawableComment.cs | 150 +++++++++++-------
3 files changed, 98 insertions(+), 78 deletions(-)
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index e420a585fe..76a322e5c9 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -89,7 +89,7 @@ namespace osu.Game.Online.API.Requests.Responses
public string GetMessage()
{
- return MessageHTML.Replace("", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace(""", "\"");
+ return IsDeleted ? @"deleted" : MessageHTML.Replace("", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace(""", "\"");
}
}
}
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 5be1b6c1c4..fb97f08a6e 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -15,12 +15,11 @@ namespace osu.Game.Overlays.Comments
{
public class CommentsContainer : CompositeDrawable
{
- private const float separator_height = 1.5f;
-
private readonly CommentableType type;
private readonly long id;
public readonly Bindable Sort = new Bindable();
+ public readonly BindableBool ShowDeleted = new BindableBool();
[Resolved]
private IAPIProvider api { get; set; }
@@ -55,7 +54,8 @@ namespace osu.Game.Overlays.Comments
{
new CommentsHeader
{
- Sort = { BindTarget = Sort }
+ Sort = { BindTarget = Sort },
+ ShowDeleted = { BindTarget = ShowDeleted }
},
content = new FillFlowContainer
{
@@ -89,21 +89,9 @@ namespace osu.Game.Overlays.Comments
{
foreach (var c in response.Comments)
{
- if (!c.IsDeleted && c.IsTopLevel)
- content.AddRange(new Drawable[]
- {
- new DrawableComment(c),
- new Container
- {
- RelativeSizeAxes = Axes.X,
- Height = separator_height,
- Child = new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = colours.Gray1,
- }
- }
- });
+ if (c.IsTopLevel)
+ content.Add(new DrawableComment(c)
+ { ShowDeleted = { BindTarget = ShowDeleted } });
}
}
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 92b59a985b..4092cbb177 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -26,19 +26,29 @@ namespace osu.Game.Overlays.Comments
private const int chevron_margin = 30;
private const int message_padding = 40;
private const int duration = 200;
+ private const float separator_height = 1.5f;
+
+ public readonly BindableBool ShowDeleted = new BindableBool();
private readonly BindableBool childExpanded = new BindableBool(true);
private readonly Container childCommentsVisibilityContainer;
+ private readonly Comment comment;
public DrawableComment(Comment comment)
{
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
FillFlowContainer info;
+ TextFlowContainer message;
+ GridContainer content;
+ VotePill votePill;
+
+ this.comment = comment;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
+ Masking = true;
InternalChild = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
@@ -46,7 +56,7 @@ namespace osu.Game.Overlays.Comments
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
- new GridContainer
+ content = new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@@ -58,7 +68,6 @@ namespace osu.Game.Overlays.Comments
},
RowDimensions = new[]
{
- new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize)
},
Content = new[]
@@ -73,10 +82,11 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
- new VotePill(comment.VotesCount)
+ votePill = new VotePill(comment.VotesCount)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
+ AlwaysPresent = true,
},
new UpdateableAvatar(comment.User)
{
@@ -92,71 +102,53 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Margin = new MarginPadding { Top = margin / 2 },
- Spacing = new Vector2(0, 2),
+ Spacing = new Vector2(0, 3),
Children = new Drawable[]
{
- new Container
+ new FillFlowContainer
{
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(7, 0),
Children = new Drawable[]
{
- new FillFlowContainer
+ username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
{
AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Spacing = new Vector2(7, 0),
- Children = new Drawable[]
- {
- username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
- {
- AutoSizeAxes = Axes.Both,
- },
- new ParentUsername(comment)
- }
},
- new ChevronButton(comment)
+ new ParentUsername(comment),
+ new SpriteText
{
- Anchor = Anchor.TopRight,
- Origin = Anchor.TopRight,
- Margin = new MarginPadding { Right = chevron_margin },
- Expanded = { BindTarget = childExpanded }
+ Alpha = comment.IsDeleted? 1 : 0,
+ Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
+ Text = @"deleted",
}
}
},
- new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
+ message = new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Text = comment.GetMessage(),
Padding = new MarginPadding { Right = message_padding }
- }
- }
- }
- },
- new Drawable[]
- {
- new Container
- {
- RelativeSizeAxes = Axes.Both,
- },
- info = new FillFlowContainer
- {
- AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Spacing = new Vector2(10, 0),
- Children = new Drawable[]
- {
- new SpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: 12),
- Text = HumanizerUtils.Humanize(comment.CreatedAt)
},
- new RepliesButton(comment.RepliesCount)
- { Expanded = { BindTarget = childExpanded } },
+ info = new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(10, 0),
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 12),
+ Text = HumanizerUtils.Humanize(comment.CreatedAt)
+ },
+ new RepliesButton(comment.RepliesCount)
+ { Expanded = { BindTarget = childExpanded } },
+ }
+ }
}
}
}
@@ -181,13 +173,9 @@ namespace osu.Game.Overlays.Comments
};
if (comment.UserId == null)
- {
username.AddText(comment.LegacyName);
- }
else
- {
username.AddUserLink(comment.User);
- }
if (comment.EditedAt.HasValue)
{
@@ -200,15 +188,45 @@ namespace osu.Game.Overlays.Comments
});
}
- comment.ChildComments.ForEach(c =>
+ if (!comment.IsDeleted)
+ message.Text = comment.GetMessage();
+ else
{
- if (!c.IsDeleted)
- childCommentsContainer.Add(new DrawableComment(c));
- });
+ content.FadeColour(OsuColour.Gray(0.5f));
+ votePill.Hide();
+ }
+
+ if (comment.IsTopLevel)
+ {
+ AddInternal(new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ Height = separator_height,
+ Child = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = OsuColour.Gray(0.1f)
+ }
+ });
+
+ if (comment.ChildComments.Any())
+ {
+ AddInternal(new ChevronButton(comment)
+ {
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ Margin = new MarginPadding { Right = chevron_margin, Top = margin },
+ Expanded = { BindTarget = childExpanded }
+ });
+ }
+ }
+
+ comment.ChildComments.ForEach(c => childCommentsContainer.Add(new DrawableComment(c)));
}
protected override void LoadComplete()
{
+ ShowDeleted.BindValueChanged(onShowDeletedChanged, true);
childExpanded.BindValueChanged(onChildExpandedChanged, true);
base.LoadComplete();
}
@@ -226,6 +244,20 @@ namespace osu.Game.Overlays.Comments
}
}
+ private void onShowDeletedChanged(ValueChangedEvent show)
+ {
+ if (comment.IsDeleted)
+ {
+ if (show.NewValue)
+ AutoSizeAxes = Axes.Y;
+ else
+ {
+ AutoSizeAxes = Axes.None;
+ this.ResizeHeightTo(0);
+ }
+ }
+ }
+
private class ChevronButton : ShowChildsButton
{
private readonly SpriteIcon icon;
From 93d2c3d7a1c43cb9871f1bcb779b51cddcc086e9 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 19:03:20 +0900
Subject: [PATCH 101/373] Warn on incorrect null usage
---
osu.sln.DotSettings | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings
index ed162eed6e..ae08a1666f 100644
--- a/osu.sln.DotSettings
+++ b/osu.sln.DotSettings
@@ -17,7 +17,8 @@
WARNING
WARNING
HINT
- HINT
+
+ True
HINT
HINT
WARNING
@@ -738,6 +739,7 @@ See the LICENCE file in the repository root for full licence text.
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+
True
True
True
From 51bf600ea7a830d736a748342bd987e6cc4dc878 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 19:08:31 +0900
Subject: [PATCH 102/373] Use empty hitwindows instead of null
---
.../Objects/CatchHitObject.cs | 2 +-
osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 2 +-
.../Objects/HoldNoteTick.cs | 2 +-
osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs | 2 +-
osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +-
.../Objects/SliderTailCircle.cs | 2 +-
osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 2 +-
osu.Game.Rulesets.Osu/Objects/Spinner.cs | 2 +-
osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 2 +-
.../Objects/DrumRollTick.cs | 2 +-
.../Objects/StrongHitObject.cs | 2 +-
osu.Game.Rulesets.Taiko/Objects/Swell.cs | 2 +-
osu.Game.Rulesets.Taiko/Objects/SwellTick.cs | 2 +-
osu.Game/Rulesets/Objects/HitObject.cs | 6 +---
.../Objects/Legacy/Mania/ConvertHit.cs | 2 +-
.../Objects/Legacy/Mania/ConvertHold.cs | 2 +-
.../Objects/Legacy/Mania/ConvertSlider.cs | 2 +-
.../Objects/Legacy/Mania/ConvertSpinner.cs | 2 +-
.../Rulesets/Objects/Legacy/Osu/ConvertHit.cs | 2 +-
.../Objects/Legacy/Osu/ConvertSlider.cs | 2 +-
.../Objects/Legacy/Osu/ConvertSpinner.cs | 2 +-
.../Objects/Legacy/Taiko/ConvertHit.cs | 2 +-
.../Objects/Legacy/Taiko/ConvertSlider.cs | 2 +-
.../Objects/Legacy/Taiko/ConvertSpinner.cs | 2 +-
osu.Game/Rulesets/Scoring/HitWindows.cs | 35 +++++++++++++++++++
osu.Game/Rulesets/UI/DrawableRuleset.cs | 4 +--
osu.Game/Screens/Play/HUD/HitErrorDisplay.cs | 2 +-
27 files changed, 62 insertions(+), 31 deletions(-)
diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
index 77d7de989a..e4ad49ea50 100644
--- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
@@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Objects
Scale = 1.0f - 0.7f * (difficulty.CircleSize - 5) / 5;
}
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
public enum FruitVisualRepresentation
diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs
index 0c82cf7bbc..bdba813eed 100644
--- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs
+++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs
@@ -101,6 +101,6 @@ namespace osu.Game.Rulesets.Mania.Objects
public override Judgement CreateJudgement() => new HoldNoteJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs
index d0125f8793..ac6697a6dc 100644
--- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs
+++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs
@@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Mania.Objects
{
public override Judgement CreateJudgement() => new HoldNoteTickJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs
index a794e57c9e..a277517f9f 100644
--- a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs
+++ b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs
@@ -30,6 +30,6 @@ namespace osu.Game.Rulesets.Osu.Objects
public override Judgement CreateJudgement() => new OsuJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs
index 3ed1f2cdde..9bed123465 100644
--- a/osu.Game.Rulesets.Osu/Objects/Slider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs
@@ -205,6 +205,6 @@ namespace osu.Game.Rulesets.Osu.Objects
public override Judgement CreateJudgement() => new OsuJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
index 7e540a577b..14c3369967 100644
--- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
@@ -25,6 +25,6 @@ namespace osu.Game.Rulesets.Osu.Objects
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs
index af7cf5b144..a49f4cef8b 100644
--- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs
+++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs
@@ -32,6 +32,6 @@ namespace osu.Game.Rulesets.Osu.Objects
public override Judgement CreateJudgement() => new OsuJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs
index 2e7b763966..2441a1449d 100644
--- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs
@@ -33,6 +33,6 @@ namespace osu.Game.Rulesets.Osu.Objects
public override Judgement CreateJudgement() => new OsuJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs
index 4e02c76a8b..8956ca9c19 100644
--- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs
@@ -88,6 +88,6 @@ namespace osu.Game.Rulesets.Taiko.Objects
public override Judgement CreateJudgement() => new TaikoDrumRollJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs
index c466ca7c8a..8a8be3e38d 100644
--- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs
@@ -27,6 +27,6 @@ namespace osu.Game.Rulesets.Taiko.Objects
public override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs
index d660149528..72a04698be 100644
--- a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs
@@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Taiko.Objects
{
public override Judgement CreateJudgement() => new TaikoStrongJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs
index f96c033dce..e60984596d 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs
@@ -35,6 +35,6 @@ namespace osu.Game.Rulesets.Taiko.Objects
public override Judgement CreateJudgement() => new TaikoSwellJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs
index 68212e8f12..91f4d3dbe7 100644
--- a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs
@@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Taiko.Objects
{
public override Judgement CreateJudgement() => new TaikoSwellTickJudgement();
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs
index a99fac09cc..eb8652443f 100644
--- a/osu.Game/Rulesets/Objects/HitObject.cs
+++ b/osu.Game/Rulesets/Objects/HitObject.cs
@@ -66,7 +66,6 @@ namespace osu.Game.Rulesets.Objects
///
/// The hit windows for this .
///
- [CanBeNull]
public HitWindows HitWindows { get; set; }
private readonly List nestedHitObjects = new List();
@@ -113,10 +112,7 @@ namespace osu.Game.Rulesets.Objects
nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
foreach (var h in nestedHitObjects)
- {
- h.HitWindows = HitWindows;
h.ApplyDefaults(controlPointInfo, difficulty);
- }
}
protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
@@ -147,7 +143,7 @@ namespace osu.Game.Rulesets.Objects
/// This will only be invoked if hasn't been set externally (e.g. from a .
///
///
- [CanBeNull]
+ [NotNull]
protected virtual HitWindows CreateHitWindows() => new HitWindows();
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs
index 609bdd571a..883ef55df0 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs
@@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
{
public float X { get; set; }
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs
index 350ee3185d..69e6f8379d 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs
@@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public double Duration => EndTime - StartTime;
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs
index e372fbd273..4486c5d906 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs
@@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
{
public float X { get; set; }
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs
index 067377d300..c6d1f1922c 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs
@@ -17,6 +17,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public float X { get; set; }
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs
index c9851a0074..e40b5b4505 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs
@@ -22,6 +22,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public int ComboOffset { get; set; }
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs
index 1c1180702b..a163329d47 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs
@@ -22,6 +22,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public int ComboOffset { get; set; }
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs
index bc94ea1803..5d96a61633 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs
@@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public float Y => Position.Y;
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
public bool NewCombo { get; set; }
diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs
index 709345170f..efb9810927 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs
@@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
///
internal sealed class ConvertHit : HitObject
{
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs
index c173b3e11a..b365fd34ae 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs
@@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
///
internal sealed class ConvertSlider : Legacy.ConvertSlider
{
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs
index 9a35ad2776..840ba51ac2 100644
--- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs
@@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
public double Duration => EndTime - StartTime;
- protected override HitWindows CreateHitWindows() => null;
+ protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
diff --git a/osu.Game/Rulesets/Scoring/HitWindows.cs b/osu.Game/Rulesets/Scoring/HitWindows.cs
index efc4cd9f5c..9e7e594104 100644
--- a/osu.Game/Rulesets/Scoring/HitWindows.cs
+++ b/osu.Game/Rulesets/Scoring/HitWindows.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
@@ -30,6 +31,17 @@ namespace osu.Game.Rulesets.Scoring
private double meh;
private double miss;
+ ///
+ /// An empty with only and .
+ /// No time values are provided (meaning instantaneous hit or miss).
+ ///
+ public static HitWindows Empty => new EmptyHitWindows();
+
+ public HitWindows()
+ {
+ Debug.Assert(GetRanges().Length >= 1, $"{nameof(HitWindows)}");
+ }
+
///
/// Retrieves the with the largest hit window that produces a successful hit.
///
@@ -168,6 +180,29 @@ namespace osu.Game.Rulesets.Scoring
/// Defaults are provided but can be overridden to customise for a ruleset.
///
protected virtual DifficultyRange[] GetRanges() => base_ranges;
+
+ public class EmptyHitWindows : HitWindows
+ {
+ private static readonly DifficultyRange[] ranges =
+ {
+ new DifficultyRange(HitResult.Perfect, 0, 0, 0),
+ new DifficultyRange(HitResult.Miss, 0, 0, 0),
+ };
+
+ public override bool IsHitResultAllowed(HitResult result)
+ {
+ switch (result)
+ {
+ case HitResult.Great:
+ case HitResult.Miss:
+ return true;
+ }
+
+ return false;
+ }
+
+ protected override DifficultyRange[] GetRanges() => ranges;
+ }
}
public struct DifficultyRange
diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs
index d68b0e94c5..d5b3df27df 100644
--- a/osu.Game/Rulesets/UI/DrawableRuleset.cs
+++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs
@@ -426,11 +426,11 @@ namespace osu.Game.Rulesets.UI
{
foreach (var h in Objects)
{
- if (h.HitWindows != null)
+ if (h.HitWindows.WindowFor(HitResult.Miss) > 0)
return h.HitWindows;
foreach (var n in h.NestedHitObjects)
- if (n.HitWindows != null)
+ if (h.HitWindows.WindowFor(HitResult.Miss) > 0)
return n.HitWindows;
}
diff --git a/osu.Game/Screens/Play/HUD/HitErrorDisplay.cs b/osu.Game/Screens/Play/HUD/HitErrorDisplay.cs
index 920d11c910..54556f8648 100644
--- a/osu.Game/Screens/Play/HUD/HitErrorDisplay.cs
+++ b/osu.Game/Screens/Play/HUD/HitErrorDisplay.cs
@@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play.HUD
private void onNewJudgement(JudgementResult result)
{
- if (result.HitObject.HitWindows == null)
+ if (result.HitObject.HitWindows.WindowFor(HitResult.Miss) == 0)
return;
foreach (var c in Children)
From ad6b8d3e04eccee5eaabf496b7b3df2d77c79659 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 19:08:55 +0900
Subject: [PATCH 103/373] Add result offset bounding to result itself, rather
than just transforms
---
osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
index f8bc74b2a6..7f3bfd3b5c 100644
--- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
+++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
@@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
UpdateInitialTransforms();
- var judgementOffset = Math.Min(HitObject.HitWindows?.WindowFor(HitResult.Miss) ?? double.MaxValue, Result?.TimeOffset ?? 0);
+ var judgementOffset = Result?.TimeOffset ?? 0;
using (BeginDelayedSequence(InitialLifetimeOffset + judgementOffset, true))
{
@@ -379,7 +379,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
// Ensure that the judgement is given a valid time offset, because this may not get set by the caller
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
- Result.TimeOffset = Time.Current - endTime;
+
+ Result.TimeOffset = Math.Min(HitObject.HitWindows.WindowFor(HitResult.Miss), Time.Current - endTime);
switch (Result.Type)
{
From 9f2a64843291fbe2e8dae6f86f8004559b75991b Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 19:23:37 +0900
Subject: [PATCH 104/373] Add full asserts
---
osu.Game/Rulesets/Scoring/HitWindows.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/osu.Game/Rulesets/Scoring/HitWindows.cs b/osu.Game/Rulesets/Scoring/HitWindows.cs
index 9e7e594104..93e4dfc5fa 100644
--- a/osu.Game/Rulesets/Scoring/HitWindows.cs
+++ b/osu.Game/Rulesets/Scoring/HitWindows.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
@@ -39,7 +40,8 @@ namespace osu.Game.Rulesets.Scoring
public HitWindows()
{
- Debug.Assert(GetRanges().Length >= 1, $"{nameof(HitWindows)}");
+ Debug.Assert(GetRanges().Any(r => r.Result == HitResult.Miss), $"{nameof(GetRanges)} should always contain {nameof(HitResult.Miss)}");
+ Debug.Assert(GetRanges().Any(r => r.Result != HitResult.Miss), $"{nameof(GetRanges)} should always contain at least one result type other than {nameof(HitResult.Miss)}.");
}
///
From 7e3c97f4962e0503b16527d13cc2fb545a3dc659 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 13:37:07 +0300
Subject: [PATCH 105/373] Implement DeletedChildsPlaceholder component
---
.../Online/TestSceneCommentsContainer.cs | 6 ++
.../Online/API/Requests/Responses/Comment.cs | 18 +++++
osu.Game/Overlays/Comments/DrawableComment.cs | 66 +++++++++++++++++--
3 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index 4187771963..8a6ec81d8e 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -40,6 +40,12 @@ namespace osu.Game.Tests.Visual.Online
scrollFlow.Clear();
scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
});
+
+ AddStep("Airman comments", () =>
+ {
+ scrollFlow.Clear();
+ scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 24313));
+ });
}
}
}
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index 76a322e5c9..6fea994cb9 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -5,6 +5,7 @@ using Newtonsoft.Json;
using osu.Game.Users;
using System;
using System.Collections.Generic;
+using System.Linq;
namespace osu.Game.Online.API.Requests.Responses
{
@@ -91,5 +92,22 @@ namespace osu.Game.Online.API.Requests.Responses
{
return IsDeleted ? @"deleted" : MessageHTML.Replace("", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace(""", "\"");
}
+
+ public int GetDeletedChildsCount()
+ {
+ int count = 0;
+
+ if (ChildComments.Any())
+ ChildComments.ForEach(child =>
+ {
+ if (child.IsDeleted)
+ count++;
+ });
+
+ if (IsDeleted)
+ count++;
+
+ return count;
+ }
}
}
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 4092cbb177..60cae8c62a 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -27,6 +27,7 @@ namespace osu.Game.Overlays.Comments
private const int message_padding = 40;
private const int duration = 200;
private const float separator_height = 1.5f;
+ private const int deleted_placeholder_margin = 80;
public readonly BindableBool ShowDeleted = new BindableBool();
@@ -161,12 +162,26 @@ namespace osu.Game.Overlays.Comments
AutoSizeDuration = duration,
AutoSizeEasing = Easing.OutQuint,
Masking = true,
- Child = childCommentsContainer = new FillFlowContainer
+ Child = new FillFlowContainer
{
- Margin = new MarginPadding { Left = child_margin },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Vertical
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ childCommentsContainer = new FillFlowContainer
+ {
+ Margin = new MarginPadding { Left = child_margin },
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical
+ },
+ new DeletedChildsPlaceholder(comment.GetDeletedChildsCount())
+ {
+ Margin = new MarginPadding { Bottom = margin, Left = deleted_placeholder_margin },
+ ShowDeleted = { BindTarget = ShowDeleted }
+ }
+ }
}
}
}
@@ -221,7 +236,8 @@ namespace osu.Game.Overlays.Comments
}
}
- comment.ChildComments.ForEach(c => childCommentsContainer.Add(new DrawableComment(c)));
+ comment.ChildComments.ForEach(c => childCommentsContainer.Add(new DrawableComment(c)
+ { ShowDeleted = { BindTarget = ShowDeleted } }));
}
protected override void LoadComplete()
@@ -258,6 +274,48 @@ namespace osu.Game.Overlays.Comments
}
}
+ private class DeletedChildsPlaceholder : FillFlowContainer
+ {
+ public readonly BindableBool ShowDeleted = new BindableBool();
+
+ private readonly bool canBeVisible;
+
+ public DeletedChildsPlaceholder(int count)
+ {
+ canBeVisible = count != 0;
+
+ AutoSizeAxes = Axes.Both;
+ Direction = FillDirection.Horizontal;
+ Spacing = new Vector2(3, 0);
+ Alpha = 0;
+ Children = new Drawable[]
+ {
+ new SpriteIcon
+ {
+ Icon = FontAwesome.Solid.Trash,
+ Size = new Vector2(14),
+ },
+ new SpriteText
+ {
+ Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
+ Text = $@"{count} deleted comments"
+ }
+ };
+ }
+
+ protected override void LoadComplete()
+ {
+ ShowDeleted.BindValueChanged(onShowDeletedChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onShowDeletedChanged(ValueChangedEvent showDeleted)
+ {
+ if (canBeVisible)
+ this.FadeTo(showDeleted.NewValue ? 0 : 1);
+ }
+ }
+
private class ChevronButton : ShowChildsButton
{
private readonly SpriteIcon icon;
From e6f857d0d8db175f6cae7b70df070227fb474387 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 19:03:20 +0900
Subject: [PATCH 106/373] Revert "Warn on incorrect null usage"
This reverts commit 93d2c3d7a1c43cb9871f1bcb779b51cddcc086e9.
---
osu.sln.DotSettings | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings
index ae08a1666f..ed162eed6e 100644
--- a/osu.sln.DotSettings
+++ b/osu.sln.DotSettings
@@ -17,8 +17,7 @@
WARNING
WARNING
HINT
-
- True
+ HINT
HINT
HINT
WARNING
@@ -739,7 +738,6 @@ See the LICENCE file in the repository root for full licence text.
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
-
True
True
True
From c9d5bea0f1bd1a8a01c4fe2f08242e8292dffe22 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 13:45:14 +0300
Subject: [PATCH 107/373] Remove animations
---
osu.Game/Overlays/Comments/DrawableComment.cs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 60cae8c62a..94ec7a861a 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -25,7 +25,6 @@ namespace osu.Game.Overlays.Comments
private const int child_margin = 20;
private const int chevron_margin = 30;
private const int message_padding = 40;
- private const int duration = 200;
private const float separator_height = 1.5f;
private const int deleted_placeholder_margin = 80;
@@ -159,8 +158,6 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- AutoSizeDuration = duration,
- AutoSizeEasing = Easing.OutQuint,
Masking = true,
Child = new FillFlowContainer
{
@@ -249,14 +246,12 @@ namespace osu.Game.Overlays.Comments
private void onChildExpandedChanged(ValueChangedEvent expanded)
{
- childCommentsVisibilityContainer.ClearTransforms();
-
if (expanded.NewValue)
childCommentsVisibilityContainer.AutoSizeAxes = Axes.Y;
else
{
childCommentsVisibilityContainer.AutoSizeAxes = Axes.None;
- childCommentsVisibilityContainer.ResizeHeightTo(0, duration, Easing.OutQuint);
+ childCommentsVisibilityContainer.ResizeHeightTo(0);
}
}
From 4e273fc628d2bea152dc93f65e9cdbf144c9c610 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Wed, 9 Oct 2019 19:50:05 +0900
Subject: [PATCH 108/373] Return correct allowed value for Perfect
Co-Authored-By: Salman Ahmed
---
osu.Game/Rulesets/Scoring/HitWindows.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Rulesets/Scoring/HitWindows.cs b/osu.Game/Rulesets/Scoring/HitWindows.cs
index 93e4dfc5fa..39d67f1071 100644
--- a/osu.Game/Rulesets/Scoring/HitWindows.cs
+++ b/osu.Game/Rulesets/Scoring/HitWindows.cs
@@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Scoring
{
switch (result)
{
- case HitResult.Great:
+ case HitResult.Perfect:
case HitResult.Miss:
return true;
}
From 107d39c3e97edb17e56bc9377d7e6cf76574ed43 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Wed, 9 Oct 2019 14:10:05 +0300
Subject: [PATCH 109/373] Add DeletedChildsPlaceholder to the bottom of the
comments container
---
.../Online/TestSceneCommentsContainer.cs | 3 +-
.../Online/API/Requests/Responses/Comment.cs | 3 -
.../Overlays/Comments/CommentsContainer.cs | 13 +++++
.../Comments/DeletedChildsPlaceholder.cs | 58 +++++++++++++++++++
osu.Game/Overlays/Comments/DrawableComment.cs | 46 +--------------
5 files changed, 75 insertions(+), 48 deletions(-)
create mode 100644 osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index 8a6ec81d8e..342ba487f0 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -21,7 +21,8 @@ namespace osu.Game.Tests.Visual.Online
typeof(DrawableComment),
typeof(HeaderButton),
typeof(SortSelector),
- typeof(ShowChildsButton)
+ typeof(ShowChildsButton),
+ typeof(DeletedChildsPlaceholder)
};
protected override bool UseOnlineAPI => true;
diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs
index 6fea994cb9..2334c86519 100644
--- a/osu.Game/Online/API/Requests/Responses/Comment.cs
+++ b/osu.Game/Online/API/Requests/Responses/Comment.cs
@@ -104,9 +104,6 @@ namespace osu.Game.Online.API.Requests.Responses
count++;
});
- if (IsDeleted)
- count++;
-
return count;
}
}
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index fb97f08a6e..bf68457988 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -93,6 +93,19 @@ namespace osu.Game.Overlays.Comments
content.Add(new DrawableComment(c)
{ ShowDeleted = { BindTarget = ShowDeleted } });
}
+
+ int deletedComments = 0;
+
+ response.Comments.ForEach(comment =>
+ {
+ if (comment.IsDeleted && comment.IsTopLevel)
+ deletedComments++;
+ });
+
+ content.Add(new DeletedChildsPlaceholder(deletedComments)
+ {
+ ShowDeleted = { BindTarget = ShowDeleted }
+ });
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
new file mode 100644
index 0000000000..d0e6c17ccb
--- /dev/null
+++ b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
@@ -0,0 +1,58 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Game.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osuTK;
+using osu.Framework.Bindables;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class DeletedChildsPlaceholder : FillFlowContainer
+ {
+ private const int deleted_placeholder_margin = 80;
+ private const int margin = 10;
+
+ public readonly BindableBool ShowDeleted = new BindableBool();
+
+ private readonly bool canBeVisible;
+
+ public DeletedChildsPlaceholder(int count)
+ {
+ canBeVisible = count != 0;
+
+ AutoSizeAxes = Axes.Both;
+ Direction = FillDirection.Horizontal;
+ Spacing = new Vector2(3, 0);
+ Margin = new MarginPadding { Vertical = margin, Left = deleted_placeholder_margin };
+ Alpha = 0;
+ Children = new Drawable[]
+ {
+ new SpriteIcon
+ {
+ Icon = FontAwesome.Solid.Trash,
+ Size = new Vector2(14),
+ },
+ new SpriteText
+ {
+ Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
+ Text = $@"{count} deleted comments"
+ }
+ };
+ }
+
+ protected override void LoadComplete()
+ {
+ ShowDeleted.BindValueChanged(onShowDeletedChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onShowDeletedChanged(ValueChangedEvent showDeleted)
+ {
+ if (canBeVisible)
+ this.FadeTo(showDeleted.NewValue ? 0 : 1);
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 94ec7a861a..4af2e07227 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -26,7 +26,6 @@ namespace osu.Game.Overlays.Comments
private const int chevron_margin = 30;
private const int message_padding = 40;
private const float separator_height = 1.5f;
- private const int deleted_placeholder_margin = 80;
public readonly BindableBool ShowDeleted = new BindableBool();
@@ -175,7 +174,6 @@ namespace osu.Game.Overlays.Comments
},
new DeletedChildsPlaceholder(comment.GetDeletedChildsCount())
{
- Margin = new MarginPadding { Bottom = margin, Left = deleted_placeholder_margin },
ShowDeleted = { BindTarget = ShowDeleted }
}
}
@@ -214,6 +212,8 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.X,
Height = separator_height,
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
@@ -269,48 +269,6 @@ namespace osu.Game.Overlays.Comments
}
}
- private class DeletedChildsPlaceholder : FillFlowContainer
- {
- public readonly BindableBool ShowDeleted = new BindableBool();
-
- private readonly bool canBeVisible;
-
- public DeletedChildsPlaceholder(int count)
- {
- canBeVisible = count != 0;
-
- AutoSizeAxes = Axes.Both;
- Direction = FillDirection.Horizontal;
- Spacing = new Vector2(3, 0);
- Alpha = 0;
- Children = new Drawable[]
- {
- new SpriteIcon
- {
- Icon = FontAwesome.Solid.Trash,
- Size = new Vector2(14),
- },
- new SpriteText
- {
- Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
- Text = $@"{count} deleted comments"
- }
- };
- }
-
- protected override void LoadComplete()
- {
- ShowDeleted.BindValueChanged(onShowDeletedChanged, true);
- base.LoadComplete();
- }
-
- private void onShowDeletedChanged(ValueChangedEvent showDeleted)
- {
- if (canBeVisible)
- this.FadeTo(showDeleted.NewValue ? 0 : 1);
- }
- }
-
private class ChevronButton : ShowChildsButton
{
private readonly SpriteIcon icon;
From f74c79c2b85422fda49a147c2ee0d9441bbd49df Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 11:58:43 +0900
Subject: [PATCH 110/373] Fix audio playback position being reset after
resuming to song select
---
.../Visual/Menus/TestSceneScreenNavigation.cs | 80 ++++++++++++++-----
osu.Game/Screens/Select/SongSelect.cs | 12 ++-
2 files changed, 68 insertions(+), 24 deletions(-)
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
index 17535cae98..124d3bb453 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
@@ -5,12 +5,15 @@ using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
+using osu.Framework.Audio.Track;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Framework.Testing;
+using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
@@ -18,7 +21,9 @@ using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
+using osu.Game.Screens.Play;
using osu.Game.Screens.Select;
+using osu.Game.Tests.Beatmaps.IO;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
@@ -31,11 +36,11 @@ namespace osu.Game.Tests.Visual.Menus
private const float click_padding = 25;
private GameHost host;
- private TestOsuGame osuGame;
+ private TestOsuGame game;
- private Vector2 backButtonPosition => osuGame.ToScreenSpace(new Vector2(click_padding, osuGame.LayoutRectangle.Bottom - click_padding));
+ private Vector2 backButtonPosition => game.ToScreenSpace(new Vector2(click_padding, game.LayoutRectangle.Bottom - click_padding));
- private Vector2 optionsButtonPosition => osuGame.ToScreenSpace(new Vector2(click_padding, click_padding));
+ private Vector2 optionsButtonPosition => game.ToScreenSpace(new Vector2(click_padding, click_padding));
[BackgroundDependencyLoader]
private void load(GameHost host)
@@ -54,23 +59,23 @@ namespace osu.Game.Tests.Visual.Menus
{
AddStep("Create new game instance", () =>
{
- if (osuGame != null)
+ if (game != null)
{
- Remove(osuGame);
- osuGame.Dispose();
+ Remove(game);
+ game.Dispose();
}
- osuGame = new TestOsuGame(LocalStorage, API);
- osuGame.SetHost(host);
+ game = new TestOsuGame(LocalStorage, API);
+ game.SetHost(host);
// todo: this can be removed once we can run audio trakcs without a device present
// see https://github.com/ppy/osu/issues/1302
- osuGame.LocalConfig.Set(OsuSetting.IntroSequence, IntroSequence.Circles);
+ game.LocalConfig.Set(OsuSetting.IntroSequence, IntroSequence.Circles);
- Add(osuGame);
+ Add(game);
});
- AddUntilStep("Wait for load", () => osuGame.IsLoaded);
- AddUntilStep("Wait for intro", () => osuGame.ScreenStack.CurrentScreen is IntroScreen);
+ AddUntilStep("Wait for load", () => game.IsLoaded);
+ AddUntilStep("Wait for intro", () => game.ScreenStack.CurrentScreen is IntroScreen);
confirmAtMainMenu();
}
@@ -82,11 +87,39 @@ namespace osu.Game.Tests.Visual.Menus
pushAndConfirm(() => songSelect = new TestSongSelect());
AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
- AddStep("Press escape", () => pressAndRelease(Key.Escape));
+ pushEscape();
AddAssert("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
exitViaEscapeAndConfirm();
}
+ [Test]
+ public void TestSongContinuesAfterExitPlayer()
+ {
+ Player player = null;
+
+ WorkingBeatmap beatmap() => game.Beatmap.Value;
+ Track track() => beatmap().Track;
+
+ pushAndConfirm(() => new TestSongSelect());
+
+ AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(game).Wait());
+
+ AddUntilStep("wait for selected", () => !(track() is TrackVirtual));
+
+ AddStep("press enter", () => pressAndRelease(Key.Enter));
+
+ AddUntilStep("wait for player", () => (player = game.ScreenStack.CurrentScreen as Player) != null);
+ AddUntilStep("wait for fail", () => player.HasFailed);
+
+ AddUntilStep("wait for track stop", () => !track().IsRunning);
+ AddAssert("Ensure time before preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
+
+ pushEscape();
+
+ AddUntilStep("wait for track playing", () => track().IsRunning);
+ AddAssert("Ensure time wasn't reset to preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
+ }
+
[Test]
public void TestExitSongSelectWithClick()
{
@@ -98,7 +131,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition));
// BackButton handles hover using its child button, so this checks whether or not any of BackButton's children are hovered.
- AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == osuGame.BackButton));
+ AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == game.BackButton));
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
@@ -122,25 +155,28 @@ namespace osu.Game.Tests.Visual.Menus
[Test]
public void TestOpenOptionsAndExitWithEscape()
{
- AddUntilStep("Wait for options to load", () => osuGame.Settings.IsLoaded);
+ AddUntilStep("Wait for options to load", () => game.Settings.IsLoaded);
AddStep("Enter menu", () => pressAndRelease(Key.Enter));
AddStep("Move mouse to options overlay", () => InputManager.MoveMouseTo(optionsButtonPosition));
AddStep("Click options overlay", () => InputManager.Click(MouseButton.Left));
- AddAssert("Options overlay was opened", () => osuGame.Settings.State.Value == Visibility.Visible);
+ AddAssert("Options overlay was opened", () => game.Settings.State.Value == Visibility.Visible);
AddStep("Hide options overlay using escape", () => pressAndRelease(Key.Escape));
- AddAssert("Options overlay was closed", () => osuGame.Settings.State.Value == Visibility.Hidden);
+ AddAssert("Options overlay was closed", () => game.Settings.State.Value == Visibility.Hidden);
}
private void pushAndConfirm(Func newScreen)
{
Screen screen = null;
- AddStep("Push new screen", () => osuGame.ScreenStack.Push(screen = newScreen()));
- AddUntilStep("Wait for new screen", () => osuGame.ScreenStack.CurrentScreen == screen && screen.IsLoaded);
+ AddStep("Push new screen", () => game.ScreenStack.Push(screen = newScreen()));
+ AddUntilStep("Wait for new screen", () => game.ScreenStack.CurrentScreen == screen && screen.IsLoaded);
}
+ private void pushEscape() =>
+ AddStep("Press escape", () => pressAndRelease(Key.Escape));
+
private void exitViaEscapeAndConfirm()
{
- AddStep("Press escape", () => pressAndRelease(Key.Escape));
+ pushEscape();
confirmAtMainMenu();
}
@@ -151,7 +187,7 @@ namespace osu.Game.Tests.Visual.Menus
confirmAtMainMenu();
}
- private void confirmAtMainMenu() => AddUntilStep("Wait for main menu", () => osuGame.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
+ private void confirmAtMainMenu() => AddUntilStep("Wait for main menu", () => game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
private void pressAndRelease(Key key)
{
@@ -169,6 +205,8 @@ namespace osu.Game.Tests.Visual.Menus
public new OsuConfigManager LocalConfig => base.LocalConfig;
+ public new Bindable Beatmap => base.Beatmap;
+
protected override Loader CreateLoader() => new TestLoader();
public TestOsuGame(Storage storage, IAPIProvider api)
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 6c5f64ed6c..0025188ad4 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -490,7 +490,7 @@ namespace osu.Game.Screens.Select
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
{
UpdateBeatmap(Beatmap.Value);
- ensurePlayingSelected();
+ ensurePlayingSelected(false);
}
base.OnResuming(last);
@@ -587,7 +587,8 @@ namespace osu.Game.Screens.Select
/// Ensures some music is playing for the current track.
/// Will resume playback from a manual user pause if the track has changed.
///
- private void ensurePlayingSelected()
+ /// Whether to restart from the preview point, rather than resuming from previous location.
+ private void ensurePlayingSelected(bool fromPreviewPoint = true)
{
Track track = Beatmap.Value.Track;
@@ -596,7 +597,12 @@ namespace osu.Game.Screens.Select
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
if (!track.IsRunning && (music?.IsUserPaused != true || isNewTrack))
- track.Restart();
+ {
+ if (fromPreviewPoint)
+ track.Restart();
+ else
+ track.Start();
+ }
lastTrack.SetTarget(track);
}
From e66f9adb8653a68b570d7fbee47f8854a7f61084 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 16:52:51 +0900
Subject: [PATCH 111/373] Fix user pause not being cancelled when playing audio
---
osu.Game/Overlays/MusicController.cs | 45 ++++++++++++++++++---------
osu.Game/Screens/Select/SongSelect.cs | 7 +----
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index f5c36a9cac..2547d7515e 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -98,20 +98,13 @@ namespace osu.Game.Overlays
///
/// Start playing the current track (if not already playing).
///
- public void Play()
- {
- if (!IsPlaying)
- TogglePause();
- }
-
- ///
- /// Toggle pause / play.
- ///
/// Whether the operation was successful.
- public bool TogglePause()
+ public bool Play(bool restart = false)
{
var track = current?.Track;
+ IsUserPaused = false;
+
if (track == null)
{
if (beatmap.Disabled)
@@ -121,16 +114,40 @@ namespace osu.Game.Overlays
return true;
}
+ if (restart)
+ track.Restart();
+ else if (!IsPlaying)
+ track.Start();
+
+ return true;
+ }
+
+ ///
+ /// Stop playing the current track and pause at the current position.
+ ///
+ public void Stop()
+ {
+ var track = current?.Track;
+
if (track.IsRunning)
{
IsUserPaused = true;
track.Stop();
}
+ }
+
+ ///
+ /// Toggle pause / play.
+ ///
+ /// Whether the operation was successful.
+ public bool TogglePause()
+ {
+ var track = current?.Track;
+
+ if (track?.IsRunning == true)
+ Stop();
else
- {
- track.Start();
- IsUserPaused = false;
- }
+ Play();
return true;
}
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 0025188ad4..8187dd04d1 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -597,12 +597,7 @@ namespace osu.Game.Screens.Select
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
if (!track.IsRunning && (music?.IsUserPaused != true || isNewTrack))
- {
- if (fromPreviewPoint)
- track.Restart();
- else
- track.Start();
- }
+ music?.Play(fromPreviewPoint);
lastTrack.SetTarget(track);
}
From 65df7902f3f933baa68df1df3211f0077147b40f Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2019 08:15:47 +0000
Subject: [PATCH 112/373] Bump ppy.osu.Framework.NativeLibs from 2019.813.0 to
2019.1010.0
Bumps [ppy.osu.Framework.NativeLibs](https://github.com/ppy/osu-framework) from 2019.813.0 to 2019.1010.0.
- [Release notes](https://github.com/ppy/osu-framework/releases)
- [Commits](https://github.com/ppy/osu-framework/compare/2019.813.0...2019.1010.0)
Signed-off-by: dependabot-preview[bot]
---
osu.iOS.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.iOS.props b/osu.iOS.props
index a15cae55c4..e59f613c98 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -124,6 +124,6 @@
-
+
From efa5cedf4fef1c3393fdb6ef5926873072c8e6c5 Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2019 08:16:07 +0000
Subject: [PATCH 113/373] Bump ppy.osu.Framework.Android from 2019.930.0 to
2019.1010.0
Bumps [ppy.osu.Framework.Android](https://github.com/ppy/osu-framework) from 2019.930.0 to 2019.1010.0.
- [Release notes](https://github.com/ppy/osu-framework/releases)
- [Commits](https://github.com/ppy/osu-framework/compare/2019.930.0...2019.1010.0)
Signed-off-by: dependabot-preview[bot]
---
osu.Android.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Android.props b/osu.Android.props
index 51245351b6..fa940a7c89 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -62,6 +62,6 @@
-
+
From bc4c1a237140da50f9958fcaf3ee7b0535e945db Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2019 08:16:28 +0000
Subject: [PATCH 114/373] Bump ppy.osu.Framework from 2019.930.0 to 2019.1010.0
Bumps [ppy.osu.Framework](https://github.com/ppy/osu-framework) from 2019.930.0 to 2019.1010.0.
- [Release notes](https://github.com/ppy/osu-framework/releases)
- [Commits](https://github.com/ppy/osu-framework/compare/2019.930.0...2019.1010.0)
Signed-off-by: dependabot-preview[bot]
---
osu.Game/osu.Game.csproj | 2 +-
osu.iOS.props | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 8cbc8b0af3..4e3130b64c 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -26,7 +26,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index a15cae55c4..8a9dc01f38 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -118,7 +118,7 @@
-
+
From e50d8419fda384b0f57a11e0bf4d838ab66d8783 Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2019 08:30:37 +0000
Subject: [PATCH 115/373] Bump ppy.osu.Framework.iOS from 2019.930.0 to
2019.1010.0
Bumps [ppy.osu.Framework.iOS](https://github.com/ppy/osu-framework) from 2019.930.0 to 2019.1010.0.
- [Release notes](https://github.com/ppy/osu-framework/releases)
- [Commits](https://github.com/ppy/osu-framework/compare/2019.930.0...2019.1010.0)
Signed-off-by: dependabot-preview[bot]
---
osu.iOS.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.iOS.props b/osu.iOS.props
index a15cae55c4..7069960ce1 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -119,7 +119,7 @@
-
+
From 8df2e359c48d458cebaa3923e9d7342428259be2 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 17:39:41 +0900
Subject: [PATCH 116/373] Fix tests on CI
---
osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 4 ++--
osu.Game.Tests/Resources/TestResources.cs | 6 +++---
osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
index 6da8d8cb71..b24171a231 100644
--- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
+++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
@@ -456,9 +456,9 @@ namespace osu.Game.Tests.Beatmaps.IO
}
}
- public static async Task LoadOszIntoOsu(OsuGameBase osu, string path = null)
+ public static async Task LoadOszIntoOsu(OsuGameBase osu, string path = null, bool virtualTrack = false)
{
- var temp = path ?? TestResources.GetTestBeatmapForImport();
+ var temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
var manager = osu.Dependencies.Get();
diff --git a/osu.Game.Tests/Resources/TestResources.cs b/osu.Game.Tests/Resources/TestResources.cs
index 9cb85a63bf..66084a3204 100644
--- a/osu.Game.Tests/Resources/TestResources.cs
+++ b/osu.Game.Tests/Resources/TestResources.cs
@@ -11,13 +11,13 @@ namespace osu.Game.Tests.Resources
{
public static Stream OpenResource(string name) => new DllResourceStore("osu.Game.Tests.dll").GetStream($"Resources/{name}");
- public static Stream GetTestBeatmapStream() => new DllResourceStore("osu.Game.Resources.dll").GetStream("Beatmaps/241526 Soleily - Renatus.osz");
+ public static Stream GetTestBeatmapStream(bool virtualTrack = false) => new DllResourceStore("osu.Game.Resources.dll").GetStream($"Beatmaps/241526 Soleily - Renatus{(virtualTrack ? "_virtual" : "")}.osz");
- public static string GetTestBeatmapForImport()
+ public static string GetTestBeatmapForImport(bool virtualTrack = false)
{
var temp = Path.GetTempFileName() + ".osz";
- using (var stream = GetTestBeatmapStream())
+ using (var stream = GetTestBeatmapStream(virtualTrack))
using (var newFile = File.Create(temp))
stream.CopyTo(newFile);
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
index 124d3bb453..e74992e37a 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
@@ -102,9 +102,9 @@ namespace osu.Game.Tests.Visual.Menus
pushAndConfirm(() => new TestSongSelect());
- AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(game).Wait());
+ AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).Wait());
- AddUntilStep("wait for selected", () => !(track() is TrackVirtual));
+ AddUntilStep("wait for selected", () => !game.Beatmap.IsDefault);
AddStep("press enter", () => pressAndRelease(Key.Enter));
From f6b78ad6617508f49654c86696585b934c83a8d2 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Thu, 10 Oct 2019 11:43:45 +0300
Subject: [PATCH 117/373] Overall cleanups
---
.../Online/API/Requests/GetCommentsRequest.cs | 8 +--
.../Overlays/Comments/CommentsContainer.cs | 4 +-
osu.Game/Overlays/Comments/CommentsHeader.cs | 3 +-
.../Comments/DeletedChildsPlaceholder.cs | 3 +-
osu.Game/Overlays/Comments/DrawableComment.cs | 59 +++++++------------
osu.Game/Overlays/Comments/SortSelector.cs | 8 ++-
6 files changed, 35 insertions(+), 50 deletions(-)
diff --git a/osu.Game/Online/API/Requests/GetCommentsRequest.cs b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
index 02a36f7aa2..fb30130ee9 100644
--- a/osu.Game/Online/API/Requests/GetCommentsRequest.cs
+++ b/osu.Game/Online/API/Requests/GetCommentsRequest.cs
@@ -4,6 +4,7 @@
using osu.Framework.IO.Network;
using Humanizer;
using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Overlays.Comments;
namespace osu.Game.Online.API.Requests
{
@@ -43,11 +44,4 @@ namespace osu.Game.Online.API.Requests
Beatmapset,
NewsPost
}
-
- public enum SortCommentsBy
- {
- New,
- Old,
- Top
- }
}
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index bf68457988..314376f5ff 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -91,7 +91,9 @@ namespace osu.Game.Overlays.Comments
{
if (c.IsTopLevel)
content.Add(new DrawableComment(c)
- { ShowDeleted = { BindTarget = ShowDeleted } });
+ {
+ ShowDeleted = { BindTarget = ShowDeleted }
+ });
}
int deletedComments = 0;
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index 90a6f44d6b..6e9864f153 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
-using osu.Game.Online.API.Requests;
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
@@ -62,7 +61,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Current = { BindTarget = Sort }
+ Current = Sort
}
}
},
diff --git a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
index d0e6c17ccb..7aae42908e 100644
--- a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
+++ b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
@@ -7,6 +7,7 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Bindables;
+using System.Linq;
namespace osu.Game.Overlays.Comments
{
@@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Comments
new SpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
- Text = $@"{count} deleted comments"
+ Text = $@"{count} deleted comment{(count.ToString().ToCharArray().Last() == '1' ? "" : "s")}"
}
};
}
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 4af2e07227..fd7f874304 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Comments
private readonly BindableBool childExpanded = new BindableBool(true);
- private readonly Container childCommentsVisibilityContainer;
+ private readonly FillFlowContainer childCommentsVisibilityContainer;
private readonly Comment comment;
public DrawableComment(Comment comment)
@@ -47,7 +47,6 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
- Masking = true;
InternalChild = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
@@ -145,7 +144,9 @@ namespace osu.Game.Overlays.Comments
Text = HumanizerUtils.Humanize(comment.CreatedAt)
},
new RepliesButton(comment.RepliesCount)
- { Expanded = { BindTarget = childExpanded } },
+ {
+ Expanded = { BindTarget = childExpanded }
+ },
}
}
}
@@ -153,29 +154,23 @@ namespace osu.Game.Overlays.Comments
}
}
},
- childCommentsVisibilityContainer = new Container
+ childCommentsVisibilityContainer = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Masking = true,
- Child = new FillFlowContainer
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
{
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Vertical,
- Children = new Drawable[]
+ childCommentsContainer = new FillFlowContainer
{
- childCommentsContainer = new FillFlowContainer
- {
- Margin = new MarginPadding { Left = child_margin },
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Vertical
- },
- new DeletedChildsPlaceholder(comment.GetDeletedChildsCount())
- {
- ShowDeleted = { BindTarget = ShowDeleted }
- }
+ Margin = new MarginPadding { Left = child_margin },
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical
+ },
+ new DeletedChildsPlaceholder(comment.GetDeletedChildsCount())
+ {
+ ShowDeleted = { BindTarget = ShowDeleted }
}
}
}
@@ -234,7 +229,9 @@ namespace osu.Game.Overlays.Comments
}
comment.ChildComments.ForEach(c => childCommentsContainer.Add(new DrawableComment(c)
- { ShowDeleted = { BindTarget = ShowDeleted } }));
+ {
+ ShowDeleted = { BindTarget = ShowDeleted }
+ }));
}
protected override void LoadComplete()
@@ -246,27 +243,13 @@ namespace osu.Game.Overlays.Comments
private void onChildExpandedChanged(ValueChangedEvent expanded)
{
- if (expanded.NewValue)
- childCommentsVisibilityContainer.AutoSizeAxes = Axes.Y;
- else
- {
- childCommentsVisibilityContainer.AutoSizeAxes = Axes.None;
- childCommentsVisibilityContainer.ResizeHeightTo(0);
- }
+ childCommentsVisibilityContainer.FadeTo(expanded.NewValue ? 1 : 0);
}
private void onShowDeletedChanged(ValueChangedEvent show)
{
if (comment.IsDeleted)
- {
- if (show.NewValue)
- AutoSizeAxes = Axes.Y;
- else
- {
- AutoSizeAxes = Axes.None;
- this.ResizeHeightTo(0);
- }
- }
+ this.FadeTo(show.NewValue ? 1 : 0);
}
private class ChevronButton : ShowChildsButton
diff --git a/osu.Game/Overlays/Comments/SortSelector.cs b/osu.Game/Overlays/Comments/SortSelector.cs
index 4425145c3e..cb95a758ff 100644
--- a/osu.Game/Overlays/Comments/SortSelector.cs
+++ b/osu.Game/Overlays/Comments/SortSelector.cs
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Game.Online.API.Requests;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
@@ -72,4 +71,11 @@ namespace osu.Game.Overlays.Comments
}
}
}
+
+ public enum SortCommentsBy
+ {
+ New,
+ Old,
+ Top
+ }
}
From 5d6648d9c95df7f5e05b5008e280f525410ccfe7 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 17:45:38 +0900
Subject: [PATCH 118/373] Update 2.2 references
---
.../CatchRuleset__Tests_.xml | 4 +--
.../ManiaRuleset__Tests_.xml | 4 +--
.../runConfigurations/OsuRuleset__Tests_.xml | 4 +--
.../TaikoRuleset__Tests_.xml | 4 +--
.../.idea/runConfigurations/Tournament.xml | 4 +--
.../.idea/runConfigurations/osu_.xml | 4 +--
.../.idea/runConfigurations/osu___Tests_.xml | 4 +--
.vscode/launch.json | 32 +++++++++----------
.vscode/tasks.json | 2 +-
README.md | 4 +--
osu.Desktop/osu.Desktop.csproj | 2 +-
.../.vscode/launch.json | 4 +--
.../osu.Game.Rulesets.Catch.Tests.csproj | 2 +-
.../.vscode/launch.json | 4 +--
.../osu.Game.Rulesets.Mania.Tests.csproj | 2 +-
.../.vscode/launch.json | 4 +--
.../osu.Game.Rulesets.Osu.Tests.csproj | 2 +-
.../.vscode/launch.json | 4 +--
.../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +-
osu.Game.Tests/osu.Game.Tests.csproj | 2 +-
.../osu.Game.Tournament.Tests.csproj | 2 +-
21 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/.idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml b/.idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml
index 6463dd6ea5..5372b6f28a 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml b/.idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml
index 0b63b2d966..45a94f37c0 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml b/.idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml
index 750ece648b..1f09381e08 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml b/.idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml
index 7b359a1ca0..ba530f0ddf 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.idea/.idea.osu/.idea/runConfigurations/Tournament.xml b/.idea/.idea.osu/.idea/runConfigurations/Tournament.xml
index 3722f3dc04..89d5b45f67 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/Tournament.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/Tournament.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.idea/.idea.osu/.idea/runConfigurations/osu_.xml b/.idea/.idea.osu/.idea/runConfigurations/osu_.xml
index 7ac6bb745d..f1d0957b8e 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/osu_.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/osu_.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.idea/.idea.osu/.idea/runConfigurations/osu___Tests_.xml b/.idea/.idea.osu/.idea/runConfigurations/osu___Tests_.xml
index 7fcb7c15ea..23b49abcad 100644
--- a/.idea/.idea.osu/.idea/runConfigurations/osu___Tests_.xml
+++ b/.idea/.idea.osu/.idea/runConfigurations/osu___Tests_.xml
@@ -1,6 +1,6 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 57ff3e6b43..5940df2191 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -6,13 +6,13 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.2/osu!.dll"
+ "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp3.0/osu!.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build osu! (Debug)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -23,13 +23,13 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.2/osu!.dll"
+ "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp3.0/osu!.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build osu! (Release)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -40,13 +40,13 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Game.Tests/bin/Debug/netcoreapp2.2/osu.Game.Tests.dll"
+ "${workspaceRoot}/osu.Game.Tests/bin/Debug/netcoreapp3.0/osu.Game.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build tests (Debug)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tests/bin/Debug/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tests/bin/Debug/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -56,13 +56,13 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Game.Tests/bin/Release/netcoreapp2.2/osu.Game.Tests.dll"
+ "${workspaceRoot}/osu.Game.Tests/bin/Release/netcoreapp3.0/osu.Game.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build tests (Release)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tests/bin/Release/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tests/bin/Release/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -73,14 +73,14 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.2/osu!.dll",
+ "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp3.0/osu!.dll",
"--tournament"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build osu! (Debug)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -91,14 +91,14 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.2/osu!.dll",
+ "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp3.0/osu!.dll",
"--tournament"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build osu! (Release)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -109,14 +109,14 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp2.2/osu.Game.Tournament.Tests.dll",
+ "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp3.0/osu.Game.Tournament.Tests.dll",
"--tournament"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build tournament tests (Debug)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
@@ -127,14 +127,14 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp2.2/osu.Game.Tournament.Tests.dll",
+ "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp3.0/osu.Game.Tournament.Tests.dll",
"--tournament"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build tournament tests (Release)",
"linux": {
"env": {
- "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp2.2:${env:LD_LIBRARY_PATH}"
+ "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tournament.Tests/bin/Debug/netcoreapp3.0:${env:LD_LIBRARY_PATH}"
}
},
"console": "internalConsole"
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index aba590f466..70e620bca2 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -95,7 +95,7 @@
"problemMatcher": "$msCompile"
},
{
- "label": "Restore (netcoreapp2.2)",
+ "label": "Restore (netcoreapp3.0)",
"type": "shell",
"command": "dotnet",
"args": [
diff --git a/README.md b/README.md
index aefeb2e96e..0460e9cbcf 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Detailed changelogs are published on the [official osu! site](https://osu.ppy.sh
## Requirements
-- A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed.
+- A desktop platform with the [.NET Core SDK 3.0](https://www.microsoft.com/net/learn/get-started) or higher installed.
- When running on linux, please have a system-wide ffmpeg installation available to support video decoding.
- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs.
- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio 2017+](https://visualstudio.microsoft.com/vs/), [Jetbrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/).
@@ -78,7 +78,7 @@ On Linux, the environment variable `LD_LIBRARY_PATH` must point to the build dir
For example, you can run osu! with the following command:
```shell
-LD_LIBRARY_PATH="$(pwd)/osu.Desktop/bin/Debug/netcoreapp2.2" dotnet run --project osu.Desktop
+LD_LIBRARY_PATH="$(pwd)/osu.Desktop/bin/Debug/netcoreapp3.0" dotnet run --project osu.Desktop
```
### Testing with resource/framework modifications
diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj
index 2461351110..2d1282634f 100644
--- a/osu.Desktop/osu.Desktop.csproj
+++ b/osu.Desktop/osu.Desktop.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.2
+ netcoreapp3.0
WinExe
AnyCPU
true
diff --git a/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json b/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json
index 5dfaf5ec39..4030d2d9e7 100644
--- a/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json
+++ b/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json
@@ -7,7 +7,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Debug/netcoreapp2.2/osu.Game.Rulesets.Catch.Tests.dll"
+ "${workspaceRoot}/bin/Debug/netcoreapp3.0/osu.Game.Rulesets.Catch.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Debug)",
@@ -20,7 +20,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Release/netcoreapp2.2/osu.Game.Rulesets.Catch.Tests.dll"
+ "${workspaceRoot}/bin/Release/netcoreapp3.0/osu.Game.Rulesets.Catch.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Release)",
diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
index 36342024b0..4b629902cb 100644
--- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
+++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
@@ -9,7 +9,7 @@
WinExe
- netcoreapp2.2
+ netcoreapp3.0
diff --git a/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json b/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json
index 492f894484..779eb4f277 100644
--- a/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json
+++ b/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json
@@ -7,7 +7,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Debug/netcoreapp2.2/osu.Game.Rulesets.Mania.Tests.dll"
+ "${workspaceRoot}/bin/Debug/netcoreapp3.0/osu.Game.Rulesets.Mania.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Debug)",
@@ -20,7 +20,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Release/netcoreapp2.2/osu.Game.Rulesets.Mania.Tests.dll"
+ "${workspaceRoot}/bin/Release/netcoreapp3.0/osu.Game.Rulesets.Mania.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Release)",
diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
index 09bf9241f2..30511d672d 100644
--- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
+++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
@@ -9,7 +9,7 @@
WinExe
- netcoreapp2.2
+ netcoreapp3.0
diff --git a/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json b/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json
index ed03e99b9b..67338b7bbe 100644
--- a/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json
+++ b/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json
@@ -7,7 +7,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Debug/netcoreapp2.2/osu.Game.Rulesets.Osu.Tests.dll"
+ "${workspaceRoot}/bin/Debug/netcoreapp3.0/osu.Game.Rulesets.Osu.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Debug)",
@@ -20,7 +20,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Release/netcoreapp2.2/osu.Game.Rulesets.Osu.Tests.dll"
+ "${workspaceRoot}/bin/Release/netcoreapp3.0/osu.Game.Rulesets.Osu.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Release)",
diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
index 791043bcc6..3aea9e0387 100644
--- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
+++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
@@ -9,7 +9,7 @@
WinExe
- netcoreapp2.2
+ netcoreapp3.0
diff --git a/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json b/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json
index 3ef78bf6c8..7d929e6bbf 100644
--- a/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json
+++ b/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json
@@ -7,7 +7,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Debug/netcoreapp2.2/osu.Game.Rulesets.Taiko.Tests.dll"
+ "${workspaceRoot}/bin/Debug/netcoreapp3.0/osu.Game.Rulesets.Taiko.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Debug)",
@@ -20,7 +20,7 @@
"request": "launch",
"program": "dotnet",
"args": [
- "${workspaceRoot}/bin/Release/netcoreapp2.2/osu.Game.Rulesets.Taiko.Tests.dll"
+ "${workspaceRoot}/bin/Release/netcoreapp3.0/osu.Game.Rulesets.Taiko.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build (Release)",
diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
index b0e0efdc68..717e795112 100644
--- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
+++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
@@ -9,7 +9,7 @@
WinExe
- netcoreapp2.2
+ netcoreapp3.0
diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj
index 75e6354612..aa29fc802c 100644
--- a/osu.Game.Tests/osu.Game.Tests.csproj
+++ b/osu.Game.Tests/osu.Game.Tests.csproj
@@ -10,7 +10,7 @@
WinExe
- netcoreapp2.2
+ netcoreapp3.0
diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
index 491cf54686..371ffcdf9e 100644
--- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
+++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
@@ -11,7 +11,7 @@
WinExe
- netcoreapp2.2
+ netcoreapp3.0
From a6588adbecd6ee4b201e90faefb1038c182586ae Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 17:48:56 +0900
Subject: [PATCH 119/373] Update cake bootstrap scripts
---
build.ps1 | 86 +++----------------------------------------------------
build.sh | 41 ++------------------------
2 files changed, 7 insertions(+), 120 deletions(-)
mode change 100644 => 100755 build.ps1
diff --git a/build.ps1 b/build.ps1
old mode 100644
new mode 100755
index c6a0bf6d4a..8eb37f2de6
--- a/build.ps1
+++ b/build.ps1
@@ -1,82 +1,4 @@
-##########################################################################
-# This is a customized Cake bootstrapper script for PowerShell.
-##########################################################################
-
-<#
-
-.SYNOPSIS
-This is a Powershell script to bootstrap a Cake build.
-
-.DESCRIPTION
-This Powershell script restores NuGet tools (including Cake)
-and execute your Cake build script with the parameters you provide.
-
-.PARAMETER Script
-The build script to execute.
-.PARAMETER Target
-The build script target to run.
-.PARAMETER Configuration
-The build configuration to use.
-.PARAMETER Verbosity
-Specifies the amount of information to be displayed.
-.PARAMETER ShowDescription
-Shows description about tasks.
-.PARAMETER DryRun
-Performs a dry run.
-.PARAMETER ScriptArgs
-Remaining arguments are added here.
-
-.LINK
-https://cakebuild.net
-
-#>
-
-[CmdletBinding()]
-Param(
- [string]$Script = "build.cake",
- [string]$Target,
- [string]$Configuration,
- [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
- [string]$Verbosity,
- [switch]$ShowDescription,
- [Alias("WhatIf", "Noop")]
- [switch]$DryRun,
- [Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)]
- [string[]]$ScriptArgs
-)
-
-Write-Host "Preparing to run build script..."
-
-# Determine the script root for resolving other paths.
-if(!$PSScriptRoot) {
- $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
-}
-
-# Resolve the paths for resources used for debugging.
-$BUILD_DIR = Join-Path $PSScriptRoot "build"
-$TOOLS_DIR = Join-Path $BUILD_DIR "tools"
-$CAKE_CSPROJ = Join-Path $BUILD_DIR "cakebuild.csproj"
-
-# Install the required tools locally.
-Write-Host "Restoring cake tools..."
-Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null
-
-# Find the Cake executable
-$CAKE_EXECUTABLE = (Get-ChildItem -Path "$TOOLS_DIR/cake.coreclr/" -Filter Cake.dll -Recurse).FullName
-
-# Build Cake arguments
-$cakeArguments = @("$Script");
-if ($Target) { $cakeArguments += "-target=$Target" }
-if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
-if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
-if ($ShowDescription) { $cakeArguments += "-showdescription" }
-if ($DryRun) { $cakeArguments += "-dryrun" }
-if ($Experimental) { $cakeArguments += "-experimental" }
-$cakeArguments += $ScriptArgs
-
-# Start Cake
-Write-Host "Running build script..."
-Push-Location -Path $BUILD_DIR
-Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments"
-Pop-Location
-exit $LASTEXITCODE
+dotnet tool install Cake.Tool --global --version 0.35.0
+dotnet cake ./build/build.cake --bootstrap
+dotnet cake ./build/build.cake
+exit $LASTEXITCODE
\ No newline at end of file
diff --git a/build.sh b/build.sh
index 8f1ef5b455..d20a9c12fa 100755
--- a/build.sh
+++ b/build.sh
@@ -1,38 +1,3 @@
-#!/usr/bin/env bash
-
-##########################################################################
-# This is a customized Cake bootstrapper script for Shell.
-##########################################################################
-
-echo "Preparing to run build script..."
-
-cd build
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-TOOLS_DIR=$SCRIPT_DIR/tools
-CAKE_BINARY_PATH=$TOOLS_DIR/"cake.coreclr"
-
-SCRIPT="build.cake"
-CAKE_CSPROJ=$SCRIPT_DIR/"cakebuild.csproj"
-
-# Parse arguments.
-CAKE_ARGUMENTS=()
-for i in "$@"; do
- case $1 in
- -s|--script) SCRIPT="$2"; shift ;;
- --) shift; CAKE_ARGUMENTS+=("$@"); break ;;
- *) CAKE_ARGUMENTS+=("$1") ;;
- esac
- shift
-done
-
-# Install the required tools locally.
-echo "Restoring cake tools..."
-dotnet restore $CAKE_CSPROJ --packages $TOOLS_DIR > /dev/null 2>&1
-
-# Search for the CakeBuild binary.
-CAKE_BINARY=$(find $CAKE_BINARY_PATH -name "Cake.dll")
-
-# Start Cake
-echo "Running build script..."
-
-dotnet "$CAKE_BINARY" $SCRIPT "${CAKE_ARGUMENTS[@]}"
+dotnet tool install Cake.Tool --global --version 0.35.0
+dotnet cake ./build/build.cake --bootstrap
+dotnet cake ./build/build.cake
\ No newline at end of file
From 3fd4b0da502ffe4ea9a5f6c24c41bee4d7f607d3 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 17:50:00 +0900
Subject: [PATCH 120/373] Update appveyor images
---
appveyor.yml | 2 +-
appveyor_deploy.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/appveyor.yml b/appveyor.yml
index be1727e7d7..f59c0b162d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,6 +1,6 @@
clone_depth: 1
version: '{branch}-{build}'
-image: Previous Visual Studio 2017
+image: Visual Studio 2019 Preview
test: off
build_script:
- cmd: PowerShell -Version 2.0 .\build.ps1
diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml
index d36298175b..13635b943c 100644
--- a/appveyor_deploy.yml
+++ b/appveyor_deploy.yml
@@ -1,6 +1,6 @@
clone_depth: 1
version: '{build}'
-image: Previous Visual Studio 2017
+image: Visual Studio 2019 Preview
test: off
skip_non_tags: true
build_script:
From d75275c0eee8deb444b462f0737eb33341235f3a Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 17:51:00 +0900
Subject: [PATCH 121/373] Remove cake csproj
---
build/cakebuild.csproj | 11 -----------
1 file changed, 11 deletions(-)
delete mode 100644 build/cakebuild.csproj
diff --git a/build/cakebuild.csproj b/build/cakebuild.csproj
deleted file mode 100644
index d5a6d44740..0000000000
--- a/build/cakebuild.csproj
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- Exe
- true
- netcoreapp2.0
-
-
-
-
-
-
\ No newline at end of file
From 4a4830c717373ac7742fe3d64741a4cd674a8906 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 17:51:56 +0900
Subject: [PATCH 122/373] Update cake dependencies
---
build/build.cake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build/build.cake b/build/build.cake
index 1d2588de49..cfdfebee61 100644
--- a/build/build.cake
+++ b/build/build.cake
@@ -1,5 +1,5 @@
-#addin "nuget:?package=CodeFileSanity&version=0.0.21"
-#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2019.1.1"
+#addin "nuget:?package=CodeFileSanity&version=0.0.33"
+#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2019.2.1"
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
From 64f62bd2bfbccd702bb39039bc77166eb16a1b0b Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Thu, 10 Oct 2019 12:06:25 +0300
Subject: [PATCH 123/373] Implement CommentsHeader component
---
.../Visual/Online/TestSceneCommentsHeader.cs | 39 +++++
osu.Game/Overlays/Comments/CommentsHeader.cs | 137 ++++++++++++++++++
osu.Game/Overlays/Comments/HeaderButton.cs | 72 +++++++++
osu.Game/Overlays/Comments/SortSelector.cs | 106 ++++++++++++++
osu.Game/osu.Game.csproj | 3 +
5 files changed, 357 insertions(+)
create mode 100644 osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
create mode 100644 osu.Game/Overlays/Comments/CommentsHeader.cs
create mode 100644 osu.Game/Overlays/Comments/HeaderButton.cs
create mode 100644 osu.Game/Overlays/Comments/SortSelector.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
new file mode 100644
index 0000000000..52318605d9
--- /dev/null
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
@@ -0,0 +1,39 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using osu.Framework.Bindables;
+using osu.Game.Overlays.Comments;
+
+namespace osu.Game.Tests.Visual.Online
+{
+ [TestFixture]
+ public class TestSceneCommentsHeader : OsuTestScene
+ {
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(CommentsHeader),
+ typeof(HeaderButton),
+ typeof(SortSelector),
+ };
+
+ private readonly Bindable sort = new Bindable();
+ private readonly BindableBool showDeleted = new BindableBool();
+
+ public TestSceneCommentsHeader()
+ {
+ Add(new CommentsHeader
+ {
+ Sort = { BindTarget = sort },
+ ShowDeleted = { BindTarget = showDeleted }
+ });
+
+ AddStep("Trigger ShowDeleted", () => showDeleted.Value = !showDeleted.Value);
+ AddStep("Select old", () => sort.Value = SortCommentsBy.Old);
+ AddStep("Select new", () => sort.Value = SortCommentsBy.New);
+ AddStep("Select top", () => sort.Value = SortCommentsBy.Top);
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
new file mode 100644
index 0000000000..c21ec90048
--- /dev/null
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -0,0 +1,137 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osuTK;
+using osu.Framework.Input.Events;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class CommentsHeader : CompositeDrawable
+ {
+ private const int height = 40;
+ private const int spacing = 10;
+ private const int padding = 50;
+ private const int text_size = 14;
+
+ public readonly Bindable Sort = new Bindable();
+ public readonly BindableBool ShowDeleted = new BindableBool();
+
+ private readonly Box background;
+
+ public CommentsHeader()
+ {
+ RelativeSizeAxes = Axes.X;
+ Height = height;
+ AddRangeInternal(new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Horizontal = padding },
+ Children = new Drawable[]
+ {
+ new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Children = new Drawable[]
+ {
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: text_size),
+ Text = @"Sort by"
+ },
+ new SortSelector
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Current = Sort
+ }
+ }
+ },
+ new ShowDeletedButton
+ {
+ Anchor = Anchor.CentreRight,
+ Origin = Anchor.CentreRight,
+ Checked = { BindTarget = ShowDeleted }
+ }
+ }
+ }
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Gray3;
+ }
+
+ private class ShowDeletedButton : HeaderButton
+ {
+ private const int spacing = 5;
+
+ public readonly BindableBool Checked = new BindableBool();
+
+ private readonly SpriteIcon checkboxIcon;
+
+ public ShowDeletedButton()
+ {
+ Add(new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ Children = new Drawable[]
+ {
+ checkboxIcon = new SpriteIcon
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Size = new Vector2(10),
+ },
+ new SpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: text_size),
+ Text = @"Show deleted"
+ }
+ },
+ });
+ }
+
+ protected override void LoadComplete()
+ {
+ Checked.BindValueChanged(onCheckedChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onCheckedChanged(ValueChangedEvent isChecked)
+ {
+ checkboxIcon.Icon = isChecked.NewValue ? FontAwesome.Solid.CheckSquare : FontAwesome.Regular.Square;
+ }
+
+ protected override bool OnClick(ClickEvent e)
+ {
+ Checked.Value = !Checked.Value;
+ return base.OnClick(e);
+ }
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Comments/HeaderButton.cs b/osu.Game/Overlays/Comments/HeaderButton.cs
new file mode 100644
index 0000000000..231a364759
--- /dev/null
+++ b/osu.Game/Overlays/Comments/HeaderButton.cs
@@ -0,0 +1,72 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osu.Framework.Input.Events;
+using osu.Game.Graphics.UserInterface;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class HeaderButton : Container
+ {
+ private const int height = 20;
+ private const int corner_radius = 3;
+ private const int margin = 10;
+ private const int duration = 200;
+
+ protected override Container Content => content;
+
+ private readonly Box background;
+ private readonly Container content;
+
+ public HeaderButton()
+ {
+ AutoSizeAxes = Axes.X;
+ Height = height;
+ Masking = true;
+ CornerRadius = corner_radius;
+ AddRangeInternal(new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0,
+ },
+ content = new Container
+ {
+ AutoSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Margin = new MarginPadding { Horizontal = margin }
+ },
+ new HoverClickSounds(),
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Gray4;
+ }
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ FadeInBackground();
+ return base.OnHover(e);
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ base.OnHoverLost(e);
+ FadeOutBackground();
+ }
+
+ protected void FadeInBackground() => background.FadeIn(duration, Easing.OutQuint);
+
+ protected void FadeOutBackground() => background.FadeOut(duration, Easing.OutQuint);
+ }
+}
diff --git a/osu.Game/Overlays/Comments/SortSelector.cs b/osu.Game/Overlays/Comments/SortSelector.cs
new file mode 100644
index 0000000000..b4e29477d7
--- /dev/null
+++ b/osu.Game/Overlays/Comments/SortSelector.cs
@@ -0,0 +1,106 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Graphics;
+using osuTK;
+using osu.Game.Graphics.UserInterface;
+using osu.Framework.Input.Events;
+using osu.Framework.Bindables;
+using osu.Framework.Allocation;
+using osuTK.Graphics;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class SortSelector : OsuTabControl
+ {
+ private const int spacing = 5;
+
+ protected override Dropdown CreateDropdown() => null;
+
+ protected override TabItem CreateTabItem(SortCommentsBy value) => new SortTabItem(value);
+
+ protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(spacing, 0),
+ };
+
+ public SortSelector()
+ {
+ AutoSizeAxes = Axes.Both;
+ }
+
+ private class SortTabItem : TabItem
+ {
+ private readonly TabContent content;
+
+ public SortTabItem(SortCommentsBy value)
+ : base(value)
+ {
+ AutoSizeAxes = Axes.Both;
+ Child = content = new TabContent(value)
+ {
+ Active = { BindTarget = Active }
+ };
+ }
+
+ protected override void OnActivated() => content.Activate();
+
+ protected override void OnDeactivated() => content.Deactivate();
+
+ private class TabContent : HeaderButton
+ {
+ private const int text_size = 14;
+
+ public readonly BindableBool Active = new BindableBool();
+
+ [Resolved]
+ private OsuColour colours { get; set; }
+
+ private readonly SpriteText text;
+
+ public TabContent(SortCommentsBy value)
+ {
+ Add(text = new SpriteText
+ {
+ Font = OsuFont.GetFont(size: text_size),
+ Text = value.ToString()
+ });
+ }
+
+ public void Activate()
+ {
+ FadeInBackground();
+ text.Font = text.Font.With(weight: FontWeight.Bold);
+ text.Colour = colours.BlueLighter;
+ }
+
+ public void Deactivate()
+ {
+ if (!IsHovered)
+ FadeOutBackground();
+
+ text.Font = text.Font.With(weight: FontWeight.Medium);
+ text.Colour = Color4.White;
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ if (!Active.Value) base.OnHoverLost(e);
+ }
+ }
+ }
+ }
+
+ public enum SortCommentsBy
+ {
+ New,
+ Old,
+ Top
+ }
+}
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 8cbc8b0af3..28d5dd796c 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -32,4 +32,7 @@
+
+
+
From a819a640362e96ce03a7a5e247b3d679afc6beb4 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 19:16:14 +0900
Subject: [PATCH 124/373] Update resources
---
osu.Game/osu.Game.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 8cbc8b0af3..7a71c5634d 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -25,7 +25,7 @@
-
+
From fe7b4037f79ed180a3ff8f682ffdc41d9e006e8e Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Thu, 10 Oct 2019 13:24:22 +0300
Subject: [PATCH 125/373] CI fix
---
osu.Game/Overlays/Comments/CommentsHeader.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index c21ec90048..fb507e6cb2 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -84,8 +84,6 @@ namespace osu.Game.Overlays.Comments
private class ShowDeletedButton : HeaderButton
{
- private const int spacing = 5;
-
public readonly BindableBool Checked = new BindableBool();
private readonly SpriteIcon checkboxIcon;
@@ -96,7 +94,7 @@ namespace osu.Game.Overlays.Comments
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
- Spacing = new Vector2(spacing, 0),
+ Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
checkboxIcon = new SpriteIcon
From 5eba33e876745e8d9519604d0e370d327cde4fdf Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Thu, 10 Oct 2019 20:12:47 +0900
Subject: [PATCH 126/373] Simplify logic and add test coverage for remaining
case
---
osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs | 8 ++++++--
osu.Game/Overlays/MusicController.cs | 6 ++----
osu.Game/Screens/Select/SongSelect.cs | 9 +++++----
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
index e74992e37a..471f67b7b6 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
@@ -92,8 +92,9 @@ namespace osu.Game.Tests.Visual.Menus
exitViaEscapeAndConfirm();
}
- [Test]
- public void TestSongContinuesAfterExitPlayer()
+ [TestCase(true)]
+ [TestCase(false)]
+ public void TestSongContinuesAfterExitPlayer(bool withUserPause)
{
Player player = null;
@@ -106,6 +107,9 @@ namespace osu.Game.Tests.Visual.Menus
AddUntilStep("wait for selected", () => !game.Beatmap.IsDefault);
+ if (withUserPause)
+ AddStep("pause", () => game.Dependencies.Get().Stop());
+
AddStep("press enter", () => pressAndRelease(Key.Enter));
AddUntilStep("wait for player", () => (player = game.ScreenStack.CurrentScreen as Player) != null);
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index 2547d7515e..9ec0364420 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -129,11 +129,9 @@ namespace osu.Game.Overlays
{
var track = current?.Track;
- if (track.IsRunning)
- {
- IsUserPaused = true;
+ IsUserPaused = true;
+ if (track?.IsRunning == true)
track.Stop();
- }
}
///
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 8187dd04d1..2d0c2e254c 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -490,7 +490,9 @@ namespace osu.Game.Screens.Select
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
{
UpdateBeatmap(Beatmap.Value);
- ensurePlayingSelected(false);
+
+ // restart playback on returning to song select, regardless.
+ music?.Play();
}
base.OnResuming(last);
@@ -587,8 +589,7 @@ namespace osu.Game.Screens.Select
/// Ensures some music is playing for the current track.
/// Will resume playback from a manual user pause if the track has changed.
///
- /// Whether to restart from the preview point, rather than resuming from previous location.
- private void ensurePlayingSelected(bool fromPreviewPoint = true)
+ private void ensurePlayingSelected()
{
Track track = Beatmap.Value.Track;
@@ -597,7 +598,7 @@ namespace osu.Game.Screens.Select
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
if (!track.IsRunning && (music?.IsUserPaused != true || isNewTrack))
- music?.Play(fromPreviewPoint);
+ music?.Play(true);
lastTrack.SetTarget(track);
}
From b45e7246b85a859fb2a6a2306914b37999d76ff8 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Thu, 10 Oct 2019 15:56:08 +0300
Subject: [PATCH 127/373] Rename SortCommentsBy to CommentsSortCriteria
---
.../Visual/Online/TestSceneCommentsHeader.cs | 8 ++++----
osu.Game/Overlays/Comments/CommentsHeader.cs | 2 +-
osu.Game/Overlays/Comments/SortSelector.cs | 14 +++++++-------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
index 52318605d9..949dbbe5c4 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
@@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(SortSelector),
};
- private readonly Bindable sort = new Bindable();
+ private readonly Bindable sort = new Bindable();
private readonly BindableBool showDeleted = new BindableBool();
public TestSceneCommentsHeader()
@@ -31,9 +31,9 @@ namespace osu.Game.Tests.Visual.Online
});
AddStep("Trigger ShowDeleted", () => showDeleted.Value = !showDeleted.Value);
- AddStep("Select old", () => sort.Value = SortCommentsBy.Old);
- AddStep("Select new", () => sort.Value = SortCommentsBy.New);
- AddStep("Select top", () => sort.Value = SortCommentsBy.Top);
+ AddStep("Select old", () => sort.Value = CommentsSortCriteria.Old);
+ AddStep("Select new", () => sort.Value = CommentsSortCriteria.New);
+ AddStep("Select top", () => sort.Value = CommentsSortCriteria.Top);
}
}
}
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index fb507e6cb2..2bd2bf21a6 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Comments
private const int padding = 50;
private const int text_size = 14;
- public readonly Bindable Sort = new Bindable();
+ public readonly Bindable Sort = new Bindable();
public readonly BindableBool ShowDeleted = new BindableBool();
private readonly Box background;
diff --git a/osu.Game/Overlays/Comments/SortSelector.cs b/osu.Game/Overlays/Comments/SortSelector.cs
index b4e29477d7..100ae83291 100644
--- a/osu.Game/Overlays/Comments/SortSelector.cs
+++ b/osu.Game/Overlays/Comments/SortSelector.cs
@@ -15,13 +15,13 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Comments
{
- public class SortSelector : OsuTabControl
+ public class SortSelector : OsuTabControl
{
private const int spacing = 5;
- protected override Dropdown CreateDropdown() => null;
+ protected override Dropdown CreateDropdown() => null;
- protected override TabItem CreateTabItem(SortCommentsBy value) => new SortTabItem(value);
+ protected override TabItem CreateTabItem(CommentsSortCriteria value) => new SortTabItem(value);
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
@@ -35,11 +35,11 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Both;
}
- private class SortTabItem : TabItem
+ private class SortTabItem : TabItem
{
private readonly TabContent content;
- public SortTabItem(SortCommentsBy value)
+ public SortTabItem(CommentsSortCriteria value)
: base(value)
{
AutoSizeAxes = Axes.Both;
@@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Comments
private readonly SpriteText text;
- public TabContent(SortCommentsBy value)
+ public TabContent(CommentsSortCriteria value)
{
Add(text = new SpriteText
{
@@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Comments
}
}
- public enum SortCommentsBy
+ public enum CommentsSortCriteria
{
New,
Old,
From cb1f7e2dc7840f3016914e5702c575dfb2a8a133 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Thu, 10 Oct 2019 13:48:36 +0200
Subject: [PATCH 128/373] Fix platform dependency in buffered reader test
Tests for the line-buffered reader added in 7b1ff38 were subtly
dependent on the execution environment due to differing end-of-line
markers on Windows and Unix-based systems.
Because StreamReader discards all newlines when reading line-by-line,
LineBufferedReader used a StringBuilder to patch the peeked lines
back together with the remaining contents of the file being read.
As StringBuilder.AppendLine uses the environment-specific newline
delimiter, the delimiters after the peeked-but-unconsumed lines can
therefore be substituted by the platform-specific variants, causing
the test failures due to the overly-simplified way they were written.
Reformulate the test to avoid such issues from resurfacing again
by splitting lines by \r or \n and then testing each line individually.
Additionally remove all raw literals in favour of explicitly mixing
various line delimiter character sequences for additional coverage.
---
.../Beatmaps/IO/LineBufferedReaderTest.cs | 34 +++++++------------
1 file changed, 13 insertions(+), 21 deletions(-)
diff --git a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs
index b582ca0a6f..25517ad615 100644
--- a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs
+++ b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.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 System.IO;
using System.Text;
using NUnit.Framework;
@@ -14,9 +15,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test]
public void TestReadLineByLine()
{
- const string contents = @"line 1
-line 2
-line 3";
+ const string contents = "line 1\rline 2\nline 3";
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
using (var bufferedReader = new LineBufferedReader(stream))
@@ -31,9 +30,7 @@ line 3";
[Test]
public void TestPeekLineOnce()
{
- const string contents = @"line 1
-peek this
-line 3";
+ const string contents = "line 1\r\npeek this\nline 3";
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
using (var bufferedReader = new LineBufferedReader(stream))
@@ -49,9 +46,7 @@ line 3";
[Test]
public void TestPeekLineMultipleTimes()
{
- const string contents = @"peek this once
-line 2
-peek this a lot";
+ const string contents = "peek this once\nline 2\rpeek this a lot";
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
using (var bufferedReader = new LineBufferedReader(stream))
@@ -70,8 +65,7 @@ peek this a lot";
[Test]
public void TestPeekLineAtEndOfStream()
{
- const string contents = @"first line
-second line";
+ const string contents = "first line\r\nsecond line";
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
using (var bufferedReader = new LineBufferedReader(stream))
@@ -100,8 +94,7 @@ second line";
[Test]
public void TestReadToEndNoPeeks()
{
- const string contents = @"first line
-second line";
+ const string contents = "first line\r\nsecond line";
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
using (var bufferedReader = new LineBufferedReader(stream))
@@ -113,20 +106,19 @@ second line";
[Test]
public void TestReadToEndAfterReadsAndPeeks()
{
- const string contents = @"this line is gone
-this one shouldn't be
-these ones
-definitely not";
+ const string contents = "this line is gone\rthis one shouldn't be\r\nthese ones\ndefinitely not";
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)))
using (var bufferedReader = new LineBufferedReader(stream))
{
Assert.AreEqual("this line is gone", bufferedReader.ReadLine());
Assert.AreEqual("this one shouldn't be", bufferedReader.PeekLine());
- const string ending = @"this one shouldn't be
-these ones
-definitely not";
- Assert.AreEqual(ending, bufferedReader.ReadToEnd());
+
+ var endingLines = bufferedReader.ReadToEnd().Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
+ Assert.AreEqual(3, endingLines.Length);
+ Assert.AreEqual("this one shouldn't be", endingLines[0]);
+ Assert.AreEqual("these ones", endingLines[1]);
+ Assert.AreEqual("definitely not", endingLines[2]);
}
}
}
From c8ffc134d47f717e6279d2a3c204b0f7c0951f77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Thu, 10 Oct 2019 22:36:43 +0200
Subject: [PATCH 129/373] Use nameof when instantiating headless game hosts
As a purely cosmetic code improvement, substitute string literals
in constructor calls of HeadlessGameHost in ImportBeatmapTest for nameof
operator usages.
---
.../Beatmaps/IO/ImportBeatmapTest.cs | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
index 6da8d8cb71..9cbb5c39c3 100644
--- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
+++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
@@ -29,7 +29,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportWhenClosed()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWhenClosed"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWhenClosed)))
{
try
{
@@ -46,7 +46,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportThenDelete()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenDelete"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenDelete)))
{
try
{
@@ -67,7 +67,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportThenImport()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenImport"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenImport)))
{
try
{
@@ -94,7 +94,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportCorruptThenImport()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenImport"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportCorruptThenImport)))
{
try
{
@@ -136,7 +136,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestRollbackOnFailure()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestRollbackOnFailure"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestRollbackOnFailure)))
{
try
{
@@ -213,7 +213,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportThenImportDifferentHash()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenImportDifferentHash"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenImportDifferentHash)))
{
try
{
@@ -244,7 +244,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportThenDeleteThenImport()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenDeleteThenImport"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenDeleteThenImport)))
{
try
{
@@ -272,7 +272,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportThenDeleteThenImportWithOnlineIDMismatch(bool set)
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"TestImportThenDeleteThenImport-{set}"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"{nameof(TestImportThenDeleteThenImportWithOnlineIDMismatch)}-{set}"))
{
try
{
@@ -306,7 +306,7 @@ namespace osu.Game.Tests.Beatmaps.IO
public async Task TestImportWithDuplicateBeatmapIDs()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWithDuplicateBeatmapID"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWithDuplicateBeatmapIDs)))
{
try
{
@@ -392,7 +392,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test]
public async Task TestImportWhenFileOpen()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWhenFileOpen"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWhenFileOpen)))
{
try
{
@@ -414,7 +414,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test]
public async Task TestImportNestedStructure()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportNestedStructure"))
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportNestedStructure)))
{
try
{
From 11acd177f18442872e0b06e93703c63c9da35e95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Thu, 10 Oct 2019 23:10:22 +0200
Subject: [PATCH 130/373] Add import test with files to be filtered out
Add a test case reproducing the conditions encountered "in the wild"
wherein a skin import would be performed incorrectly due to a __MACOSX
resource fork directory present next to a directory with the actual skin
files in the archive.
---
.../Beatmaps/IO/ImportBeatmapTest.cs | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
index 9cbb5c39c3..e96637cae9 100644
--- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
+++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
@@ -456,6 +456,60 @@ namespace osu.Game.Tests.Beatmaps.IO
}
}
+ [Test]
+ public async Task TestImportWithIgnoredDirectoryInArchive()
+ {
+ using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWithIgnoredDirectoryInArchive)))
+ {
+ try
+ {
+ var osu = loadOsu(host);
+
+ var temp = TestResources.GetTestBeatmapForImport();
+
+ string extractedFolder = $"{temp}_extracted";
+ string dataFolder = Path.Combine(extractedFolder, "actual_data");
+ string resourceForkFolder = Path.Combine(extractedFolder, "__MACOSX");
+ string resourceForkFilePath = Path.Combine(resourceForkFolder, ".extracted");
+
+ Directory.CreateDirectory(dataFolder);
+ Directory.CreateDirectory(resourceForkFolder);
+
+ using (var resourceForkFile = File.CreateText(resourceForkFilePath))
+ {
+ resourceForkFile.WriteLine("adding content so that it's not empty");
+ }
+
+ try
+ {
+ using (var zip = ZipArchive.Open(temp))
+ zip.WriteToDirectory(dataFolder);
+
+ using (var zip = ZipArchive.Create())
+ {
+ zip.AddAllFromDirectory(extractedFolder);
+ zip.SaveTo(temp, new ZipWriterOptions(CompressionType.Deflate));
+ }
+
+ var imported = await osu.Dependencies.Get().Import(temp);
+
+ ensureLoaded(osu);
+
+ Assert.IsFalse(imported.Files.Any(f => f.Filename.Contains("__MACOSX")), "Files contain resource fork folder, which should be ignored");
+ Assert.IsFalse(imported.Files.Any(f => f.Filename.Contains("actual_data")), "Files contain common subfolder");
+ }
+ finally
+ {
+ Directory.Delete(extractedFolder, true);
+ }
+ }
+ finally
+ {
+ host.Exit();
+ }
+ }
+ }
+
public static async Task LoadOszIntoOsu(OsuGameBase osu, string path = null)
{
var temp = path ?? TestResources.GetTestBeatmapForImport();
From 57bfa18359fe9d0d4fd1221e888405065342635d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Thu, 10 Oct 2019 23:42:02 +0200
Subject: [PATCH 131/373] Filter out OS-generated files from archives
Add a filename ignore list to ZipArchiveReader to filter out superfluous
OS-generated files from archives during the import process. In addition
to decreasing the size of files imported this allows imports of some
incorrectly-constructed archives. An example is the case of having
a __MACOSX directory next to a single directory with the actual files -
filtering out the former at ZipArchiveReader allows the fallback added
in #6170 to work.
---
osu.Game/IO/Archives/ZipArchiveReader.cs | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/osu.Game/IO/Archives/ZipArchiveReader.cs b/osu.Game/IO/Archives/ZipArchiveReader.cs
index d934ac54c4..2233520916 100644
--- a/osu.Game/IO/Archives/ZipArchiveReader.cs
+++ b/osu.Game/IO/Archives/ZipArchiveReader.cs
@@ -1,15 +1,30 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SharpCompress.Archives.Zip;
+using SharpCompress.Common;
namespace osu.Game.IO.Archives
{
public sealed class ZipArchiveReader : ArchiveReader
{
+ ///
+ /// List of substrings that indicate a file should be ignored during the import process
+ /// (usually due to representing no useful data and being autogenerated by the OS).
+ ///
+ private static readonly string[] filename_ignore_list =
+ {
+ // Mac-specific
+ "__MACOSX",
+ ".DS_Store",
+ // Windows-specific
+ "Thumbs.db"
+ };
+
private readonly Stream archiveStream;
private readonly ZipArchive archive;
@@ -43,7 +58,9 @@ namespace osu.Game.IO.Archives
archiveStream.Dispose();
}
- public override IEnumerable Filenames => archive.Entries.Select(e => e.Key).ToArray();
+ private static bool canBeIgnored(IEntry entry) => filename_ignore_list.Any(ignoredName => entry.Key.IndexOf(ignoredName, StringComparison.InvariantCultureIgnoreCase) >= 0);
+
+ public override IEnumerable Filenames => archive.Entries.Where(e => !canBeIgnored(e)).Select(e => e.Key).ToArray();
public override Stream GetUnderlyingStream() => archiveStream;
}
From 475815df0465e296e3536f33f8d27514c7a0121d Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Fri, 11 Oct 2019 13:09:21 +0900
Subject: [PATCH 132/373] Update ranking display to handle new osu-web request
format
---
osu.Game/Online/API/Requests/GetUsersRequest.cs | 5 +----
osu.Game/Online/API/Requests/GetUsersResponse.cs | 15 +++++++++++++++
.../Online/API/Requests/ResponseWithCursor.cs | 16 ++++++++++++++++
.../API/Requests/SearchBeatmapSetsResponse.cs | 9 +--------
osu.Game/Overlays/SocialOverlay.cs | 2 +-
5 files changed, 34 insertions(+), 13 deletions(-)
create mode 100644 osu.Game/Online/API/Requests/GetUsersResponse.cs
create mode 100644 osu.Game/Online/API/Requests/ResponseWithCursor.cs
diff --git a/osu.Game/Online/API/Requests/GetUsersRequest.cs b/osu.Game/Online/API/Requests/GetUsersRequest.cs
index 55df88b7e5..b75ecd5bd7 100644
--- a/osu.Game/Online/API/Requests/GetUsersRequest.cs
+++ b/osu.Game/Online/API/Requests/GetUsersRequest.cs
@@ -1,12 +1,9 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System.Collections.Generic;
-using osu.Game.Online.API.Requests.Responses;
-
namespace osu.Game.Online.API.Requests
{
- public class GetUsersRequest : APIRequest>
+ public class GetUsersRequest : APIRequest
{
protected override string Target => @"rankings/osu/performance";
}
diff --git a/osu.Game/Online/API/Requests/GetUsersResponse.cs b/osu.Game/Online/API/Requests/GetUsersResponse.cs
new file mode 100644
index 0000000000..860785875a
--- /dev/null
+++ b/osu.Game/Online/API/Requests/GetUsersResponse.cs
@@ -0,0 +1,15 @@
+// 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 Newtonsoft.Json;
+using osu.Game.Online.API.Requests.Responses;
+
+namespace osu.Game.Online.API.Requests
+{
+ public class GetUsersResponse : ResponseWithCursor
+ {
+ [JsonProperty("ranking")]
+ public List Users;
+ }
+}
diff --git a/osu.Game/Online/API/Requests/ResponseWithCursor.cs b/osu.Game/Online/API/Requests/ResponseWithCursor.cs
new file mode 100644
index 0000000000..e38e73dd01
--- /dev/null
+++ b/osu.Game/Online/API/Requests/ResponseWithCursor.cs
@@ -0,0 +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 Newtonsoft.Json;
+
+namespace osu.Game.Online.API.Requests
+{
+ public abstract class ResponseWithCursor
+ {
+ ///
+ /// A collection of parameters which should be passed to the search endpoint to fetch the next page.
+ ///
+ [JsonProperty("cursor")]
+ public dynamic CursorJson;
+ }
+}
diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
index b0f4fef81a..28863cb0e0 100644
--- a/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
+++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
@@ -2,19 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
-using Newtonsoft.Json;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
- public class SearchBeatmapSetsResponse
+ public class SearchBeatmapSetsResponse : ResponseWithCursor
{
public IEnumerable BeatmapSets;
-
- ///
- /// A collection of parameters which should be passed to the search endpoint to fetch the next page.
- ///
- [JsonProperty("cursor")]
- public dynamic CursorJson;
}
}
diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs
index 4def249200..6f468bbeb7 100644
--- a/osu.Game/Overlays/SocialOverlay.cs
+++ b/osu.Game/Overlays/SocialOverlay.cs
@@ -118,7 +118,7 @@ namespace osu.Game.Overlays
default:
var userRequest = new GetUsersRequest(); // TODO filter arguments!
- userRequest.Success += response => updateUsers(response.Select(r => r.User));
+ userRequest.Success += res => updateUsers(res.Users.Select(r => r.User));
API.Queue(getUsersRequest = userRequest);
break;
}
From 44853c262c8573fc1161bfab9fe27c0abfa56a8a Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Fri, 11 Oct 2019 13:55:58 +0900
Subject: [PATCH 133/373] 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 fa940a7c89..0a831eceb2 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -62,6 +62,6 @@
-
+
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 4e3130b64c..c2888c8e21 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -26,7 +26,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index fb6d5107ff..8ad7a58e36 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -118,8 +118,8 @@
-
-
+
+
From 9fb5c85a18d2ff4c0f3abb33b96bc490d8cad487 Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Fri, 11 Oct 2019 05:15:14 +0000
Subject: [PATCH 134/373] Bump ppy.osu.Game.Resources from 2019.913.0 to
2019.1010.0
Bumps [ppy.osu.Game.Resources](https://github.com/ppy/osu-resources) from 2019.913.0 to 2019.1010.0.
- [Release notes](https://github.com/ppy/osu-resources/releases)
- [Commits](https://github.com/ppy/osu-resources/compare/2019.913.0...2019.1010.0)
Signed-off-by: dependabot-preview[bot]
---
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 0a831eceb2..85766665a9 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -61,7 +61,7 @@
-
+
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index c2888c8e21..ab7c40116b 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 8ad7a58e36..925a217a13 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -117,7 +117,7 @@
-
+
From d44acf20b40b75e9cc92ac2feb8c3d6f2779b1cc Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Fri, 11 Oct 2019 05:33:15 +0000
Subject: [PATCH 135/373] Bump ppy.osu.Framework.NativeLibs from 2019.1010.0 to
2019.1011.0
Bumps [ppy.osu.Framework.NativeLibs](https://github.com/ppy/osu-framework) from 2019.1010.0 to 2019.1011.0.
- [Release notes](https://github.com/ppy/osu-framework/releases)
- [Commits](https://github.com/ppy/osu-framework/compare/2019.1010.0...2019.1011.0)
Signed-off-by: dependabot-preview[bot]
---
osu.iOS.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.iOS.props b/osu.iOS.props
index 8ad7a58e36..7532bd5100 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -124,6 +124,6 @@
-
+
From 4f0354bdb63cc6216117db6e6f7148a2cf3a5f84 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Fri, 11 Oct 2019 14:56:54 +0900
Subject: [PATCH 136/373] Revert nativelibs update
---
osu.iOS.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.iOS.props b/osu.iOS.props
index a73d40b37b..925a217a13 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -124,6 +124,6 @@
-
+
From 1faef2f97dbefda23b62dbb39494f0a6fe6b96f7 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Fri, 11 Oct 2019 16:17:15 +0900
Subject: [PATCH 137/373] Update fastlane
---
Gemfile.lock | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 7df9c46482..ab594aee74 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -18,7 +18,7 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.5)
emoji_regex (1.0.1)
- excon (0.66.0)
+ excon (0.67.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
@@ -27,7 +27,7 @@ GEM
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.7)
- fastlane (2.131.0)
+ fastlane (2.133.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
@@ -37,9 +37,9 @@ GEM
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 2.0)
excon (>= 0.45.0, < 1.0.0)
- faraday (~> 0.9)
+ faraday (< 0.16.0)
faraday-cookie_jar (~> 0.0.6)
- faraday_middleware (~> 0.9)
+ faraday_middleware (< 0.16.0)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.21.2, < 0.24.0)
@@ -52,7 +52,7 @@ GEM
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
public_suffix (~> 2.0.0)
- rubyzip (>= 1.2.2, < 2.0.0)
+ rubyzip (>= 1.3.0, < 2.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
@@ -102,7 +102,7 @@ GEM
memoist (0.16.0)
mime-types (3.3)
mime-types-data (~> 3.2015)
- mime-types-data (3.2019.0904)
+ mime-types-data (3.2019.1009)
mini_magick (4.9.5)
mini_portile2 (2.4.0)
multi_json (1.13.1)
@@ -121,9 +121,9 @@ GEM
uber (< 0.2.0)
retriable (3.1.2)
rouge (2.0.7)
- rubyzip (1.2.4)
+ rubyzip (1.3.0)
security (0.1.3)
- signet (0.11.0)
+ signet (0.12.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
From 4b84564f474e1369817815a7bfa8dcb90d99f0c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?=
Date: Fri, 11 Oct 2019 09:24:41 +0200
Subject: [PATCH 138/373] Switch casing comparison mode to ordinal
Switch from InvariantCultureIgnoreCase to OrdinalIgnoreCase when
checking file paths in archives for substrings indicating the file can
be ignored for performance gains.
Co-Authored-By: Dan Balasescu
---
osu.Game/IO/Archives/ZipArchiveReader.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/IO/Archives/ZipArchiveReader.cs b/osu.Game/IO/Archives/ZipArchiveReader.cs
index 2233520916..9033e7529d 100644
--- a/osu.Game/IO/Archives/ZipArchiveReader.cs
+++ b/osu.Game/IO/Archives/ZipArchiveReader.cs
@@ -58,7 +58,7 @@ namespace osu.Game.IO.Archives
archiveStream.Dispose();
}
- private static bool canBeIgnored(IEntry entry) => filename_ignore_list.Any(ignoredName => entry.Key.IndexOf(ignoredName, StringComparison.InvariantCultureIgnoreCase) >= 0);
+ private static bool canBeIgnored(IEntry entry) => filename_ignore_list.Any(ignoredName => entry.Key.IndexOf(ignoredName, StringComparison.OrdinalIgnoreCase) >= 0);
public override IEnumerable Filenames => archive.Entries.Where(e => !canBeIgnored(e)).Select(e => e.Key).ToArray();
From 2aa3d0bb39f7a0e0cd8b82e2c6285197f3609e23 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Thu, 10 Oct 2019 21:55:48 +0900
Subject: [PATCH 139/373] Implement base class for beat snapping grids
---
.../Visual/Editor/TestSceneBeatSnapGrid.cs | 210 ++++++++++++++++++
.../Edit/Compose/Components/BeatSnapGrid.cs | 149 +++++++++++++
2 files changed, 359 insertions(+)
create mode 100644 osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
create mode 100644 osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
new file mode 100644
index 0000000000..8502cefdeb
--- /dev/null
+++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
@@ -0,0 +1,210 @@
+// 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 NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.MathUtils;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Rulesets.Objects;
+using osu.Game.Rulesets.Osu.Beatmaps;
+using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Screens.Edit;
+using osu.Game.Screens.Edit.Compose.Components;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual.Editor
+{
+ public class TestSceneBeatSnapGrid : EditorClockTestScene
+ {
+ private const double beat_length = 100;
+ private static readonly Vector2 grid_position = new Vector2(512, 384);
+
+ [Cached(typeof(IEditorBeatmap))]
+ private readonly EditorBeatmap editorBeatmap;
+
+ private TestBeatSnapGrid grid;
+
+ public TestSceneBeatSnapGrid()
+ {
+ editorBeatmap = new EditorBeatmap(new OsuBeatmap());
+ }
+
+ [SetUp]
+ public void Setup() => Schedule(() =>
+ {
+ Clear();
+
+ editorBeatmap.ControlPointInfo.TimingPoints.Clear();
+ editorBeatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { BeatLength = beat_length });
+
+ BeatDivisor.Value = 1;
+ });
+
+ [TestCase(1)]
+ [TestCase(2)]
+ [TestCase(3)]
+ [TestCase(4)]
+ [TestCase(6)]
+ [TestCase(8)]
+ [TestCase(12)]
+ [TestCase(16)]
+ public void TestInitialBeatDivisor(int divisor)
+ {
+ AddStep($"set beat divisor = {divisor}", () => BeatDivisor.Value = divisor);
+ createGrid();
+
+ float expectedDistance = (float)beat_length / divisor;
+ AddAssert($"spacing is {expectedDistance}", () => Precision.AlmostEquals(grid.DistanceSpacing, expectedDistance));
+ }
+
+ [Test]
+ public void TestChangeBeatDivisor()
+ {
+ createGrid();
+ AddStep("set beat divisor = 2", () => BeatDivisor.Value = 2);
+
+ const float expected_distance = (float)beat_length / 2;
+ AddAssert($"spacing is {expected_distance}", () => Precision.AlmostEquals(grid.DistanceSpacing, expected_distance));
+ }
+
+ [TestCase(100)]
+ [TestCase(200)]
+ public void TestBeatLength(double beatLength)
+ {
+ AddStep($"set beat length = {beatLength}", () =>
+ {
+ editorBeatmap.ControlPointInfo.TimingPoints.Clear();
+ editorBeatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { BeatLength = beatLength });
+ });
+
+ createGrid();
+ AddAssert($"spacing is {beatLength}", () => Precision.AlmostEquals(grid.DistanceSpacing, beatLength));
+ }
+
+ [TestCase(1)]
+ [TestCase(2)]
+ public void TestGridVelocity(float velocity)
+ {
+ createGrid(g => g.Velocity = velocity);
+
+ float expectedDistance = (float)beat_length * velocity;
+ AddAssert($"spacing is {expectedDistance}", () => Precision.AlmostEquals(grid.DistanceSpacing, expectedDistance));
+ }
+
+ [Test]
+ public void TestGetSnappedTime()
+ {
+ createGrid();
+
+ Vector2 screenSpacePosition = Vector2.Zero;
+ AddStep("get first tick position", () => screenSpacePosition = grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0)));
+ AddAssert("snap time is 1 beat away", () => Precision.AlmostEquals(beat_length, grid.GetSnapTime(screenSpacePosition), 0.01));
+
+ createGrid(g => g.Velocity = 2, " with velocity = 2");
+ AddAssert("snap time is now 0.5 beats away", () => Precision.AlmostEquals(beat_length / 2, grid.GetSnapTime(screenSpacePosition), 0.01));
+ }
+
+ private void createGrid(Action func = null, string description = null)
+ {
+ AddStep($"create grid {description ?? string.Empty}", () =>
+ {
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.SlateGray
+ },
+ grid = new TestBeatSnapGrid(new HitObject(), grid_position)
+ };
+
+ func?.Invoke(grid);
+ });
+ }
+
+ private class TestBeatSnapGrid : BeatSnapGrid
+ {
+ public new float Velocity = 1;
+
+ public new float DistanceSpacing => base.DistanceSpacing;
+
+ public TestBeatSnapGrid(HitObject hitObject, Vector2 startPosition)
+ : base(hitObject, startPosition)
+ {
+ }
+
+ protected override void CreateGrid(Vector2 startPosition)
+ {
+ AddInternal(new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(5),
+ Position = startPosition
+ });
+
+ int beatIndex = 0;
+
+ for (float s = startPosition.X + DistanceSpacing; s <= DrawWidth; s += DistanceSpacing, beatIndex++)
+ {
+ AddInternal(new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(5, 10),
+ Position = new Vector2(s, startPosition.Y),
+ Colour = GetColourForBeatIndex(beatIndex)
+ });
+ }
+
+ beatIndex = 0;
+
+ for (float s = startPosition.X - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
+ {
+ AddInternal(new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(5, 10),
+ Position = new Vector2(s, startPosition.Y),
+ Colour = GetColourForBeatIndex(beatIndex)
+ });
+ }
+
+ beatIndex = 0;
+
+ for (float s = startPosition.Y + DistanceSpacing; s <= DrawHeight; s += DistanceSpacing, beatIndex++)
+ {
+ AddInternal(new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(10, 5),
+ Position = new Vector2(startPosition.X, s),
+ Colour = GetColourForBeatIndex(beatIndex)
+ });
+ }
+
+ beatIndex = 0;
+
+ for (float s = startPosition.Y - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
+ {
+ AddInternal(new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(10, 5),
+ Position = new Vector2(startPosition.X, s),
+ Colour = GetColourForBeatIndex(beatIndex)
+ });
+ }
+ }
+
+ protected override float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
+ => Velocity;
+
+ public override Vector2 GetSnapPosition(Vector2 screenSpacePosition)
+ => Vector2.Zero;
+ }
+ }
+}
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
new file mode 100644
index 0000000000..957e752fa2
--- /dev/null
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -0,0 +1,149 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Caching;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Colour;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Timing;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Graphics;
+using osu.Game.Rulesets.Objects;
+using osu.Game.Rulesets.Objects.Types;
+using osuTK;
+
+namespace osu.Game.Screens.Edit.Compose.Components
+{
+ public abstract class BeatSnapGrid : CompositeDrawable
+ {
+ protected double Velocity { get; private set; }
+
+ protected float DistanceSpacing { get; private set; }
+
+ [Resolved]
+ private IFrameBasedClock framedClock { get; set; }
+
+ [Resolved]
+ private IEditorBeatmap beatmap { get; set; }
+
+ [Resolved]
+ private BindableBeatDivisor beatDivisor { get; set; }
+
+ [Resolved]
+ private OsuColour colours { get; set; }
+
+ private readonly Cached gridCache = new Cached();
+ private readonly HitObject hitObject;
+ private readonly Vector2 startPosition;
+
+ private double startTime;
+ private double beatLength;
+
+ protected BeatSnapGrid(HitObject hitObject, Vector2 startPosition)
+ {
+ this.hitObject = hitObject;
+ this.startPosition = startPosition;
+
+ RelativeSizeAxes = Axes.Both;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ startTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime;
+ beatLength = beatmap.ControlPointInfo.TimingPointAt(startTime).BeatLength;
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ beatDivisor.BindValueChanged(_ => updateSpacing(), true);
+ }
+
+ private void updateSpacing()
+ {
+ Velocity = GetVelocity(startTime, beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
+ DistanceSpacing = (float)(beatLength / beatDivisor.Value * Velocity);
+ gridCache.Invalidate();
+ }
+
+ public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
+ {
+ if ((invalidation & Invalidation.RequiredParentSizeToFit) > 0)
+ gridCache.Invalidate();
+
+ return base.Invalidate(invalidation, source, shallPropagate);
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ if (!gridCache.IsValid)
+ {
+ ClearInternal();
+ CreateGrid(startPosition);
+ gridCache.Validate();
+ }
+ }
+
+ ///
+ /// Draws the grid.
+ ///
+ protected abstract void CreateGrid(Vector2 startPosition);
+
+ ///
+ /// Retrieves the velocity of gameplay at a time.
+ ///
+ /// The time to retrieve the velocity at.
+ /// The beatmap's at the requested time.
+ /// The beatmap's at the requested time.
+ /// The velocity in pixels per millisecond.
+ protected abstract float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty);
+
+ ///
+ /// Snaps a position to this grid.
+ ///
+ /// The original screen-space position.
+ /// The snapped position.
+ public abstract Vector2 GetSnapPosition(Vector2 screenSpacePosition);
+
+ ///
+ /// Retrieves the time at a snapped position.
+ ///
+ /// The snapped position.
+ /// The time at the snapped position.
+ public double GetSnapTime(Vector2 snappedPosition) => startTime + (ToLocalSpace(snappedPosition) - startPosition).Length / Velocity;
+
+ ///
+ /// Retrieves the applicable colour for a beat index.
+ ///
+ /// The 0-based beat index.
+ /// The applicable colour.
+ protected ColourInfo GetColourForBeatIndex(int index)
+ {
+ int divIndex = beatDivisor.Value - (index % beatDivisor.Value) - 1;
+
+ ColourInfo colour = colours.Gray5;
+
+ {
+ for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++)
+ {
+ int divisor = BindableBeatDivisor.VALID_DIVISORS[i];
+
+ if ((divIndex * divisor) % beatDivisor.Value == 0)
+ {
+ colour = BindableBeatDivisor.GetColourFor(divisor, colours);
+ break;
+ }
+ }
+ }
+
+ int repeatIndex = index / beatDivisor.Value;
+ return colour.MultiplyAlpha(0.5f / (repeatIndex + 1));
+ }
+ }
+}
From 824595427d6739cabc48a8759bddbc40578e480d Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 13:53:49 +0900
Subject: [PATCH 140/373] Remove extra whitespace
---
osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
index 8502cefdeb..6419b0c2e2 100644
--- a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
+++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
@@ -105,7 +105,7 @@ namespace osu.Game.Tests.Visual.Editor
AddStep("get first tick position", () => screenSpacePosition = grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0)));
AddAssert("snap time is 1 beat away", () => Precision.AlmostEquals(beat_length, grid.GetSnapTime(screenSpacePosition), 0.01));
- createGrid(g => g.Velocity = 2, " with velocity = 2");
+ createGrid(g => g.Velocity = 2, "with velocity = 2");
AddAssert("snap time is now 0.5 beats away", () => Precision.AlmostEquals(beat_length / 2, grid.GetSnapTime(screenSpacePosition), 0.01));
}
From 2df519ddfad597931c038876ebebfaf7e1740dd1 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 14:01:36 +0900
Subject: [PATCH 141/373] Simplify colour retrieval function
---
.../Edit/Compose/Components/BeatSnapGrid.cs | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index 957e752fa2..0630fc5099 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -125,20 +125,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// The applicable colour.
protected ColourInfo GetColourForBeatIndex(int index)
{
- int divIndex = beatDivisor.Value - (index % beatDivisor.Value) - 1;
-
+ int beat = (index + 1) % beatDivisor.Value;
ColourInfo colour = colours.Gray5;
+ for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++)
{
- for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++)
- {
- int divisor = BindableBeatDivisor.VALID_DIVISORS[i];
+ int divisor = BindableBeatDivisor.VALID_DIVISORS[i];
- if ((divIndex * divisor) % beatDivisor.Value == 0)
- {
- colour = BindableBeatDivisor.GetColourFor(divisor, colours);
- break;
- }
+ if ((beat * divisor) % beatDivisor.Value == 0)
+ {
+ colour = BindableBeatDivisor.GetColourFor(divisor, colours);
+ break;
}
}
From 97d4a8e59e384e321996653bd1de8831ad44fafb Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:30:20 +0900
Subject: [PATCH 142/373] Remove unnecessary dependency
---
osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs | 2 --
1 file changed, 2 deletions(-)
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index 0630fc5099..9135931823 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -22,8 +22,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected float DistanceSpacing { get; private set; }
- [Resolved]
- private IFrameBasedClock framedClock { get; set; }
[Resolved]
private IEditorBeatmap beatmap { get; set; }
From 66e0fef85b6ff60aff277da7f81f70735bb45ae4 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:30:31 +0900
Subject: [PATCH 143/373] Expose StartPosition for derived grids to use
---
osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index 9135931823..d44d53dca7 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -6,7 +6,6 @@ using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
-using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
@@ -22,6 +21,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected float DistanceSpacing { get; private set; }
+ protected readonly Vector2 StartPosition;
[Resolved]
private IEditorBeatmap beatmap { get; set; }
@@ -34,7 +34,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
private readonly Cached gridCache = new Cached();
private readonly HitObject hitObject;
- private readonly Vector2 startPosition;
private double startTime;
private double beatLength;
@@ -42,7 +41,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected BeatSnapGrid(HitObject hitObject, Vector2 startPosition)
{
this.hitObject = hitObject;
- this.startPosition = startPosition;
+ this.StartPosition = startPosition;
RelativeSizeAxes = Axes.Both;
}
@@ -83,7 +82,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (!gridCache.IsValid)
{
ClearInternal();
- CreateGrid(startPosition);
+ CreateGrid(StartPosition);
gridCache.Validate();
}
}
@@ -114,7 +113,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
///
/// The snapped position.
/// The time at the snapped position.
- public double GetSnapTime(Vector2 snappedPosition) => startTime + (ToLocalSpace(snappedPosition) - startPosition).Length / Velocity;
+ public double GetSnapTime(Vector2 snappedPosition) => startTime + (ToLocalSpace(snappedPosition) - StartPosition).Length / Velocity;
///
/// Retrieves the applicable colour for a beat index.
From 8fb2628f9e07185dbdf1b3211a753839c3561ac1 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:41:01 +0900
Subject: [PATCH 144/373] Improve xmldocs
---
.../Edit/Compose/Components/BeatSnapGrid.cs | 26 ++++++++++++-------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index d44d53dca7..175d61fd32 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -17,8 +17,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
public abstract class BeatSnapGrid : CompositeDrawable
{
+ ///
+ /// The velocity of the beatmap at the point of placement in pixels per millisecond.
+ ///
protected double Velocity { get; private set; }
+ ///
+ /// The spacing between each tick of the beat snapping grid.
+ ///
protected float DistanceSpacing { get; private set; }
protected readonly Vector2 StartPosition;
@@ -88,32 +94,32 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
///
- /// Draws the grid.
+ /// Creates the content which visualises the grid ticks.
///
protected abstract void CreateGrid(Vector2 startPosition);
///
- /// Retrieves the velocity of gameplay at a time.
+ /// Retrieves the velocity of gameplay at a point in time in pixels per millisecond.
///
/// The time to retrieve the velocity at.
- /// The beatmap's at the requested time.
- /// The beatmap's at the requested time.
- /// The velocity in pixels per millisecond.
+ /// The beatmap's at the point in time.
+ /// The beatmap's at the point in time.
+ /// The velocity.
protected abstract float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty);
///
- /// Snaps a position to this grid.
+ /// Snaps a screen-space position to this grid.
///
/// The original screen-space position.
- /// The snapped position.
+ /// The snapped screen-space position.
public abstract Vector2 GetSnapPosition(Vector2 screenSpacePosition);
///
- /// Retrieves the time at a snapped position.
+ /// Retrieves the time at a snapped screen-space position.
///
- /// The snapped position.
+ /// The snapped screen-space position.
/// The time at the snapped position.
- public double GetSnapTime(Vector2 snappedPosition) => startTime + (ToLocalSpace(snappedPosition) - StartPosition).Length / Velocity;
+ public double GetSnapTime(Vector2 screenSpacePosition) => startTime + (ToLocalSpace(screenSpacePosition) - CentrePosition).Length / Velocity;
///
/// Retrieves the applicable colour for a beat index.
From 5f0cd356d764ffab48ab4396c18f4a017600e4f0 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:41:21 +0900
Subject: [PATCH 145/373] Rename startPosition to centrePosition
---
osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs | 4 ++--
.../Screens/Edit/Compose/Components/BeatSnapGrid.cs | 10 +++++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
index 6419b0c2e2..9f9b884cdd 100644
--- a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
+++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
@@ -133,8 +133,8 @@ namespace osu.Game.Tests.Visual.Editor
public new float DistanceSpacing => base.DistanceSpacing;
- public TestBeatSnapGrid(HitObject hitObject, Vector2 startPosition)
- : base(hitObject, startPosition)
+ public TestBeatSnapGrid(HitObject hitObject, Vector2 centrePosition)
+ : base(hitObject, centrePosition)
{
}
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index 175d61fd32..24926995e6 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -27,7 +27,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
///
protected float DistanceSpacing { get; private set; }
- protected readonly Vector2 StartPosition;
+ ///
+ /// The position which the grid is centred on.
+ /// The first beat snapping tick is located at + in the desired direction.
+ ///
+ protected readonly Vector2 CentrePosition;
[Resolved]
private IEditorBeatmap beatmap { get; set; }
@@ -44,10 +48,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
private double startTime;
private double beatLength;
- protected BeatSnapGrid(HitObject hitObject, Vector2 startPosition)
+ protected BeatSnapGrid(HitObject hitObject, Vector2 centrePosition)
{
this.hitObject = hitObject;
- this.StartPosition = startPosition;
+ this.CentrePosition = centrePosition;
RelativeSizeAxes = Axes.Both;
}
From 9ecec806c2343d90c03eb48b71b264e1f82dba0e Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:41:40 +0900
Subject: [PATCH 146/373] Rename grid creation method + parameter
---
.../Visual/Editor/TestSceneBeatSnapGrid.cs | 20 +++++++++----------
.../Edit/Compose/Components/BeatSnapGrid.cs | 4 ++--
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
index 9f9b884cdd..345fe245fe 100644
--- a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
+++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
@@ -138,63 +138,63 @@ namespace osu.Game.Tests.Visual.Editor
{
}
- protected override void CreateGrid(Vector2 startPosition)
+ protected override void CreateContent(Vector2 centrePosition)
{
AddInternal(new Circle
{
Origin = Anchor.Centre,
Size = new Vector2(5),
- Position = startPosition
+ Position = centrePosition
});
int beatIndex = 0;
- for (float s = startPosition.X + DistanceSpacing; s <= DrawWidth; s += DistanceSpacing, beatIndex++)
+ for (float s = centrePosition.X + DistanceSpacing; s <= DrawWidth; s += DistanceSpacing, beatIndex++)
{
AddInternal(new Circle
{
Origin = Anchor.Centre,
Size = new Vector2(5, 10),
- Position = new Vector2(s, startPosition.Y),
+ Position = new Vector2(s, centrePosition.Y),
Colour = GetColourForBeatIndex(beatIndex)
});
}
beatIndex = 0;
- for (float s = startPosition.X - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
+ for (float s = centrePosition.X - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
{
AddInternal(new Circle
{
Origin = Anchor.Centre,
Size = new Vector2(5, 10),
- Position = new Vector2(s, startPosition.Y),
+ Position = new Vector2(s, centrePosition.Y),
Colour = GetColourForBeatIndex(beatIndex)
});
}
beatIndex = 0;
- for (float s = startPosition.Y + DistanceSpacing; s <= DrawHeight; s += DistanceSpacing, beatIndex++)
+ for (float s = centrePosition.Y + DistanceSpacing; s <= DrawHeight; s += DistanceSpacing, beatIndex++)
{
AddInternal(new Circle
{
Origin = Anchor.Centre,
Size = new Vector2(10, 5),
- Position = new Vector2(startPosition.X, s),
+ Position = new Vector2(centrePosition.X, s),
Colour = GetColourForBeatIndex(beatIndex)
});
}
beatIndex = 0;
- for (float s = startPosition.Y - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
+ for (float s = centrePosition.Y - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
{
AddInternal(new Circle
{
Origin = Anchor.Centre,
Size = new Vector2(10, 5),
- Position = new Vector2(startPosition.X, s),
+ Position = new Vector2(centrePosition.X, s),
Colour = GetColourForBeatIndex(beatIndex)
});
}
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index 24926995e6..98ad0dd3e8 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (!gridCache.IsValid)
{
ClearInternal();
- CreateGrid(StartPosition);
+ CreateContent(CentrePosition);
gridCache.Validate();
}
}
@@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
///
/// Creates the content which visualises the grid ticks.
///
- protected abstract void CreateGrid(Vector2 startPosition);
+ protected abstract void CreateContent(Vector2 centrePosition);
///
/// Retrieves the velocity of gameplay at a point in time in pixels per millisecond.
From 050d86a741b5908d45ea588d7d25d3f8ae9c079b Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:46:11 +0900
Subject: [PATCH 147/373] Always use the local coordinate space
---
.../Visual/Editor/TestSceneBeatSnapGrid.cs | 8 ++++----
.../Edit/Compose/Components/BeatSnapGrid.cs | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
index 345fe245fe..d6ddd4cc86 100644
--- a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
+++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
@@ -101,12 +101,12 @@ namespace osu.Game.Tests.Visual.Editor
{
createGrid();
- Vector2 screenSpacePosition = Vector2.Zero;
- AddStep("get first tick position", () => screenSpacePosition = grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0)));
- AddAssert("snap time is 1 beat away", () => Precision.AlmostEquals(beat_length, grid.GetSnapTime(screenSpacePosition), 0.01));
+ Vector2 snapPosition = Vector2.Zero;
+ AddStep("get first tick position", () => snapPosition = grid_position + new Vector2((float)beat_length, 0));
+ AddAssert("snap time is 1 beat away", () => Precision.AlmostEquals(beat_length, grid.GetSnapTime(snapPosition), 0.01));
createGrid(g => g.Velocity = 2, "with velocity = 2");
- AddAssert("snap time is now 0.5 beats away", () => Precision.AlmostEquals(beat_length / 2, grid.GetSnapTime(screenSpacePosition), 0.01));
+ AddAssert("snap time is now 0.5 beats away", () => Precision.AlmostEquals(beat_length / 2, grid.GetSnapTime(snapPosition), 0.01));
}
private void createGrid(Action func = null, string description = null)
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
index 98ad0dd3e8..9040843144 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs
@@ -112,18 +112,18 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected abstract float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty);
///
- /// Snaps a screen-space position to this grid.
+ /// Snaps a position to this grid.
///
- /// The original screen-space position.
- /// The snapped screen-space position.
- public abstract Vector2 GetSnapPosition(Vector2 screenSpacePosition);
+ /// The original position in coordinate space local to this .
+ /// The snapped position in coordinate space local to this .
+ public abstract Vector2 GetSnapPosition(Vector2 position);
///
- /// Retrieves the time at a snapped screen-space position.
+ /// Retrieves the time at a snapped position.
///
- /// The snapped screen-space position.
+ /// The snapped position in coordinate space local to this .
/// The time at the snapped position.
- public double GetSnapTime(Vector2 screenSpacePosition) => startTime + (ToLocalSpace(screenSpacePosition) - CentrePosition).Length / Velocity;
+ public double GetSnapTime(Vector2 position) => startTime + (position - CentrePosition).Length / Velocity;
///
/// Retrieves the applicable colour for a beat index.
From 631f1555547581f0383a864e174683dc54ff9692 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 17:17:08 +0900
Subject: [PATCH 148/373] Add grid to make the test not appear empty
---
osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
index d6ddd4cc86..073cec7315 100644
--- a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
+++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs
@@ -32,6 +32,9 @@ namespace osu.Game.Tests.Visual.Editor
public TestSceneBeatSnapGrid()
{
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
+ editorBeatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { BeatLength = beat_length });
+
+ createGrid();
}
[SetUp]
From 6301f837e0b17a8216f2af8a3ee55e064249b16d Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 15:27:23 +0900
Subject: [PATCH 149/373] Initial implementation of osu! beat snapping grid
---
.../TestSceneOsuBeatSnapGrid.cs | 170 ++++++++++++++++++
1 file changed, 170 insertions(+)
create mode 100644 osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
new file mode 100644
index 0000000000..9f0d59afab
--- /dev/null
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
@@ -0,0 +1,170 @@
+// 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 NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Input.Events;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Rulesets.Objects;
+using osu.Game.Rulesets.Osu.Beatmaps;
+using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Screens.Edit;
+using osu.Game.Screens.Edit.Compose.Components;
+using osu.Game.Tests.Visual;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Rulesets.Osu.Tests
+{
+ public class TestSceneOsuBeatSnapGrid : ManualInputManagerTestScene
+ {
+ private const double beat_length = 100;
+ private static readonly Vector2 grid_position = new Vector2(512, 384);
+
+ [Cached(typeof(IEditorBeatmap))]
+ private readonly EditorBeatmap editorBeatmap;
+
+ [Cached]
+ private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
+
+ private OsuBeatSnapGrid grid;
+ private Drawable cursor;
+
+ public TestSceneOsuBeatSnapGrid()
+ {
+ editorBeatmap = new EditorBeatmap(new OsuBeatmap());
+ }
+
+ [SetUp]
+ public void Setup() => Schedule(() =>
+ {
+ Clear();
+
+ editorBeatmap.ControlPointInfo.TimingPoints.Clear();
+ editorBeatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { BeatLength = beat_length });
+
+ beatDivisor.Value = 1;
+ });
+
+ protected override bool OnMouseMove(MouseMoveEvent e)
+ {
+ base.OnMouseMove(e);
+
+ if (cursor != null)
+ cursor.Position = grid?.GetSnapPosition(grid.ToLocalSpace(e.ScreenSpaceMousePosition)) ?? e.ScreenSpaceMousePosition;
+
+ return true;
+ }
+
+ [TestCase(1)]
+ [TestCase(2)]
+ [TestCase(3)]
+ [TestCase(4)]
+ [TestCase(6)]
+ [TestCase(8)]
+ [TestCase(12)]
+ [TestCase(16)]
+ public void TestBeatDivisor(int divisor)
+ {
+ AddStep($"set beat divisor = {divisor}", () => beatDivisor.Value = divisor);
+ createGrid();
+ }
+
+ private void createGrid()
+ {
+ AddStep("create grid", () =>
+ {
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.SlateGray
+ },
+ grid = new OsuBeatSnapGrid(new HitCircle { Position = grid_position }),
+ cursor = new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(50),
+ Colour = Color4.Red
+ }
+ };
+ });
+ }
+
+ private abstract class CircularBeatSnapGrid : BeatSnapGrid
+ {
+ protected override void CreateGrid(Vector2 startPosition)
+ {
+ float maxDistance = Math.Max(
+ Vector2.Distance(startPosition, Vector2.Zero),
+ Math.Max(
+ Vector2.Distance(startPosition, new Vector2(DrawWidth, 0)),
+ Math.Max(
+ Vector2.Distance(startPosition, new Vector2(0, DrawHeight)),
+ Vector2.Distance(startPosition, DrawSize))));
+
+ int requiredCircles = (int)(maxDistance / DistanceSpacing);
+
+ for (int i = 0; i < requiredCircles; i++)
+ {
+ float radius = (i + 1) * DistanceSpacing * 2;
+
+ AddInternal(new CircularProgress
+ {
+ Origin = Anchor.Centre,
+ Position = startPosition,
+ Current = { Value = 1 },
+ Size = new Vector2(radius),
+ InnerRadius = 4 * 1f / radius,
+ Colour = GetColourForBeatIndex(i)
+ });
+ }
+ }
+
+ public override Vector2 GetSnapPosition(Vector2 position)
+ {
+ Vector2 direction = position - StartPosition;
+ float distance = direction.Length;
+
+ float radius = DistanceSpacing;
+ int radialCount = Math.Max(1, (int)Math.Round(distance / radius));
+
+ if (radialCount <= 0)
+ return position;
+
+ Vector2 normalisedDirection = direction * new Vector2(1f / distance);
+
+ return StartPosition + normalisedDirection * radialCount * radius;
+ }
+ }
+
+ private class OsuBeatSnapGrid : CircularBeatSnapGrid
+ {
+ ///
+ /// Scoring distance with a speed-adjusted beat length of 1 second.
+ ///
+ private const float base_scoring_distance = 100;
+
+ public OsuBeatSnapGrid(OsuHitObject hitObject)
+ : base(hitObject, hitObject.StackedEndPosition)
+ {
+ }
+
+ protected override float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
+ {
+ TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(time);
+ DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(time);
+
+ double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
+
+ return (float)(scoringDistance / timingPoint.BeatLength);
+ }
+ }
+ }
+}
From 4d32a8aa6b5cca76f5b993791ce4e536a4709836 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 17:11:37 +0900
Subject: [PATCH 150/373] More tests
---
.../TestSceneOsuBeatSnapGrid.cs | 172 +++++++++++++++---
1 file changed, 145 insertions(+), 27 deletions(-)
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
index 9f0d59afab..7baa2f0d72 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
@@ -5,9 +5,11 @@ using System;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
+using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects;
@@ -32,12 +34,13 @@ namespace osu.Game.Rulesets.Osu.Tests
[Cached]
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
- private OsuBeatSnapGrid grid;
- private Drawable cursor;
+ private TestOsuBeatSnapGrid grid;
public TestSceneOsuBeatSnapGrid()
{
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
+
+ createGrid();
}
[SetUp]
@@ -45,22 +48,14 @@ namespace osu.Game.Rulesets.Osu.Tests
{
Clear();
+ editorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 1;
+ editorBeatmap.ControlPointInfo.DifficultyPoints.Clear();
editorBeatmap.ControlPointInfo.TimingPoints.Clear();
editorBeatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { BeatLength = beat_length });
beatDivisor.Value = 1;
});
- protected override bool OnMouseMove(MouseMoveEvent e)
- {
- base.OnMouseMove(e);
-
- if (cursor != null)
- cursor.Position = grid?.GetSnapPosition(grid.ToLocalSpace(e.ScreenSpaceMousePosition)) ?? e.ScreenSpaceMousePosition;
-
- return true;
- }
-
[TestCase(1)]
[TestCase(2)]
[TestCase(3)]
@@ -75,6 +70,80 @@ namespace osu.Game.Rulesets.Osu.Tests
createGrid();
}
+ [TestCase(100, 100)]
+ [TestCase(200, 100)]
+ public void TestBeatLength(float beatLength, float expectedSpacing)
+ {
+ AddStep($"set beat length = {beatLength}", () =>
+ {
+ editorBeatmap.ControlPointInfo.TimingPoints.Clear();
+ editorBeatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { BeatLength = beatLength });
+ });
+
+ createGrid();
+ AddAssert($"spacing = {expectedSpacing}", () => Precision.AlmostEquals(expectedSpacing, grid.DistanceSpacing));
+ }
+
+ [TestCase(0.5f, 50)]
+ [TestCase(1, 100)]
+ [TestCase(1.5f, 150)]
+ public void TestSpeedMultiplier(float multiplier, float expectedSpacing)
+ {
+ AddStep($"set speed multiplier = {multiplier}", () =>
+ {
+ editorBeatmap.ControlPointInfo.DifficultyPoints.Clear();
+ editorBeatmap.ControlPointInfo.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = multiplier });
+ });
+
+ createGrid();
+ AddAssert($"spacing = {expectedSpacing}", () => Precision.AlmostEquals(expectedSpacing, grid.DistanceSpacing));
+ }
+
+ [TestCase(0.5f, 50)]
+ [TestCase(1, 100)]
+ [TestCase(1.5f, 150)]
+ public void TestSliderMultiplier(float multiplier, float expectedSpacing)
+ {
+ AddStep($"set speed multiplier = {multiplier}", () => editorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = multiplier);
+ createGrid();
+ AddAssert($"spacing = {expectedSpacing}", () => Precision.AlmostEquals(expectedSpacing, grid.DistanceSpacing));
+ }
+
+ [Test]
+ public void TestCursorInCentre()
+ {
+ createGrid();
+
+ AddStep("move mouse to centre", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position)));
+ assertSnappedDistance((float)beat_length);
+ }
+
+ [Test]
+ public void TestCursorBeforeMovementPoint()
+ {
+ createGrid();
+
+ AddStep("move mouse to just before movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.49f)));
+ assertSnappedDistance((float)beat_length);
+ }
+
+ [Test]
+ public void TestCursorAfterMovementPoint()
+ {
+ createGrid();
+
+ AddStep("move mouse to just after movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.51f)));
+ assertSnappedDistance((float)beat_length * 2);
+ }
+
+ private void assertSnappedDistance(float expectedDistance) => AddAssert($"snap distance = {expectedDistance}", () =>
+ {
+ Vector2 snappedPosition = grid.GetSnapPosition(grid.ToLocalSpace(InputManager.CurrentState.Mouse.Position));
+ float distance = Vector2.Distance(snappedPosition, grid_position);
+
+ return Precision.AlmostEquals(expectedDistance, distance);
+ });
+
private void createGrid()
{
AddStep("create grid", () =>
@@ -86,28 +155,77 @@ namespace osu.Game.Rulesets.Osu.Tests
RelativeSizeAxes = Axes.Both,
Colour = Color4.SlateGray
},
- grid = new OsuBeatSnapGrid(new HitCircle { Position = grid_position }),
- cursor = new Circle
- {
- Origin = Anchor.Centre,
- Size = new Vector2(50),
- Colour = Color4.Red
- }
+ grid = new TestOsuBeatSnapGrid(new HitCircle { Position = grid_position }),
+ new SnappingCursorContainer { GetSnapPosition = v => grid.GetSnapPosition(grid.ToLocalSpace(v)) }
};
});
}
+ private class SnappingCursorContainer : CompositeDrawable
+ {
+ public Func GetSnapPosition;
+
+ private readonly Drawable cursor;
+
+ public SnappingCursorContainer()
+ {
+ RelativeSizeAxes = Axes.Both;
+
+ InternalChild = cursor = new Circle
+ {
+ Origin = Anchor.Centre,
+ Size = new Vector2(50),
+ Colour = Color4.Red
+ };
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ updatePosition(GetContainingInputManager().CurrentState.Mouse.Position);
+ }
+
+ protected override bool OnMouseMove(MouseMoveEvent e)
+ {
+ base.OnMouseMove(e);
+
+ updatePosition(e.ScreenSpaceMousePosition);
+ return true;
+ }
+
+ private void updatePosition(Vector2 screenSpacePosition)
+ {
+ cursor.Position = GetSnapPosition.Invoke(screenSpacePosition);
+ }
+ }
+
+ private class TestOsuBeatSnapGrid : OsuBeatSnapGrid
+ {
+ public new float DistanceSpacing => base.DistanceSpacing;
+
+ public TestOsuBeatSnapGrid(OsuHitObject hitObject)
+ : base(hitObject)
+ {
+ }
+ }
+
private abstract class CircularBeatSnapGrid : BeatSnapGrid
{
- protected override void CreateGrid(Vector2 startPosition)
+ protected CircularBeatSnapGrid(HitObject hitObject, Vector2 centrePosition)
+ : base(hitObject, centrePosition)
+ {
+ }
+
+ protected override void CreateContent(Vector2 centrePosition)
{
float maxDistance = Math.Max(
- Vector2.Distance(startPosition, Vector2.Zero),
+ Vector2.Distance(centrePosition, Vector2.Zero),
Math.Max(
- Vector2.Distance(startPosition, new Vector2(DrawWidth, 0)),
+ Vector2.Distance(centrePosition, new Vector2(DrawWidth, 0)),
Math.Max(
- Vector2.Distance(startPosition, new Vector2(0, DrawHeight)),
- Vector2.Distance(startPosition, DrawSize))));
+ Vector2.Distance(centrePosition, new Vector2(0, DrawHeight)),
+ Vector2.Distance(centrePosition, DrawSize))));
int requiredCircles = (int)(maxDistance / DistanceSpacing);
@@ -118,7 +236,7 @@ namespace osu.Game.Rulesets.Osu.Tests
AddInternal(new CircularProgress
{
Origin = Anchor.Centre,
- Position = startPosition,
+ Position = centrePosition,
Current = { Value = 1 },
Size = new Vector2(radius),
InnerRadius = 4 * 1f / radius,
@@ -129,7 +247,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public override Vector2 GetSnapPosition(Vector2 position)
{
- Vector2 direction = position - StartPosition;
+ Vector2 direction = position - CentrePosition;
float distance = direction.Length;
float radius = DistanceSpacing;
@@ -140,7 +258,7 @@ namespace osu.Game.Rulesets.Osu.Tests
Vector2 normalisedDirection = direction * new Vector2(1f / distance);
- return StartPosition + normalisedDirection * radialCount * radius;
+ return CentrePosition + normalisedDirection * radialCount * radius;
}
}
From 45835f97a177597fb236793116382f5b8c7918ea Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 17:13:28 +0900
Subject: [PATCH 151/373] Split out grids into separate files
---
.../TestSceneOsuBeatSnapGrid.cs | 80 +------------------
osu.Game.Rulesets.Osu/Edit/OsuBeatSnapGrid.cs | 33 ++++++++
.../Components/CircularBeatSnapGrid.cs | 63 +++++++++++++++
3 files changed, 97 insertions(+), 79 deletions(-)
create mode 100644 osu.Game.Rulesets.Osu/Edit/OsuBeatSnapGrid.cs
create mode 100644 osu.Game/Screens/Edit/Compose/Components/CircularBeatSnapGrid.cs
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
index 7baa2f0d72..7399f12372 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuBeatSnapGrid.cs
@@ -7,16 +7,13 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
-using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.MathUtils;
-using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Beatmaps;
+using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit;
-using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Graphics;
@@ -209,80 +206,5 @@ namespace osu.Game.Rulesets.Osu.Tests
{
}
}
-
- private abstract class CircularBeatSnapGrid : BeatSnapGrid
- {
- protected CircularBeatSnapGrid(HitObject hitObject, Vector2 centrePosition)
- : base(hitObject, centrePosition)
- {
- }
-
- protected override void CreateContent(Vector2 centrePosition)
- {
- float maxDistance = Math.Max(
- Vector2.Distance(centrePosition, Vector2.Zero),
- Math.Max(
- Vector2.Distance(centrePosition, new Vector2(DrawWidth, 0)),
- Math.Max(
- Vector2.Distance(centrePosition, new Vector2(0, DrawHeight)),
- Vector2.Distance(centrePosition, DrawSize))));
-
- int requiredCircles = (int)(maxDistance / DistanceSpacing);
-
- for (int i = 0; i < requiredCircles; i++)
- {
- float radius = (i + 1) * DistanceSpacing * 2;
-
- AddInternal(new CircularProgress
- {
- Origin = Anchor.Centre,
- Position = centrePosition,
- Current = { Value = 1 },
- Size = new Vector2(radius),
- InnerRadius = 4 * 1f / radius,
- Colour = GetColourForBeatIndex(i)
- });
- }
- }
-
- public override Vector2 GetSnapPosition(Vector2 position)
- {
- Vector2 direction = position - CentrePosition;
- float distance = direction.Length;
-
- float radius = DistanceSpacing;
- int radialCount = Math.Max(1, (int)Math.Round(distance / radius));
-
- if (radialCount <= 0)
- return position;
-
- Vector2 normalisedDirection = direction * new Vector2(1f / distance);
-
- return CentrePosition + normalisedDirection * radialCount * radius;
- }
- }
-
- private class OsuBeatSnapGrid : CircularBeatSnapGrid
- {
- ///
- /// Scoring distance with a speed-adjusted beat length of 1 second.
- ///
- private const float base_scoring_distance = 100;
-
- public OsuBeatSnapGrid(OsuHitObject hitObject)
- : base(hitObject, hitObject.StackedEndPosition)
- {
- }
-
- protected override float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
- {
- TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(time);
- DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(time);
-
- double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
-
- return (float)(scoringDistance / timingPoint.BeatLength);
- }
- }
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/OsuBeatSnapGrid.cs b/osu.Game.Rulesets.Osu/Edit/OsuBeatSnapGrid.cs
new file mode 100644
index 0000000000..d453e3d062
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Edit/OsuBeatSnapGrid.cs
@@ -0,0 +1,33 @@
+// 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.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Screens.Edit.Compose.Components;
+
+namespace osu.Game.Rulesets.Osu.Edit
+{
+ public class OsuBeatSnapGrid : CircularBeatSnapGrid
+ {
+ ///
+ /// Scoring distance with a speed-adjusted beat length of 1 second.
+ ///
+ private const float base_scoring_distance = 100;
+
+ public OsuBeatSnapGrid(OsuHitObject hitObject)
+ : base(hitObject, hitObject.StackedEndPosition)
+ {
+ }
+
+ protected override float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
+ {
+ TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(time);
+ DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(time);
+
+ double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
+
+ return (float)(scoringDistance / timingPoint.BeatLength);
+ }
+ }
+}
diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularBeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularBeatSnapGrid.cs
new file mode 100644
index 0000000000..8492771808
--- /dev/null
+++ b/osu.Game/Screens/Edit/Compose/Components/CircularBeatSnapGrid.cs
@@ -0,0 +1,63 @@
+// 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;
+using osu.Framework.Graphics.UserInterface;
+using osu.Game.Rulesets.Objects;
+using osuTK;
+
+namespace osu.Game.Screens.Edit.Compose.Components
+{
+ public abstract class CircularBeatSnapGrid : BeatSnapGrid
+ {
+ protected CircularBeatSnapGrid(HitObject hitObject, Vector2 centrePosition)
+ : base(hitObject, centrePosition)
+ {
+ }
+
+ protected override void CreateContent(Vector2 centrePosition)
+ {
+ float maxDistance = Math.Max(
+ Vector2.Distance(centrePosition, Vector2.Zero),
+ Math.Max(
+ Vector2.Distance(centrePosition, new Vector2(DrawWidth, 0)),
+ Math.Max(
+ Vector2.Distance(centrePosition, new Vector2(0, DrawHeight)),
+ Vector2.Distance(centrePosition, DrawSize))));
+
+ int requiredCircles = (int)(maxDistance / DistanceSpacing);
+
+ for (int i = 0; i < requiredCircles; i++)
+ {
+ float radius = (i + 1) * DistanceSpacing * 2;
+
+ AddInternal(new CircularProgress
+ {
+ Origin = Anchor.Centre,
+ Position = centrePosition,
+ Current = { Value = 1 },
+ Size = new Vector2(radius),
+ InnerRadius = 4 * 1f / radius,
+ Colour = GetColourForBeatIndex(i)
+ });
+ }
+ }
+
+ public override Vector2 GetSnapPosition(Vector2 position)
+ {
+ Vector2 direction = position - CentrePosition;
+ float distance = direction.Length;
+
+ float radius = DistanceSpacing;
+ int radialCount = Math.Max(1, (int)Math.Round(distance / radius));
+
+ if (radialCount <= 0)
+ return position;
+
+ Vector2 normalisedDirection = direction * new Vector2(1f / distance);
+
+ return CentrePosition + normalisedDirection * radialCount * radius;
+ }
+ }
+}
From 715fb88316bf4609a18a6cedaa9214a1454acb09 Mon Sep 17 00:00:00 2001
From: smoogipoo
Date: Fri, 11 Oct 2019 19:33:21 +0900
Subject: [PATCH 152/373] Fix build scripts not passing arguments to cake
---
build.ps1 | 25 ++++++++++++++++++++++++-
build.sh | 16 +++++++++++++++-
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/build.ps1 b/build.ps1
index 8eb37f2de6..2dbd10a150 100755
--- a/build.ps1
+++ b/build.ps1
@@ -1,4 +1,27 @@
+[CmdletBinding()]
+Param(
+ [string]$Target,
+ [string]$Configuration,
+ [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
+ [string]$Verbosity,
+ [switch]$ShowDescription,
+ [Alias("WhatIf", "Noop")]
+ [switch]$DryRun,
+ [Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)]
+ [string[]]$ScriptArgs
+)
+
+# Build Cake arguments
+$cakeArguments = "";
+if ($Target) { $cakeArguments += "-target=$Target" }
+if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
+if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
+if ($ShowDescription) { $cakeArguments += "-showdescription" }
+if ($DryRun) { $cakeArguments += "-dryrun" }
+if ($Experimental) { $cakeArguments += "-experimental" }
+$cakeArguments += $ScriptArgs
+
dotnet tool install Cake.Tool --global --version 0.35.0
dotnet cake ./build/build.cake --bootstrap
-dotnet cake ./build/build.cake
+dotnet cake ./build/build.cake $cakeArguments
exit $LASTEXITCODE
\ No newline at end of file
diff --git a/build.sh b/build.sh
index d20a9c12fa..ac6bd877a6 100755
--- a/build.sh
+++ b/build.sh
@@ -1,3 +1,17 @@
+echo "Installing Cake.Tool..."
dotnet tool install Cake.Tool --global --version 0.35.0
+
+# Parse arguments.
+CAKE_ARGUMENTS=()
+for i in "$@"; do
+ case $1 in
+ -s|--script) SCRIPT="$2"; shift ;;
+ --) shift; CAKE_ARGUMENTS+=("$@"); break ;;
+ *) CAKE_ARGUMENTS+=("$1") ;;
+ esac
+ shift
+done
+
+echo "Running build script..."
dotnet cake ./build/build.cake --bootstrap
-dotnet cake ./build/build.cake
\ No newline at end of file
+dotnet cake ./build/build.cake "${CAKE_ARGUMENTS[@]}"
\ No newline at end of file
From 13924174c4950a173c575217484006046cfaccf4 Mon Sep 17 00:00:00 2001
From: HoLLy-HaCKeR
Date: Sat, 12 Oct 2019 10:04:14 +0200
Subject: [PATCH 153/373] Fix PopIn and PopOut resetting cursor scale
---
osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index 371c2983fc..2b499064fb 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private Bindable cursorScale;
private Bindable autoCursorScale;
+ private float calculatedCursorScale;
private readonly IBindable beatmap = new Bindable();
public OsuCursorContainer()
@@ -69,6 +70,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
}
+ calculatedCursorScale = scale;
ActiveCursor.Scale = cursorTrail.Scale = new Vector2(scale);
}
@@ -125,13 +127,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
protected override void PopIn()
{
fadeContainer.FadeTo(1, 300, Easing.OutQuint);
- ActiveCursor.ScaleTo(1, 400, Easing.OutQuint);
+ ActiveCursor.ScaleTo(calculatedCursorScale, 400, Easing.OutQuint);
}
protected override void PopOut()
{
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
- ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint);
+ ActiveCursor.ScaleTo(calculatedCursorScale * 0.8f, 450, Easing.OutQuint);
}
private class DefaultCursorTrail : CursorTrail
From fdc17d2adb07d81c22f7d1b6ad3c44f277917429 Mon Sep 17 00:00:00 2001
From: HoLLy-HaCKeR
Date: Sat, 12 Oct 2019 11:51:14 +0200
Subject: [PATCH 154/373] Scale OsuResumeCursor with gameplay cursor
---
.../UI/Cursor/OsuCursorContainer.cs | 13 ++++++++-----
osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 14 +++++++++++---
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index 2b499064fb..8ea11d0a4b 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -29,9 +29,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Drawable cursorTrail;
+ public IBindable CalculatedCursorScale => calculatedCursorScale;
+ private Bindable calculatedCursorScale;
private Bindable cursorScale;
private Bindable autoCursorScale;
- private float calculatedCursorScale;
private readonly IBindable beatmap = new Bindable();
public OsuCursorContainer()
@@ -57,6 +58,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += _ => calculateScale();
+ calculatedCursorScale = new Bindable();
+ calculatedCursorScale.ValueChanged += e => ActiveCursor.Scale = cursorTrail.Scale = new Vector2(e.NewValue);
+
calculateScale();
}
@@ -70,8 +74,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
}
- calculatedCursorScale = scale;
- ActiveCursor.Scale = cursorTrail.Scale = new Vector2(scale);
+ calculatedCursorScale.Value = scale;
}
protected override void LoadComplete()
@@ -127,13 +130,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
protected override void PopIn()
{
fadeContainer.FadeTo(1, 300, Easing.OutQuint);
- ActiveCursor.ScaleTo(calculatedCursorScale, 400, Easing.OutQuint);
+ ActiveCursor.ScaleTo(calculatedCursorScale.Value, 400, Easing.OutQuint);
}
protected override void PopOut()
{
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
- ActiveCursor.ScaleTo(calculatedCursorScale * 0.8f, 450, Easing.OutQuint);
+ ActiveCursor.ScaleTo(calculatedCursorScale.Value * 0.8f, 450, Easing.OutQuint);
}
private class DefaultCursorTrail : CursorTrail
diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
index 9e5df0d6b1..9033817115 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -38,7 +38,13 @@ namespace osu.Game.Rulesets.Osu.UI
clickToResumeCursor.ShowAt(GameplayCursor.ActiveCursor.Position);
if (localCursorContainer == null)
- Add(localCursorContainer = new OsuCursorContainer());
+ {
+ var newContainer = new OsuCursorContainer();
+ Add(localCursorContainer = newContainer);
+
+ clickToResumeCursor.CursorScale = newContainer.CalculatedCursorScale.Value;
+ newContainer.CalculatedCursorScale.ValueChanged += e => clickToResumeCursor.CursorScale = e.NewValue;
+ }
}
public override void Hide()
@@ -57,6 +63,8 @@ namespace osu.Game.Rulesets.Osu.UI
public Action ResumeRequested;
+ public float CursorScale;
+
public OsuClickToResumeCursor()
{
RelativePositionAxes = Axes.Both;
@@ -82,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.UI
case OsuAction.RightButton:
if (!IsHovered) return false;
- this.ScaleTo(new Vector2(2), TRANSITION_TIME, Easing.OutQuint);
+ this.ScaleTo(2 * CursorScale, TRANSITION_TIME, Easing.OutQuint);
ResumeRequested?.Invoke();
return true;
@@ -97,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
updateColour();
this.MoveTo(activeCursorPosition);
- this.ScaleTo(new Vector2(4)).Then().ScaleTo(Vector2.One, 1000, Easing.OutQuint);
+ this.ScaleTo(4 * CursorScale).Then().ScaleTo(CursorScale, 1000, Easing.OutQuint);
});
private void updateColour()
From 7931510d7bda55dc3b54da6d411cd8c4711a7e4e Mon Sep 17 00:00:00 2001
From: HoLLy-HaCKeR
Date: Sat, 12 Oct 2019 11:59:22 +0200
Subject: [PATCH 155/373] Ensure OsuResumeCursor can change scale when it is
being shown
---
osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
index 9033817115..7221e09c35 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -43,7 +43,13 @@ namespace osu.Game.Rulesets.Osu.UI
Add(localCursorContainer = newContainer);
clickToResumeCursor.CursorScale = newContainer.CalculatedCursorScale.Value;
- newContainer.CalculatedCursorScale.ValueChanged += e => clickToResumeCursor.CursorScale = e.NewValue;
+ clickToResumeCursor.Scale = new Vector2(newContainer.CalculatedCursorScale.Value);
+
+ newContainer.CalculatedCursorScale.ValueChanged += e =>
+ {
+ clickToResumeCursor.CursorScale = e.NewValue;
+ clickToResumeCursor.Scale = new Vector2(e.NewValue);
+ };
}
}
From f6b138fe6ed3aa230c1753b4ce0bb7bf576dcfef Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Sat, 12 Oct 2019 15:03:24 +0300
Subject: [PATCH 156/373] Remove useless ItemGroup
---
osu.Game/osu.Game.csproj | 3 ---
1 file changed, 3 deletions(-)
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 4e6511385e..ab7c40116b 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -32,7 +32,4 @@
-
-
-
From 4d971e49ff050685a4498cc31b941fd426f41ef1 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Sun, 13 Oct 2019 11:50:27 +0300
Subject: [PATCH 157/373] Colours update
---
osu.Game/Overlays/Comments/CommentsContainer.cs | 2 +-
osu.Game/Overlays/Comments/DrawableComment.cs | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 265793226e..b66374cb69 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -113,7 +113,7 @@ namespace osu.Game.Overlays.Comments
[BackgroundDependencyLoader]
private void load()
{
- background.Colour = colours.Gray3;
+ background.Colour = colours.Gray2;
}
}
}
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index fd7f874304..4617f6f86e 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -13,7 +13,6 @@ using osu.Game.Utils;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
-using osuTK.Graphics;
using System.Linq;
namespace osu.Game.Overlays.Comments
@@ -134,6 +133,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
+ Colour = OsuColour.Gray(0.7f),
Children = new Drawable[]
{
new SpriteText
@@ -262,6 +262,7 @@ namespace osu.Game.Overlays.Comments
Child = icon = new SpriteIcon
{
Size = new Vector2(12),
+ Colour = OsuColour.Gray(0.7f)
};
}
@@ -340,7 +341,7 @@ namespace osu.Game.Overlays.Comments
new Box
{
RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black
+ Colour = OsuColour.Gray(0.05f)
},
new SpriteText
{
From 795ce8146895f435744a41e929a4621d0a212f16 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Sun, 13 Oct 2019 12:10:01 +0300
Subject: [PATCH 158/373] Use async loading for comment pages
---
.../Overlays/Comments/CommentsContainer.cs | 42 +++++++++++++------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index b66374cb69..3b997540c4 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -10,6 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
+using System.Threading;
namespace osu.Game.Overlays.Comments
{
@@ -28,6 +29,7 @@ namespace osu.Game.Overlays.Comments
private OsuColour colours { get; set; }
private GetCommentsRequest request;
+ private CancellationTokenSource loadCancellation;
private readonly Box background;
private readonly FillFlowContainer content;
@@ -79,7 +81,7 @@ namespace osu.Game.Overlays.Comments
private void getComments()
{
request?.Cancel();
- content.Clear();
+ loadCancellation?.Cancel();
request = new GetCommentsRequest(type, id, Sort.Value);
request.Success += onSuccess;
api.Queue(request);
@@ -87,27 +89,43 @@ namespace osu.Game.Overlays.Comments
private void onSuccess(APICommentsController response)
{
+ loadCancellation = new CancellationTokenSource();
+
+ FillFlowContainer page = new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ };
+
foreach (var c in response.Comments)
{
if (c.IsTopLevel)
- content.Add(new DrawableComment(c)
+ page.Add(new DrawableComment(c)
{
ShowDeleted = { BindTarget = ShowDeleted }
});
}
- int deletedComments = 0;
-
- response.Comments.ForEach(comment =>
+ LoadComponentAsync(page, loaded =>
{
- if (comment.IsDeleted && comment.IsTopLevel)
- deletedComments++;
- });
+ content.Clear();
- content.Add(new DeletedChildsPlaceholder(deletedComments)
- {
- ShowDeleted = { BindTarget = ShowDeleted }
- });
+ content.Add(loaded);
+
+ int deletedComments = 0;
+
+ response.Comments.ForEach(comment =>
+ {
+ if (comment.IsDeleted && comment.IsTopLevel)
+ deletedComments++;
+ });
+
+ content.Add(new DeletedChildsPlaceholder(deletedComments)
+ {
+ ShowDeleted = { BindTarget = ShowDeleted }
+ });
+ }, loadCancellation.Token);
}
[BackgroundDependencyLoader]
From 60954f969d77f6350b0f63903cf2f5696046c248 Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Sun, 13 Oct 2019 12:38:50 +0300
Subject: [PATCH 159/373] DeletedChildsPlaceholder refactor
---
.../Overlays/Comments/CommentsContainer.cs | 33 ++++++++++++++++---
.../Comments/DeletedChildsPlaceholder.cs | 30 ++++++++++++-----
osu.Game/Overlays/Comments/DrawableComment.cs | 5 ++-
3 files changed, 55 insertions(+), 13 deletions(-)
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 3b997540c4..1fca9ca5e5 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -33,6 +33,8 @@ namespace osu.Game.Overlays.Comments
private readonly Box background;
private readonly FillFlowContainer content;
+ private readonly FillFlowContainer footer;
+ private readonly DeletedChildsPlaceholder deletedChildsPlaceholder;
public CommentsContainer(CommentableType type, long id)
{
@@ -64,6 +66,32 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = OsuColour.Gray(0.2f)
+ },
+ footer = new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ deletedChildsPlaceholder = new DeletedChildsPlaceholder
+ {
+ ShowDeleted = { BindTarget = ShowDeleted }
+ }
+ }
+ }
+ }
}
}
}
@@ -121,10 +149,7 @@ namespace osu.Game.Overlays.Comments
deletedComments++;
});
- content.Add(new DeletedChildsPlaceholder(deletedComments)
- {
- ShowDeleted = { BindTarget = ShowDeleted }
- });
+ deletedChildsPlaceholder.DeletedCount.Value = deletedComments;
}, loadCancellation.Token);
}
diff --git a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
index 7aae42908e..b5dcf433f1 100644
--- a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
+++ b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
@@ -17,18 +17,18 @@ namespace osu.Game.Overlays.Comments
private const int margin = 10;
public readonly BindableBool ShowDeleted = new BindableBool();
+ public readonly BindableInt DeletedCount = new BindableInt();
- private readonly bool canBeVisible;
+ private bool canBeShown;
- public DeletedChildsPlaceholder(int count)
+ private readonly SpriteText countText;
+
+ public DeletedChildsPlaceholder()
{
- canBeVisible = count != 0;
-
AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
Spacing = new Vector2(3, 0);
Margin = new MarginPadding { Vertical = margin, Left = deleted_placeholder_margin };
- Alpha = 0;
Children = new Drawable[]
{
new SpriteIcon
@@ -36,24 +36,38 @@ namespace osu.Game.Overlays.Comments
Icon = FontAwesome.Solid.Trash,
Size = new Vector2(14),
},
- new SpriteText
+ countText = new SpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
- Text = $@"{count} deleted comment{(count.ToString().ToCharArray().Last() == '1' ? "" : "s")}"
}
};
}
protected override void LoadComplete()
{
+ DeletedCount.BindValueChanged(onCountChanged, true);
ShowDeleted.BindValueChanged(onShowDeletedChanged, true);
base.LoadComplete();
}
private void onShowDeletedChanged(ValueChangedEvent showDeleted)
{
- if (canBeVisible)
+ if (canBeShown)
this.FadeTo(showDeleted.NewValue ? 0 : 1);
}
+
+ private void onCountChanged(ValueChangedEvent count)
+ {
+ canBeShown = count.NewValue != 0;
+
+ if (!canBeShown)
+ {
+ Hide();
+ return;
+ }
+
+ countText.Text = $@"{count.NewValue} deleted comment{(count.NewValue.ToString().ToCharArray().Last() == '1' ? "" : "s")}";
+ Show();
+ }
}
}
diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs
index 4617f6f86e..8c356a6156 100644
--- a/osu.Game/Overlays/Comments/DrawableComment.cs
+++ b/osu.Game/Overlays/Comments/DrawableComment.cs
@@ -32,6 +32,7 @@ namespace osu.Game.Overlays.Comments
private readonly FillFlowContainer childCommentsVisibilityContainer;
private readonly Comment comment;
+ private readonly DeletedChildsPlaceholder deletedChildsPlaceholder;
public DrawableComment(Comment comment)
{
@@ -168,7 +169,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical
},
- new DeletedChildsPlaceholder(comment.GetDeletedChildsCount())
+ deletedChildsPlaceholder = new DeletedChildsPlaceholder
{
ShowDeleted = { BindTarget = ShowDeleted }
}
@@ -177,6 +178,8 @@ namespace osu.Game.Overlays.Comments
}
};
+ deletedChildsPlaceholder.DeletedCount.Value = comment.GetDeletedChildsCount();
+
if (comment.UserId == null)
username.AddText(comment.LegacyName);
else
From a44cc2e70baf13f3f90c6635d23bb2645b06841f Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Sun, 13 Oct 2019 14:43:30 +0300
Subject: [PATCH 160/373] Implement CommentsShowMoreButton
---
.../Online/TestSceneCommentsContainer.cs | 6 ++
.../Visual/Online/TestSceneShowMoreButton.cs | 5 +-
.../UserInterface}/ShowMoreButton.cs | 67 ++++++++++---------
.../Overlays/Comments/CommentsContainer.cs | 54 ++++++++++++---
.../Comments/CommentsShowMoreButton.cs | 32 +++++++++
.../Comments/DeletedChildsPlaceholder.cs | 8 ++-
.../Profile/Sections/PaginatedContainer.cs | 4 +-
.../Profile/Sections/ProfileShowMoreButton.cs | 20 ++++++
8 files changed, 151 insertions(+), 45 deletions(-)
rename osu.Game/{Overlays/Profile/Sections => Graphics/UserInterface}/ShowMoreButton.cs (77%)
create mode 100644 osu.Game/Overlays/Comments/CommentsShowMoreButton.cs
create mode 100644 osu.Game/Overlays/Profile/Sections/ProfileShowMoreButton.cs
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
index 342ba487f0..a283663a4a 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs
@@ -47,6 +47,12 @@ namespace osu.Game.Tests.Visual.Online
scrollFlow.Clear();
scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 24313));
});
+
+ AddStep("lazer build comments", () =>
+ {
+ scrollFlow.Clear();
+ scrollFlow.Add(new CommentsContainer(CommentableType.Build, 4772));
+ });
}
}
}
diff --git a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs
index bccb263600..8d4955abf0 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs
@@ -5,6 +5,7 @@ using osu.Game.Overlays.Profile.Sections;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
+using osu.Game.Graphics.UserInterface;
namespace osu.Game.Tests.Visual.Online
{
@@ -17,11 +18,11 @@ namespace osu.Game.Tests.Visual.Online
public TestSceneShowMoreButton()
{
- ShowMoreButton button = null;
+ ProfileShowMoreButton button = null;
int fireCount = 0;
- Add(button = new ShowMoreButton
+ Add(button = new ProfileShowMoreButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Graphics/UserInterface/ShowMoreButton.cs
similarity index 77%
rename from osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs
rename to osu.Game/Graphics/UserInterface/ShowMoreButton.cs
index cf4e1c0dde..627ad995e8 100644
--- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs
+++ b/osu.Game/Graphics/UserInterface/ShowMoreButton.cs
@@ -1,30 +1,36 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
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;
+using osuTK.Graphics;
using System.Collections.Generic;
-namespace osu.Game.Overlays.Profile.Sections
+namespace osu.Game.Graphics.UserInterface
{
public class ShowMoreButton : OsuHoverContainer
{
private const float fade_duration = 200;
- private readonly Box background;
- private readonly LoadingAnimation loading;
- private readonly FillFlowContainer content;
+ private Color4 chevronIconColour;
- protected override IEnumerable EffectTargets => new[] { background };
+ public Color4 ChevronIconColour
+ {
+ get => chevronIconColour;
+ set { chevronIconColour = leftChevron.AccentColour = rightChevron.AccentColour = value; }
+ }
+
+ public string Text
+ {
+ get => text.Text;
+ set { text.Text = value; }
+ }
private bool isLoading;
@@ -33,26 +39,32 @@ namespace osu.Game.Overlays.Profile.Sections
get => isLoading;
set
{
- if (isLoading == value)
- return;
-
isLoading = value;
Enabled.Value = !isLoading;
if (value)
{
- loading.FadeIn(fade_duration, Easing.OutQuint);
+ loading.Show();
content.FadeOut(fade_duration, Easing.OutQuint);
}
else
{
- loading.FadeOut(fade_duration, Easing.OutQuint);
+ loading.Hide();
content.FadeIn(fade_duration, Easing.OutQuint);
}
}
}
+ private readonly Box background;
+ private readonly LoadingAnimation loading;
+ private readonly FillFlowContainer content;
+ private readonly ChevronIcon leftChevron;
+ private readonly ChevronIcon rightChevron;
+ private readonly SpriteText text;
+
+ protected override IEnumerable EffectTargets => new[] { background };
+
public ShowMoreButton()
{
AutoSizeAxes = Axes.Both;
@@ -77,15 +89,15 @@ namespace osu.Game.Overlays.Profile.Sections
Spacing = new Vector2(7),
Children = new Drawable[]
{
- new ChevronIcon(),
- new OsuSpriteText
+ leftChevron = new ChevronIcon(),
+ text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Text = "show more".ToUpper(),
},
- new ChevronIcon(),
+ rightChevron = new ChevronIcon(),
}
},
loading = new LoadingAnimation
@@ -99,13 +111,6 @@ namespace osu.Game.Overlays.Profile.Sections
};
}
- [BackgroundDependencyLoader]
- private void load(OsuColour colors)
- {
- IdleColour = colors.GreySeafoamDark;
- HoverColour = colors.GreySeafoam;
- }
-
protected override bool OnClick(ClickEvent e)
{
if (!Enabled.Value)
@@ -126,6 +131,14 @@ namespace osu.Game.Overlays.Profile.Sections
{
private const int icon_size = 8;
+ private Color4 accentColour;
+
+ public Color4 AccentColour
+ {
+ get => accentColour;
+ set { accentColour = Colour = value; }
+ }
+
public ChevronIcon()
{
Anchor = Anchor.Centre;
@@ -133,12 +146,6 @@ namespace osu.Game.Overlays.Profile.Sections
Size = new Vector2(icon_size);
Icon = FontAwesome.Solid.ChevronDown;
}
-
- [BackgroundDependencyLoader]
- private void load(OsuColour colors)
- {
- Colour = colors.Yellow;
- }
}
}
}
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 1fca9ca5e5..1111313d7f 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -16,6 +16,8 @@ namespace osu.Game.Overlays.Comments
{
public class CommentsContainer : CompositeDrawable
{
+ private const int more_button_margin = 5;
+
private readonly CommentableType type;
private readonly long id;
@@ -30,11 +32,13 @@ namespace osu.Game.Overlays.Comments
private GetCommentsRequest request;
private CancellationTokenSource loadCancellation;
+ private int currentPage;
+ private int loadedTopLevelComments;
private readonly Box background;
private readonly FillFlowContainer content;
- private readonly FillFlowContainer footer;
private readonly DeletedChildsPlaceholder deletedChildsPlaceholder;
+ private readonly CommentsShowMoreButton moreButton;
public CommentsContainer(CommentableType type, long id)
{
@@ -78,7 +82,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f)
},
- footer = new FillFlowContainer
+ new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@@ -88,6 +92,18 @@ namespace osu.Game.Overlays.Comments
deletedChildsPlaceholder = new DeletedChildsPlaceholder
{
ShowDeleted = { BindTarget = ShowDeleted }
+ },
+ new Container
+ {
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ Child = moreButton = new CommentsShowMoreButton
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Margin = new MarginPadding(more_button_margin),
+ Action = () => getComments(false),
+ }
}
}
}
@@ -106,16 +122,25 @@ namespace osu.Game.Overlays.Comments
private void onSortChanged(ValueChangedEvent sort) => getComments();
- private void getComments()
+ private void getComments(bool initial = true)
{
+ if (initial)
+ {
+ currentPage = 1;
+ loadedTopLevelComments = 0;
+ deletedChildsPlaceholder.DeletedCount.Value = 0;
+ moreButton.IsLoading = true;
+ content.Clear();
+ }
+
request?.Cancel();
loadCancellation?.Cancel();
- request = new GetCommentsRequest(type, id, Sort.Value);
- request.Success += onSuccess;
+ request = new GetCommentsRequest(type, id, Sort.Value, currentPage++);
+ request.Success += response => onSuccess(response, initial);
api.Queue(request);
}
- private void onSuccess(APICommentsController response)
+ private void onSuccess(APICommentsController response, bool initial)
{
loadCancellation = new CancellationTokenSource();
@@ -137,8 +162,6 @@ namespace osu.Game.Overlays.Comments
LoadComponentAsync(page, loaded =>
{
- content.Clear();
-
content.Add(loaded);
int deletedComments = 0;
@@ -149,7 +172,20 @@ namespace osu.Game.Overlays.Comments
deletedComments++;
});
- deletedChildsPlaceholder.DeletedCount.Value = deletedComments;
+ deletedChildsPlaceholder.DeletedCount.Value = initial ? deletedComments : deletedChildsPlaceholder.DeletedCount.Value + deletedComments;
+
+ if (response.HasMore)
+ {
+ response.Comments.ForEach(comment =>
+ {
+ if (comment.IsTopLevel)
+ loadedTopLevelComments++;
+ });
+ moreButton.Current.Value = response.TopLevelCount - loadedTopLevelComments;
+ moreButton.IsLoading = false;
+ }
+ moreButton.FadeTo(response.HasMore ? 1 : 0);
+
}, loadCancellation.Token);
}
diff --git a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs
new file mode 100644
index 0000000000..b0174e7b1a
--- /dev/null
+++ b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs
@@ -0,0 +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.Bindables;
+using osu.Game.Graphics;
+using osu.Game.Graphics.UserInterface;
+
+namespace osu.Game.Overlays.Comments
+{
+ public class CommentsShowMoreButton : ShowMoreButton
+ {
+ public readonly BindableInt Current = new BindableInt();
+
+ public CommentsShowMoreButton()
+ {
+ IdleColour = OsuColour.Gray(0.3f);
+ HoverColour = OsuColour.Gray(0.4f);
+ ChevronIconColour = OsuColour.Gray(0.5f);
+ }
+
+ protected override void LoadComplete()
+ {
+ Current.BindValueChanged(onCurrentChanged, true);
+ base.LoadComplete();
+ }
+
+ private void onCurrentChanged(ValueChangedEvent count)
+ {
+ Text = $@"Show More ({count.NewValue})".ToUpper();
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
index b5dcf433f1..d626c13afd 100644
--- a/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
+++ b/osu.Game/Overlays/Comments/DeletedChildsPlaceholder.cs
@@ -7,7 +7,6 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Bindables;
-using System.Linq;
namespace osu.Game.Overlays.Comments
{
@@ -66,7 +65,12 @@ namespace osu.Game.Overlays.Comments
return;
}
- countText.Text = $@"{count.NewValue} deleted comment{(count.NewValue.ToString().ToCharArray().Last() == '1' ? "" : "s")}";
+ string str = $@"{count.NewValue} deleted comment";
+
+ if (!(count.NewValue.ToString().EndsWith("1") && !count.NewValue.ToString().EndsWith("11")))
+ str += "s";
+
+ countText.Text = str;
Show();
}
}
diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs
index bb221bd43a..dc1a847b14 100644
--- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs
+++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs
@@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
public abstract class PaginatedContainer : FillFlowContainer
{
- private readonly ShowMoreButton moreButton;
+ private readonly ProfileShowMoreButton moreButton;
private readonly OsuSpriteText missingText;
private APIRequest> retrievalRequest;
private CancellationTokenSource loadCancellation;
@@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Profile.Sections
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0, 2),
},
- moreButton = new ShowMoreButton
+ moreButton = new ProfileShowMoreButton
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
diff --git a/osu.Game/Overlays/Profile/Sections/ProfileShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ProfileShowMoreButton.cs
new file mode 100644
index 0000000000..28486cc743
--- /dev/null
+++ b/osu.Game/Overlays/Profile/Sections/ProfileShowMoreButton.cs
@@ -0,0 +1,20 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Game.Graphics;
+using osu.Game.Graphics.UserInterface;
+
+namespace osu.Game.Overlays.Profile.Sections
+{
+ public class ProfileShowMoreButton : ShowMoreButton
+ {
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colors)
+ {
+ IdleColour = colors.GreySeafoamDark;
+ HoverColour = colors.GreySeafoam;
+ ChevronIconColour = colors.Yellow;
+ }
+ }
+}
From 328b4d6863a3002b396b65bbcdde32d0a95568ff Mon Sep 17 00:00:00 2001
From: Andrei Zavatski
Date: Sun, 13 Oct 2019 16:22:10 +0300
Subject: [PATCH 161/373] Cancel request on dispose
---
osu.Game/Overlays/Comments/CommentsContainer.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs
index 1111313d7f..4c27c498c3 100644
--- a/osu.Game/Overlays/Comments/CommentsContainer.cs
+++ b/osu.Game/Overlays/Comments/CommentsContainer.cs
@@ -194,5 +194,12 @@ namespace osu.Game.Overlays.Comments
{
background.Colour = colours.Gray2;
}
+
+ protected override void Dispose(bool isDisposing)
+ {
+ request?.Cancel();
+ loadCancellation?.Cancel();
+ base.Dispose(isDisposing);
+ }
}
}
From ae2fe62fd9ed27d1ef5bdd60927795b9d509ca97 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 14 Oct 2019 17:13:36 +0900
Subject: [PATCH 162/373] Use BindValueChanged
---
osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
index 7221e09c35..1ee2a04a3b 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -9,7 +9,6 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.UI.Cursor;
-using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osuTK;
using osuTK.Graphics;
@@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
private OsuClickToResumeCursor clickToResumeCursor;
- private GameplayCursorContainer localCursorContainer;
+ private OsuCursorContainer localCursorContainer;
public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null;
@@ -39,17 +38,13 @@ namespace osu.Game.Rulesets.Osu.UI
if (localCursorContainer == null)
{
- var newContainer = new OsuCursorContainer();
- Add(localCursorContainer = newContainer);
+ Add(localCursorContainer = new OsuCursorContainer());
- clickToResumeCursor.CursorScale = newContainer.CalculatedCursorScale.Value;
- clickToResumeCursor.Scale = new Vector2(newContainer.CalculatedCursorScale.Value);
-
- newContainer.CalculatedCursorScale.ValueChanged += e =>
+ localCursorContainer.CalculatedCursorScale.BindValueChanged(scale =>
{
- clickToResumeCursor.CursorScale = e.NewValue;
- clickToResumeCursor.Scale = new Vector2(e.NewValue);
- };
+ clickToResumeCursor.CursorScale = scale.NewValue;
+ clickToResumeCursor.Scale = new Vector2(scale.NewValue);
+ }, true);
}
}
From 9372526d3af9f42da19442ed21baca4c692a358d Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 14 Oct 2019 20:08:05 +0900
Subject: [PATCH 163/373] Don't automatically return to gameplay from map pool
if no picks are made
Closes #6491.
---
osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs
index d32c0d6156..ec55bb5b54 100644
--- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs
+++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs
@@ -196,7 +196,7 @@ namespace osu.Game.Tournament.Screens.MapPool
setNextMode();
- if (pickType == ChoiceType.Pick)
+ if (pickType == ChoiceType.Pick && currentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
{
scheduledChange?.Cancel();
scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
From e191c2c50e5652d32f04b7fccb7a7a57ed5c2e9d Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 14 Oct 2019 21:32:16 +0900
Subject: [PATCH 164/373] Tidy up constants and method naming
---
osu.Game/Overlays/Comments/CommentsHeader.cs | 16 +++++++---------
osu.Game/Overlays/Comments/HeaderButton.cs | 19 ++++++++-----------
osu.Game/Overlays/Comments/SortSelector.cs | 4 ++--
3 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index 2bd2bf21a6..1df347eb82 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -15,10 +15,7 @@ namespace osu.Game.Overlays.Comments
{
public class CommentsHeader : CompositeDrawable
{
- private const int height = 40;
- private const int spacing = 10;
- private const int padding = 50;
- private const int text_size = 14;
+ private const int font_size = 14;
public readonly Bindable Sort = new Bindable();
public readonly BindableBool ShowDeleted = new BindableBool();
@@ -28,7 +25,8 @@ namespace osu.Game.Overlays.Comments
public CommentsHeader()
{
RelativeSizeAxes = Axes.X;
- Height = height;
+ Height = 40;
+
AddRangeInternal(new Drawable[]
{
background = new Box
@@ -38,14 +36,14 @@ namespace osu.Game.Overlays.Comments
new Container
{
RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Horizontal = padding },
+ Padding = new MarginPadding { Horizontal = 50 },
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
- Spacing = new Vector2(spacing, 0),
+ Spacing = new Vector2(10, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
@@ -54,7 +52,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: text_size),
+ Font = OsuFont.GetFont(size: font_size),
Text = @"Sort by"
},
new SortSelector
@@ -107,7 +105,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: text_size),
+ Font = OsuFont.GetFont(size: font_size),
Text = @"Show deleted"
}
},
diff --git a/osu.Game/Overlays/Comments/HeaderButton.cs b/osu.Game/Overlays/Comments/HeaderButton.cs
index 231a364759..8789cf5830 100644
--- a/osu.Game/Overlays/Comments/HeaderButton.cs
+++ b/osu.Game/Overlays/Comments/HeaderButton.cs
@@ -13,10 +13,7 @@ namespace osu.Game.Overlays.Comments
{
public class HeaderButton : Container
{
- private const int height = 20;
- private const int corner_radius = 3;
- private const int margin = 10;
- private const int duration = 200;
+ private const int transition_duration = 200;
protected override Container Content => content;
@@ -26,9 +23,9 @@ namespace osu.Game.Overlays.Comments
public HeaderButton()
{
AutoSizeAxes = Axes.X;
- Height = height;
+ Height = 20;
Masking = true;
- CornerRadius = corner_radius;
+ CornerRadius = 3;
AddRangeInternal(new Drawable[]
{
background = new Box
@@ -41,7 +38,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Margin = new MarginPadding { Horizontal = margin }
+ Margin = new MarginPadding { Horizontal = 10 }
},
new HoverClickSounds(),
});
@@ -55,18 +52,18 @@ namespace osu.Game.Overlays.Comments
protected override bool OnHover(HoverEvent e)
{
- FadeInBackground();
+ ShowBackground();
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
- FadeOutBackground();
+ HideBackground();
}
- protected void FadeInBackground() => background.FadeIn(duration, Easing.OutQuint);
+ protected void ShowBackground() => background.FadeIn(transition_duration, Easing.OutQuint);
- protected void FadeOutBackground() => background.FadeOut(duration, Easing.OutQuint);
+ protected void HideBackground() => background.FadeOut(transition_duration, Easing.OutQuint);
}
}
diff --git a/osu.Game/Overlays/Comments/SortSelector.cs b/osu.Game/Overlays/Comments/SortSelector.cs
index 100ae83291..90e7defb9a 100644
--- a/osu.Game/Overlays/Comments/SortSelector.cs
+++ b/osu.Game/Overlays/Comments/SortSelector.cs
@@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Comments
public void Activate()
{
- FadeInBackground();
+ ShowBackground();
text.Font = text.Font.With(weight: FontWeight.Bold);
text.Colour = colours.BlueLighter;
}
@@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Comments
public void Deactivate()
{
if (!IsHovered)
- FadeOutBackground();
+ HideBackground();
text.Font = text.Font.With(weight: FontWeight.Medium);
text.Colour = Color4.White;
From 89f270a19a32df0696cbd244eb9e39d826220f4b Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 14 Oct 2019 21:32:41 +0900
Subject: [PATCH 165/373] SortSelector -> SortTabControl
---
osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs | 2 +-
osu.Game/Overlays/Comments/CommentsHeader.cs | 2 +-
.../Overlays/Comments/{SortSelector.cs => SortTabControl.cs} | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
rename osu.Game/Overlays/Comments/{SortSelector.cs => SortTabControl.cs} (96%)
diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
index 949dbbe5c4..bc3e0eff1a 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
@@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.Online
{
typeof(CommentsHeader),
typeof(HeaderButton),
- typeof(SortSelector),
+ typeof(SortTabControl),
};
private readonly Bindable sort = new Bindable();
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index 1df347eb82..81be16967f 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Comments
Font = OsuFont.GetFont(size: font_size),
Text = @"Sort by"
},
- new SortSelector
+ new SortTabControl
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
diff --git a/osu.Game/Overlays/Comments/SortSelector.cs b/osu.Game/Overlays/Comments/SortTabControl.cs
similarity index 96%
rename from osu.Game/Overlays/Comments/SortSelector.cs
rename to osu.Game/Overlays/Comments/SortTabControl.cs
index 90e7defb9a..8dc1f14c3d 100644
--- a/osu.Game/Overlays/Comments/SortSelector.cs
+++ b/osu.Game/Overlays/Comments/SortTabControl.cs
@@ -15,7 +15,7 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Comments
{
- public class SortSelector : OsuTabControl
+ public class SortTabControl : OsuTabControl
{
private const int spacing = 5;
@@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(spacing, 0),
};
- public SortSelector()
+ public SortTabControl()
{
AutoSizeAxes = Axes.Both;
}
From 4822496c130880a5f3c20e847942cbab870849a9 Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Mon, 14 Oct 2019 21:34:16 +0900
Subject: [PATCH 166/373] Fix more naming
---
osu.Game/Overlays/Comments/SortTabControl.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/osu.Game/Overlays/Comments/SortTabControl.cs b/osu.Game/Overlays/Comments/SortTabControl.cs
index 8dc1f14c3d..3f1b5c54bd 100644
--- a/osu.Game/Overlays/Comments/SortTabControl.cs
+++ b/osu.Game/Overlays/Comments/SortTabControl.cs
@@ -37,23 +37,23 @@ namespace osu.Game.Overlays.Comments
private class SortTabItem : TabItem
{
- private readonly TabContent content;
+ private readonly TabButton button;
public SortTabItem(CommentsSortCriteria value)
: base(value)
{
AutoSizeAxes = Axes.Both;
- Child = content = new TabContent(value)
+ Child = button = new TabButton(value)
{
Active = { BindTarget = Active }
};
}
- protected override void OnActivated() => content.Activate();
+ protected override void OnActivated() => button.Activate();
- protected override void OnDeactivated() => content.Deactivate();
+ protected override void OnDeactivated() => button.Deactivate();
- private class TabContent : HeaderButton
+ private class TabButton : HeaderButton
{
private const int text_size = 14;
@@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Comments
private readonly SpriteText text;
- public TabContent(CommentsSortCriteria value)
+ public TabButton(CommentsSortCriteria value)
{
Add(text = new SpriteText
{
From 779445755034234c0c986dd8f874b0b2162ea35e Mon Sep 17 00:00:00 2001
From: Dean Herbert