diff --git a/osu.Android.props b/osu.Android.props
index a2c97ead2f..0881861bdc 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -52,6 +52,6 @@
-
+
diff --git a/osu.Android/OsuGameActivity.cs b/osu.Android/OsuGameActivity.cs
index 2e5fa59d20..9839d16030 100644
--- a/osu.Android/OsuGameActivity.cs
+++ b/osu.Android/OsuGameActivity.cs
@@ -9,7 +9,7 @@ using osu.Framework.Android;
namespace osu.Android
{
- [Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = true)]
+ [Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false)]
public class OsuGameActivity : AndroidGameActivity
{
protected override Framework.Game CreateGame() => new OsuGameAndroid();
diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
index f4749be370..df54df7b01 100644
--- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
+++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
@@ -8,7 +8,6 @@ using NUnit.Framework;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Tests.Beatmaps;
@@ -83,7 +82,7 @@ namespace osu.Game.Rulesets.Catch.Tests
public float Position
{
- get => HitObject?.X * CatchPlayfield.BASE_WIDTH ?? position;
+ get => HitObject?.X ?? position;
set => position = value;
}
diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs
index 7c2304694f..d6bba3d55e 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs
@@ -27,15 +27,15 @@ namespace osu.Game.Rulesets.Catch.Tests
for (int i = 0; i < 100; i++)
{
- float width = (i % 10 + 1) / 20f;
+ float width = (i % 10 + 1) / 20f * CatchPlayfield.WIDTH;
beatmap.HitObjects.Add(new JuiceStream
{
- X = 0.5f - width / 2,
+ X = CatchPlayfield.CENTER_X - width / 2,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,
- new Vector2(width * CatchPlayfield.BASE_WIDTH, 0)
+ new Vector2(width, 0)
}),
StartTime = i * 2000,
NewCombo = i % 8 == 0
diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs
index 44672b6526..1ff31697b8 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs
@@ -4,6 +4,7 @@
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
+using osu.Game.Rulesets.Catch.UI;
namespace osu.Game.Rulesets.Catch.Tests
{
@@ -22,7 +23,14 @@ namespace osu.Game.Rulesets.Catch.Tests
};
for (int i = 0; i < 512; i++)
- beatmap.HitObjects.Add(new Fruit { X = 0.5f + i / 2048f * (i % 10 - 5), StartTime = i * 100, NewCombo = i % 8 == 0 });
+ {
+ beatmap.HitObjects.Add(new Fruit
+ {
+ X = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH,
+ StartTime = i * 100,
+ NewCombo = i % 8 == 0
+ });
+ }
return beatmap;
}
diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs
index 2b30edb70b..fbb22a8498 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs
@@ -76,8 +76,8 @@ namespace osu.Game.Rulesets.Catch.Tests
RelativeSizeAxes = Axes.Both,
Child = new TestCatcherArea(new BeatmapDifficulty { CircleSize = size })
{
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.TopLeft,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.TopCentre,
CreateDrawableRepresentation = ((DrawableRuleset)catchRuleset.CreateInstance().CreateDrawableRulesetWith(new CatchBeatmap())).CreateDrawableRepresentation
},
});
diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs
index a7094c00be..d35f828e28 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs
@@ -158,8 +158,8 @@ namespace osu.Game.Rulesets.Catch.Tests
private float getXCoords(bool hit)
{
- const float x_offset = 0.2f;
- float xCoords = drawableRuleset.Playfield.Width / 2;
+ const float x_offset = 0.2f * CatchPlayfield.WIDTH;
+ float xCoords = CatchPlayfield.CENTER_X;
if (drawableRuleset.Playfield is CatchPlayfield catchPlayfield)
catchPlayfield.CatcherArea.MovableCatcher.X = xCoords - x_offset;
diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs
index a0dcb86d57..ad24adf352 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs
@@ -47,13 +47,13 @@ namespace osu.Game.Rulesets.Catch.Tests
};
// Should produce a hyper-dash (edge case test)
- beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56 / 512f, NewCombo = true });
- beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308 / 512f, NewCombo = true });
+ beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56, NewCombo = true });
+ beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308, NewCombo = true });
double startTime = 3000;
- const float left_x = 0.02f;
- const float right_x = 0.98f;
+ const float left_x = 0.02f * CatchPlayfield.WIDTH;
+ const float right_x = 0.98f * CatchPlayfield.WIDTH;
createObjects(() => new Fruit { X = left_x });
createObjects(() => new TestJuiceStream(right_x), 1);
diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs
index ffcf61a4bf..269e783899 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
+using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osuTK;
@@ -30,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
new JuiceStream
{
- X = 0.5f,
+ X = CatchPlayfield.CENTER_X,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,
@@ -40,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Tests
},
new Banana
{
- X = 0.5f,
+ X = CatchPlayfield.CENTER_X,
StartTime = 1000,
NewCombo = true
}
diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs
index 0de2060e2d..145a40f5f5 100644
--- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs
+++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs
@@ -5,7 +5,6 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using System.Collections.Generic;
using System.Linq;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
using osu.Framework.Extensions.IEnumerableExtensions;
@@ -36,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
Path = curveData.Path,
NodeSamples = curveData.NodeSamples,
RepeatCount = curveData.RepeatCount,
- X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH,
+ X = positionData?.X ?? 0,
NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
LegacyLastTickOffset = (obj as IHasLegacyLastTickOffset)?.LegacyLastTickOffset ?? 0
@@ -59,7 +58,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
Samples = obj.Samples,
NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
- X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH
+ X = positionData?.X ?? 0
}.Yield();
}
}
diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
index 7c81bcdf0c..bb14988414 100644
--- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
+++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
@@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
case BananaShower bananaShower:
foreach (var banana in bananaShower.NestedHitObjects.OfType())
{
- banana.XOffset = (float)rng.NextDouble();
+ banana.XOffset = (float)(rng.NextDouble() * CatchPlayfield.WIDTH);
rng.Next(); // osu!stable retrieved a random banana type
rng.Next(); // osu!stable retrieved a random banana rotation
rng.Next(); // osu!stable retrieved a random banana colour
@@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
case JuiceStream juiceStream:
// Todo: BUG!! Stable used the last control point as the final position of the path, but it should use the computed path instead.
- lastPosition = juiceStream.X + juiceStream.Path.ControlPoints[^1].Position.Value.X / CatchPlayfield.BASE_WIDTH;
+ lastPosition = juiceStream.X + juiceStream.Path.ControlPoints[^1].Position.Value.X;
// Todo: BUG!! Stable attempted to use the end time of the stream, but referenced it too early in execution and used the start time instead.
lastStartTime = juiceStream.StartTime;
@@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
catchObject.XOffset = 0;
if (catchObject is TinyDroplet)
- catchObject.XOffset = Math.Clamp(rng.Next(-20, 20) / CatchPlayfield.BASE_WIDTH, -catchObject.X, 1 - catchObject.X);
+ catchObject.XOffset = Math.Clamp(rng.Next(-20, 20), -catchObject.X, CatchPlayfield.WIDTH - catchObject.X);
else if (catchObject is Droplet)
rng.Next(); // osu!stable retrieved a random droplet rotation
}
@@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
}
// ReSharper disable once PossibleLossOfFraction
- if (Math.Abs(positionDiff * CatchPlayfield.BASE_WIDTH) < timeDiff / 3)
+ if (Math.Abs(positionDiff) < timeDiff / 3)
applyOffset(ref offsetPosition, positionDiff);
hitObject.XOffset = offsetPosition - hitObject.X;
@@ -149,12 +149,12 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
private static void applyRandomOffset(ref float position, double maxOffset, FastRandom rng)
{
bool right = rng.NextBool();
- float rand = Math.Min(20, (float)rng.Next(0, Math.Max(0, maxOffset))) / CatchPlayfield.BASE_WIDTH;
+ float rand = Math.Min(20, (float)rng.Next(0, Math.Max(0, maxOffset)));
if (right)
{
// Clamp to the right bound
- if (position + rand <= 1)
+ if (position + rand <= CatchPlayfield.WIDTH)
position += rand;
else
position -= rand;
@@ -211,7 +211,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
objectWithDroplets.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
- double halfCatcherWidth = CatcherArea.GetCatcherSize(beatmap.BeatmapInfo.BaseDifficulty) / 2;
+ double halfCatcherWidth = Catcher.CalculateCatchWidth(beatmap.BeatmapInfo.BaseDifficulty) / 2;
int lastDirection = 0;
double lastExcess = halfCatcherWidth;
diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs
index ca75a816f1..9437023c70 100644
--- a/osu.Game.Rulesets.Catch/CatchRuleset.cs
+++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs
@@ -21,11 +21,13 @@ using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using System;
+using osu.Framework.Testing;
using osu.Game.Rulesets.Catch.Skinning;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch
{
+ [ExcludeFromDynamicCompile]
public class CatchRuleset : Ruleset, ILegacyRuleset
{
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => new DrawableCatchRuleset(this, beatmap, mods);
diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs
index 360af1a8c9..3e21b8fbaf 100644
--- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs
@@ -3,7 +3,6 @@
using System;
using osu.Game.Rulesets.Catch.Objects;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Objects;
@@ -33,8 +32,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
- NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
- LastNormalizedPosition = LastObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
+ NormalizedPosition = BaseObject.X * scalingFactor;
+ LastNormalizedPosition = LastObject.X * scalingFactor;
// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
StrainTime = Math.Max(40, DeltaTime);
diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
index 918ed77683..e679231638 100644
--- a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
+++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
@@ -3,7 +3,6 @@
using System;
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
@@ -68,7 +67,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
}
// Bonus for edge dashes.
- if (catchCurrent.LastObject.DistanceToHyperDash <= 20.0f / CatchPlayfield.BASE_WIDTH)
+ if (catchCurrent.LastObject.DistanceToHyperDash <= 20.0f)
{
if (!catchCurrent.LastObject.HyperDash)
edgeDashBonus += 5.7;
@@ -78,7 +77,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
playerPosition = catchCurrent.NormalizedPosition;
}
- distanceAddition *= 1.0 + edgeDashBonus * ((20 - catchCurrent.LastObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 20) * Math.Pow((Math.Min(catchCurrent.StrainTime * catchCurrent.ClockRate, 265) / 265), 1.5); // Edge Dashes are easier at lower ms values
+ distanceAddition *= 1.0 + edgeDashBonus * ((20 - catchCurrent.LastObject.DistanceToHyperDash) / 20) * Math.Pow((Math.Min(catchCurrent.StrainTime * catchCurrent.ClockRate, 265) / 265), 1.5); // Edge Dashes are easier at lower ms values
}
lastPlayerPosition = playerPosition;
diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs
index fc030877f1..a7449ba4e1 100644
--- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs
+++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs
@@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Judgements
return 0;
case HitResult.Perfect:
- return 0.01;
+ return DEFAULT_MAX_HEALTH_INCREASE * 0.75;
}
}
diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
index f3b566f340..04932ecdbb 100644
--- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
@@ -5,6 +5,7 @@ using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Catch.Beatmaps;
+using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
@@ -17,6 +18,9 @@ namespace osu.Game.Rulesets.Catch.Objects
private float x;
+ ///
+ /// The horizontal position of the fruit between 0 and .
+ ///
public float X
{
get => x + XOffset;
diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs
index b12cdd4ccb..c6345a9df7 100644
--- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs
@@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
+using osu.Game.Rulesets.Catch.UI;
using osuTK;
using osuTK.Graphics;
@@ -70,12 +71,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public float DisplayRadius => DrawSize.X / 2 * Scale.X * HitObject.Scale;
- protected override float SamplePlaybackPosition => HitObject.X;
+ protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
protected DrawableCatchHitObject(CatchHitObject hitObject)
: base(hitObject)
{
- RelativePositionAxes = Axes.X;
X = hitObject.X;
}
diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs
index 2c96ee2b19..6b8b70ed54 100644
--- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs
+++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs
@@ -7,7 +7,6 @@ using System.Threading;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@@ -80,7 +79,7 @@ namespace osu.Game.Rulesets.Catch.Objects
{
StartTime = t + lastEvent.Value.Time,
X = X + Path.PositionAt(
- lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X / CatchPlayfield.BASE_WIDTH,
+ lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X,
});
}
}
@@ -97,7 +96,7 @@ namespace osu.Game.Rulesets.Catch.Objects
{
Samples = dropletSamples,
StartTime = e.Time,
- X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH,
+ X = X + Path.PositionAt(e.PathProgress).X,
});
break;
@@ -108,14 +107,14 @@ namespace osu.Game.Rulesets.Catch.Objects
{
Samples = Samples,
StartTime = e.Time,
- X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH,
+ X = X + Path.PositionAt(e.PathProgress).X,
});
break;
}
}
}
- public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH;
+ public float EndX => X + this.CurvePositionAt(1).X;
public double Duration
{
diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs
index 7a33cb0577..5d11c574b1 100644
--- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs
+++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs
@@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.Replays
// todo: add support for HT DT
const double dash_speed = Catcher.BASE_SPEED;
const double movement_speed = dash_speed / 2;
- float lastPosition = 0.5f;
+ float lastPosition = CatchPlayfield.CENTER_X;
double lastTime = 0;
void moveToNext(CatchHitObject h)
@@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Catch.Replays
bool impossibleJump = speedRequired > movement_speed * 2;
// todo: get correct catcher size, based on difficulty CS.
- const float catcher_width_half = CatcherArea.CATCHER_SIZE / CatchPlayfield.BASE_WIDTH * 0.3f * 0.5f;
+ const float catcher_width_half = CatcherArea.CATCHER_SIZE * 0.3f * 0.5f;
if (lastPosition - catcher_width_half < h.X && lastPosition + catcher_width_half > h.X)
{
diff --git a/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs b/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs
index 9dab3ed630..7efd832f62 100644
--- a/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs
+++ b/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs
@@ -4,7 +4,6 @@
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Replays.Legacy;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Replays.Types;
@@ -41,7 +40,7 @@ namespace osu.Game.Rulesets.Catch.Replays
public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
{
- Position = currentFrame.Position.X / CatchPlayfield.BASE_WIDTH;
+ Position = currentFrame.Position.X;
Dashing = currentFrame.ButtonState == ReplayButtonState.Left1;
if (Dashing)
@@ -63,7 +62,7 @@ namespace osu.Game.Rulesets.Catch.Replays
if (Actions.Contains(CatchAction.Dash)) state |= ReplayButtonState.Left1;
- return new LegacyReplayFrame(Time, Position * CatchPlayfield.BASE_WIDTH, null, state);
+ return new LegacyReplayFrame(Time, Position, null, state);
}
}
}
diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs
index 2319c5ac1f..d034f3c7d4 100644
--- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs
+++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs
@@ -16,7 +16,16 @@ namespace osu.Game.Rulesets.Catch.UI
{
public class CatchPlayfield : ScrollingPlayfield
{
- public const float BASE_WIDTH = 512;
+ ///
+ /// The width of the playfield.
+ /// The horizontal movement of the catcher is confined in the area of this width.
+ ///
+ public const float WIDTH = 512;
+
+ ///
+ /// The center position of the playfield.
+ ///
+ public const float CENTER_X = WIDTH / 2;
internal readonly CatcherArea CatcherArea;
diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs
index b8d3dc9017..8ee23461ba 100644
--- a/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs
+++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs
@@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Catch.UI
{
base.Update();
- Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.BASE_WIDTH);
+ Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.WIDTH);
Size = Vector2.Divide(Vector2.One, Scale);
}
}
diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs
index 9cce46d730..82cbbefcca 100644
--- a/osu.Game.Rulesets.Catch/UI/Catcher.cs
+++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs
@@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.UI
///
/// The relative space to cover in 1 millisecond. based on 1 game pixel per millisecond as in osu-stable.
///
- public const double BASE_SPEED = 1.0 / 512;
+ public const double BASE_SPEED = 1.0;
public Container ExplodingFruitTarget;
@@ -104,9 +104,6 @@ namespace osu.Game.Rulesets.Catch.UI
{
this.trailsTarget = trailsTarget;
- RelativePositionAxes = Axes.X;
- X = 0.5f;
-
Origin = Anchor.TopCentre;
Size = new Vector2(CatcherArea.CATCHER_SIZE);
@@ -209,8 +206,8 @@ namespace osu.Game.Rulesets.Catch.UI
var halfCatchWidth = catchWidth * 0.5f;
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
- var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH;
- var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH;
+ var catchObjectPosition = fruit.X;
+ var catcherPosition = Position.X;
var validCatch =
catchObjectPosition >= catcherPosition - halfCatchWidth &&
@@ -224,7 +221,7 @@ namespace osu.Game.Rulesets.Catch.UI
{
var target = fruit.HyperDashTarget;
var timeDifference = target.StartTime - fruit.StartTime;
- double positionDifference = target.X * CatchPlayfield.BASE_WIDTH - catcherPosition;
+ double positionDifference = target.X - catcherPosition;
var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0);
SetHyperDashState(Math.Abs(velocity), target.X);
@@ -331,7 +328,7 @@ namespace osu.Game.Rulesets.Catch.UI
public void UpdatePosition(float position)
{
- position = Math.Clamp(position, 0, 1);
+ position = Math.Clamp(position, 0, CatchPlayfield.WIDTH);
if (position == X)
return;
diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs
index 37d177b936..bf1ac5bc0e 100644
--- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs
+++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs
@@ -31,14 +31,8 @@ namespace osu.Game.Rulesets.Catch.UI
public CatcherArea(BeatmapDifficulty difficulty = null)
{
- RelativeSizeAxes = Axes.X;
- Height = CATCHER_SIZE;
- Child = MovableCatcher = new Catcher(this, difficulty);
- }
-
- public static float GetCatcherSize(BeatmapDifficulty difficulty)
- {
- return CATCHER_SIZE / CatchPlayfield.BASE_WIDTH * (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5);
+ Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
+ Child = MovableCatcher = new Catcher(this, difficulty) { X = CatchPlayfield.CENTER_X };
}
public void OnResult(DrawableCatchHitObject fruit, JudgementResult result)
diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania-stage-left.png b/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania/stage-left.png
similarity index 100%
rename from osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania-stage-left.png
rename to osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania/stage-left.png
diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania-stage-right.png b/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania/stage-right.png
similarity index 100%
rename from osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania-stage-right.png
rename to osu.Game.Rulesets.Mania.Tests/Resources/special-skin/mania/stage-right.png
diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/skin.ini b/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/skin.ini
index 941abac1da..36765d61bf 100644
--- a/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/skin.ini
+++ b/osu.Game.Rulesets.Mania.Tests/Resources/special-skin/skin.ini
@@ -9,4 +9,6 @@ Hit50: mania/hit50
Hit100: mania/hit100
Hit200: mania/hit200
Hit300: mania/hit300
-Hit300g: mania/hit300g
\ No newline at end of file
+Hit300g: mania/hit300g
+StageLeft: mania/stage-left
+StageRight: mania/stage-right
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs
index a27485dd06..68dce8b139 100644
--- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs
+++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs
@@ -12,6 +12,7 @@ using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
+using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays.Types;
@@ -34,6 +35,7 @@ using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Rulesets.Mania
{
+ [ExcludeFromDynamicCompile]
public class ManiaRuleset : Ruleset, ILegacyRuleset
{
///
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs
index 38c2bb9b95..461779b185 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs
@@ -5,7 +5,9 @@ using System;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing.Input;
+using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Screens.Play;
@@ -24,9 +26,34 @@ namespace osu.Game.Rulesets.Osu.Tests
[Resolved]
private OsuConfigManager config { get; set; }
+ private Drawable background;
+
public TestSceneGameplayCursor()
{
gameplayBeatmap = new GameplayBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
+
+ AddStep("change background colour", () =>
+ {
+ background?.Expire();
+
+ Add(background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Depth = float.MaxValue,
+ Colour = new Colour4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)
+ });
+ });
+
+ AddSliderStep("circle size", 0f, 10f, 0f, val =>
+ {
+ config.Set(OsuSetting.AutoCursorSize, true);
+ gameplayBeatmap.BeatmapInfo.BaseDifficulty.CircleSize = val;
+ Scheduler.AddOnce(recreate);
+ });
+
+ AddStep("test cursor container", recreate);
+
+ void recreate() => SetContents(() => new OsuInputManager(new OsuRuleset().RulesetInfo) { Child = new OsuCursorContainer() });
}
[TestCase(1, 1)]
@@ -69,16 +96,27 @@ namespace osu.Game.Rulesets.Osu.Tests
private class ClickingCursorContainer : OsuCursorContainer
{
+ private bool pressed;
+
+ public bool Pressed
+ {
+ set
+ {
+ if (value == pressed)
+ return;
+
+ pressed = value;
+ if (value)
+ OnPressed(OsuAction.LeftButton);
+ else
+ OnReleased(OsuAction.LeftButton);
+ }
+ }
+
protected override void Update()
{
base.Update();
-
- double currentTime = Time.Current;
-
- if (((int)(currentTime / 1000)) % 2 == 0)
- OnPressed(OsuAction.LeftButton);
- else
- OnReleased(OsuAction.LeftButton);
+ Pressed = ((int)(Time.Current / 1000)) % 2 == 0;
}
}
@@ -87,6 +125,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public MovingCursorInputManager()
{
UseParentInput = false;
+ ShowVisualCursorGuide = false;
}
protected override void Update()
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs
index 65bed071cd..8cb7f3f4b6 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs
@@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Tests
if (auto && !userTriggered && Time.Current > Spinner.StartTime + Spinner.Duration / 2 && Progress < 1)
{
// force completion only once to not break human interaction
- Disc.RotationAbsolute = Spinner.SpinsRequired * 360;
+ Disc.CumulativeRotation = Spinner.SpinsRequired * 360;
auto = false;
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
index ea006ec607..6b1394d799 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
@@ -14,6 +14,12 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK;
using System.Collections.Generic;
using System.Linq;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Replays;
+using osu.Game.Rulesets.Osu.Replays;
+using osu.Game.Rulesets.Osu.UI;
+using osu.Game.Rulesets.Replays;
+using osu.Game.Scoring;
using osu.Game.Storyboards;
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
@@ -36,6 +42,7 @@ namespace osu.Game.Rulesets.Osu.Tests
}
private DrawableSpinner drawableSpinner;
+ private SpriteIcon spinnerSymbol => drawableSpinner.ChildrenOfType().Single();
[SetUpSteps]
public override void SetUpSteps()
@@ -50,25 +57,78 @@ namespace osu.Game.Rulesets.Osu.Tests
public void TestSpinnerRewindingRotation()
{
addSeekStep(5000);
- AddAssert("is rotation absolute not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, 0, 100));
+ AddAssert("is disc rotation not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.Rotation, 0, 100));
+ AddAssert("is disc rotation absolute not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.CumulativeRotation, 0, 100));
addSeekStep(0);
- AddAssert("is rotation absolute almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, 0, 100));
+ AddAssert("is disc rotation almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.Rotation, 0, 100));
+ AddAssert("is disc rotation absolute almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.CumulativeRotation, 0, 100));
}
[Test]
public void TestSpinnerMiddleRewindingRotation()
{
- double estimatedRotation = 0;
+ double finalAbsoluteDiscRotation = 0, finalRelativeDiscRotation = 0, finalSpinnerSymbolRotation = 0;
addSeekStep(5000);
- AddStep("retrieve rotation", () => estimatedRotation = drawableSpinner.Disc.RotationAbsolute);
+ AddStep("retrieve disc relative rotation", () => finalRelativeDiscRotation = drawableSpinner.Disc.Rotation);
+ AddStep("retrieve disc absolute rotation", () => finalAbsoluteDiscRotation = drawableSpinner.Disc.CumulativeRotation);
+ AddStep("retrieve spinner symbol rotation", () => finalSpinnerSymbolRotation = spinnerSymbol.Rotation);
addSeekStep(2500);
+ AddUntilStep("disc rotation rewound",
+ // we want to make sure that the rotation at time 2500 is in the same direction as at time 5000, but about half-way in.
+ () => Precision.AlmostEquals(drawableSpinner.Disc.Rotation, finalRelativeDiscRotation / 2, 100));
+ AddUntilStep("symbol rotation rewound",
+ () => Precision.AlmostEquals(spinnerSymbol.Rotation, finalSpinnerSymbolRotation / 2, 100));
+
addSeekStep(5000);
- AddAssert("is rotation absolute almost same", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, estimatedRotation, 100));
+ AddAssert("is disc rotation almost same",
+ () => Precision.AlmostEquals(drawableSpinner.Disc.Rotation, finalRelativeDiscRotation, 100));
+ AddAssert("is symbol rotation almost same",
+ () => Precision.AlmostEquals(spinnerSymbol.Rotation, finalSpinnerSymbolRotation, 100));
+ AddAssert("is disc rotation absolute almost same",
+ () => Precision.AlmostEquals(drawableSpinner.Disc.CumulativeRotation, finalAbsoluteDiscRotation, 100));
}
+ [Test]
+ public void TestRotationDirection([Values(true, false)] bool clockwise)
+ {
+ if (clockwise)
+ {
+ AddStep("flip replay", () =>
+ {
+ var drawableRuleset = this.ChildrenOfType().Single();
+ var score = drawableRuleset.ReplayScore;
+ var scoreWithFlippedReplay = new Score
+ {
+ ScoreInfo = score.ScoreInfo,
+ Replay = flipReplay(score.Replay)
+ };
+ drawableRuleset.SetReplayScore(scoreWithFlippedReplay);
+ });
+ }
+
+ addSeekStep(5000);
+
+ AddAssert("disc spin direction correct", () => clockwise ? drawableSpinner.Disc.Rotation > 0 : drawableSpinner.Disc.Rotation < 0);
+ AddAssert("spinner symbol direction correct", () => clockwise ? spinnerSymbol.Rotation > 0 : spinnerSymbol.Rotation < 0);
+ }
+
+ private Replay flipReplay(Replay scoreReplay) => new Replay
+ {
+ Frames = scoreReplay
+ .Frames
+ .Cast()
+ .Select(replayFrame =>
+ {
+ var flippedPosition = new Vector2(OsuPlayfield.BASE_SIZE.X - replayFrame.Position.X, replayFrame.Position.Y);
+ return new OsuReplayFrame(replayFrame.Time, flippedPosition, replayFrame.Actions.ToArray());
+ })
+ .Cast()
+ .ToList()
+ };
+
[Test]
public void TestSpinPerMinuteOnRewind()
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs
index 022e9ea12b..cfe969d1cc 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs
@@ -24,10 +24,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
}
+ public DrawableOsuJudgement()
+ {
+ }
+
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
- if (config.Get(OsuSetting.HitLighting) && Result.Type != HitResult.Miss)
+ if (config.Get(OsuSetting.HitLighting))
{
AddInternal(lighting = new SkinnableSprite("lighting")
{
@@ -36,11 +40,32 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Blending = BlendingParameters.Additive,
Depth = float.MaxValue
});
+ }
+ }
+ public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
+ {
+ base.Apply(result, judgedObject);
+
+ if (judgedObject?.HitObject is OsuHitObject osuObject)
+ {
+ Position = osuObject.StackedPosition;
+ Scale = new Vector2(osuObject.Scale);
+ }
+ }
+
+ protected override void PrepareForUse()
+ {
+ base.PrepareForUse();
+
+ lightingColour?.UnbindAll();
+
+ if (lighting != null)
+ {
if (JudgedObject != null)
{
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
- lightingColour.BindValueChanged(colour => lighting.Colour = colour.NewValue, true);
+ lightingColour.BindValueChanged(colour => lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
}
else
{
@@ -55,13 +80,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
if (lighting != null)
{
- JudgementBody.Delay(FadeInDuration).FadeOut(400);
+ JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400);
lighting.ScaleTo(0.8f).ScaleTo(1.2f, 600, Easing.Out);
lighting.FadeIn(200).Then().Delay(200).FadeOut(1000);
}
- JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
+ JudgementText?.TransformSpacingTo(Vector2.Zero).Then().TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
base.ApplyHitAnimations();
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
index 3c8ab0f5ab..be6766509c 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
@@ -14,6 +14,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
+using osu.Framework.Utils;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking;
@@ -137,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
positionBindable.BindTo(HitObject.PositionBindable);
}
- public float Progress => Math.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1);
+ public float Progress => Math.Clamp(Disc.CumulativeRotation / 360 / Spinner.SpinsRequired, 0, 1);
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
@@ -190,12 +191,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circle.Rotation = Disc.Rotation;
Ticks.Rotation = Disc.Rotation;
- SpmCounter.SetRotation(Disc.RotationAbsolute);
+ SpmCounter.SetRotation(Disc.CumulativeRotation);
float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight;
- Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint);
+ float targetScale = relativeCircleScale + (1 - relativeCircleScale) * Progress;
+ Disc.Scale = new Vector2((float)Interpolation.Lerp(Disc.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1)));
- symbol.RotateTo(Disc.Rotation / 2, 500, Easing.OutQuint);
+ symbol.Rotation = (float)Interpolation.Lerp(symbol.Rotation, Disc.Rotation / 2, Math.Clamp(Math.Abs(Time.Elapsed) / 40, 0, 1));
}
protected override void UpdateInitialTransforms()
@@ -205,9 +207,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circleContainer.ScaleTo(Spinner.Scale * 0.3f);
circleContainer.ScaleTo(Spinner.Scale, HitObject.TimePreempt / 1.4f, Easing.OutQuint);
- Disc.RotateTo(-720);
- symbol.RotateTo(-720);
-
mainContainer
.ScaleTo(0)
.ScaleTo(Spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, HitObject.TimePreempt - 150, Easing.OutQuint)
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
index d4ef039b79..35819cd05e 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
@@ -73,6 +73,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
}
+ ///
+ /// The total rotation performed on the spinner disc, disregarding the spin direction.
+ ///
+ ///
+ /// This value is always non-negative and is monotonically increasing with time
+ /// (i.e. will only increase if time is passing forward, but can decrease during rewind).
+ ///
+ ///
+ /// If the spinner is spun 360 degrees clockwise and then 360 degrees counter-clockwise,
+ /// this property will return the value of 720 (as opposed to 0 for ).
+ ///
+ public float CumulativeRotation;
+
///
/// Whether currently in the correct time range to allow spinning.
///
@@ -88,10 +101,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private float lastAngle;
private float currentRotation;
- public float RotationAbsolute;
private int completeTick;
- private bool updateCompleteTick() => completeTick != (completeTick = (int)(RotationAbsolute / 360));
+ private bool updateCompleteTick() => completeTick != (completeTick = (int)(CumulativeRotation / 360));
private bool rotationTransferred;
@@ -149,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
currentRotation += angle;
- RotationAbsolute += Math.Abs(angle) * Math.Sign(Clock.ElapsedFrameTime);
+ CumulativeRotation += Math.Abs(angle) * Math.Sign(Clock.ElapsedFrameTime);
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
index c11e20c9e7..1e54b576f1 100644
--- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
@@ -4,6 +4,7 @@
using osu.Framework.Bindables;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
+using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects
@@ -24,6 +25,13 @@ namespace osu.Game.Rulesets.Osu.Objects
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
- public override Judgement CreateJudgement() => new SliderRepeat.SliderRepeatJudgement();
+ public override Judgement CreateJudgement() => new SliderTailJudgement();
+
+ public class SliderTailJudgement : OsuJudgement
+ {
+ protected override int NumericResultFor(HitResult result) => 0;
+
+ public override bool AffectsCombo => false;
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs
index e488ba65c8..eaa5d8937a 100644
--- a/osu.Game.Rulesets.Osu/OsuRuleset.cs
+++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs
@@ -30,12 +30,14 @@ using osu.Game.Scoring;
using osu.Game.Skinning;
using System;
using System.Linq;
+using osu.Framework.Testing;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Statistics;
using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Rulesets.Osu
{
+ [ExcludeFromDynamicCompile]
public class OsuRuleset : Ruleset, ILegacyRuleset
{
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => new DrawableOsuRuleset(this, beatmap, mods);
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
index 4f3d07f208..eea45c6c80 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
@@ -59,10 +59,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{
if (!cursorExpand) return;
- expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad);
+ expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 400, Easing.OutElasticHalf);
}
- public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
+ public void Contract() => expandTarget.ScaleTo(released_scale, 400, Easing.OutQuad);
private class DefaultCursor : OsuCursorSprite
{
@@ -115,24 +115,22 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
},
},
},
- new CircularContainer
- {
- Origin = Anchor.Centre,
- Anchor = Anchor.Centre,
- RelativeSizeAxes = Axes.Both,
- Scale = new Vector2(0.1f),
- Masking = true,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.White,
- },
- },
- },
- }
- }
+ },
+ },
+ new Circle
+ {
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ RelativeSizeAxes = Axes.Both,
+ Scale = new Vector2(0.14f),
+ Colour = new Color4(34, 93, 204, 255),
+ EdgeEffect = new EdgeEffectParameters
+ {
+ Type = EdgeEffectType.Glow,
+ Radius = 8,
+ Colour = Color4.White,
+ },
+ },
};
}
}
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index 28600ef55b..5812e8cf75 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -30,7 +30,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Drawable cursorTrail;
- public Bindable CursorScale = new BindableFloat(1);
+ public IBindable CursorScale => cursorScale;
+
+ private readonly Bindable cursorScale = new BindableFloat(1);
private Bindable userCursorScale;
private Bindable autoCursorScale;
@@ -68,13 +70,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += _ => calculateScale();
- CursorScale.ValueChanged += e =>
+ CursorScale.BindValueChanged(e =>
{
var newScale = new Vector2(e.NewValue);
ActiveCursor.Scale = newScale;
cursorTrail.Scale = newScale;
- };
+ }, true);
calculateScale();
}
@@ -95,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
scale *= GetScaleForCircleSize(beatmap.BeatmapInfo.BaseDifficulty.CircleSize);
}
- CursorScale.Value = scale;
+ cursorScale.Value = scale;
var newScale = new Vector2(scale);
diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
index 4b1a2ce43c..600efefca3 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
@@ -1,17 +1,23 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osuTK;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Pooling;
+using osu.Game.Rulesets.Judgements;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
-using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
-using osu.Game.Rulesets.UI;
-using osu.Game.Rulesets.Judgements;
+using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Osu.UI.Cursor;
+using osu.Game.Rulesets.Scoring;
+using osu.Game.Rulesets.UI;
using osu.Game.Skinning;
+using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
@@ -26,6 +32,8 @@ namespace osu.Game.Rulesets.Osu.UI
protected override GameplayCursorContainer CreateCursor() => new OsuCursorContainer();
+ private readonly IDictionary> poolDictionary = new Dictionary>();
+
public OsuPlayfield()
{
InternalChildren = new Drawable[]
@@ -54,6 +62,13 @@ namespace osu.Game.Rulesets.Osu.UI
};
hitPolicy = new OrderedHitPolicy(HitObjectContainer);
+
+ var hitWindows = new OsuHitWindows();
+
+ foreach (var result in Enum.GetValues(typeof(HitResult)).OfType().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
+ poolDictionary.Add(result, new DrawableJudgementPool(result));
+
+ AddRangeInternal(poolDictionary.Values);
}
public override void Add(DrawableHitObject h)
@@ -91,12 +106,7 @@ namespace osu.Game.Rulesets.Osu.UI
if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
return;
- DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject)
- {
- Origin = Anchor.Centre,
- Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition,
- Scale = new Vector2(((OsuHitObject)judgedObject.HitObject).Scale)
- };
+ DrawableOsuJudgement explosion = poolDictionary[result.Type].Get(doj => doj.Apply(result, judgedObject));
judgementLayer.Add(explosion);
}
@@ -107,5 +117,26 @@ namespace osu.Game.Rulesets.Osu.UI
{
public void Add(Drawable approachCircleProxy) => AddInternal(approachCircleProxy);
}
+
+ private class DrawableJudgementPool : DrawablePool
+ {
+ private readonly HitResult result;
+
+ public DrawableJudgementPool(HitResult result)
+ : base(10)
+ {
+ this.result = result;
+ }
+
+ protected override DrawableOsuJudgement CreateNewDrawable()
+ {
+ var judgement = base.CreateNewDrawable();
+
+ // just a placeholder to initialise the correct drawable hierarchy for this pool.
+ judgement.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null);
+
+ return judgement;
+ }
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
index abba444c73..ec7751d2b4 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.UI
private OsuClickToResumeCursor clickToResumeCursor;
private OsuCursorContainer localCursorContainer;
- private Bindable localCursorScale;
+ private IBindable localCursorScale;
public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null;
diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs
index 156905fa9c..2011842591 100644
--- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs
+++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs
@@ -22,6 +22,7 @@ using osu.Game.Rulesets.Taiko.Scoring;
using osu.Game.Scoring;
using System;
using System.Linq;
+using osu.Framework.Testing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Taiko.Edit;
using osu.Game.Rulesets.Taiko.Objects;
@@ -31,6 +32,7 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko
{
+ [ExcludeFromDynamicCompile]
public class TaikoRuleset : Ruleset, ILegacyRuleset
{
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => new DrawableTaikoRuleset(this, beatmap, mods);
diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs
index e50b2231bf..460ad1b898 100644
--- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs
+++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs
@@ -157,6 +157,24 @@ namespace osu.Game.Tests.Gameplay
assertHealthNotEqualTo(1);
}
+ [Test]
+ public void TestBonusObjectsExcludedFromDrain()
+ {
+ var beatmap = new Beatmap
+ {
+ BeatmapInfo = { BaseDifficulty = { DrainRate = 10 } },
+ };
+
+ beatmap.HitObjects.Add(new JudgeableHitObject { StartTime = 0 });
+ for (double time = 0; time < 5000; time += 100)
+ beatmap.HitObjects.Add(new JudgeableHitObject(false) { StartTime = time });
+ beatmap.HitObjects.Add(new JudgeableHitObject { StartTime = 5000 });
+
+ createProcessor(beatmap);
+ setTime(4900); // Get close to the second combo-affecting object
+ assertHealthNotEqualTo(0);
+ }
+
private Beatmap createBeatmap(double startTime, double endTime, params BreakPeriod[] breaks)
{
var beatmap = new Beatmap
@@ -197,8 +215,25 @@ namespace osu.Game.Tests.Gameplay
private class JudgeableHitObject : HitObject
{
- public override Judgement CreateJudgement() => new Judgement();
+ private readonly bool affectsCombo;
+
+ public JudgeableHitObject(bool affectsCombo = true)
+ {
+ this.affectsCombo = affectsCombo;
+ }
+
+ public override Judgement CreateJudgement() => new TestJudgement(affectsCombo);
protected override HitWindows CreateHitWindows() => new HitWindows();
+
+ private class TestJudgement : Judgement
+ {
+ public override bool AffectsCombo { get; }
+
+ public TestJudgement(bool affectsCombo)
+ {
+ AffectsCombo = affectsCombo;
+ }
+ }
}
}
}
diff --git a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs
index 8ea0e34214..199e69a19d 100644
--- a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs
+++ b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs
@@ -19,24 +19,18 @@ namespace osu.Game.Tests.NonVisual
[TestFixture]
public class CustomDataDirectoryTest
{
- [SetUp]
- public void SetUp()
- {
- if (Directory.Exists(customPath))
- Directory.Delete(customPath, true);
- }
-
[Test]
public void TestDefaultDirectory()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestDefaultDirectory)))
+ using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestDefaultDirectory)))
{
try
{
+ string defaultStorageLocation = getDefaultLocationFor(nameof(TestDefaultDirectory));
+
var osu = loadOsu(host);
var storage = osu.Dependencies.Get();
- string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestDefaultDirectory));
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
}
finally
@@ -46,21 +40,14 @@ namespace osu.Game.Tests.NonVisual
}
}
- private string customPath => Path.Combine(RuntimeInfo.StartupDirectory, "custom-path");
-
[Test]
public void TestCustomDirectory()
{
- using (var host = new HeadlessGameHost(nameof(TestCustomDirectory)))
+ string customPath = prepareCustomPath();
+
+ using (var host = new CustomTestHeadlessGameHost(nameof(TestCustomDirectory)))
{
- string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestCustomDirectory));
-
- // need access before the game has constructed its own storage yet.
- Storage storage = new DesktopStorage(defaultStorageLocation, host);
- // manual cleaning so we can prepare a config file.
- storage.DeleteDirectory(string.Empty);
-
- using (var storageConfig = new StorageConfigManager(storage))
+ using (var storageConfig = new StorageConfigManager(host.InitialStorage))
storageConfig.Set(StorageConfig.FullPath, customPath);
try
@@ -68,7 +55,7 @@ namespace osu.Game.Tests.NonVisual
var osu = loadOsu(host);
// switch to DI'd storage
- storage = osu.Dependencies.Get();
+ var storage = osu.Dependencies.Get();
Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
}
@@ -82,16 +69,11 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestSubDirectoryLookup()
{
- using (var host = new HeadlessGameHost(nameof(TestSubDirectoryLookup)))
+ string customPath = prepareCustomPath();
+
+ using (var host = new CustomTestHeadlessGameHost(nameof(TestSubDirectoryLookup)))
{
- string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestSubDirectoryLookup));
-
- // need access before the game has constructed its own storage yet.
- Storage storage = new DesktopStorage(defaultStorageLocation, host);
- // manual cleaning so we can prepare a config file.
- storage.DeleteDirectory(string.Empty);
-
- using (var storageConfig = new StorageConfigManager(storage))
+ using (var storageConfig = new StorageConfigManager(host.InitialStorage))
storageConfig.Set(StorageConfig.FullPath, customPath);
try
@@ -99,7 +81,7 @@ namespace osu.Game.Tests.NonVisual
var osu = loadOsu(host);
// switch to DI'd storage
- storage = osu.Dependencies.Get();
+ var storage = osu.Dependencies.Get();
string actualTestFile = Path.Combine(customPath, "rulesets", "test");
@@ -120,10 +102,14 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestMigration()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigration)))
+ string customPath = prepareCustomPath();
+
+ using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigration)))
{
try
{
+ string defaultStorageLocation = getDefaultLocationFor(nameof(TestMigration));
+
var osu = loadOsu(host);
var storage = osu.Dependencies.Get();
@@ -139,8 +125,6 @@ namespace osu.Game.Tests.NonVisual
// for testing nested files are not ignored (only top level)
host.Storage.GetStorageForDirectory("test-nested").GetStorageForDirectory("cache");
- string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestMigration));
-
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
osu.Migrate(customPath);
@@ -178,14 +162,15 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestMigrationBetweenTwoTargets()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationBetweenTwoTargets)))
+ string customPath = prepareCustomPath();
+ string customPath2 = prepareCustomPath("-2");
+
+ using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationBetweenTwoTargets)))
{
try
{
var osu = loadOsu(host);
- string customPath2 = $"{customPath}-2";
-
const string database_filename = "client.db";
Assert.DoesNotThrow(() => osu.Migrate(customPath));
@@ -207,7 +192,9 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestMigrationToSameTargetFails()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToSameTargetFails)))
+ string customPath = prepareCustomPath();
+
+ using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationToSameTargetFails)))
{
try
{
@@ -226,7 +213,9 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestMigrationToNestedTargetFails()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToNestedTargetFails)))
+ string customPath = prepareCustomPath();
+
+ using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationToNestedTargetFails)))
{
try
{
@@ -253,7 +242,9 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestMigrationToSeeminglyNestedTarget()
{
- using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToSeeminglyNestedTarget)))
+ string customPath = prepareCustomPath();
+
+ using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationToSeeminglyNestedTarget)))
{
try
{
@@ -282,6 +273,7 @@ namespace osu.Game.Tests.NonVisual
var osu = new OsuGameBase();
Task.Run(() => host.Run(osu));
waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");
+
return osu;
}
@@ -294,5 +286,39 @@ namespace osu.Game.Tests.NonVisual
Assert.IsTrue(task.Wait(timeout), failureMessage);
}
+
+ private static string getDefaultLocationFor(string testTypeName)
+ {
+ string path = Path.Combine(RuntimeInfo.StartupDirectory, "headless", testTypeName);
+
+ if (Directory.Exists(path))
+ Directory.Delete(path, true);
+
+ return path;
+ }
+
+ private string prepareCustomPath(string suffix = "")
+ {
+ string path = Path.Combine(RuntimeInfo.StartupDirectory, $"custom-path{suffix}");
+
+ if (Directory.Exists(path))
+ Directory.Delete(path, true);
+
+ return path;
+ }
+
+ public class CustomTestHeadlessGameHost : HeadlessGameHost
+ {
+ public Storage InitialStorage { get; }
+
+ public CustomTestHeadlessGameHost(string name)
+ : base(name)
+ {
+ string defaultStorageLocation = getDefaultLocationFor(name);
+
+ InitialStorage = new DesktopStorage(defaultStorageLocation, this);
+ InitialStorage.DeleteDirectory(string.Empty);
+ }
+ }
}
}
diff --git a/osu.Game.Tests/Visual/Multiplayer/RoomManagerTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/RoomManagerTestScene.cs
new file mode 100644
index 0000000000..8b7e0fd9da
--- /dev/null
+++ b/osu.Game.Tests/Visual/Multiplayer/RoomManagerTestScene.cs
@@ -0,0 +1,61 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using osu.Framework.Allocation;
+using osu.Game.Beatmaps;
+using osu.Game.Online.Multiplayer;
+using osu.Game.Rulesets;
+using osu.Game.Screens.Multi;
+using osu.Game.Users;
+
+namespace osu.Game.Tests.Visual.Multiplayer
+{
+ public abstract class RoomManagerTestScene : MultiplayerTestScene
+ {
+ [Cached(Type = typeof(IRoomManager))]
+ protected TestRoomManager RoomManager { get; } = new TestRoomManager();
+
+ public override void SetUpSteps()
+ {
+ base.SetUpSteps();
+
+ AddStep("clear rooms", () => RoomManager.Rooms.Clear());
+ }
+
+ protected void AddRooms(int count, RulesetInfo ruleset = null)
+ {
+ AddStep("add rooms", () =>
+ {
+ for (int i = 0; i < count; i++)
+ {
+ var room = new Room
+ {
+ RoomID = { Value = i },
+ Name = { Value = $"Room {i}" },
+ Host = { Value = new User { Username = "Host" } },
+ EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) },
+ Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal }
+ };
+
+ if (ruleset != null)
+ {
+ room.Playlist.Add(new PlaylistItem
+ {
+ Ruleset = { Value = ruleset },
+ Beatmap =
+ {
+ Value = new BeatmapInfo
+ {
+ Metadata = new BeatmapMetadata()
+ }
+ }
+ });
+ }
+
+ RoomManager.Rooms.Add(room);
+ }
+ });
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestRoomManager.cs b/osu.Game.Tests/Visual/Multiplayer/TestRoomManager.cs
new file mode 100644
index 0000000000..67a53307fc
--- /dev/null
+++ b/osu.Game.Tests/Visual/Multiplayer/TestRoomManager.cs
@@ -0,0 +1,35 @@
+// 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.Bindables;
+using osu.Game.Online.Multiplayer;
+using osu.Game.Screens.Multi;
+
+namespace osu.Game.Tests.Visual.Multiplayer
+{
+ public class TestRoomManager : IRoomManager
+ {
+ public event Action RoomsUpdated
+ {
+ add { }
+ remove { }
+ }
+
+ public readonly BindableList Rooms = new BindableList();
+
+ public Bindable InitialRoomsReceived { get; } = new Bindable(true);
+
+ IBindableList IRoomManager.Rooms => Rooms;
+
+ public void CreateRoom(Room room, Action onSuccess = null, Action onError = null) => Rooms.Add(room);
+
+ public void JoinRoom(Room room, Action onSuccess = null, Action onError = null)
+ {
+ }
+
+ public void PartRoom()
+ {
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeFilterControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeFilterControl.cs
new file mode 100644
index 0000000000..7c0c2797f5
--- /dev/null
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeFilterControl.cs
@@ -0,0 +1,20 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics;
+using osu.Game.Screens.Multi.Lounge.Components;
+
+namespace osu.Game.Tests.Visual.Multiplayer
+{
+ public class TestSceneLoungeFilterControl : OsuTestScene
+ {
+ public TestSceneLoungeFilterControl()
+ {
+ Child = new FilterControl
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre
+ };
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomInfo.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomInfo.cs
index 8b74eb5f27..cdad37a9ad 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomInfo.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomInfo.cs
@@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[SetUp]
public void Setup() => Schedule(() =>
{
- Room.CopyFrom(new Room());
+ Room = new Room();
Child = new RoomInfo
{
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs
index 83f2297bd2..b1f6ee3e3a 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs
@@ -1,30 +1,22 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
-using osu.Framework.Bindables;
using osu.Framework.Graphics;
-using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Online.Multiplayer;
-using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Osu;
-using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.Lounge.Components;
-using osu.Game.Users;
using osuTK.Graphics;
+using osuTK.Input;
namespace osu.Game.Tests.Visual.Multiplayer
{
- public class TestSceneLoungeRoomsContainer : MultiplayerTestScene
+ public class TestSceneLoungeRoomsContainer : RoomManagerTestScene
{
- [Cached(Type = typeof(IRoomManager))]
- private TestRoomManager roomManager = new TestRoomManager();
-
private RoomsContainer container;
[BackgroundDependencyLoader]
@@ -39,34 +31,57 @@ namespace osu.Game.Tests.Visual.Multiplayer
};
}
- public override void SetUpSteps()
- {
- base.SetUpSteps();
-
- AddStep("clear rooms", () => roomManager.Rooms.Clear());
- }
-
[Test]
public void TestBasicListChanges()
{
- addRooms(3);
+ AddRooms(3);
AddAssert("has 3 rooms", () => container.Rooms.Count == 3);
- AddStep("remove first room", () => roomManager.Rooms.Remove(roomManager.Rooms.FirstOrDefault()));
+ AddStep("remove first room", () => RoomManager.Rooms.Remove(RoomManager.Rooms.FirstOrDefault()));
AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
AddStep("select first room", () => container.Rooms.First().Action?.Invoke());
- AddAssert("first room selected", () => Room == roomManager.Rooms.First());
+ AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
AddStep("join first room", () => container.Rooms.First().Action?.Invoke());
- AddAssert("first room joined", () => roomManager.Rooms.First().Status.Value is JoinedRoomStatus);
+ AddAssert("first room joined", () => RoomManager.Rooms.First().Status.Value is JoinedRoomStatus);
+ }
+
+ [Test]
+ public void TestKeyboardNavigation()
+ {
+ AddRooms(3);
+
+ AddAssert("no selection", () => checkRoomSelected(null));
+
+ press(Key.Down);
+ AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
+
+ press(Key.Up);
+ AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
+
+ press(Key.Down);
+ press(Key.Down);
+ AddAssert("last room selected", () => checkRoomSelected(RoomManager.Rooms.Last()));
+
+ press(Key.Enter);
+ AddAssert("last room joined", () => RoomManager.Rooms.Last().Status.Value is JoinedRoomStatus);
+ }
+
+ private void press(Key down)
+ {
+ AddStep($"press {down}", () =>
+ {
+ InputManager.PressKey(down);
+ InputManager.ReleaseKey(down);
+ });
}
[Test]
public void TestStringFiltering()
{
- addRooms(4);
+ AddRooms(4);
AddUntilStep("4 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 4);
@@ -82,8 +97,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestRulesetFiltering()
{
- addRooms(2, new OsuRuleset().RulesetInfo);
- addRooms(3, new CatchRuleset().RulesetInfo);
+ AddRooms(2, new OsuRuleset().RulesetInfo);
+ AddRooms(3, new CatchRuleset().RulesetInfo);
AddUntilStep("5 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 5);
@@ -96,67 +111,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddUntilStep("3 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 3);
}
- private void addRooms(int count, RulesetInfo ruleset = null)
- {
- AddStep("add rooms", () =>
- {
- for (int i = 0; i < count; i++)
- {
- var room = new Room
- {
- RoomID = { Value = i },
- Name = { Value = $"Room {i}" },
- Host = { Value = new User { Username = "Host" } },
- EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) }
- };
-
- if (ruleset != null)
- {
- room.Playlist.Add(new PlaylistItem
- {
- Ruleset = { Value = ruleset },
- Beatmap =
- {
- Value = new BeatmapInfo
- {
- Metadata = new BeatmapMetadata()
- }
- }
- });
- }
-
- roomManager.Rooms.Add(room);
- }
- });
- }
+ private bool checkRoomSelected(Room room) => Room == room;
private void joinRequested(Room room) => room.Status.Value = new JoinedRoomStatus();
- private class TestRoomManager : IRoomManager
- {
- public event Action RoomsUpdated
- {
- add { }
- remove { }
- }
-
- public readonly BindableList Rooms = new BindableList();
-
- public Bindable InitialRoomsReceived { get; } = new Bindable(true);
-
- IBindableList IRoomManager.Rooms => Rooms;
-
- public void CreateRoom(Room room, Action onSuccess = null, Action onError = null) => Rooms.Add(room);
-
- public void JoinRoom(Room room, Action onSuccess = null, Action onError = null)
- {
- }
-
- public void PartRoom()
- {
- }
- }
-
private class JoinedRoomStatus : RoomStatus
{
public override string Message => "Joined";
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeSubScreen.cs
new file mode 100644
index 0000000000..68987127d2
--- /dev/null
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeSubScreen.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 System.Linq;
+using NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Screens;
+using osu.Framework.Testing;
+using osu.Game.Graphics.Containers;
+using osu.Game.Screens.Multi.Lounge;
+using osu.Game.Screens.Multi.Lounge.Components;
+
+namespace osu.Game.Tests.Visual.Multiplayer
+{
+ public class TestSceneLoungeSubScreen : RoomManagerTestScene
+ {
+ private LoungeSubScreen loungeScreen;
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ }
+
+ public override void SetUpSteps()
+ {
+ base.SetUpSteps();
+
+ AddStep("push screen", () => LoadScreen(loungeScreen = new LoungeSubScreen
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Width = 0.5f,
+ }));
+
+ AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
+ }
+
+ private RoomsContainer roomsContainer => loungeScreen.ChildrenOfType().First();
+
+ [Test]
+ public void TestScrollSelectedIntoView()
+ {
+ AddRooms(30);
+
+ AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms.First()));
+
+ AddStep("select last room", () => roomsContainer.Rooms.Last().Action?.Invoke());
+
+ AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms.First()));
+ AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms.Last()));
+ }
+
+ private bool checkRoomVisible(DrawableRoom room) =>
+ loungeScreen.ChildrenOfType().First().ScreenSpaceDrawQuad
+ .Contains(room.ScreenSpaceDrawQuad.Centre);
+ }
+}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs
index 24d9f5ab12..01cd26fbe5 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs
@@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[SetUp]
public void Setup() => Schedule(() =>
{
- Room.Playlist.Clear();
+ Room = new Room();
Child = new MatchBeatmapDetailArea
{
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchHeader.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchHeader.cs
index 38eb3181bf..e5943105b7 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchHeader.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchHeader.cs
@@ -14,6 +14,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
public TestSceneMatchHeader()
{
+ Room = new Room();
Room.Playlist.Add(new PlaylistItem
{
Beatmap =
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs
index 7ba1782a28..c24c6c4ba3 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs
@@ -6,6 +6,7 @@ using Newtonsoft.Json;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Online.API;
+using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi.Match.Components;
using osu.Game.Users;
using osuTK;
@@ -18,7 +19,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public TestSceneMatchLeaderboard()
{
- Room.RoomID.Value = 3;
+ Room = new Room { RoomID = { Value = 3 } };
Add(new MatchLeaderboard
{
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboardChatDisplay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboardChatDisplay.cs
deleted file mode 100644
index 72bbc11cd0..0000000000
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboardChatDisplay.cs
+++ /dev/null
@@ -1,32 +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;
-using osu.Framework.Graphics.Containers;
-using osu.Game.Screens.Multi.Match.Components;
-using osuTK;
-
-namespace osu.Game.Tests.Visual.Multiplayer
-{
- public class TestSceneMatchLeaderboardChatDisplay : MultiplayerTestScene
- {
- protected override bool UseOnlineAPI => true;
-
- public TestSceneMatchLeaderboardChatDisplay()
- {
- Room.RoomID.Value = 7;
-
- Add(new Container
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Size = new Vector2(500),
- Child = new LeaderboardChatDisplay
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- }
- });
- }
- }
-}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs
index 5cff2d7d05..c62479faa0 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs
@@ -14,6 +14,7 @@ using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
+using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Multi.Components;
@@ -95,7 +96,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[SetUp]
public void Setup() => Schedule(() =>
{
- Room.Playlist.Clear();
+ Room = new Room();
});
[Test]
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSubScreen.cs
index b687724105..2e22317539 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSubScreen.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSubScreen.cs
@@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[SetUp]
public void Setup() => Schedule(() =>
{
- Room.CopyFrom(new Room());
+ Room = new Room();
});
[SetUpSteps]
@@ -58,6 +58,23 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddUntilStep("wait for load", () => match.IsCurrentScreen());
}
+ [Test]
+ public void TestLoadSimpleMatch()
+ {
+ AddStep("set room properties", () =>
+ {
+ Room.RoomID.Value = 1;
+ Room.Name.Value = "my awesome room";
+ Room.Host.Value = new User { Id = 2, Username = "peppy" };
+ Room.RecentParticipants.Add(Room.Host.Value);
+ Room.Playlist.Add(new PlaylistItem
+ {
+ Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
+ Ruleset = { Value = new OsuRuleset().RulesetInfo }
+ });
+ });
+ }
+
[Test]
public void TestPlaylistItemSelectedOnCreate()
{
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedParticipants.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedParticipants.cs
index 7ea3bba23f..b6bfa7c93a 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedParticipants.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedParticipants.cs
@@ -3,6 +3,7 @@
using NUnit.Framework;
using osu.Framework.Graphics;
+using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi.Components;
using osuTK;
@@ -12,22 +13,22 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
protected override bool UseOnlineAPI => true;
- public TestSceneOverlinedParticipants()
+ [SetUp]
+ public void Setup() => Schedule(() =>
{
- Room.RoomID.Value = 7;
- }
+ Room = new Room { RoomID = { Value = 7 } };
+ });
[Test]
public void TestHorizontalLayout()
{
AddStep("create component", () =>
{
- Child = new OverlinedParticipants(Direction.Horizontal)
+ Child = new ParticipantsDisplay(Direction.Horizontal)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 500,
- AutoSizeAxes = Axes.Y,
};
});
}
@@ -37,7 +38,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
AddStep("create component", () =>
{
- Child = new OverlinedParticipants(Direction.Vertical)
+ Child = new ParticipantsDisplay(Direction.Vertical)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedPlaylist.cs
index 14b7934dc7..14984988cb 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedPlaylist.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedPlaylist.cs
@@ -4,7 +4,7 @@
using osu.Framework.Graphics;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Osu;
-using osu.Game.Screens.Multi.Components;
+using osu.Game.Screens.Multi;
using osu.Game.Tests.Beatmaps;
using osuTK;
@@ -16,6 +16,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
public TestSceneOverlinedPlaylist()
{
+ Room = new Room { RoomID = { Value = 7 } };
+
for (int i = 0; i < 10; i++)
{
Room.Playlist.Add(new PlaylistItem
@@ -26,7 +28,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
});
}
- Add(new OverlinedPlaylist(false)
+ Add(new DrawableRoomPlaylist(false, false)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneParticipantsList.cs
index 9c4c45f94a..f71c5fc5d2 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneParticipantsList.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneParticipantsList.cs
@@ -1,7 +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 NUnit.Framework;
using osu.Framework.Graphics;
+using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi.Components;
namespace osu.Game.Tests.Visual.Multiplayer
@@ -10,10 +12,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
protected override bool UseOnlineAPI => true;
+ [SetUp]
+ public void Setup() => Schedule(() =>
+ {
+ Room = new Room { RoomID = { Value = 7 } };
+ });
+
public TestSceneParticipantsList()
{
- Room.RoomID.Value = 7;
-
Add(new ParticipantsList { RelativeSizeAxes = Axes.Both });
}
}
diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
index 9d603ac471..8ccaca8630 100644
--- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
+++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
@@ -6,6 +6,7 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
@@ -70,6 +71,23 @@ namespace osu.Game.Tests.Visual.Navigation
AddAssert("Ensure time wasn't reset to preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
}
+ [Test]
+ public void TestMenuMakesMusic()
+ {
+ WorkingBeatmap beatmap() => Game.Beatmap.Value;
+ Track track() => beatmap().Track;
+
+ TestSongSelect songSelect = null;
+
+ PushAndConfirm(() => songSelect = new TestSongSelect());
+
+ AddUntilStep("wait for no track", () => track() is TrackVirtual);
+
+ AddStep("return to menu", () => songSelect.Exit());
+
+ AddUntilStep("wait for track", () => !(track() is TrackVirtual) && track().IsRunning);
+ }
+
[Test]
public void TestExitSongSelectWithClick()
{
diff --git a/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs b/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs
new file mode 100644
index 0000000000..0446cadac9
--- /dev/null
+++ b/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs
@@ -0,0 +1,52 @@
+// 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.Overlays.News;
+using osu.Game.Online.API.Requests.Responses;
+using osu.Framework.Allocation;
+using osu.Game.Overlays;
+using osuTK;
+using System;
+
+namespace osu.Game.Tests.Visual.Online
+{
+ public class TestSceneNewsCard : OsuTestScene
+ {
+ [Cached]
+ private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Purple);
+
+ public TestSceneNewsCard()
+ {
+ Add(new FillFlowContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Direction = FillDirection.Vertical,
+ Width = 500,
+ AutoSizeAxes = Axes.Y,
+ Spacing = new Vector2(0, 20),
+ Children = new[]
+ {
+ new NewsCard(new APINewsPost
+ {
+ Title = "This post has an image which starts with \"/\" and has many authors!",
+ Preview = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
+ Author = "someone, someone1, someone2, someone3, someone4",
+ FirstImage = "/help/wiki/shared/news/banners/monthly-beatmapping-contest.png",
+ PublishedAt = DateTimeOffset.Now
+ }),
+ new NewsCard(new APINewsPost
+ {
+ Title = "This post has a full-url image! (HTML entity: &)",
+ Preview = "boom (HTML entity: &)",
+ Author = "user (HTML entity: &)",
+ FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
+ PublishedAt = DateTimeOffset.Now
+ })
+ }
+ });
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNumberBox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNumberBox.cs
deleted file mode 100644
index 97a3f62b2d..0000000000
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneNumberBox.cs
+++ /dev/null
@@ -1,48 +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 NUnit.Framework;
-using osu.Framework.Allocation;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Game.Graphics.UserInterface;
-
-namespace osu.Game.Tests.Visual.UserInterface
-{
- [TestFixture]
- public class TestSceneNumberBox : OsuTestScene
- {
- private OsuNumberBox numberBox;
-
- [BackgroundDependencyLoader]
- private void load()
- {
- Child = new Container
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- RelativeSizeAxes = Axes.X,
- Padding = new MarginPadding { Horizontal = 250 },
- Child = numberBox = new OsuNumberBox
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- RelativeSizeAxes = Axes.X,
- PlaceholderText = "Insert numbers here"
- }
- };
-
- clearInput();
- AddStep("enter numbers", () => numberBox.Text = "987654321");
- expectedValue("987654321");
- clearInput();
- AddStep("enter text + single number", () => numberBox.Text = "1 hello 2 world 3");
- expectedValue("123");
- clearInput();
- }
-
- private void clearInput() => AddStep("clear input", () => numberBox.Text = null);
-
- private void expectedValue(string value) => AddAssert("expect number", () => numberBox.Text == value);
- }
-}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs
new file mode 100644
index 0000000000..756928d3ec
--- /dev/null
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs
@@ -0,0 +1,80 @@
+// 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.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics.UserInterface;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual.UserInterface
+{
+ public class TestSceneOsuTextBox : OsuTestScene
+ {
+ private readonly OsuNumberBox numberBox;
+
+ public TestSceneOsuTextBox()
+ {
+ Child = new Container
+ {
+ Masking = true,
+ CornerRadius = 10f,
+ AutoSizeAxes = Axes.Both,
+ Padding = new MarginPadding(15f),
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.DarkSlateGray,
+ Alpha = 0.75f,
+ },
+ new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Vertical,
+ Padding = new MarginPadding(50f),
+ Spacing = new Vector2(0f, 50f),
+ Children = new[]
+ {
+ new OsuTextBox
+ {
+ Width = 500f,
+ PlaceholderText = "Normal textbox",
+ },
+ new OsuPasswordTextBox
+ {
+ Width = 500f,
+ PlaceholderText = "Password textbox",
+ },
+ numberBox = new OsuNumberBox
+ {
+ Width = 500f,
+ PlaceholderText = "Number textbox"
+ }
+ }
+ }
+ }
+ };
+ }
+
+ [Test]
+ public void TestNumberBox()
+ {
+ clearTextbox(numberBox);
+ AddStep("enter numbers", () => numberBox.Text = "987654321");
+ expectedValue(numberBox, "987654321");
+
+ clearTextbox(numberBox);
+ AddStep("enter text + single number", () => numberBox.Text = "1 hello 2 world 3");
+ expectedValue(numberBox, "123");
+
+ clearTextbox(numberBox);
+ }
+
+ private void clearTextbox(OsuTextBox textBox) => AddStep("clear textbox", () => textBox.Text = null);
+ private void expectedValue(OsuTextBox textBox, string value) => AddAssert("expected textbox value", () => textBox.Text == value);
+ }
+}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.cs
new file mode 100644
index 0000000000..24bc0dbc97
--- /dev/null
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.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.Allocation;
+using osu.Framework.Graphics;
+using osu.Game.Overlays;
+using osu.Game.Overlays.Rankings;
+
+namespace osu.Game.Tests.Visual.UserInterface
+{
+ public class TestSceneRankingsSortTabControl : OsuTestScene
+ {
+ [Cached]
+ private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
+
+ public TestSceneRankingsSortTabControl()
+ {
+ Child = new RankingsSortTabControl
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre
+ };
+ }
+ }
+}
diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs
index d48e396b89..eed3cac9f0 100644
--- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs
+++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs
@@ -203,13 +203,14 @@ namespace osu.Game.Tournament.Screens.TeamIntro
new Box
{
RelativeSizeAxes = Axes.Both,
- Colour = TournamentGame.TEXT_COLOUR,
+ Colour = TournamentGame.ELEMENT_BACKGROUND_COLOUR,
},
new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = seeding.ToString("#,0"),
+ Colour = TournamentGame.ELEMENT_FOREGROUND_COLOUR
},
}
},
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index 637833fb5d..b4b341634c 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -283,14 +283,16 @@ namespace osu.Game.Beatmaps
/// Returns a list of all usable s.
///
/// A list of available .
- public List GetAllUsableBeatmapSets(IncludedDetails includes = IncludedDetails.All) => GetAllUsableBeatmapSetsEnumerable(includes).ToList();
+ public List GetAllUsableBeatmapSets(IncludedDetails includes = IncludedDetails.All, bool includeProtected = false) =>
+ GetAllUsableBeatmapSetsEnumerable(includes, includeProtected).ToList();
///
/// Returns a list of all usable s. Note that files are not populated.
///
/// The level of detail to include in the returned objects.
+ /// Whether to include protected (system) beatmaps. These should not be included for gameplay playable use cases.
/// A list of available .
- public IEnumerable GetAllUsableBeatmapSetsEnumerable(IncludedDetails includes)
+ public IEnumerable GetAllUsableBeatmapSetsEnumerable(IncludedDetails includes, bool includeProtected = false)
{
IQueryable queryable;
@@ -312,7 +314,7 @@ namespace osu.Game.Beatmaps
// AsEnumerable used here to avoid applying the WHERE in sql. When done so, ef core 2.x uses an incorrect ORDER BY
// clause which causes queries to take 5-10x longer.
// TODO: remove if upgrading to EF core 3.x.
- return queryable.AsEnumerable().Where(s => !s.DeletePending && !s.Protected);
+ return queryable.AsEnumerable().Where(s => !s.DeletePending && (includeProtected || !s.Protected));
}
///
diff --git a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs
index d47d37806e..3106d1143e 100644
--- a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs
+++ b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs
@@ -183,6 +183,7 @@ namespace osu.Game.Beatmaps
public void Dispose()
{
cacheDownloadRequest?.Dispose();
+ updateScheduler?.Dispose();
}
[Serializable]
diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs
index cefb47893c..57555cce90 100644
--- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs
@@ -218,7 +218,7 @@ namespace osu.Game.Beatmaps.Formats
break;
case 2:
- position.X = ((IHasXPosition)hitObject).X * 512;
+ position.X = ((IHasXPosition)hitObject).X;
break;
case 3:
diff --git a/osu.Game/Graphics/DateTooltip.cs b/osu.Game/Graphics/DateTooltip.cs
new file mode 100644
index 0000000000..67fcab43f7
--- /dev/null
+++ b/osu.Game/Graphics/DateTooltip.cs
@@ -0,0 +1,78 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Cursor;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics.Sprites;
+using osuTK;
+
+namespace osu.Game.Graphics
+{
+ public class DateTooltip : VisibilityContainer, ITooltip
+ {
+ private readonly OsuSpriteText dateText, timeText;
+ private readonly Box background;
+
+ public DateTooltip()
+ {
+ AutoSizeAxes = Axes.Both;
+ Masking = true;
+ CornerRadius = 5;
+
+ Children = new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both
+ },
+ new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Padding = new MarginPadding(10),
+ Children = new Drawable[]
+ {
+ dateText = new OsuSpriteText
+ {
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
+ },
+ timeText = new OsuSpriteText
+ {
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
+ }
+ }
+ },
+ };
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.GreySeafoamDarker;
+ timeText.Colour = colours.BlueLighter;
+ }
+
+ protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
+ protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
+
+ public bool SetContent(object content)
+ {
+ if (!(content is DateTimeOffset date))
+ return false;
+
+ dateText.Text = $"{date:d MMMM yyyy} ";
+ timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
+ return true;
+ }
+
+ public void Move(Vector2 pos) => Position = pos;
+ }
+}
diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs
index 8b6df4a834..259d9c8d6e 100644
--- a/osu.Game/Graphics/DrawableDate.cs
+++ b/osu.Game/Graphics/DrawableDate.cs
@@ -4,12 +4,9 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
-using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using osu.Game.Utils;
-using osuTK;
namespace osu.Game.Graphics
{
@@ -81,69 +78,5 @@ namespace osu.Game.Graphics
public ITooltip GetCustomTooltip() => new DateTooltip();
public object TooltipContent => Date;
-
- private class DateTooltip : VisibilityContainer, ITooltip
- {
- private readonly OsuSpriteText dateText, timeText;
- private readonly Box background;
-
- public DateTooltip()
- {
- AutoSizeAxes = Axes.Both;
- Masking = true;
- CornerRadius = 5;
-
- Children = new Drawable[]
- {
- background = new Box
- {
- RelativeSizeAxes = Axes.Both
- },
- new FillFlowContainer
- {
- AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Padding = new MarginPadding(10),
- Children = new Drawable[]
- {
- dateText = new OsuSpriteText
- {
- Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
- Anchor = Anchor.BottomLeft,
- Origin = Anchor.BottomLeft,
- },
- timeText = new OsuSpriteText
- {
- Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
- Anchor = Anchor.BottomLeft,
- Origin = Anchor.BottomLeft,
- }
- }
- },
- };
- }
-
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
- {
- background.Colour = colours.GreySeafoamDarker;
- timeText.Colour = colours.BlueLighter;
- }
-
- protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
- protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
-
- public bool SetContent(object content)
- {
- if (!(content is DateTimeOffset date))
- return false;
-
- dateText.Text = $"{date:d MMMM yyyy} ";
- timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
- return true;
- }
-
- public void Move(Vector2 pos) => Position = pos;
- }
}
}
diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
index 84429bf5bd..fb5ff4aad3 100644
--- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
+++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
@@ -27,6 +27,8 @@ namespace osu.Game.Graphics.UserInterface
{
Height = 32;
TabContainer.Spacing = new Vector2(padding, 0f);
+ SwitchTabOnRemove = false;
+
Current.ValueChanged += index =>
{
foreach (var t in TabContainer.Children.OfType())
diff --git a/osu.Game/Graphics/UserInterface/DownloadButton.cs b/osu.Game/Graphics/UserInterface/DownloadButton.cs
index 86a5cb9aa6..da6c95299e 100644
--- a/osu.Game/Graphics/UserInterface/DownloadButton.cs
+++ b/osu.Game/Graphics/UserInterface/DownloadButton.cs
@@ -63,16 +63,19 @@ namespace osu.Game.Graphics.UserInterface
background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
icon.MoveToX(0, 500, Easing.InOutExpo);
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
+ TooltipText = "Download";
break;
case DownloadState.Downloading:
background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
icon.MoveToX(0, 500, Easing.InOutExpo);
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
+ TooltipText = "Downloading...";
break;
case DownloadState.Downloaded:
background.FadeColour(colours.Yellow, 500, Easing.InOutExpo);
+ TooltipText = "Importing";
break;
case DownloadState.LocallyAvailable:
diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
index 0c82a869f8..ac6f5ceb1b 100644
--- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
@@ -24,6 +24,8 @@ namespace osu.Game.Graphics.UserInterface
Child = new PasswordMaskChar(CalculatedTextSize),
};
+ protected override bool AllowUniqueCharacterSamples => false;
+
protected override bool AllowClipboardExport => false;
private readonly CapsWarning warning;
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs
index c2feca171b..61501b0cd8 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs
@@ -23,6 +23,8 @@ namespace osu.Game.Graphics.UserInterface
{
private Color4 accentColour;
+ public const float HORIZONTAL_SPACING = 10;
+
public virtual Color4 AccentColour
{
get => accentColour;
@@ -54,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface
public OsuTabControl()
{
- TabContainer.Spacing = new Vector2(10f, 0f);
+ TabContainer.Spacing = new Vector2(HORIZONTAL_SPACING, 0f);
AddInternal(strip = new Box
{
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
index 544acc7eb2..bdc95ee048 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
@@ -21,7 +21,6 @@ namespace osu.Game.Graphics.UserInterface
{
private readonly Box box;
private readonly SpriteText text;
- private readonly SpriteIcon icon;
private Color4? accentColour;
@@ -32,12 +31,6 @@ namespace osu.Game.Graphics.UserInterface
{
accentColour = value;
- if (Current.Value)
- {
- text.Colour = AccentColour;
- icon.Colour = AccentColour;
- }
-
updateFade();
}
}
@@ -52,6 +45,8 @@ namespace osu.Game.Graphics.UserInterface
public OsuTabControlCheckbox()
{
+ SpriteIcon icon;
+
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
@@ -89,6 +84,8 @@ namespace osu.Game.Graphics.UserInterface
{
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
+
+ updateFade();
};
}
@@ -115,8 +112,8 @@ namespace osu.Game.Graphics.UserInterface
private void updateFade()
{
- box.FadeTo(IsHovered ? 1 : 0, transition_length, Easing.OutQuint);
- text.FadeColour(IsHovered ? Color4.White : AccentColour, transition_length, Easing.OutQuint);
+ box.FadeTo(Current.Value || IsHovered ? 1 : 0, transition_length, Easing.OutQuint);
+ text.FadeColour(Current.Value || IsHovered ? Color4.White : AccentColour, transition_length, Easing.OutQuint);
}
}
}
diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs
index 06c46fbb91..0d173e2d3e 100644
--- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs
@@ -1,7 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System.Linq;
using osu.Framework.Allocation;
+using osu.Framework.Audio;
+using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
@@ -11,6 +14,7 @@ using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
+using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osuTK;
@@ -19,6 +23,18 @@ namespace osu.Game.Graphics.UserInterface
{
public class OsuTextBox : BasicTextBox
{
+ private readonly SampleChannel[] textAddedSamples = new SampleChannel[4];
+ private SampleChannel capsTextAddedSample;
+ private SampleChannel textRemovedSample;
+ private SampleChannel textCommittedSample;
+ private SampleChannel caretMovedSample;
+
+ ///
+ /// Whether to allow playing a different samples based on the type of character.
+ /// If set to false, the same sample will be used for all characters.
+ ///
+ protected virtual bool AllowUniqueCharacterSamples => true;
+
protected override float LeftRightPadding => 10;
protected override float CaretWidth => 3;
@@ -41,15 +57,54 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
- private void load(OsuColour colour)
+ private void load(OsuColour colour, AudioManager audio)
{
BackgroundUnfocused = Color4.Black.Opacity(0.5f);
BackgroundFocused = OsuColour.Gray(0.3f).Opacity(0.8f);
BackgroundCommit = BorderColour = colour.Yellow;
+
+ for (int i = 0; i < textAddedSamples.Length; i++)
+ textAddedSamples[i] = audio.Samples.Get($@"Keyboard/key-press-{1 + i}");
+
+ capsTextAddedSample = audio.Samples.Get(@"Keyboard/key-caps");
+ textRemovedSample = audio.Samples.Get(@"Keyboard/key-delete");
+ textCommittedSample = audio.Samples.Get(@"Keyboard/key-confirm");
+ caretMovedSample = audio.Samples.Get(@"Keyboard/key-movement");
}
protected override Color4 SelectionColour => new Color4(249, 90, 255, 255);
+ protected override void OnTextAdded(string added)
+ {
+ base.OnTextAdded(added);
+
+ if (added.Any(char.IsUpper) && AllowUniqueCharacterSamples)
+ capsTextAddedSample?.Play();
+ else
+ textAddedSamples[RNG.Next(0, 3)]?.Play();
+ }
+
+ protected override void OnTextRemoved(string removed)
+ {
+ base.OnTextRemoved(removed);
+
+ textRemovedSample?.Play();
+ }
+
+ protected override void OnTextCommitted(bool textChanged)
+ {
+ base.OnTextCommitted(textChanged);
+
+ textCommittedSample?.Play();
+ }
+
+ protected override void OnCaretMoved(bool selecting)
+ {
+ base.OnCaretMoved(selecting);
+
+ caretMovedSample?.Play();
+ }
+
protected override void OnFocus(FocusEvent e)
{
BorderThickness = 3;
diff --git a/osu.Game/IO/OsuStorage.cs b/osu.Game/IO/OsuStorage.cs
index f5ce1c0105..1d15294666 100644
--- a/osu.Game/IO/OsuStorage.cs
+++ b/osu.Game/IO/OsuStorage.cs
@@ -2,9 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
+using JetBrains.Annotations;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Configuration;
@@ -13,12 +15,30 @@ namespace osu.Game.IO
{
public class OsuStorage : WrappedStorage
{
+ ///
+ /// Indicates the error (if any) that occurred when initialising the custom storage during initial startup.
+ ///
+ public readonly OsuStorageError Error;
+
+ ///
+ /// The custom storage path as selected by the user.
+ ///
+ [CanBeNull]
+ public string CustomStoragePath => storageConfig.Get(StorageConfig.FullPath);
+
+ ///
+ /// The default storage path to be used if a custom storage path hasn't been selected or is not accessible.
+ ///
+ [NotNull]
+ public string DefaultStoragePath => defaultStorage.GetFullPath(".");
+
private readonly GameHost host;
private readonly StorageConfigManager storageConfig;
+ private readonly Storage defaultStorage;
- internal static readonly string[] IGNORE_DIRECTORIES = { "cache" };
+ public static readonly string[] IGNORE_DIRECTORIES = { "cache" };
- internal static readonly string[] IGNORE_FILES =
+ public static readonly string[] IGNORE_FILES =
{
"framework.ini",
"storage.ini"
@@ -28,13 +48,53 @@ namespace osu.Game.IO
: base(defaultStorage, string.Empty)
{
this.host = host;
+ this.defaultStorage = defaultStorage;
storageConfig = new StorageConfigManager(defaultStorage);
- var customStoragePath = storageConfig.Get(StorageConfig.FullPath);
+ if (!string.IsNullOrEmpty(CustomStoragePath))
+ TryChangeToCustomStorage(out Error);
+ }
- if (!string.IsNullOrEmpty(customStoragePath))
- ChangeTargetStorage(host.GetStorage(customStoragePath));
+ ///
+ /// Resets the custom storage path, changing the target storage to the default location.
+ ///
+ public void ResetCustomStoragePath()
+ {
+ storageConfig.Set(StorageConfig.FullPath, string.Empty);
+ storageConfig.Save();
+
+ ChangeTargetStorage(defaultStorage);
+ }
+
+ ///
+ /// Attempts to change to the user's custom storage path.
+ ///
+ /// The error that occurred.
+ /// Whether the custom storage path was used successfully. If not, will be populated with the reason.
+ public bool TryChangeToCustomStorage(out OsuStorageError error)
+ {
+ Debug.Assert(!string.IsNullOrEmpty(CustomStoragePath));
+
+ error = OsuStorageError.None;
+ Storage lastStorage = UnderlyingStorage;
+
+ try
+ {
+ Storage userStorage = host.GetStorage(CustomStoragePath);
+
+ if (!userStorage.ExistsDirectory(".") || !userStorage.GetFiles(".").Any())
+ error = OsuStorageError.AccessibleButEmpty;
+
+ ChangeTargetStorage(userStorage);
+ }
+ catch
+ {
+ error = OsuStorageError.NotAccessible;
+ ChangeTargetStorage(lastStorage);
+ }
+
+ return error == OsuStorageError.None;
}
protected override void ChangeTargetStorage(Storage newStorage)
@@ -145,4 +205,23 @@ namespace osu.Game.IO
}
}
}
+
+ public enum OsuStorageError
+ {
+ ///
+ /// No error.
+ ///
+ None,
+
+ ///
+ /// Occurs when the target storage directory is accessible but does not already contain game files.
+ /// Only happens when the user changes the storage directory and then moves the files manually or mounts a different device to the same path.
+ ///
+ AccessibleButEmpty,
+
+ ///
+ /// Occurs when the target storage directory cannot be accessed at all.
+ ///
+ NotAccessible,
+ }
}
diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs
index 618798a6d8..8a5acbadbc 100644
--- a/osu.Game/Input/Bindings/GlobalActionContainer.cs
+++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs
@@ -35,6 +35,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
new KeyBinding(new[] { InputKey.Control, InputKey.D }, GlobalAction.ToggleDirect),
+ new KeyBinding(new[] { InputKey.Control, InputKey.N }, GlobalAction.ToggleNotifications),
new KeyBinding(InputKey.Escape, GlobalAction.Back),
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
@@ -157,5 +158,8 @@ namespace osu.Game.Input.Bindings
[Description("Home")]
Home,
+
+ [Description("Toggle notifications")]
+ ToggleNotifications
}
}
diff --git a/osu.Game/Input/KeyBindingStore.cs b/osu.Game/Input/KeyBindingStore.cs
index 74b3134964..198ab6883d 100644
--- a/osu.Game/Input/KeyBindingStore.cs
+++ b/osu.Game/Input/KeyBindingStore.cs
@@ -55,6 +55,9 @@ namespace osu.Game.Input
RulesetID = rulesetId,
Variant = variant
});
+
+ // required to ensure stable insert order (https://github.com/dotnet/efcore/issues/11686)
+ usage.Context.SaveChanges();
}
}
}
diff --git a/osu.Game/Online/API/Requests/GetRoomsRequest.cs b/osu.Game/Online/API/Requests/GetRoomsRequest.cs
index 8f1497ef33..c47ed20909 100644
--- a/osu.Game/Online/API/Requests/GetRoomsRequest.cs
+++ b/osu.Game/Online/API/Requests/GetRoomsRequest.cs
@@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
+using Humanizer;
+using osu.Framework.IO.Network;
using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi.Lounge.Components;
@@ -9,39 +11,28 @@ namespace osu.Game.Online.API.Requests
{
public class GetRoomsRequest : APIRequest>
{
- private readonly PrimaryFilter primaryFilter;
+ private readonly RoomStatusFilter statusFilter;
+ private readonly RoomCategoryFilter categoryFilter;
- public GetRoomsRequest(PrimaryFilter primaryFilter)
+ public GetRoomsRequest(RoomStatusFilter statusFilter, RoomCategoryFilter categoryFilter)
{
- this.primaryFilter = primaryFilter;
+ this.statusFilter = statusFilter;
+ this.categoryFilter = categoryFilter;
}
- protected override string Target
+ protected override WebRequest CreateWebRequest()
{
- get
- {
- string target = "rooms";
+ var req = base.CreateWebRequest();
- switch (primaryFilter)
- {
- case PrimaryFilter.Open:
- break;
+ if (statusFilter != RoomStatusFilter.Open)
+ req.AddParameter("mode", statusFilter.ToString().Underscore().ToLowerInvariant());
- case PrimaryFilter.Owned:
- target += "/owned";
- break;
+ if (categoryFilter != RoomCategoryFilter.Any)
+ req.AddParameter("category", categoryFilter.ToString().Underscore().ToLowerInvariant());
- case PrimaryFilter.Participated:
- target += "/participated";
- break;
-
- case PrimaryFilter.RecentlyEnded:
- target += "/ended";
- break;
- }
-
- return target;
- }
+ return req;
}
+
+ protected override string Target => "rooms";
}
}
diff --git a/osu.Game/Online/API/Requests/Responses/APINewsPost.cs b/osu.Game/Online/API/Requests/Responses/APINewsPost.cs
new file mode 100644
index 0000000000..ced08f0bf2
--- /dev/null
+++ b/osu.Game/Online/API/Requests/Responses/APINewsPost.cs
@@ -0,0 +1,57 @@
+// 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;
+using System.Net;
+
+namespace osu.Game.Online.API.Requests.Responses
+{
+ public class APINewsPost
+ {
+ [JsonProperty("id")]
+ public long Id { get; set; }
+
+ private string author;
+
+ [JsonProperty("author")]
+ public string Author
+ {
+ get => author;
+ set => author = WebUtility.HtmlDecode(value);
+ }
+
+ [JsonProperty("edit_url")]
+ public string EditUrl { get; set; }
+
+ [JsonProperty("first_image")]
+ public string FirstImage { get; set; }
+
+ [JsonProperty("published_at")]
+ public DateTimeOffset PublishedAt { get; set; }
+
+ [JsonProperty("updated_at")]
+ public DateTimeOffset UpdatedAt { get; set; }
+
+ [JsonProperty("slug")]
+ public string Slug { get; set; }
+
+ private string title;
+
+ [JsonProperty("title")]
+ public string Title
+ {
+ get => title;
+ set => title = WebUtility.HtmlDecode(value);
+ }
+
+ private string preview;
+
+ [JsonProperty("preview")]
+ public string Preview
+ {
+ get => preview;
+ set => preview = WebUtility.HtmlDecode(value);
+ }
+ }
+}
diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs
index e2a817aaff..800029ceb9 100644
--- a/osu.Game/Online/Leaderboards/Leaderboard.cs
+++ b/osu.Game/Online/Leaderboards/Leaderboard.cs
@@ -170,36 +170,37 @@ namespace osu.Game.Online.Leaderboards
{
InternalChildren = new Drawable[]
{
- new GridContainer
+ new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
- RowDimensions = new[]
+ Masking = true,
+ Child = new GridContainer
{
- new Dimension(),
- new Dimension(GridSizeMode.AutoSize),
- },
- Content = new[]
- {
- new Drawable[]
+ RelativeSizeAxes = Axes.Both,
+ RowDimensions = new[]
{
- new OsuContextMenuContainer
+ new Dimension(),
+ new Dimension(GridSizeMode.AutoSize),
+ },
+ Content = new[]
+ {
+ new Drawable[]
{
- RelativeSizeAxes = Axes.Both,
- Child = scrollContainer = new OsuScrollContainer
+ scrollContainer = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
}
+ },
+ new Drawable[]
+ {
+ content = new Container
+ {
+ AutoSizeAxes = Axes.Y,
+ RelativeSizeAxes = Axes.X,
+ },
}
},
- new Drawable[]
- {
- content = new Container
- {
- AutoSizeAxes = Axes.Y,
- RelativeSizeAxes = Axes.X,
- },
- }
},
},
loading = new LoadingSpinner(),
diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs
index 1469f29874..b60d71cfe7 100644
--- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs
+++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs
@@ -58,6 +58,9 @@ namespace osu.Game.Online.Leaderboards
[Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; }
+ [Resolved(CanBeNull = true)]
+ private SongSelect songSelect { get; set; }
+
public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true)
{
this.score = score;
@@ -373,6 +376,9 @@ namespace osu.Game.Online.Leaderboards
{
List
[JsonIgnore]
- public Bindable Position { get; private set; } = new Bindable(-1);
+ public readonly Bindable Position = new Bindable(-1);
public void CopyFrom(Room other)
{
@@ -130,7 +134,7 @@ namespace osu.Game.Online.Multiplayer
RecentParticipants.AddRange(other.RecentParticipants);
}
- Position = other.Position;
+ Position.Value = other.Position.Value;
}
public bool ShouldSerializeRoomID() => false;
diff --git a/osu.Game/Online/Multiplayer/RoomCategory.cs b/osu.Game/Online/Multiplayer/RoomCategory.cs
new file mode 100644
index 0000000000..636a73a3e9
--- /dev/null
+++ b/osu.Game/Online/Multiplayer/RoomCategory.cs
@@ -0,0 +1,11 @@
+// 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.Online.Multiplayer
+{
+ public enum RoomCategory
+ {
+ Normal,
+ Spotlight
+ }
+}
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index 92233f143d..47a7c2ae11 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -890,6 +890,10 @@ namespace osu.Game
beatmapListing.ToggleVisibility();
return true;
+ case GlobalAction.ToggleNotifications:
+ notifications.ToggleVisibility();
+ return true;
+
case GlobalAction.ToggleGameplayMouseButtons:
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get(OsuSetting.MouseDisableButtons));
return true;
diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
index 64b3afcae1..45ef793deb 100644
--- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
+++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
@@ -91,7 +91,8 @@ namespace osu.Game.Overlays.BeatmapListing
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
- ((FilterDropdown)Dropdown).AccentColour = colourProvider.Light2;
+ if (Dropdown is FilterDropdown fd)
+ fd.AccentColour = colourProvider.Light2;
}
protected override Dropdown CreateDropdown() => new FilterDropdown();
diff --git a/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanelDownloadButton.cs b/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanelDownloadButton.cs
index 67782dfe3f..001ca801d9 100644
--- a/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanelDownloadButton.cs
+++ b/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanelDownloadButton.cs
@@ -81,7 +81,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
{
case DownloadState.LocallyAvailable:
button.Enabled.Value = true;
- button.TooltipText = string.Empty;
+ button.TooltipText = "Go to beatmap";
break;
default:
diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs
index 83f44ccd80..0dd68bbd41 100644
--- a/osu.Game/Overlays/Comments/CommentsHeader.cs
+++ b/osu.Game/Overlays/Comments/CommentsHeader.cs
@@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: 12),
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = @"Show deleted"
}
},
diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs
index 02ef900dc5..1bcbe4dd2f 100644
--- a/osu.Game/Overlays/Dialog/PopupDialog.cs
+++ b/osu.Game/Overlays/Dialog/PopupDialog.cs
@@ -42,25 +42,34 @@ namespace osu.Game.Overlays.Dialog
set => icon.Icon = value;
}
- private string text;
+ private string headerText;
public string HeaderText
{
- get => text;
+ get => headerText;
set
{
- if (text == value)
+ if (headerText == value)
return;
- text = value;
-
+ headerText = value;
header.Text = value;
}
}
+ private string bodyText;
+
public string BodyText
{
- set => body.Text = value;
+ get => bodyText;
+ set
+ {
+ if (bodyText == value)
+ return;
+
+ bodyText = value;
+ body.Text = value;
+ }
}
public IEnumerable Buttons
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index 92cf490be2..09f2a66b47 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
+using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
@@ -71,7 +72,7 @@ namespace osu.Game.Overlays
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(beatmapRemoved);
- beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal).OrderBy(_ => RNG.Next()));
+ beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal, true).OrderBy(_ => RNG.Next()));
}
protected override void LoadComplete()
@@ -133,6 +134,29 @@ namespace osu.Game.Overlays
});
}
+ ///
+ /// Ensures music is playing, no matter what, unless the user has explicitly paused.
+ /// This means that if the current beatmap has a virtual track (see ) a new beatmap will be selected.
+ ///
+ public void EnsurePlayingSomething()
+ {
+ if (IsUserPaused) return;
+
+ var track = current?.Track;
+
+ if (track == null || track is TrackVirtual)
+ {
+ if (beatmap.Disabled)
+ return;
+
+ next();
+ }
+ else if (!IsPlaying)
+ {
+ Play();
+ }
+ }
+
///
/// Start playing the current track (if not already playing).
///
@@ -144,13 +168,7 @@ namespace osu.Game.Overlays
IsUserPaused = false;
if (track == null)
- {
- if (beatmap.Disabled)
- return false;
-
- next(true);
- return true;
- }
+ return false;
if (restart)
track.Restart();
@@ -228,10 +246,9 @@ namespace osu.Game.Overlays
///
public void NextTrack() => Schedule(() => next());
- private bool next(bool instant = false)
+ private bool next()
{
- if (!instant)
- queuedDirection = TrackChangeDirection.Next;
+ queuedDirection = TrackChangeDirection.Next;
var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
diff --git a/osu.Game/Overlays/News/NewsCard.cs b/osu.Game/Overlays/News/NewsCard.cs
new file mode 100644
index 0000000000..9c478a7c1d
--- /dev/null
+++ b/osu.Game/Overlays/News/NewsCard.cs
@@ -0,0 +1,198 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Cursor;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.Textures;
+using osu.Framework.Input.Events;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Online.API.Requests.Responses;
+
+namespace osu.Game.Overlays.News
+{
+ public class NewsCard : CompositeDrawable
+ {
+ [Resolved]
+ private OverlayColourProvider colourProvider { get; set; }
+
+ private readonly APINewsPost post;
+
+ private Box background;
+ private TextFlowContainer main;
+
+ public NewsCard(APINewsPost post)
+ {
+ this.post = post;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ RelativeSizeAxes = Axes.X;
+ AutoSizeAxes = Axes.Y;
+ Masking = true;
+ CornerRadius = 6;
+
+ NewsBackground bg;
+
+ InternalChildren = new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = colourProvider.Background4
+ },
+ new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ Height = 160,
+ Masking = true,
+ CornerRadius = 6,
+ Children = new Drawable[]
+ {
+ new DelayedLoadWrapper(bg = new NewsBackground(post.FirstImage)
+ {
+ RelativeSizeAxes = Axes.Both,
+ FillMode = FillMode.Fill,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Alpha = 0
+ })
+ {
+ RelativeSizeAxes = Axes.Both
+ },
+ new DateContainer(post.PublishedAt)
+ {
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ Margin = new MarginPadding
+ {
+ Top = 10,
+ Right = 15
+ }
+ }
+ }
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Padding = new MarginPadding
+ {
+ Horizontal = 15,
+ Vertical = 10
+ },
+ Child = main = new TextFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y
+ }
+ }
+ }
+ },
+ new HoverClickSounds()
+ };
+
+ bg.OnLoadComplete += d => d.FadeIn(250, Easing.In);
+
+ main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold));
+ main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font
+ main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12));
+ main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold));
+ }
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ background.FadeColour(colourProvider.Background3, 200, Easing.OutQuint);
+ return true;
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ background.FadeColour(colourProvider.Background4, 200, Easing.OutQuint);
+ base.OnHoverLost(e);
+ }
+
+ [LongRunningLoad]
+ private class NewsBackground : Sprite
+ {
+ private readonly string sourceUrl;
+
+ public NewsBackground(string sourceUrl)
+ {
+ this.sourceUrl = sourceUrl;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(LargeTextureStore store)
+ {
+ Texture = store.Get(createUrl(sourceUrl));
+ }
+
+ private string createUrl(string source)
+ {
+ if (string.IsNullOrEmpty(source))
+ return "Headers/news";
+
+ if (source.StartsWith('/'))
+ return "https://osu.ppy.sh" + source;
+
+ return source;
+ }
+ }
+
+ private class DateContainer : CircularContainer, IHasCustomTooltip
+ {
+ public ITooltip GetCustomTooltip() => new DateTooltip();
+
+ public object TooltipContent => date;
+
+ private readonly DateTimeOffset date;
+
+ public DateContainer(DateTimeOffset date)
+ {
+ this.date = date;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OverlayColourProvider colourProvider)
+ {
+ AutoSizeAxes = Axes.Both;
+ Masking = true;
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = colourProvider.Background6.Opacity(0.5f)
+ },
+ new OsuSpriteText
+ {
+ Text = date.ToString("d MMM yyyy").ToUpper(),
+ Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
+ Margin = new MarginPadding
+ {
+ Horizontal = 20,
+ Vertical = 5
+ }
+ }
+ };
+ }
+ }
+ }
+}
diff --git a/osu.Game/Overlays/OverlaySortTabControl.cs b/osu.Game/Overlays/OverlaySortTabControl.cs
index 395f3aec4c..b2212336ef 100644
--- a/osu.Game/Overlays/OverlaySortTabControl.cs
+++ b/osu.Game/Overlays/OverlaySortTabControl.cs
@@ -30,6 +30,14 @@ namespace osu.Game.Overlays
set => current.Current = value;
}
+ public string Title
+ {
+ get => text.Text;
+ set => text.Text = value;
+ }
+
+ private readonly OsuSpriteText text;
+
public OverlaySortTabControl()
{
AutoSizeAxes = Axes.Both;
@@ -40,11 +48,11 @@ namespace osu.Game.Overlays
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
- new OsuSpriteText
+ text = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- Font = OsuFont.GetFont(size: 12),
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = @"Sort by"
},
CreateControl().With(c =>
@@ -133,7 +141,7 @@ namespace osu.Game.Overlays
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Font = OsuFont.GetFont(size: 12),
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = (value as Enum)?.GetDescription() ?? value.ToString()
}
}
@@ -163,7 +171,7 @@ namespace osu.Game.Overlays
ContentColour = Active.Value && !IsHovered ? colourProvider.Light1 : Color4.White;
- text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium);
+ text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.SemiBold);
}
}
}
diff --git a/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs b/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs
new file mode 100644
index 0000000000..c0bbf46e30
--- /dev/null
+++ b/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs
@@ -0,0 +1,19 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+namespace osu.Game.Overlays.Rankings
+{
+ public class RankingsSortTabControl : OverlaySortTabControl
+ {
+ public RankingsSortTabControl()
+ {
+ Title = "Show";
+ }
+ }
+
+ public enum RankingsSortCriteria
+ {
+ All,
+ Friends
+ }
+}
diff --git a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs
index 5ecb477a2f..ffbc1c9586 100644
--- a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs
+++ b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
using osu.Framework.Bindables;
using osuTK;
using osu.Framework.Graphics;
@@ -11,44 +10,23 @@ using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.SearchableList
{
- public class DisplayStyleControl : Container
- where T : struct, Enum
+ public class DisplayStyleControl : CompositeDrawable
{
- public readonly SlimEnumDropdown Dropdown;
public readonly Bindable DisplayStyle = new Bindable();
public DisplayStyleControl()
{
AutoSizeAxes = Axes.Both;
- Children = new[]
+ InternalChild = new FillFlowContainer
{
- new FillFlowContainer
+ AutoSizeAxes = Axes.Both,
+ Spacing = new Vector2(5f, 0f),
+ Direction = FillDirection.Horizontal,
+ Children = new[]
{
- AutoSizeAxes = Axes.Both,
- Anchor = Anchor.TopRight,
- Origin = Anchor.TopRight,
- Spacing = new Vector2(10f, 0f),
- Direction = FillDirection.Horizontal,
- Children = new Drawable[]
- {
- new FillFlowContainer
- {
- AutoSizeAxes = Axes.Both,
- Spacing = new Vector2(5f, 0f),
- Direction = FillDirection.Horizontal,
- Children = new[]
- {
- new DisplayStyleToggleButton(FontAwesome.Solid.ThLarge, PanelDisplayStyle.Grid, DisplayStyle),
- new DisplayStyleToggleButton(FontAwesome.Solid.ListUl, PanelDisplayStyle.List, DisplayStyle),
- },
- },
- Dropdown = new SlimEnumDropdown
- {
- RelativeSizeAxes = Axes.None,
- Width = 160f,
- },
- },
+ new DisplayStyleToggleButton(FontAwesome.Solid.ThLarge, PanelDisplayStyle.Grid, DisplayStyle),
+ new DisplayStyleToggleButton(FontAwesome.Solid.ListUl, PanelDisplayStyle.List, DisplayStyle),
},
};
diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
index d31470e685..e0163b5b0c 100644
--- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
+++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
@@ -19,12 +19,14 @@ namespace osu.Game.Overlays.SearchableList
{
private const float padding = 10;
- private readonly Container filterContainer;
+ private readonly Drawable filterContainer;
+ private readonly Drawable rightFilterContainer;
private readonly Box tabStrip;
public readonly SearchTextBox Search;
public readonly PageTabControl Tabs;
- public readonly DisplayStyleControl DisplayStyleControl;
+ public readonly SlimEnumDropdown Dropdown;
+ public readonly DisplayStyleControl DisplayStyleControl;
protected abstract Color4 BackgroundColour { get; }
protected abstract TTab DefaultTab { get; }
@@ -42,7 +44,7 @@ namespace osu.Game.Overlays.SearchableList
var controls = CreateSupplementaryControls();
Container controlsContainer;
- Children = new Drawable[]
+ Children = new[]
{
filterContainer = new Container
{
@@ -104,11 +106,27 @@ namespace osu.Game.Overlays.SearchableList
},
},
},
- DisplayStyleControl = new DisplayStyleControl
+ rightFilterContainer = new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
- },
+ AutoSizeAxes = Axes.Both,
+ Children = new Drawable[]
+ {
+ Dropdown = new SlimEnumDropdown
+ {
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ RelativeSizeAxes = Axes.None,
+ Width = 160f,
+ },
+ DisplayStyleControl = new DisplayStyleControl
+ {
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ },
+ }
+ }
};
if (controls != null) controlsContainer.Children = new[] { controls };
@@ -116,8 +134,8 @@ namespace osu.Game.Overlays.SearchableList
Tabs.Current.Value = DefaultTab;
Tabs.Current.TriggerChange();
- DisplayStyleControl.Dropdown.Current.Value = DefaultCategory;
- DisplayStyleControl.Dropdown.Current.TriggerChange();
+ Dropdown.Current.Value = DefaultCategory;
+ Dropdown.Current.TriggerChange();
}
[BackgroundDependencyLoader]
@@ -131,13 +149,11 @@ namespace osu.Game.Overlays.SearchableList
base.Update();
Height = filterContainer.Height;
- DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING };
+ rightFilterContainer.Margin = new MarginPadding { Top = filterContainer.Height - 30, Right = ContentHorizontalPadding };
}
private class FilterSearchTextBox : SearchTextBox
{
- protected override bool AllowCommit => true;
-
[BackgroundDependencyLoader]
private void load()
{
diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs
index 9548573b4f..1b05142192 100644
--- a/osu.Game/Overlays/SocialOverlay.cs
+++ b/osu.Game/Overlays/SocialOverlay.cs
@@ -72,7 +72,7 @@ namespace osu.Game.Overlays
Filter.Tabs.Current.ValueChanged += _ => onFilterUpdate();
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += _ => recreatePanels();
- Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => recreatePanels();
+ Filter.Dropdown.Current.ValueChanged += _ => recreatePanels();
currentQuery.BindTo(Filter.Search.Current);
currentQuery.ValueChanged += query =>
@@ -155,7 +155,7 @@ namespace osu.Game.Overlays
break;
}
- if (Filter.DisplayStyleControl.Dropdown.Current.Value == SortDirection.Descending)
+ if (Filter.Dropdown.Current.Value == SortDirection.Descending)
sortedUsers = sortedUsers.Reverse();
var newPanels = new FillFlowContainer
diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs
index 1b748cb672..de08b79f57 100644
--- a/osu.Game/Overlays/Toolbar/Toolbar.cs
+++ b/osu.Game/Overlays/Toolbar/Toolbar.cs
@@ -28,9 +28,6 @@ namespace osu.Game.Overlays.Toolbar
private const double transition_time = 500;
- private const float alpha_hovering = 0.8f;
- private const float alpha_normal = 0.6f;
-
private readonly Bindable overlayActivationMode = new Bindable(OverlayActivation.All);
// Toolbar components like RulesetSelector should receive keyboard input events even when the toolbar is hidden.
@@ -103,7 +100,6 @@ namespace osu.Game.Overlays.Toolbar
public class ToolbarBackground : Container
{
- private readonly Box solidBackground;
private readonly Box gradientBackground;
public ToolbarBackground()
@@ -111,11 +107,10 @@ namespace osu.Game.Overlays.Toolbar
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
- solidBackground = new Box
+ new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.1f),
- Alpha = alpha_normal,
},
gradientBackground = new Box
{
@@ -131,14 +126,12 @@ namespace osu.Game.Overlays.Toolbar
protected override bool OnHover(HoverEvent e)
{
- solidBackground.FadeTo(alpha_hovering, transition_time, Easing.OutQuint);
gradientBackground.FadeIn(transition_time, Easing.OutQuint);
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
- solidBackground.FadeTo(alpha_normal, transition_time, Easing.OutQuint);
gradientBackground.FadeOut(transition_time, Easing.OutQuint);
}
}
@@ -146,7 +139,7 @@ namespace osu.Game.Overlays.Toolbar
protected override void PopIn()
{
this.MoveToY(0, transition_time, Easing.OutQuint);
- this.FadeIn(transition_time / 2, Easing.OutQuint);
+ this.FadeIn(transition_time / 4, Easing.OutQuint);
}
protected override void PopOut()
@@ -154,7 +147,7 @@ namespace osu.Game.Overlays.Toolbar
userButton.StateContainer?.Hide();
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
- this.FadeOut(transition_time);
+ this.FadeOut(transition_time, Easing.InQuint);
}
}
}
diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs
index 7113acbbfb..4e7f0018ef 100644
--- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs
+++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs
@@ -1,11 +1,14 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System.Diagnostics;
+using JetBrains.Annotations;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Pooling;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@@ -18,16 +21,15 @@ namespace osu.Game.Rulesets.Judgements
///
/// A drawable object which visualises the hit result of a .
///
- public class DrawableJudgement : CompositeDrawable
+ public class DrawableJudgement : PoolableDrawable
{
private const float judgement_size = 128;
[Resolved]
private OsuColour colours { get; set; }
- protected readonly JudgementResult Result;
-
- public readonly DrawableHitObject JudgedObject;
+ public JudgementResult Result { get; private set; }
+ public DrawableHitObject JudgedObject { get; private set; }
protected Container JudgementBody;
protected SpriteText JudgementText;
@@ -48,29 +50,21 @@ namespace osu.Game.Rulesets.Judgements
/// The judgement to visualise.
/// The object which was judged.
public DrawableJudgement(JudgementResult result, DrawableHitObject judgedObject)
+ : this()
{
- Result = result;
- JudgedObject = judgedObject;
+ Apply(result, judgedObject);
+ }
+ public DrawableJudgement()
+ {
Size = new Vector2(judgement_size);
+ Origin = Anchor.Centre;
}
[BackgroundDependencyLoader]
private void load()
{
- InternalChild = JudgementBody = new Container
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- RelativeSizeAxes = Axes.Both,
- Child = new SkinnableDrawable(new GameplaySkinComponent(Result.Type), _ => JudgementText = new OsuSpriteText
- {
- Text = Result.Type.GetDescription().ToUpperInvariant(),
- Font = OsuFont.Numeric.With(size: 20),
- Colour = colours.ForHitResult(Result.Type),
- Scale = new Vector2(0.85f, 1),
- }, confineMode: ConfineMode.NoScaling)
- };
+ prepareDrawables();
}
protected virtual void ApplyHitAnimations()
@@ -81,11 +75,24 @@ namespace osu.Game.Rulesets.Judgements
this.Delay(FadeOutDelay).FadeOut(400);
}
- protected override void LoadComplete()
+ public virtual void Apply([NotNull] JudgementResult result, [CanBeNull] DrawableHitObject judgedObject)
{
- base.LoadComplete();
+ Result = result;
+ JudgedObject = judgedObject;
+ }
+
+ protected override void PrepareForUse()
+ {
+ base.PrepareForUse();
+
+ Debug.Assert(Result != null);
+
+ prepareDrawables();
this.FadeInFromZero(FadeInDuration, Easing.OutQuint);
+ JudgementBody.ScaleTo(1);
+ JudgementBody.RotateTo(0);
+ JudgementBody.MoveTo(Vector2.Zero);
switch (Result.Type)
{
@@ -109,5 +116,31 @@ namespace osu.Game.Rulesets.Judgements
Expire(true);
}
+
+ private HitResult? currentDrawableType;
+
+ private void prepareDrawables()
+ {
+ var type = Result?.Type ?? HitResult.Perfect; //TODO: better default type from ruleset
+
+ if (type == currentDrawableType)
+ return;
+
+ InternalChild = JudgementBody = new Container
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ RelativeSizeAxes = Axes.Both,
+ Child = new SkinnableDrawable(new GameplaySkinComponent(type), _ => JudgementText = new OsuSpriteText
+ {
+ Text = type.GetDescription().ToUpperInvariant(),
+ Font = OsuFont.Numeric.With(size: 20),
+ Colour = colours.ForHitResult(type),
+ Scale = new Vector2(0.85f, 1),
+ }, confineMode: ConfineMode.NoScaling)
+ };
+
+ currentDrawableType = type;
+ }
}
}
diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs
index 35a8334237..6e94a84e7d 100644
--- a/osu.Game/Rulesets/Mods/ModFlashlight.cs
+++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs
@@ -47,9 +47,25 @@ namespace osu.Game.Rulesets.Mods
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
Combo.BindTo(scoreProcessor.Combo);
+
+ // Default value of ScoreProcessor's Rank in Flashlight Mod should be SS+
+ scoreProcessor.Rank.Value = ScoreRank.XH;
}
- public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
+ public ScoreRank AdjustRank(ScoreRank rank, double accuracy)
+ {
+ switch (rank)
+ {
+ case ScoreRank.X:
+ return ScoreRank.XH;
+
+ case ScoreRank.S:
+ return ScoreRank.SH;
+
+ default:
+ return rank;
+ }
+ }
public virtual void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset)
{
diff --git a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs
index ef341575fa..130907b242 100644
--- a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs
+++ b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs
@@ -114,7 +114,9 @@ namespace osu.Game.Rulesets.Scoring
protected override void ApplyResultInternal(JudgementResult result)
{
base.ApplyResultInternal(result);
- healthIncreases.Add((result.HitObject.GetEndTime() + result.TimeOffset, GetHealthIncreaseFor(result)));
+
+ if (!result.Judgement.IsBonus)
+ healthIncreases.Add((result.HitObject.GetEndTime() + result.TimeOffset, GetHealthIncreaseFor(result)));
}
protected override void Reset(bool storeResults)
diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
index 9c1bc35169..eb49638d59 100644
--- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
+++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
@@ -252,6 +252,12 @@ namespace osu.Game.Rulesets.Scoring
HighestCombo.Value = 0;
}
+ protected override void Dispose(bool isDisposing)
+ {
+ base.Dispose(isDisposing);
+ hitEvents.Clear();
+ }
+
///
/// Retrieve a score populated with data for the current play this processor is responsible for.
///
@@ -269,7 +275,7 @@ namespace osu.Game.Rulesets.Scoring
foreach (var result in Enum.GetValues(typeof(HitResult)).OfType().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
score.Statistics[result] = GetStatistic(result);
- score.HitEvents = new List(hitEvents);
+ score.HitEvents = hitEvents;
}
///
diff --git a/osu.Game/Screens/Menu/ConfirmExitDialog.cs b/osu.Game/Screens/Menu/ConfirmExitDialog.cs
new file mode 100644
index 0000000000..d120eb21a8
--- /dev/null
+++ b/osu.Game/Screens/Menu/ConfirmExitDialog.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 System;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Overlays.Dialog;
+
+namespace osu.Game.Screens.Menu
+{
+ public class ConfirmExitDialog : PopupDialog
+ {
+ public ConfirmExitDialog(Action confirm, Action cancel)
+ {
+ HeaderText = "Are you sure you want to exit?";
+ BodyText = "Last chance to back out.";
+
+ Icon = FontAwesome.Solid.ExclamationTriangle;
+
+ Buttons = new PopupDialogButton[]
+ {
+ new PopupDialogOkButton
+ {
+ Text = @"Goodbye",
+ Action = confirm
+ },
+ new PopupDialogCancelButton
+ {
+ Text = @"Just a little more",
+ Action = cancel
+ },
+ };
+ }
+ }
+}
diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs
index 35091028ae..986de1edf0 100644
--- a/osu.Game/Screens/Menu/Disclaimer.cs
+++ b/osu.Game/Screens/Menu/Disclaimer.cs
@@ -51,7 +51,7 @@ namespace osu.Game.Screens.Menu
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Icon = FontAwesome.Solid.Poo,
+ Icon = FontAwesome.Solid.Flask,
Size = new Vector2(icon_size),
Y = icon_y,
},
diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs
index 9245df2a7d..57252d557e 100644
--- a/osu.Game/Screens/Menu/MainMenu.cs
+++ b/osu.Game/Screens/Menu/MainMenu.cs
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
using System.Linq;
using osuTK;
using osuTK.Graphics;
@@ -9,15 +8,14 @@ using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
-using osu.Framework.Graphics.Sprites;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
+using osu.Game.IO;
using osu.Game.Online.API;
using osu.Game.Overlays;
-using osu.Game.Overlays.Dialog;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Multi;
@@ -171,6 +169,9 @@ namespace osu.Game.Screens.Menu
return s;
}
+ [Resolved]
+ private Storage storage { get; set; }
+
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
@@ -187,6 +188,9 @@ namespace osu.Game.Screens.Menu
Track.Start();
}
}
+
+ if (storage is OsuStorage osuStorage && osuStorage.Error != OsuStorageError.None)
+ dialogOverlay?.Push(new StorageErrorDialog(osuStorage, osuStorage.Error));
}
private bool exitConfirmed;
@@ -256,8 +260,7 @@ namespace osu.Game.Screens.Menu
// we may have consumed our preloaded instance, so let's make another.
preloadSongSelect();
- if (Beatmap.Value.Track != null && music?.IsUserPaused != true)
- Beatmap.Value.Track.Start();
+ music.EnsurePlayingSomething();
}
public override bool OnExiting(IScreen next)
@@ -283,30 +286,5 @@ namespace osu.Game.Screens.Menu
this.FadeOut(3000);
return base.OnExiting(next);
}
-
- private class ConfirmExitDialog : PopupDialog
- {
- public ConfirmExitDialog(Action confirm, Action cancel)
- {
- HeaderText = "Are you sure you want to exit?";
- BodyText = "Last chance to back out.";
-
- Icon = FontAwesome.Solid.ExclamationTriangle;
-
- Buttons = new PopupDialogButton[]
- {
- new PopupDialogOkButton
- {
- Text = @"Goodbye",
- Action = confirm
- },
- new PopupDialogCancelButton
- {
- Text = @"Just a little more",
- Action = cancel
- },
- };
- }
- }
}
}
diff --git a/osu.Game/Screens/Menu/StorageErrorDialog.cs b/osu.Game/Screens/Menu/StorageErrorDialog.cs
new file mode 100644
index 0000000000..dcaad4013a
--- /dev/null
+++ b/osu.Game/Screens/Menu/StorageErrorDialog.cs
@@ -0,0 +1,79 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System.Collections.Generic;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.IO;
+using osu.Game.Overlays;
+using osu.Game.Overlays.Dialog;
+
+namespace osu.Game.Screens.Menu
+{
+ public class StorageErrorDialog : PopupDialog
+ {
+ [Resolved]
+ private DialogOverlay dialogOverlay { get; set; }
+
+ [Resolved]
+ private OsuGameBase osuGame { get; set; }
+
+ public StorageErrorDialog(OsuStorage storage, OsuStorageError error)
+ {
+ HeaderText = "osu! storage error";
+ Icon = FontAwesome.Solid.ExclamationTriangle;
+
+ var buttons = new List();
+
+ switch (error)
+ {
+ case OsuStorageError.NotAccessible:
+ BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is not accessible. If it is on external storage, please reconnect the device and try again.";
+
+ buttons.AddRange(new PopupDialogButton[]
+ {
+ new PopupDialogCancelButton
+ {
+ Text = "Try again",
+ Action = () =>
+ {
+ if (!storage.TryChangeToCustomStorage(out var nextError))
+ dialogOverlay.Push(new StorageErrorDialog(storage, nextError));
+ }
+ },
+ new PopupDialogCancelButton
+ {
+ Text = "Use default location until restart",
+ },
+ new PopupDialogOkButton
+ {
+ Text = "Reset to default location",
+ Action = storage.ResetCustomStoragePath
+ },
+ });
+ break;
+
+ case OsuStorageError.AccessibleButEmpty:
+ BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is empty. If you have moved the files, please close osu! and move them back.";
+
+ // Todo: Provide the option to search for the files similar to migration.
+ buttons.AddRange(new PopupDialogButton[]
+ {
+ new PopupDialogCancelButton
+ {
+ Text = "Start fresh at specified location"
+ },
+ new PopupDialogOkButton
+ {
+ Text = "Reset to default location",
+ Action = storage.ResetCustomStoragePath
+ },
+ });
+
+ break;
+ }
+
+ Buttons = buttons;
+ }
+ }
+}
diff --git a/osu.Game/Screens/Multi/Components/OverlinedDisplay.cs b/osu.Game/Screens/Multi/Components/OverlinedDisplay.cs
deleted file mode 100644
index 8d8d4cc404..0000000000
--- a/osu.Game/Screens/Multi/Components/OverlinedDisplay.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Framework.Allocation;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Shapes;
-using osu.Game.Graphics;
-using osu.Game.Graphics.Sprites;
-using osuTK;
-
-namespace osu.Game.Screens.Multi.Components
-{
- public abstract class OverlinedDisplay : MultiplayerComposite
- {
- protected readonly Container Content;
-
- public override Axes RelativeSizeAxes
- {
- get => base.RelativeSizeAxes;
- set
- {
- base.RelativeSizeAxes = value;
- updateDimensions();
- }
- }
-
- public override Axes AutoSizeAxes
- {
- get => base.AutoSizeAxes;
- protected set
- {
- base.AutoSizeAxes = value;
- updateDimensions();
- }
- }
-
- protected string Details
- {
- set => details.Text = value;
- }
-
- private readonly Circle line;
- private readonly OsuSpriteText details;
- private readonly GridContainer grid;
-
- protected OverlinedDisplay(string title)
- {
- InternalChild = grid = new GridContainer
- {
- Content = new[]
- {
- new Drawable[]
- {
- line = new Circle
- {
- RelativeSizeAxes = Axes.X,
- Height = 2,
- Margin = new MarginPadding { Bottom = 2 }
- },
- },
- new Drawable[]
- {
- new FillFlowContainer
- {
- AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Margin = new MarginPadding { Top = 5 },
- Spacing = new Vector2(10, 0),
- Children = new Drawable[]
- {
- new OsuSpriteText
- {
- Text = title,
- Font = OsuFont.GetFont(size: 14)
- },
- details = new OsuSpriteText { Font = OsuFont.GetFont(size: 14) },
- }
- },
- },
- new Drawable[]
- {
- Content = new Container { Padding = new MarginPadding { Top = 5 } }
- }
- }
- };
-
- updateDimensions();
- }
-
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
- {
- line.Colour = colours.Yellow;
- details.Colour = colours.Yellow;
- }
-
- private void updateDimensions()
- {
- grid.RowDimensions = new[]
- {
- new Dimension(GridSizeMode.AutoSize),
- new Dimension(GridSizeMode.AutoSize),
- new Dimension(AutoSizeAxes.HasFlag(Axes.Y) ? GridSizeMode.AutoSize : GridSizeMode.Distributed),
- };
-
- // Assigning to none is done so that setting auto and relative size modes doesn't cause exceptions to be thrown
- grid.AutoSizeAxes = Content.AutoSizeAxes = Axes.None;
- grid.RelativeSizeAxes = Content.RelativeSizeAxes = Axes.None;
-
- // Auto-size when required, otherwise eagerly relative-size
- grid.AutoSizeAxes = Content.AutoSizeAxes = AutoSizeAxes;
- grid.RelativeSizeAxes = Content.RelativeSizeAxes = ~AutoSizeAxes;
- }
- }
-}
diff --git a/osu.Game/Screens/Multi/Components/OverlinedHeader.cs b/osu.Game/Screens/Multi/Components/OverlinedHeader.cs
new file mode 100644
index 0000000000..7ec20c8cae
--- /dev/null
+++ b/osu.Game/Screens/Multi/Components/OverlinedHeader.cs
@@ -0,0 +1,89 @@
+// 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;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osuTK;
+
+namespace osu.Game.Screens.Multi.Components
+{
+ ///
+ /// A header used in the multiplayer interface which shows text / details beneath a line.
+ ///
+ public class OverlinedHeader : MultiplayerComposite
+ {
+ private bool showLine = true;
+
+ public bool ShowLine
+ {
+ get => showLine;
+ set
+ {
+ showLine = value;
+ line.Alpha = value ? 1 : 0;
+ }
+ }
+
+ public Bindable Details = new Bindable();
+
+ private readonly Circle line;
+ private readonly OsuSpriteText details;
+
+ public OverlinedHeader(string title)
+ {
+ RelativeSizeAxes = Axes.X;
+ AutoSizeAxes = Axes.Y;
+
+ Margin = new MarginPadding { Bottom = 5 };
+
+ InternalChild = new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ line = new Circle
+ {
+ RelativeSizeAxes = Axes.X,
+ Height = 2,
+ Margin = new MarginPadding { Bottom = 2 }
+ },
+ new FillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Margin = new MarginPadding { Top = 5 },
+ Spacing = new Vector2(10, 0),
+ Children = new Drawable[]
+ {
+ new OsuSpriteText
+ {
+ Text = title,
+ Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
+ },
+ details = new OsuSpriteText
+ {
+ Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
+ },
+ }
+ },
+ }
+ };
+
+ Details.BindValueChanged(val => details.Text = val.NewValue);
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ line.Colour = colours.Yellow;
+ details.Colour = colours.Yellow;
+ }
+ }
+}
diff --git a/osu.Game/Screens/Multi/Components/OverlinedPlaylist.cs b/osu.Game/Screens/Multi/Components/OverlinedPlaylist.cs
deleted file mode 100644
index 4fe79b40a0..0000000000
--- a/osu.Game/Screens/Multi/Components/OverlinedPlaylist.cs
+++ /dev/null
@@ -1,33 +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.Bindables;
-using osu.Framework.Graphics;
-using osu.Game.Online.Multiplayer;
-
-namespace osu.Game.Screens.Multi.Components
-{
- public class OverlinedPlaylist : OverlinedDisplay
- {
- public readonly Bindable SelectedItem = new Bindable();
-
- private readonly DrawableRoomPlaylist playlist;
-
- public OverlinedPlaylist(bool allowSelection)
- : base("Playlist")
- {
- Content.Add(playlist = new DrawableRoomPlaylist(false, allowSelection)
- {
- RelativeSizeAxes = Axes.Both,
- SelectedItem = { BindTarget = SelectedItem }
- });
- }
-
- [BackgroundDependencyLoader]
- private void load()
- {
- playlist.Items.BindTo(Playlist);
- }
- }
-}
diff --git a/osu.Game/Screens/Multi/Components/OverlinedParticipants.cs b/osu.Game/Screens/Multi/Components/ParticipantsDisplay.cs
similarity index 63%
rename from osu.Game/Screens/Multi/Components/OverlinedParticipants.cs
rename to osu.Game/Screens/Multi/Components/ParticipantsDisplay.cs
index eb1782d147..6ea4283379 100644
--- a/osu.Game/Screens/Multi/Components/OverlinedParticipants.cs
+++ b/osu.Game/Screens/Multi/Components/ParticipantsDisplay.cs
@@ -2,26 +2,22 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Multi.Components
{
- public class OverlinedParticipants : OverlinedDisplay
+ public class ParticipantsDisplay : MultiplayerComposite
{
- public new Axes AutoSizeAxes
- {
- get => base.AutoSizeAxes;
- set => base.AutoSizeAxes = value;
- }
+ public Bindable Details = new Bindable();
- public OverlinedParticipants(Direction direction)
- : base("Recent participants")
+ public ParticipantsDisplay(Direction direction)
{
OsuScrollContainer scroll;
ParticipantsList list;
- Content.Add(scroll = new OsuScrollContainer(direction)
+ AddInternal(scroll = new OsuScrollContainer(direction)
{
Child = list = new ParticipantsList()
});
@@ -29,13 +25,21 @@ namespace osu.Game.Screens.Multi.Components
switch (direction)
{
case Direction.Horizontal:
+ AutoSizeAxes = Axes.Y;
+ RelativeSizeAxes = Axes.X;
+
scroll.RelativeSizeAxes = Axes.X;
scroll.Height = ParticipantsList.TILE_SIZE + OsuScrollContainer.SCROLL_BAR_HEIGHT + OsuScrollContainer.SCROLL_BAR_PADDING * 2;
- list.AutoSizeAxes = Axes.Both;
+
+ list.RelativeSizeAxes = Axes.Y;
+ list.AutoSizeAxes = Axes.X;
break;
case Direction.Vertical:
+ RelativeSizeAxes = Axes.Both;
+
scroll.RelativeSizeAxes = Axes.Both;
+
list.RelativeSizeAxes = Axes.X;
list.AutoSizeAxes = Axes.Y;
break;
@@ -46,11 +50,10 @@ namespace osu.Game.Screens.Multi.Components
private void load()
{
ParticipantCount.BindValueChanged(_ => setParticipantCount());
- MaxParticipants.BindValueChanged(_ => setParticipantCount());
-
- setParticipantCount();
+ MaxParticipants.BindValueChanged(_ => setParticipantCount(), true);
}
- private void setParticipantCount() => Details = MaxParticipants.Value != null ? $"{ParticipantCount.Value}/{MaxParticipants.Value}" : ParticipantCount.Value.ToString();
+ private void setParticipantCount() =>
+ Details.Value = MaxParticipants.Value != null ? $"{ParticipantCount.Value}/{MaxParticipants.Value}" : ParticipantCount.Value.ToString();
}
}
diff --git a/osu.Game/Screens/Multi/Components/ParticipantsList.cs b/osu.Game/Screens/Multi/Components/ParticipantsList.cs
index 79d130adf5..7978b4eaab 100644
--- a/osu.Game/Screens/Multi/Components/ParticipantsList.cs
+++ b/osu.Game/Screens/Multi/Components/ParticipantsList.cs
@@ -79,7 +79,7 @@ namespace osu.Game.Screens.Multi.Components
Direction = Direction,
AutoSizeAxes = AutoSizeAxes,
RelativeSizeAxes = RelativeSizeAxes,
- Spacing = new Vector2(10)
+ Spacing = Vector2.One
};
for (int i = 0; i < RecentParticipants.Count; i++)
diff --git a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs
index 97af6674bf..a115f06e7b 100644
--- a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs
+++ b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs
@@ -17,6 +17,9 @@ namespace osu.Game.Screens.Multi.Components
[Resolved(typeof(Room), nameof(Room.Status))]
private Bindable status { get; set; }
+ [Resolved(typeof(Room), nameof(Room.Category))]
+ private Bindable category { get; set; }
+
public StatusColouredContainer(double transitionDuration = 100)
{
this.transitionDuration = transitionDuration;
@@ -25,7 +28,11 @@ namespace osu.Game.Screens.Multi.Components
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
- status.BindValueChanged(s => this.FadeColour(s.NewValue.GetAppropriateColour(colours), transitionDuration), true);
+ status.BindValueChanged(s =>
+ {
+ this.FadeColour(category.Value == RoomCategory.Spotlight ? colours.Pink : s.NewValue.GetAppropriateColour(colours)
+ , transitionDuration);
+ }, true);
}
}
}
diff --git a/osu.Game/Screens/Multi/DrawableRoomPlaylist.cs b/osu.Game/Screens/Multi/DrawableRoomPlaylist.cs
index 9a3fcb1cdc..89c335183b 100644
--- a/osu.Game/Screens/Multi/DrawableRoomPlaylist.cs
+++ b/osu.Game/Screens/Multi/DrawableRoomPlaylist.cs
@@ -60,8 +60,6 @@ namespace osu.Game.Screens.Multi
RequestDeletion = requestDeletion
};
- private void requestSelection(PlaylistItem item) => SelectedItem.Value = item;
-
private void requestDeletion(PlaylistItem item)
{
if (SelectedItem.Value == item)
diff --git a/osu.Game/Screens/Multi/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/Multi/DrawableRoomPlaylistItem.cs
index 414c1f5748..c0892235f2 100644
--- a/osu.Game/Screens/Multi/DrawableRoomPlaylistItem.cs
+++ b/osu.Game/Screens/Multi/DrawableRoomPlaylistItem.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@@ -48,7 +49,8 @@ namespace osu.Game.Screens.Multi
private readonly Bindable ruleset = new Bindable();
private readonly BindableList requiredMods = new BindableList();
- private readonly PlaylistItem item;
+ public readonly PlaylistItem Item;
+
private readonly bool allowEdit;
private readonly bool allowSelection;
@@ -57,8 +59,11 @@ namespace osu.Game.Screens.Multi
public DrawableRoomPlaylistItem(PlaylistItem item, bool allowEdit, bool allowSelection)
: base(item)
{
- this.item = item;
+ Item = item;
+
+ // TODO: edit support should be moved out into a derived class
this.allowEdit = allowEdit;
+
this.allowSelection = allowSelection;
beatmap.BindTo(item.Beatmap);
@@ -102,14 +107,14 @@ namespace osu.Game.Screens.Multi
difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value) { Size = new Vector2(32) };
beatmapText.Clear();
- beatmapText.AddLink(item.Beatmap.ToString(), LinkAction.OpenBeatmap, item.Beatmap.Value.OnlineBeatmapID.ToString());
+ beatmapText.AddLink(Item.Beatmap.ToString(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString());
authorText.Clear();
- if (item.Beatmap?.Value?.Metadata?.Author != null)
+ if (Item.Beatmap?.Value?.Metadata?.Author != null)
{
authorText.AddText("mapped by ");
- authorText.AddUserLink(item.Beatmap.Value?.Metadata.Author);
+ authorText.AddUserLink(Item.Beatmap.Value?.Metadata.Author);
}
modDisplay.Current.Value = requiredMods.ToArray();
@@ -180,29 +185,33 @@ namespace osu.Game.Screens.Multi
}
}
},
- new Container
+ new FillFlowContainer
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
+ Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
X = -18,
- Children = new Drawable[]
- {
- new PlaylistDownloadButton(item)
- {
- Size = new Vector2(50, 30)
- },
- new IconButton
- {
- Icon = FontAwesome.Solid.MinusSquare,
- Alpha = allowEdit ? 1 : 0,
- Action = () => RequestDeletion?.Invoke(Model),
- },
- }
+ ChildrenEnumerable = CreateButtons()
}
}
};
+ protected virtual IEnumerable CreateButtons() =>
+ new Drawable[]
+ {
+ new PlaylistDownloadButton(Item)
+ {
+ Size = new Vector2(50, 30)
+ },
+ new IconButton
+ {
+ Icon = FontAwesome.Solid.MinusSquare,
+ Alpha = allowEdit ? 1 : 0,
+ Action = () => RequestDeletion?.Invoke(Model),
+ },
+ };
+
protected override bool OnClick(ClickEvent e)
{
if (allowSelection)
diff --git a/osu.Game/Screens/Multi/DrawableRoomPlaylistWithResults.cs b/osu.Game/Screens/Multi/DrawableRoomPlaylistWithResults.cs
new file mode 100644
index 0000000000..439aaaa275
--- /dev/null
+++ b/osu.Game/Screens/Multi/DrawableRoomPlaylistWithResults.cs
@@ -0,0 +1,66 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Containers;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Online.Multiplayer;
+
+namespace osu.Game.Screens.Multi
+{
+ public class DrawableRoomPlaylistWithResults : DrawableRoomPlaylist
+ {
+ public Action RequestShowResults;
+
+ public DrawableRoomPlaylistWithResults()
+ : base(false, true)
+ {
+ }
+
+ protected override OsuRearrangeableListItem CreateOsuDrawable(PlaylistItem item) =>
+ new DrawableRoomPlaylistItemWithResults(item, false, true)
+ {
+ RequestShowResults = () => RequestShowResults(item),
+ SelectedItem = { BindTarget = SelectedItem },
+ };
+
+ private class DrawableRoomPlaylistItemWithResults : DrawableRoomPlaylistItem
+ {
+ public Action RequestShowResults;
+
+ public DrawableRoomPlaylistItemWithResults(PlaylistItem item, bool allowEdit, bool allowSelection)
+ : base(item, allowEdit, allowSelection)
+ {
+ }
+
+ protected override IEnumerable CreateButtons() =>
+ base.CreateButtons().Prepend(new FilledIconButton
+ {
+ Icon = FontAwesome.Solid.ChartPie,
+ Action = () => RequestShowResults?.Invoke(),
+ TooltipText = "View results"
+ });
+
+ private class FilledIconButton : IconButton
+ {
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ Add(new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Depth = float.MaxValue,
+ Colour = colours.Gray4,
+ });
+ }
+ }
+ }
+ }
+}
diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs
index 5b8e8a7fd9..653cb3791a 100644
--- a/osu.Game/Screens/Multi/Header.cs
+++ b/osu.Game/Screens/Multi/Header.cs
@@ -1,12 +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 Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
-using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.UserInterface;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
@@ -19,41 +20,41 @@ namespace osu.Game.Screens.Multi
{
public class Header : Container
{
- public const float HEIGHT = 121;
-
- private readonly HeaderBreadcrumbControl breadcrumbs;
+ public const float HEIGHT = 80;
public Header(ScreenStack stack)
{
- MultiHeaderTitle title;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
+ HeaderBreadcrumbControl breadcrumbs;
+ MultiHeaderTitle title;
+
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
- Colour = Color4Extensions.FromHex(@"2f2043"),
+ Colour = Color4Extensions.FromHex(@"#1f1921"),
},
new Container
{
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
+ Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[]
{
title = new MultiHeaderTitle
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomLeft,
- X = -MultiHeaderTitle.ICON_WIDTH,
},
breadcrumbs = new HeaderBreadcrumbControl(stack)
{
Anchor = Anchor.BottomLeft,
- Origin = Anchor.BottomLeft,
- RelativeSizeAxes = Axes.X,
- },
+ Origin = Anchor.BottomLeft
+ }
},
},
};
@@ -67,32 +68,16 @@ namespace osu.Game.Screens.Multi
breadcrumbs.Current.TriggerChange();
}
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
+ private class MultiHeaderTitle : CompositeDrawable
{
- breadcrumbs.StripColour = colours.Green;
- }
-
- private class MultiHeaderTitle : CompositeDrawable, IHasAccentColour
- {
- public const float ICON_WIDTH = icon_size + spacing;
-
- private const float icon_size = 25;
private const float spacing = 6;
- private const int text_offset = 2;
- private readonly SpriteIcon iconSprite;
- private readonly OsuSpriteText title, pageText;
+ private readonly OsuSpriteText dot;
+ private readonly OsuSpriteText pageTitle;
public IMultiplayerSubScreen Screen
{
- set => pageText.Text = value.ShortTitle.ToLowerInvariant();
- }
-
- public Color4 AccentColour
- {
- get => pageText.Colour;
- set => pageText.Colour = value;
+ set => pageTitle.Text = value.ShortTitle.Titleize();
}
public MultiHeaderTitle()
@@ -108,32 +93,26 @@ namespace osu.Game.Screens.Multi
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
- iconSprite = new SpriteIcon
+ new OsuSpriteText
{
- Size = new Vector2(icon_size),
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 24),
+ Text = "Multiplayer"
},
- title = new OsuSpriteText
+ dot = new OsuSpriteText
{
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
- Margin = new MarginPadding { Bottom = text_offset }
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 24),
+ Text = "·"
},
- new Circle
+ pageTitle = new OsuSpriteText
{
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Size = new Vector2(4),
- Colour = Color4.Gray,
- },
- pageText = new OsuSpriteText
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Font = OsuFont.GetFont(size: 20),
- Margin = new MarginPadding { Bottom = text_offset }
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Font = OsuFont.GetFont(size: 24),
+ Text = "Lounge"
}
}
},
@@ -143,9 +122,7 @@ namespace osu.Game.Screens.Multi
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
- title.Text = "multi";
- iconSprite.Icon = OsuIcon.Multi;
- AccentColour = colours.Yellow;
+ pageTitle.Colour = dot.Colour = colours.Yellow;
}
}
@@ -154,12 +131,28 @@ namespace osu.Game.Screens.Multi
public HeaderBreadcrumbControl(ScreenStack stack)
: base(stack)
{
+ RelativeSizeAxes = Axes.X;
+ StripColour = Color4.Transparent;
}
protected override void LoadComplete()
{
base.LoadComplete();
- AccentColour = Color4.White;
+ AccentColour = Color4Extensions.FromHex("#e35c99");
+ }
+
+ protected override TabItem CreateTabItem(IScreen value) => new HeaderBreadcrumbTabItem(value)
+ {
+ AccentColour = AccentColour
+ };
+
+ private class HeaderBreadcrumbTabItem : BreadcrumbTabItem
+ {
+ public HeaderBreadcrumbTabItem(IScreen value)
+ : base(value)
+ {
+ Bar.Colour = Color4.Transparent;
+ }
}
}
}
diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs
index de02d779e1..8dd1b239e8 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs
@@ -107,6 +107,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
+ float stripWidth = side_strip_width * (Room.Category.Value == RoomCategory.Spotlight ? 2 : 1);
+
Children = new Drawable[]
{
new StatusColouredContainer(transition_duration)
@@ -139,7 +141,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
new StatusColouredContainer(transition_duration)
{
RelativeSizeAxes = Axes.Y,
- Width = side_strip_width,
+ Width = stripWidth,
Child = new Box { RelativeSizeAxes = Axes.Both }
},
new Container
@@ -147,7 +149,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
RelativeSizeAxes = Axes.Y,
Width = cover_width,
Masking = true,
- Margin = new MarginPadding { Left = side_strip_width },
+ Margin = new MarginPadding { Left = stripWidth },
Child = new MultiplayerBackgroundSprite(BeatmapSetCoverType.List) { RelativeSizeAxes = Axes.Both }
},
new Container
@@ -156,7 +158,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Padding = new MarginPadding
{
Vertical = content_padding,
- Left = side_strip_width + cover_width + content_padding,
+ Left = stripWidth + cover_width + content_padding,
Right = content_padding,
},
Children = new Drawable[]
@@ -217,6 +219,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Alpha = 0;
}
+ protected override bool ShouldBeConsideredForInput(Drawable child) => state == SelectionState.Selected;
+
private class RoomName : OsuSpriteText
{
[Resolved(typeof(Room), nameof(Online.Multiplayer.Room.Name))]
diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
index 2742ef3404..be1083ce8d 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
@@ -12,11 +12,11 @@ using osuTK.Graphics;
namespace osu.Game.Screens.Multi.Lounge.Components
{
- public class FilterControl : SearchableListFilterControl
+ public class FilterControl : SearchableListFilterControl
{
protected override Color4 BackgroundColour => Color4.Black.Opacity(0.5f);
- protected override PrimaryFilter DefaultTab => PrimaryFilter.Open;
- protected override SecondaryFilter DefaultCategory => SecondaryFilter.Public;
+ protected override RoomStatusFilter DefaultTab => RoomStatusFilter.Open;
+ protected override RoomCategoryFilter DefaultCategory => RoomCategoryFilter.Any;
protected override float ContentHorizontalPadding => base.ContentHorizontalPadding + OsuScreen.HORIZONTAL_OVERFLOW_PADDING;
@@ -43,6 +43,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
ruleset.BindValueChanged(_ => updateFilter());
Search.Current.BindValueChanged(_ => scheduleUpdateFilter());
+ Dropdown.Current.BindValueChanged(_ => updateFilter());
Tabs.Current.BindValueChanged(_ => updateFilter(), true);
}
@@ -61,26 +62,27 @@ namespace osu.Game.Screens.Multi.Lounge.Components
filter.Value = new FilterCriteria
{
SearchString = Search.Current.Value ?? string.Empty,
- PrimaryFilter = Tabs.Current.Value,
- SecondaryFilter = DisplayStyleControl.Dropdown.Current.Value,
+ StatusFilter = Tabs.Current.Value,
+ RoomCategoryFilter = Dropdown.Current.Value,
Ruleset = ruleset.Value
};
}
}
- public enum PrimaryFilter
+ public enum RoomStatusFilter
{
Open,
[Description("Recently Ended")]
- RecentlyEnded,
+ Ended,
Participated,
Owned,
}
- public enum SecondaryFilter
+ public enum RoomCategoryFilter
{
- Public,
- //Private,
+ Any,
+ Normal,
+ Spotlight
}
}
diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterCriteria.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterCriteria.cs
index 26d445e151..6d70225eec 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/FilterCriteria.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/FilterCriteria.cs
@@ -8,8 +8,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public class FilterCriteria
{
public string SearchString;
- public PrimaryFilter PrimaryFilter;
- public SecondaryFilter SecondaryFilter;
+ public RoomStatusFilter StatusFilter;
+ public RoomCategoryFilter RoomCategoryFilter;
public RulesetInfo Ruleset;
}
}
diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInfo.cs
index 02f2667802..e6f6ce5ed2 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/RoomInfo.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInfo.cs
@@ -4,9 +4,8 @@
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
-using osu.Game.Graphics.Sprites;
+using osu.Game.Graphics.Containers;
using osu.Game.Screens.Multi.Components;
using osuTK;
@@ -15,7 +14,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public class RoomInfo : MultiplayerComposite
{
private readonly List statusElements = new List();
- private readonly SpriteText roomName;
+ private readonly OsuTextFlowContainer roomName;
public RoomInfo()
{
@@ -43,18 +42,23 @@ namespace osu.Game.Screens.Multi.Lounge.Components
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- AutoSizeAxes = Axes.Both,
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
- roomName = new OsuSpriteText { Font = OsuFont.GetFont(size: 30) },
+ roomName = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 30))
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ },
statusInfo = new RoomStatusInfo(),
}
},
typeInfo = new ModeTypeInfo
{
- Anchor = Anchor.CentreRight,
- Origin = Anchor.CentreRight
+ Anchor = Anchor.BottomRight,
+ Origin = Anchor.BottomRight
}
}
},
diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs
index 891853dee5..77fbd606f4 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs
@@ -24,6 +24,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
+ OverlinedHeader participantsHeader;
+
InternalChildren = new Drawable[]
{
new Box
@@ -55,22 +57,31 @@ namespace osu.Game.Screens.Multi.Lounge.Components
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Vertical = 60 },
},
- new OverlinedParticipants(Direction.Horizontal)
+ participantsHeader = new OverlinedHeader("Recent Participants"),
+ new ParticipantsDisplay(Direction.Vertical)
{
RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y
- },
+ Height = ParticipantsList.TILE_SIZE * 3,
+ Details = { BindTarget = participantsHeader.Details }
+ }
}
}
},
+ new Drawable[] { new OverlinedHeader("Playlist"), },
new Drawable[]
{
- new OverlinedPlaylist(false) { RelativeSizeAxes = Axes.Both },
+ new DrawableRoomPlaylist(false, false)
+ {
+ RelativeSizeAxes = Axes.Both,
+ Items = { BindTarget = Playlist }
+ },
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
+ new Dimension(GridSizeMode.AutoSize),
+ new Dimension(),
}
}
}
diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs
index f14aa5fd8c..447c99039a 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs
@@ -9,13 +9,17 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Input.Bindings;
+using osu.Framework.Threading;
+using osu.Game.Extensions;
using osu.Game.Graphics.UserInterface;
+using osu.Game.Input.Bindings;
using osu.Game.Online.Multiplayer;
using osuTK;
namespace osu.Game.Screens.Multi.Lounge.Components
{
- public class RoomsContainer : CompositeDrawable
+ public class RoomsContainer : CompositeDrawable, IKeyBindingHandler
{
public Action JoinRequested;
@@ -73,14 +77,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
if (!string.IsNullOrEmpty(criteria.SearchString))
matchingFilter &= r.FilterTerms.Any(term => term.IndexOf(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase) >= 0);
- switch (criteria.SecondaryFilter)
- {
- default:
- case SecondaryFilter.Public:
- matchingFilter &= r.Room.Availability.Value == RoomAvailability.Public;
- break;
- }
-
r.MatchingFilter = matchingFilter;
}
});
@@ -88,8 +84,22 @@ namespace osu.Game.Screens.Multi.Lounge.Components
private void addRooms(IEnumerable rooms)
{
- foreach (var r in rooms)
- roomFlow.Add(new DrawableRoom(r) { Action = () => selectRoom(r) });
+ foreach (var room in rooms)
+ {
+ roomFlow.Add(new DrawableRoom(room)
+ {
+ Action = () =>
+ {
+ if (room == selectedRoom.Value)
+ {
+ joinSelected();
+ return;
+ }
+
+ selectRoom(room);
+ }
+ });
+ }
Filter(filter?.Value);
}
@@ -115,16 +125,100 @@ namespace osu.Game.Screens.Multi.Lounge.Components
private void selectRoom(Room room)
{
- var drawable = roomFlow.FirstOrDefault(r => r.Room == room);
-
- if (drawable != null && drawable.State == SelectionState.Selected)
- JoinRequested?.Invoke(room);
- else
- roomFlow.Children.ForEach(r => r.State = r.Room == room ? SelectionState.Selected : SelectionState.NotSelected);
-
+ roomFlow.Children.ForEach(r => r.State = r.Room == room ? SelectionState.Selected : SelectionState.NotSelected);
selectedRoom.Value = room;
}
+ private void joinSelected()
+ {
+ if (selectedRoom.Value == null) return;
+
+ JoinRequested?.Invoke(selectedRoom.Value);
+ }
+
+ #region Key selection logic (shared with BeatmapCarousel)
+
+ public bool OnPressed(GlobalAction action)
+ {
+ switch (action)
+ {
+ case GlobalAction.Select:
+ joinSelected();
+ return true;
+
+ case GlobalAction.SelectNext:
+ beginRepeatSelection(() => selectNext(1), action);
+ return true;
+
+ case GlobalAction.SelectPrevious:
+ beginRepeatSelection(() => selectNext(-1), action);
+ return true;
+ }
+
+ return false;
+ }
+
+ public void OnReleased(GlobalAction action)
+ {
+ switch (action)
+ {
+ case GlobalAction.SelectNext:
+ case GlobalAction.SelectPrevious:
+ endRepeatSelection(action);
+ break;
+ }
+ }
+
+ private ScheduledDelegate repeatDelegate;
+ private object lastRepeatSource;
+
+ ///
+ /// Begin repeating the specified selection action.
+ ///
+ /// The action to perform.
+ /// The source of the action. Used in conjunction with to only cancel the correct action (most recently pressed key).
+ private void beginRepeatSelection(Action action, object source)
+ {
+ endRepeatSelection();
+
+ lastRepeatSource = source;
+ repeatDelegate = this.BeginKeyRepeat(Scheduler, action);
+ }
+
+ private void endRepeatSelection(object source = null)
+ {
+ // only the most recent source should be able to cancel the current action.
+ if (source != null && !EqualityComparer