diff --git a/.github/ISSUE_TEMPLATE/mobile-issues.md b/.github/ISSUE_TEMPLATE/00-mobile-issues.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/mobile-issues.md
rename to .github/ISSUE_TEMPLATE/00-mobile-issues.md
diff --git a/.github/ISSUE_TEMPLATE/bug-issues.md b/.github/ISSUE_TEMPLATE/01-bug-issues.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/bug-issues.md
rename to .github/ISSUE_TEMPLATE/01-bug-issues.md
diff --git a/.github/ISSUE_TEMPLATE/crash-issues.md b/.github/ISSUE_TEMPLATE/02-crash-issues.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/crash-issues.md
rename to .github/ISSUE_TEMPLATE/02-crash-issues.md
diff --git a/.github/ISSUE_TEMPLATE/feature-request-issues.md b/.github/ISSUE_TEMPLATE/03-feature-request-issues.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/feature-request-issues.md
rename to .github/ISSUE_TEMPLATE/03-feature-request-issues.md
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000000..69baeee60c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: false
+contact_links:
+ - name: osu!stable issues
+ url: https://github.com/ppy/osu-stable-issues
+ about: For issues regarding osu!stable (not osu!lazer), open them here.
diff --git a/.github/ISSUE_TEMPLATE/missing-for-live-issues.md b/.github/ISSUE_TEMPLATE/missing-for-live-issues.md
deleted file mode 100644
index 5822da9c65..0000000000
--- a/.github/ISSUE_TEMPLATE/missing-for-live-issues.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-name: Missing for Live
-about: Features which are available in osu!stable but not yet in osu!lazer.
----
-**Describe the missing feature:**
-
-**Proposal designs of the feature:**
diff --git a/osu.Android.props b/osu.Android.props
index 43c1302e54..8b31be3f12 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -62,6 +62,6 @@
-
+
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
index 5df0b70f12..dde2aa53e0 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
@@ -16,6 +16,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK;
+using osuTK.Input;
namespace osu.Game.Rulesets.Osu.Tests
{
@@ -85,6 +86,93 @@ namespace osu.Game.Rulesets.Osu.Tests
checkPositions();
}
+ [Test]
+ public void TestSingleControlPointSelection()
+ {
+ moveMouseToControlPoint(0);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ checkControlPointSelected(0, true);
+ checkControlPointSelected(1, false);
+ }
+
+ [Test]
+ public void TestSingleControlPointDeselectionViaOtherControlPoint()
+ {
+ moveMouseToControlPoint(0);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+
+ moveMouseToControlPoint(1);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ checkControlPointSelected(0, false);
+ checkControlPointSelected(1, true);
+ }
+
+ [Test]
+ public void TestSingleControlPointDeselectionViaClickOutside()
+ {
+ moveMouseToControlPoint(0);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+
+ AddStep("move mouse outside control point", () => InputManager.MoveMouseTo(drawableObject));
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ checkControlPointSelected(0, false);
+ checkControlPointSelected(1, false);
+ }
+
+ [Test]
+ public void TestMultipleControlPointSelection()
+ {
+ moveMouseToControlPoint(0);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ moveMouseToControlPoint(1);
+ AddStep("ctrl + click", () =>
+ {
+ InputManager.PressKey(Key.ControlLeft);
+ InputManager.Click(MouseButton.Left);
+ InputManager.ReleaseKey(Key.ControlLeft);
+ });
+ checkControlPointSelected(0, true);
+ checkControlPointSelected(1, true);
+ }
+
+ [Test]
+ public void TestMultipleControlPointDeselectionViaOtherControlPoint()
+ {
+ moveMouseToControlPoint(0);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ moveMouseToControlPoint(1);
+ AddStep("ctrl + click", () =>
+ {
+ InputManager.PressKey(Key.ControlLeft);
+ InputManager.Click(MouseButton.Left);
+ InputManager.ReleaseKey(Key.ControlLeft);
+ });
+
+ moveMouseToControlPoint(2);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ checkControlPointSelected(0, false);
+ checkControlPointSelected(1, false);
+ }
+
+ [Test]
+ public void TestMultipleControlPointDeselectionViaClickOutside()
+ {
+ moveMouseToControlPoint(0);
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ moveMouseToControlPoint(1);
+ AddStep("ctrl + click", () =>
+ {
+ InputManager.PressKey(Key.ControlLeft);
+ InputManager.Click(MouseButton.Left);
+ InputManager.ReleaseKey(Key.ControlLeft);
+ });
+
+ AddStep("move mouse outside control point", () => InputManager.MoveMouseTo(drawableObject));
+ AddStep("click", () => InputManager.Click(MouseButton.Left));
+ checkControlPointSelected(0, false);
+ checkControlPointSelected(1, false);
+ }
+
private void moveHitObject()
{
AddStep("move hitobject", () =>
@@ -104,11 +192,24 @@ namespace osu.Game.Rulesets.Osu.Tests
() => Precision.AlmostEquals(blueprint.TailBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
}
+ private void moveMouseToControlPoint(int index)
+ {
+ AddStep($"move mouse to control point {index}", () =>
+ {
+ Vector2 position = slider.Position + slider.Path.ControlPoints[index];
+ InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position));
+ });
+ }
+
+ private void checkControlPointSelected(int index, bool selected)
+ => AddAssert($"control point {index} {(selected ? "selected" : "not selected")}", () => blueprint.ControlPointVisualiser.Pieces[index].IsSelected.Value == selected);
+
private class TestSliderBlueprint : SliderSelectionBlueprint
{
public new SliderBodyPiece BodyPiece => base.BodyPiece;
public new TestSliderCircleBlueprint HeadBlueprint => (TestSliderCircleBlueprint)base.HeadBlueprint;
public new TestSliderCircleBlueprint TailBlueprint => (TestSliderCircleBlueprint)base.TailBlueprint;
+ public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
public TestSliderBlueprint(DrawableSlider slider)
: base(slider)
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
index 7afb8fcf49..0353ba241c 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
@@ -3,6 +3,7 @@
using System;
using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines;
@@ -11,18 +12,22 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class PathControlPointPiece : BlueprintPiece
{
+ public Action RequestSelection;
public Action ControlPointsChanged;
- private readonly Slider slider;
- private readonly int index;
+ public readonly BindableBool IsSelected = new BindableBool();
+ public readonly int Index;
+ private readonly Slider slider;
private readonly Path path;
- private readonly CircularContainer marker;
+ private readonly Container marker;
+ private readonly Drawable markerRing;
[Resolved]
private OsuColour colours { get; set; }
@@ -30,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
public PathControlPointPiece(Slider slider, int index)
{
this.slider = slider;
- this.index = index;
+ Index = index;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
@@ -42,13 +47,36 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
Anchor = Anchor.Centre,
PathRadius = 1
},
- marker = new CircularContainer
+ marker = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Size = new Vector2(10),
- Masking = true,
- Child = new Box { RelativeSizeAxes = Axes.Both }
+ AutoSizeAxes = Axes.Both,
+ Children = new[]
+ {
+ new Circle
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(10),
+ },
+ markerRing = new CircularContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(14),
+ Masking = true,
+ BorderThickness = 2,
+ BorderColour = Color4.White,
+ Alpha = 0,
+ Child = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0,
+ AlwaysPresent = true
+ }
+ }
+ }
}
};
}
@@ -57,30 +85,66 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
base.Update();
- Position = slider.StackedPosition + slider.Path.ControlPoints[index];
+ Position = slider.StackedPosition + slider.Path.ControlPoints[Index];
- marker.Colour = isSegmentSeparator ? colours.Red : colours.Yellow;
+ updateMarkerDisplay();
+ updateConnectingPath();
+ }
+ ///
+ /// Updates the state of the circular control point marker.
+ ///
+ private void updateMarkerDisplay()
+ {
+ markerRing.Alpha = IsSelected.Value ? 1 : 0;
+
+ Color4 colour = isSegmentSeparator ? colours.Red : colours.Yellow;
+ if (IsHovered || IsSelected.Value)
+ colour = Color4.White;
+ marker.Colour = colour;
+ }
+
+ ///
+ /// Updates the path connecting this control point to the previous one.
+ ///
+ private void updateConnectingPath()
+ {
path.ClearVertices();
- if (index != slider.Path.ControlPoints.Length - 1)
+ if (Index != slider.Path.ControlPoints.Length - 1)
{
path.AddVertex(Vector2.Zero);
- path.AddVertex(slider.Path.ControlPoints[index + 1] - slider.Path.ControlPoints[index]);
+ path.AddVertex(slider.Path.ControlPoints[Index + 1] - slider.Path.ControlPoints[Index]);
}
path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero);
}
+ // The connecting path is excluded from positional input
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => marker.ReceivePositionalInputAt(screenSpacePos);
+ protected override bool OnMouseDown(MouseDownEvent e)
+ {
+ if (RequestSelection != null)
+ {
+ RequestSelection.Invoke(Index);
+ return true;
+ }
+
+ return false;
+ }
+
+ protected override bool OnMouseUp(MouseUpEvent e) => RequestSelection != null;
+
+ protected override bool OnClick(ClickEvent e) => RequestSelection != null;
+
protected override bool OnDragStart(DragStartEvent e) => true;
protected override bool OnDrag(DragEvent e)
{
var newControlPoints = slider.Path.ControlPoints.ToArray();
- if (index == 0)
+ if (Index == 0)
{
// Special handling for the head - only the position of the slider changes
slider.Position += e.Delta;
@@ -90,13 +154,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
newControlPoints[i] -= e.Delta;
}
else
- newControlPoints[index] += e.Delta;
+ newControlPoints[Index] += e.Delta;
if (isSegmentSeparatorWithNext)
- newControlPoints[index + 1] = newControlPoints[index];
+ newControlPoints[Index + 1] = newControlPoints[Index];
if (isSegmentSeparatorWithPrevious)
- newControlPoints[index - 1] = newControlPoints[index];
+ newControlPoints[Index - 1] = newControlPoints[Index];
ControlPointsChanged?.Invoke(newControlPoints);
@@ -107,8 +171,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
private bool isSegmentSeparator => isSegmentSeparatorWithNext || isSegmentSeparatorWithPrevious;
- private bool isSegmentSeparatorWithNext => index < slider.Path.ControlPoints.Length - 1 && slider.Path.ControlPoints[index + 1] == slider.Path.ControlPoints[index];
+ private bool isSegmentSeparatorWithNext => Index < slider.Path.ControlPoints.Length - 1 && slider.Path.ControlPoints[Index + 1] == slider.Path.ControlPoints[Index];
- private bool isSegmentSeparatorWithPrevious => index > 0 && slider.Path.ControlPoints[index - 1] == slider.Path.ControlPoints[index];
+ private bool isSegmentSeparatorWithPrevious => Index > 0 && slider.Path.ControlPoints[Index - 1] == slider.Path.ControlPoints[Index];
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
index 0385824b27..6962736157 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -2,36 +2,132 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using System.Collections.Generic;
+using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Input;
+using osu.Framework.Input.Bindings;
+using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Screens.Edit.Compose;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class PathControlPointVisualiser : CompositeDrawable
+ public class PathControlPointVisualiser : CompositeDrawable, IKeyBindingHandler
{
public Action ControlPointsChanged;
+ internal readonly Container Pieces;
private readonly Slider slider;
+ private readonly bool allowSelection;
- private readonly Container pieces;
+ private InputManager inputManager;
- public PathControlPointVisualiser(Slider slider)
+ [Resolved(CanBeNull = true)]
+ private IPlacementHandler placementHandler { get; set; }
+
+ public PathControlPointVisualiser(Slider slider, bool allowSelection)
{
this.slider = slider;
+ this.allowSelection = allowSelection;
- InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both };
+ RelativeSizeAxes = Axes.Both;
+
+ InternalChild = Pieces = new Container { RelativeSizeAxes = Axes.Both };
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ inputManager = GetContainingInputManager();
}
protected override void Update()
{
base.Update();
- while (slider.Path.ControlPoints.Length > pieces.Count)
- pieces.Add(new PathControlPointPiece(slider, pieces.Count) { ControlPointsChanged = c => ControlPointsChanged?.Invoke(c) });
- while (slider.Path.ControlPoints.Length < pieces.Count)
- pieces.Remove(pieces[pieces.Count - 1]);
+ while (slider.Path.ControlPoints.Length > Pieces.Count)
+ {
+ var piece = new PathControlPointPiece(slider, Pieces.Count)
+ {
+ ControlPointsChanged = c => ControlPointsChanged?.Invoke(c),
+ };
+
+ if (allowSelection)
+ piece.RequestSelection = selectPiece;
+
+ Pieces.Add(piece);
+ }
+
+ while (slider.Path.ControlPoints.Length < Pieces.Count)
+ Pieces.Remove(Pieces[Pieces.Count - 1]);
}
+
+ protected override bool OnClick(ClickEvent e)
+ {
+ foreach (var piece in Pieces)
+ piece.IsSelected.Value = false;
+ return false;
+ }
+
+ private void selectPiece(int index)
+ {
+ if (inputManager.CurrentState.Keyboard.ControlPressed)
+ Pieces[index].IsSelected.Toggle();
+ else
+ {
+ foreach (var piece in Pieces)
+ piece.IsSelected.Value = piece.Index == index;
+ }
+ }
+
+ public bool OnPressed(PlatformAction action)
+ {
+ switch (action.ActionMethod)
+ {
+ case PlatformActionMethod.Delete:
+ var newControlPoints = new List();
+
+ foreach (var piece in Pieces)
+ {
+ if (!piece.IsSelected.Value)
+ newControlPoints.Add(slider.Path.ControlPoints[piece.Index]);
+ }
+
+ // Ensure that there are any points to be deleted
+ if (newControlPoints.Count == slider.Path.ControlPoints.Length)
+ return false;
+
+ // If there are 0 remaining control points, treat the slider as being deleted
+ if (newControlPoints.Count == 0)
+ {
+ placementHandler?.Delete(slider);
+ return true;
+ }
+
+ // Make control points relative
+ Vector2 first = newControlPoints[0];
+ for (int i = 0; i < newControlPoints.Count; i++)
+ newControlPoints[i] = newControlPoints[i] - first;
+
+ // The slider's position defines the position of the first control point, and all further control points are relative to that point
+ slider.Position = slider.Position + first;
+
+ // Since pieces are re-used, they will not point to the deleted control points while remaining selected
+ foreach (var piece in Pieces)
+ piece.IsSelected.Value = false;
+
+ ControlPointsChanged?.Invoke(newControlPoints.ToArray());
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
index d28cf7b492..78f4c4d992 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
@@ -43,5 +43,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
Size = body.Size;
OriginPosition = body.PathOffset;
}
+
+ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos);
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
index 6f5309c2c2..9c0afada29 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
@@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
bodyPiece = new SliderBodyPiece(),
headCirclePiece = new HitCirclePiece(),
tailCirclePiece = new HitCirclePiece(),
- new PathControlPointVisualiser(HitObject) { ControlPointsChanged = _ => updateSlider() },
+ new PathControlPointVisualiser(HitObject, false) { ControlPointsChanged = _ => updateSlider() },
};
setState(PlacementState.Initial);
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
index b09f598bcc..25362820a3 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
@@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
protected readonly SliderBodyPiece BodyPiece;
protected readonly SliderCircleSelectionBlueprint HeadBlueprint;
protected readonly SliderCircleSelectionBlueprint TailBlueprint;
+ protected readonly PathControlPointVisualiser ControlPointVisualiser;
[Resolved(CanBeNull = true)]
private HitObjectComposer composer { get; set; }
@@ -32,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
BodyPiece = new SliderBodyPiece(),
HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
- new PathControlPointVisualiser(sliderObject) { ControlPointsChanged = onNewControlPoints },
+ ControlPointVisualiser = new PathControlPointVisualiser(sliderObject, true) { ControlPointsChanged = onNewControlPoints },
};
}
@@ -49,6 +50,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
var snappedDistance = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)unsnappedPath.Distance) ?? (float)unsnappedPath.Distance;
HitObject.Path = new SliderPath(unsnappedPath.Type, controlPoints, snappedDistance);
+
+ UpdateHitObject();
}
public override Vector2 SelectionPoint => HeadBlueprint.SelectionPoint;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
index 62c4ba5ee3..7c94568835 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
@@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
-using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Skinning;
@@ -30,17 +29,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Children = new Drawable[]
{
- new CircularContainer
+ new Container
{
Masking = true,
- Origin = Anchor.Centre,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Radius = 60,
Colour = Color4.White.Opacity(0.5f),
},
- Child = new Box()
},
number = new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs
index 010bf072e8..f60b7e67b2 100644
--- a/osu.Game.Rulesets.Osu/Objects/Slider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs
@@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Osu.Objects
{
PathBindable.Value = value;
endPositionCache.Invalidate();
+
+ updateNestedPositions();
}
}
@@ -48,14 +50,9 @@ namespace osu.Game.Rulesets.Osu.Objects
set
{
base.Position = value;
-
endPositionCache.Invalidate();
- if (HeadCircle != null)
- HeadCircle.Position = value;
-
- if (TailCircle != null)
- TailCircle.Position = EndPosition;
+ updateNestedPositions();
}
}
@@ -197,6 +194,15 @@ namespace osu.Game.Rulesets.Osu.Objects
}
}
+ private void updateNestedPositions()
+ {
+ if (HeadCircle != null)
+ HeadCircle.Position = Position;
+
+ if (TailCircle != null)
+ TailCircle.Position = EndPosition;
+ }
+
private List getNodeSamples(int nodeIndex) =>
nodeIndex < NodeSamples.Count ? NodeSamples[nodeIndex] : Samples;
diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
index 8347d255fa..3b18e41f30 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -38,9 +38,10 @@ namespace osu.Game.Rulesets.Osu.UI
});
}
- public override void Show()
+ protected override void PopIn()
{
- base.Show();
+ base.PopIn();
+
GameplayCursor.ActiveCursor.Hide();
cursorScaleContainer.MoveTo(GameplayCursor.ActiveCursor.Position);
clickToResumeCursor.Appear();
@@ -55,13 +56,13 @@ namespace osu.Game.Rulesets.Osu.UI
}
}
- public override void Hide()
+ protected override void PopOut()
{
+ base.PopOut();
+
localCursorContainer?.Expire();
localCursorContainer = null;
- GameplayCursor.ActiveCursor.Show();
-
- base.Hide();
+ GameplayCursor?.ActiveCursor?.Show();
}
protected override bool OnHover(HoverEvent e) => true;
diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
index 7317771bac..2ecc516919 100644
--- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
@@ -167,9 +167,9 @@ namespace osu.Game.Tests.Beatmaps.Formats
var controlPoints = beatmap.ControlPointInfo;
Assert.AreEqual(4, controlPoints.TimingPoints.Count);
- Assert.AreEqual(6, controlPoints.DifficultyPoints.Count);
+ Assert.AreEqual(5, controlPoints.DifficultyPoints.Count);
Assert.AreEqual(34, controlPoints.SamplePoints.Count);
- Assert.AreEqual(9, controlPoints.EffectPoints.Count);
+ Assert.AreEqual(8, controlPoints.EffectPoints.Count);
var timingPoint = controlPoints.TimingPointAt(0);
Assert.AreEqual(956, timingPoint.Time);
@@ -191,7 +191,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier);
difficultyPoint = controlPoints.DifficultyPointAt(48428);
- Assert.AreEqual(956, difficultyPoint.Time);
+ Assert.AreEqual(0, difficultyPoint.Time);
Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier);
difficultyPoint = controlPoints.DifficultyPointAt(116999);
@@ -262,6 +262,21 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
}
+ [Test]
+ public void TestTimingPointResetsSpeedMultiplier()
+ {
+ var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
+
+ using (var resStream = TestResources.OpenResource("timingpoint-speedmultiplier-reset.osu"))
+ using (var stream = new LineBufferedReader(resStream))
+ {
+ var controlPoints = decoder.Decode(stream).ControlPointInfo;
+
+ Assert.That(controlPoints.DifficultyPointAt(0).SpeedMultiplier, Is.EqualTo(0.5).Within(0.1));
+ Assert.That(controlPoints.DifficultyPointAt(2000).SpeedMultiplier, Is.EqualTo(1).Within(0.1));
+ }
+ }
+
[Test]
public void TestDecodeBeatmapColours()
{
@@ -362,6 +377,23 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
}
+ [Test]
+ public void TestDecodeControlPointDifficultyChange()
+ {
+ var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
+
+ using (var resStream = TestResources.OpenResource("controlpoint-difficulty-multiplier.osu"))
+ using (var stream = new LineBufferedReader(resStream))
+ {
+ var controlPointInfo = decoder.Decode(stream).ControlPointInfo;
+
+ Assert.That(controlPointInfo.DifficultyPointAt(5).SpeedMultiplier, Is.EqualTo(1));
+ Assert.That(controlPointInfo.DifficultyPointAt(1000).SpeedMultiplier, Is.EqualTo(10));
+ Assert.That(controlPointInfo.DifficultyPointAt(2000).SpeedMultiplier, Is.EqualTo(1.8518518518518519d));
+ Assert.That(controlPointInfo.DifficultyPointAt(3000).SpeedMultiplier, Is.EqualTo(0.5));
+ }
+ }
+
[Test]
public void TestDecodeControlPointCustomSampleBank()
{
diff --git a/osu.Game.Tests/Resources/controlpoint-difficulty-multiplier.osu b/osu.Game.Tests/Resources/controlpoint-difficulty-multiplier.osu
new file mode 100644
index 0000000000..5f06fc33c8
--- /dev/null
+++ b/osu.Game.Tests/Resources/controlpoint-difficulty-multiplier.osu
@@ -0,0 +1,8 @@
+osu file format v7
+
+[TimingPoints]
+0,100,4,2,0,100,1,0
+12,500,4,2,0,100,1,0
+1000,-10,4,2,0,100,0,0
+2000,-54,4,2,0,100,0,0
+3000,-200,4,2,0,100,0,0
diff --git a/osu.Game.Tests/Resources/timingpoint-speedmultiplier-reset.osu b/osu.Game.Tests/Resources/timingpoint-speedmultiplier-reset.osu
new file mode 100644
index 0000000000..4512903c68
--- /dev/null
+++ b/osu.Game.Tests/Resources/timingpoint-speedmultiplier-reset.osu
@@ -0,0 +1,5 @@
+osu file format v14
+
+[TimingPoints]
+0,-200,4,1,0,100,0,0
+2000,100,1,1,0,100,1,0
diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs
index 2df22df659..64022b2410 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs
@@ -69,6 +69,24 @@ namespace osu.Game.Tests.Visual.Gameplay
confirmClockRunning(true);
}
+ [Test]
+ public void TestPauseWithResumeOverlay()
+ {
+ AddStep("move cursor to center", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.Centre));
+ AddUntilStep("wait for hitobjects", () => Player.ScoreProcessor.Health.Value < 1);
+
+ pauseAndConfirm();
+
+ resume();
+ confirmClockRunning(false);
+ confirmPauseOverlayShown(false);
+
+ pauseAndConfirm();
+
+ AddUntilStep("resume overlay is not active", () => Player.DrawableRuleset.ResumeOverlay.State.Value == Visibility.Hidden);
+ confirmPaused();
+ }
+
[Test]
public void TestResumeWithResumeOverlaySkipped()
{
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs
index 0dfcda122f..7b22fedbd5 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs
@@ -7,11 +7,10 @@ using osu.Game.Online;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
-using osu.Game.Screens.Play;
using osu.Game.Users;
-using osuTK;
using System;
using System.Collections.Generic;
+using osu.Game.Screens.Ranking.Pages;
namespace osu.Game.Tests.Visual.Gameplay
{
@@ -42,7 +41,6 @@ namespace osu.Game.Tests.Visual.Gameplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Size = new Vector2(80, 40),
};
});
}
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs
index 944480243d..cdfb3beb19 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs
@@ -3,6 +3,7 @@
using NUnit.Framework;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.PlayerSettings;
@@ -20,6 +21,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
+ State = { Value = Visibility.Visible }
});
Add(container = new ExampleContainer());
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneResults.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneResults.cs
index f3c8f89db7..7790126db5 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneResults.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneResults.cs
@@ -3,11 +3,16 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
+using osu.Game.Screens;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Ranking.Pages;
@@ -22,11 +27,13 @@ namespace osu.Game.Tests.Visual.Gameplay
public override IReadOnlyList RequiredTypes => new[]
{
- typeof(ScoreInfo),
typeof(Results),
typeof(ResultsPage),
typeof(ScoreResultsPage),
- typeof(LocalLeaderboardPage)
+ typeof(RetryButton),
+ typeof(ReplayDownloadButton),
+ typeof(LocalLeaderboardPage),
+ typeof(TestPlayer)
};
[BackgroundDependencyLoader]
@@ -42,26 +49,82 @@ namespace osu.Game.Tests.Visual.Gameplay
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
if (beatmapInfo != null)
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
+ }
- LoadScreen(new SoloResults(new ScoreInfo
+ private TestSoloResults createResultsScreen() => new TestSoloResults(new ScoreInfo
+ {
+ TotalScore = 2845370,
+ Accuracy = 0.98,
+ MaxCombo = 123,
+ Rank = ScoreRank.A,
+ Date = DateTimeOffset.Now,
+ Statistics = new Dictionary
{
- TotalScore = 2845370,
- Accuracy = 0.98,
- MaxCombo = 123,
- Rank = ScoreRank.A,
- Date = DateTimeOffset.Now,
- Statistics = new Dictionary
+ { HitResult.Great, 50 },
+ { HitResult.Good, 20 },
+ { HitResult.Meh, 50 },
+ { HitResult.Miss, 1 }
+ },
+ User = new User
+ {
+ Username = "peppy",
+ }
+ });
+
+ [Test]
+ public void ResultsWithoutPlayer()
+ {
+ TestSoloResults screen = null;
+
+ AddStep("load results", () => Child = new OsuScreenStack(screen = createResultsScreen())
+ {
+ RelativeSizeAxes = Axes.Both
+ });
+ AddUntilStep("wait for loaded", () => screen.IsLoaded);
+ AddAssert("retry overlay not present", () => screen.RetryOverlay == null);
+ }
+
+ [Test]
+ public void ResultsWithPlayer()
+ {
+ TestSoloResults screen = null;
+
+ AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen()));
+ AddUntilStep("wait for loaded", () => screen.IsLoaded);
+ AddAssert("retry overlay present", () => screen.RetryOverlay != null);
+ }
+
+ private class TestResultsContainer : Container
+ {
+ [Cached(typeof(Player))]
+ private readonly Player player = new TestPlayer();
+
+ public TestResultsContainer(IScreen screen)
+ {
+ RelativeSizeAxes = Axes.Both;
+
+ InternalChild = new OsuScreenStack(screen)
{
- { HitResult.Great, 50 },
- { HitResult.Good, 20 },
- { HitResult.Meh, 50 },
- { HitResult.Miss, 1 }
- },
- User = new User
- {
- Username = "peppy",
- }
- }));
+ RelativeSizeAxes = Axes.Both,
+ };
+ }
+ }
+
+ private class TestSoloResults : SoloResults
+ {
+ public HotkeyRetryOverlay RetryOverlay;
+
+ public TestSoloResults(ScoreInfo score)
+ : base(score)
+ {
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ RetryOverlay = InternalChildren.OfType().SingleOrDefault();
+ }
}
}
}
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs
index 000832b784..61fed3013e 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs
@@ -33,23 +33,15 @@ namespace osu.Game.Tests.Visual.Menus
[Test]
public void TestInstantLoad()
{
- bool logoVisible = false;
+ // visual only, very impossible to test this using asserts.
- AddStep("begin loading", () =>
+ AddStep("load immediately", () =>
{
loader = new TestLoader();
loader.AllowLoad.Set();
LoadScreen(loader);
});
-
- AddUntilStep("loaded", () =>
- {
- logoVisible = loader.Logo?.Alpha > 0;
- return loader.Logo != null && loader.ScreenLoaded;
- });
-
- AddAssert("logo was not visible", () => !logoVisible);
}
[Test]
@@ -58,7 +50,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0);
AddStep("finish loading", () => loader.AllowLoad.Set());
- AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded);
+ AddUntilStep("loaded", () => loader.Logo != null && loader.ScreenLoaded);
AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
}
diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs
new file mode 100644
index 0000000000..1f8df438fb
--- /dev/null
+++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs
@@ -0,0 +1,102 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.UserInterface;
+using osu.Game.Beatmaps;
+using osu.Game.Overlays.BeatmapSet;
+using osu.Game.Rulesets;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace osu.Game.Tests.Visual.Online
+{
+ public class TestSceneBeatmapRulesetSelector : OsuTestScene
+ {
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(BeatmapRulesetSelector),
+ typeof(BeatmapRulesetTabItem),
+ };
+
+ private readonly TestRulesetSelector selector;
+
+ public TestSceneBeatmapRulesetSelector()
+ {
+ Add(selector = new TestRulesetSelector());
+ }
+
+ [Resolved]
+ private RulesetStore rulesets { get; set; }
+
+ [Test]
+ public void TestMultipleRulesetsBeatmapSet()
+ {
+ var enabledRulesets = rulesets.AvailableRulesets.Skip(1).Take(2);
+
+ AddStep("load multiple rulesets beatmapset", () =>
+ {
+ selector.BeatmapSet = new BeatmapSetInfo
+ {
+ Beatmaps = enabledRulesets.Select(r => new BeatmapInfo { Ruleset = r }).ToList()
+ };
+ });
+
+ var tabItems = selector.TabContainer.TabItems;
+ AddAssert("other rulesets disabled", () => tabItems.Except(tabItems.Where(t => enabledRulesets.Any(r => r.Equals(t.Value)))).All(t => !t.Enabled.Value));
+ AddAssert("left-most ruleset selected", () => tabItems.First(t => t.Enabled.Value).Active.Value);
+ }
+
+ [Test]
+ public void TestSingleRulesetBeatmapSet()
+ {
+ var enabledRuleset = rulesets.AvailableRulesets.Last();
+
+ AddStep("load single ruleset beatmapset", () =>
+ {
+ selector.BeatmapSet = new BeatmapSetInfo
+ {
+ Beatmaps = new List
+ {
+ new BeatmapInfo
+ {
+ Ruleset = enabledRuleset
+ }
+ }
+ };
+ });
+
+ AddAssert("single ruleset selected", () => selector.SelectedTab.Value.Equals(enabledRuleset));
+ }
+
+ [Test]
+ public void TestEmptyBeatmapSet()
+ {
+ AddStep("load empty beatmapset", () => selector.BeatmapSet = new BeatmapSetInfo
+ {
+ Beatmaps = new List()
+ });
+
+ AddAssert("no ruleset selected", () => selector.SelectedTab == null);
+ AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value));
+ }
+
+ [Test]
+ public void TestNullBeatmapSet()
+ {
+ AddStep("load null beatmapset", () => selector.BeatmapSet = null);
+
+ AddAssert("no ruleset selected", () => selector.SelectedTab == null);
+ AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value));
+ }
+
+ private class TestRulesetSelector : BeatmapRulesetSelector
+ {
+ public new TabItem SelectedTab => base.SelectedTab;
+
+ public new TabFillFlowContainer TabContainer => base.TabContainer;
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs
index 9f03d947b9..286971bc90 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs
@@ -40,24 +40,19 @@ namespace osu.Game.Tests.Visual.Online
typeof(PreviewButton),
typeof(SuccessRate),
typeof(BeatmapAvailability),
+ typeof(BeatmapRulesetSelector),
+ typeof(BeatmapRulesetTabItem),
};
protected override bool UseOnlineAPI => true;
- private RulesetInfo taikoRuleset;
- private RulesetInfo maniaRuleset;
-
public TestSceneBeatmapSetOverlay()
{
Add(overlay = new TestBeatmapSetOverlay());
}
- [BackgroundDependencyLoader]
- private void load(RulesetStore rulesets)
- {
- taikoRuleset = rulesets.GetRuleset(1);
- maniaRuleset = rulesets.GetRuleset(3);
- }
+ [Resolved]
+ private RulesetStore rulesets { get; set; }
[Test]
public void TestLoading()
@@ -111,7 +106,7 @@ namespace osu.Game.Tests.Visual.Online
StarDifficulty = 9.99,
Version = @"TEST",
Length = 456000,
- Ruleset = maniaRuleset,
+ Ruleset = rulesets.GetRuleset(3),
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 1,
@@ -189,7 +184,7 @@ namespace osu.Game.Tests.Visual.Online
StarDifficulty = 5.67,
Version = @"ANOTHER TEST",
Length = 123000,
- Ruleset = taikoRuleset,
+ Ruleset = rulesets.GetRuleset(1),
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 9,
@@ -217,6 +212,54 @@ namespace osu.Game.Tests.Visual.Online
downloadAssert(false);
}
+ [Test]
+ public void TestMultipleRulesets()
+ {
+ AddStep("show multiple rulesets beatmap", () =>
+ {
+ var beatmaps = new List();
+
+ foreach (var ruleset in rulesets.AvailableRulesets.Skip(1))
+ {
+ beatmaps.Add(new BeatmapInfo
+ {
+ Version = ruleset.Name,
+ Ruleset = ruleset,
+ BaseDifficulty = new BeatmapDifficulty(),
+ OnlineInfo = new BeatmapOnlineInfo(),
+ Metrics = new BeatmapMetrics
+ {
+ Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
+ Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
+ },
+ });
+ }
+
+ overlay.ShowBeatmapSet(new BeatmapSetInfo
+ {
+ Metadata = new BeatmapMetadata
+ {
+ Title = @"multiple rulesets beatmap",
+ Artist = @"none",
+ Author = new User
+ {
+ Username = "BanchoBot",
+ Id = 3,
+ }
+ },
+ OnlineInfo = new BeatmapSetOnlineInfo
+ {
+ Covers = new BeatmapSetOnlineCovers(),
+ },
+ Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
+ Beatmaps = beatmaps
+ });
+ });
+
+ AddAssert("shown beatmaps of current ruleset", () => overlay.Header.Picker.Difficulties.All(b => b.Beatmap.Ruleset.Equals(overlay.Header.RulesetSelector.Current.Value)));
+ AddAssert("left-most beatmap selected", () => overlay.Header.Picker.Difficulties.First().State == BeatmapPicker.DifficultySelectorState.Selected);
+ }
+
[Test]
public void TestHide()
{
@@ -281,12 +324,12 @@ namespace osu.Game.Tests.Visual.Online
private void downloadAssert(bool shown)
{
- AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.DownloadButtonsVisible == shown);
+ AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.DownloadButtonsVisible == shown);
}
private class TestBeatmapSetOverlay : BeatmapSetOverlay
{
- public bool DownloadButtonsVisible => Header.DownloadButtonsVisible;
+ public new Header Header => base.Header;
}
}
}
diff --git a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs
index 39c2fbfcc9..01400bf1d9 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs
@@ -7,6 +7,10 @@ using osu.Game.Online.Chat;
using osu.Game.Users;
using osuTK;
using System;
+using System.Linq;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Graphics.Containers;
+using osu.Game.Overlays.Chat;
namespace osu.Game.Tests.Visual.Online
{
@@ -42,14 +46,14 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private ChannelManager channelManager = new ChannelManager();
- private readonly StandAloneChatDisplay chatDisplay;
- private readonly StandAloneChatDisplay chatDisplay2;
+ private readonly TestStandAloneChatDisplay chatDisplay;
+ private readonly TestStandAloneChatDisplay chatDisplay2;
public TestSceneStandAloneChatDisplay()
{
Add(channelManager);
- Add(chatDisplay = new StandAloneChatDisplay
+ Add(chatDisplay = new TestStandAloneChatDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@@ -57,7 +61,7 @@ namespace osu.Game.Tests.Visual.Online
Size = new Vector2(400, 80)
});
- Add(chatDisplay2 = new StandAloneChatDisplay(true)
+ Add(chatDisplay2 = new TestStandAloneChatDisplay(true)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
@@ -119,6 +123,49 @@ namespace osu.Game.Tests.Visual.Online
Content = "Message from the future!",
Timestamp = DateTimeOffset.Now
}));
+
+ AddUntilStep("ensure still scrolled to bottom", () => chatDisplay.ScrolledToBottom);
+
+ const int messages_per_call = 10;
+ AddRepeatStep("add many messages", () =>
+ {
+ for (int i = 0; i < messages_per_call; i++)
+ testChannel.AddNewMessages(new Message(sequence++)
+ {
+ Sender = longUsernameUser,
+ Content = "Many messages! " + Guid.NewGuid(),
+ Timestamp = DateTimeOffset.Now
+ });
+ }, Channel.MAX_HISTORY / messages_per_call + 5);
+
+ AddAssert("Ensure no adjacent day separators", () =>
+ {
+ var indices = chatDisplay.FillFlow.OfType().Select(ds => chatDisplay.FillFlow.IndexOf(ds));
+
+ foreach (var i in indices)
+ if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DrawableChannel.DaySeparator)
+ return false;
+
+ return true;
+ });
+
+ AddUntilStep("ensure still scrolled to bottom", () => chatDisplay.ScrolledToBottom);
+ }
+
+ private class TestStandAloneChatDisplay : StandAloneChatDisplay
+ {
+ public TestStandAloneChatDisplay(bool textbox = false)
+ : base(textbox)
+ {
+ }
+
+ protected DrawableChannel DrawableChannel => InternalChildren.OfType().First();
+
+ protected OsuScrollContainer ScrollContainer => (OsuScrollContainer)((Container)DrawableChannel.Child).Child;
+
+ public FillFlowContainer FillFlow => (FillFlowContainer)ScrollContainer.Child;
+
+ public bool ScrolledToBottom => ScrollContainer.IsScrolledToEnd(1);
}
}
}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
index f87d6ebebb..8b82567a8d 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
@@ -245,6 +245,28 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!"));
}
+ [Test]
+ public void TestSortingStability()
+ {
+ var sets = new List();
+
+ for (int i = 0; i < 20; i++)
+ {
+ var set = createTestBeatmapSet(i);
+ set.Metadata.Artist = "same artist";
+ set.Metadata.Title = "same title";
+ sets.Add(set);
+ }
+
+ loadBeatmaps(sets);
+
+ AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
+ AddAssert("Items remain in original order", () => carousel.BeatmapSets.Select((set, index) => set.ID == index).All(b => b));
+
+ AddStep("Sort by title", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Title }, false));
+ AddAssert("Items remain in original order", () => carousel.BeatmapSets.Select((set, index) => set.ID == index).All(b => b));
+ }
+
[Test]
public void TestSortingWithFiltered()
{
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
index b6df559686..ed44d82bce 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
@@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
-using Microsoft.EntityFrameworkCore.Internal;
+using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
@@ -153,7 +153,7 @@ namespace osu.Game.Tests.Visual.UserInterface
};
}
- private IReadOnlyList timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints;
+ private List timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.ToList();
private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
{
diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs
index dbfa70704b..21552882ef 100644
--- a/osu.Game.Tournament/TournamentGameBase.cs
+++ b/osu.Game.Tournament/TournamentGameBase.cs
@@ -215,7 +215,7 @@ namespace osu.Game.Tournament
foreach (var r in ladder.Rounds)
foreach (var b in r.Beatmaps)
- if (b.BeatmapInfo == null)
+ if (b.BeatmapInfo == null && b.ID > 0)
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
req.Perform(API);
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index dd2044b4bc..6e485f642a 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -392,8 +392,15 @@ namespace osu.Game.Beatmaps
req.Failure += e => { LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})"); };
- // intentionally blocking to limit web request concurrency
- req.Perform(api);
+ try
+ {
+ // intentionally blocking to limit web request concurrency
+ req.Perform(api);
+ }
+ catch (Exception e)
+ {
+ LogForModel(set, $"Online retrieval failed for {beatmap} ({e.Message})");
+ }
}
}
}
diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
index 5589aecc19..aeb5df46f8 100644
--- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
@@ -379,7 +379,7 @@ namespace osu.Game.Beatmaps.Formats
addControlPoint(time, controlPoint, true);
}
- addControlPoint(time, new DifficultyControlPoint
+ addControlPoint(time, new LegacyDifficultyControlPoint
{
SpeedMultiplier = speedMultiplier,
}, timingChange);
@@ -411,15 +411,15 @@ namespace osu.Game.Beatmaps.Formats
private void addControlPoint(double time, ControlPoint point, bool timingChange)
{
+ if (time != pendingControlPointsTime)
+ flushPendingPoints();
+
if (timingChange)
{
beatmap.ControlPointInfo.Add(time, point);
return;
}
- if (time != pendingControlPointsTime)
- flushPendingPoints();
-
pendingControlPoints.Add(point);
pendingControlPointsTime = time;
}
diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
index a5a4380d4a..2b914669cb 100644
--- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
@@ -189,6 +189,14 @@ namespace osu.Game.Beatmaps.Formats
Foreground = 3
}
+ internal class LegacyDifficultyControlPoint : DifficultyControlPoint
+ {
+ public LegacyDifficultyControlPoint()
+ {
+ SpeedMultiplierBindable.Precision = double.Epsilon;
+ }
+ }
+
internal class LegacySampleControlPoint : SampleControlPoint
{
public int CustomSampleBank;
diff --git a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs
index a16d391b99..527f520172 100644
--- a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs
@@ -28,11 +28,11 @@ namespace osu.Game.Beatmaps.Formats
}
protected override TimingControlPoint CreateTimingControlPoint()
- => new LegacyDifficultyCalculatorControlPoint();
+ => new LegacyDifficultyCalculatorTimingControlPoint();
- private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint
+ private class LegacyDifficultyCalculatorTimingControlPoint : TimingControlPoint
{
- public LegacyDifficultyCalculatorControlPoint()
+ public LegacyDifficultyCalculatorTimingControlPoint()
{
BeatLengthBindable.MinValue = double.MinValue;
BeatLengthBindable.MaxValue = double.MaxValue;
diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs
index b567f0c0e3..9fed8e03ac 100644
--- a/osu.Game/Database/ArchiveModelManager.cs
+++ b/osu.Game/Database/ArchiveModelManager.cs
@@ -108,7 +108,7 @@ namespace osu.Game.Database
return Import(notification, paths);
}
- protected async Task Import(ProgressNotification notification, params string[] paths)
+ protected async Task> Import(ProgressNotification notification, params string[] paths)
{
notification.Progress = 0;
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import is initialising...";
@@ -168,6 +168,8 @@ namespace osu.Game.Database
notification.State = ProgressNotificationState.Completed;
}
+
+ return imported;
}
///
diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs
index 78c0837ce9..a81dff3475 100644
--- a/osu.Game/Database/DownloadableArchiveModelManager.cs
+++ b/osu.Game/Database/DownloadableArchiveModelManager.cs
@@ -76,21 +76,17 @@ namespace osu.Game.Database
Task.Factory.StartNew(async () =>
{
// This gets scheduled back to the update thread, but we want the import to run in the background.
- await Import(notification, filename);
+ var imported = await Import(notification, filename);
+
+ // for now a failed import will be marked as a failed download for simplicity.
+ if (!imported.Any())
+ DownloadFailed?.Invoke(request);
+
currentDownloads.Remove(request);
}, TaskCreationOptions.LongRunning);
};
- request.Failure += error =>
- {
- DownloadFailed?.Invoke(request);
-
- if (error is OperationCanceledException) return;
-
- notification.State = ProgressNotificationState.Cancelled;
- Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!");
- currentDownloads.Remove(request);
- };
+ request.Failure += triggerFailure;
notification.CancelRequested += () =>
{
@@ -103,11 +99,31 @@ namespace osu.Game.Database
currentDownloads.Add(request);
PostNotification?.Invoke(notification);
- Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning);
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ request.Perform(api);
+ }
+ catch (Exception error)
+ {
+ triggerFailure(error);
+ }
+ }, TaskCreationOptions.LongRunning);
DownloadBegan?.Invoke(request);
-
return true;
+
+ void triggerFailure(Exception error)
+ {
+ DownloadFailed?.Invoke(request);
+
+ if (error is OperationCanceledException) return;
+
+ notification.State = ProgressNotificationState.Cancelled;
+ Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!");
+ currentDownloads.Remove(request);
+ }
}
public bool IsAvailableLocally(TModel model) => CheckLocalAvailability(model, modelStore.ConsumableItems.Where(m => !m.DeletePending));
diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs
index 15068d81c0..61391b7102 100644
--- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs
+++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs
@@ -8,9 +8,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using System.Collections.Generic;
using osu.Framework.Graphics;
-using osu.Framework.Logging;
-using osu.Game.Overlays;
-using osu.Game.Overlays.Notifications;
using osu.Game.Users;
namespace osu.Game.Graphics.Containers
@@ -23,21 +20,12 @@ namespace osu.Game.Graphics.Containers
}
private OsuGame game;
- private ChannelManager channelManager;
- private Action showNotImplementedError;
[BackgroundDependencyLoader(true)]
- private void load(OsuGame game, NotificationOverlay notifications, ChannelManager channelManager)
+ private void load(OsuGame game)
{
// will be null in tests
this.game = game;
- this.channelManager = channelManager;
-
- showNotImplementedError = () => notifications?.Post(new SimpleNotification
- {
- Text = @"This link type is not yet supported!",
- Icon = FontAwesome.Solid.LifeRing,
- });
}
public void AddLinks(string text, List links)
@@ -56,85 +44,47 @@ namespace osu.Game.Graphics.Containers
foreach (var link in links)
{
AddText(text.Substring(previousLinkEnd, link.Index - previousLinkEnd));
- AddLink(text.Substring(link.Index, link.Length), link.Url, link.Action, link.Argument);
+ AddLink(text.Substring(link.Index, link.Length), link.Action, link.Argument ?? link.Url);
previousLinkEnd = link.Index + link.Length;
}
AddText(text.Substring(previousLinkEnd));
}
- public IEnumerable AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action creationParameters = null)
- => createLink(AddText(text, creationParameters), text, url, linkType, linkArgument, tooltipText);
+ public void AddLink(string text, string url, Action creationParameters = null) =>
+ createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.External, url), url);
- public IEnumerable AddLink(string text, Action action, string tooltipText = null, Action creationParameters = null)
- => createLink(AddText(text, creationParameters), text, tooltipText: tooltipText, action: action);
+ public void AddLink(string text, Action action, string tooltipText = null, Action creationParameters = null)
+ => createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.Custom, null), tooltipText, action);
- public IEnumerable AddLink(IEnumerable text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null)
+ public void AddLink(string text, LinkAction action, string argument, string tooltipText = null, Action creationParameters = null)
+ => createLink(AddText(text, creationParameters), new LinkDetails(action, argument), null);
+
+ public void AddLink(IEnumerable text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null)
{
foreach (var t in text)
AddArbitraryDrawable(t);
- return createLink(text, null, url, linkType, linkArgument, tooltipText);
+ createLink(text, new LinkDetails(action, linkArgument), tooltipText);
}
- public IEnumerable AddUserLink(User user, Action creationParameters = null)
- => createLink(AddText(user.Username, creationParameters), user.Username, null, LinkAction.OpenUserProfile, user.Id.ToString(), "View profile");
+ public void AddUserLink(User user, Action creationParameters = null)
+ => createLink(AddText(user.Username, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, user.Id.ToString()), "View Profile");
- private IEnumerable createLink(IEnumerable drawables, string text, string url = null, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action action = null)
+ private void createLink(IEnumerable drawables, LinkDetails link, string tooltipText, Action action = null)
{
AddInternal(new DrawableLinkCompiler(drawables.OfType().ToList())
{
RelativeSizeAxes = Axes.Both,
- TooltipText = tooltipText ?? (url != text ? url : string.Empty),
- Action = action ?? (() =>
+ TooltipText = tooltipText,
+ Action = () =>
{
- switch (linkType)
- {
- case LinkAction.OpenBeatmap:
- // TODO: proper query params handling
- if (linkArgument != null && int.TryParse(linkArgument.Contains('?') ? linkArgument.Split('?')[0] : linkArgument, out int beatmapId))
- game?.ShowBeatmap(beatmapId);
- break;
-
- case LinkAction.OpenBeatmapSet:
- if (int.TryParse(linkArgument, out int setId))
- game?.ShowBeatmapSet(setId);
- break;
-
- case LinkAction.OpenChannel:
- try
- {
- channelManager?.OpenChannel(linkArgument);
- }
- catch (ChannelNotFoundException)
- {
- Logger.Log($"The requested channel \"{linkArgument}\" does not exist");
- }
-
- break;
-
- case LinkAction.OpenEditorTimestamp:
- case LinkAction.JoinMultiplayerMatch:
- case LinkAction.Spectate:
- showNotImplementedError?.Invoke();
- break;
-
- case LinkAction.External:
- game?.OpenUrlExternally(url);
- break;
-
- case LinkAction.OpenUserProfile:
- if (long.TryParse(linkArgument, out long userId))
- game?.ShowUser(userId);
- break;
-
- default:
- throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action.");
- }
- }),
+ if (action != null)
+ action();
+ else
+ game.HandleLink(link);
+ },
});
-
- return drawables;
}
// We want the compilers to always be visible no matter where they are, so RelativeSizeAxes is used.
diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs
index 9ec39c5cb1..451174a73c 100644
--- a/osu.Game/Online/Chat/Channel.cs
+++ b/osu.Game/Online/Chat/Channel.cs
@@ -14,7 +14,7 @@ namespace osu.Game.Online.Chat
{
public class Channel
{
- public readonly int MaxHistory = 300;
+ public const int MAX_HISTORY = 300;
///
/// Contains every joined user except the current logged in user. Currently only returned for PM channels.
@@ -80,8 +80,6 @@ namespace osu.Game.Online.Chat
///
public Bindable Joined = new Bindable();
- public const int MAX_HISTORY = 300;
-
[JsonConstructor]
public Channel()
{
@@ -162,8 +160,8 @@ namespace osu.Game.Online.Chat
{
// never purge local echos
int messageCount = Messages.Count - pendingMessages.Count;
- if (messageCount > MaxHistory)
- Messages.RemoveRange(0, messageCount - MaxHistory);
+ if (messageCount > MAX_HISTORY)
+ Messages.RemoveRange(0, messageCount - MAX_HISTORY);
}
}
}
diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs
index 3ffff281f8..717de18c14 100644
--- a/osu.Game/Online/Chat/MessageFormatter.cs
+++ b/osu.Game/Online/Chat/MessageFormatter.cs
@@ -81,7 +81,7 @@ namespace osu.Game.Online.Chat
//since we just changed the line display text, offset any already processed links.
result.Links.ForEach(l => l.Index -= l.Index > index ? m.Length - displayText.Length : 0);
- var details = getLinkDetails(linkText);
+ var details = GetLinkDetails(linkText);
result.Links.Add(new Link(linkText, index, displayText.Length, linkActionOverride ?? details.Action, details.Argument));
//adjust the offset for processing the current matches group.
@@ -98,7 +98,7 @@ namespace osu.Game.Online.Chat
var linkText = m.Groups["link"].Value;
var indexLength = linkText.Length;
- var details = getLinkDetails(linkText);
+ var details = GetLinkDetails(linkText);
var link = new Link(linkText, index, indexLength, details.Action, details.Argument);
// sometimes an already-processed formatted link can reduce to a simple URL, too
@@ -109,7 +109,7 @@ namespace osu.Game.Online.Chat
}
}
- private static LinkDetails getLinkDetails(string url)
+ public static LinkDetails GetLinkDetails(string url)
{
var args = url.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
args[0] = args[0].TrimEnd(':');
@@ -255,17 +255,17 @@ namespace osu.Game.Online.Chat
OriginalText = Text = text;
}
}
+ }
- public class LinkDetails
+ public class LinkDetails
+ {
+ public LinkAction Action;
+ public string Argument;
+
+ public LinkDetails(LinkAction action, string argument)
{
- public LinkAction Action;
- public string Argument;
-
- public LinkDetails(LinkAction action, string argument)
- {
- Action = action;
- Argument = argument;
- }
+ Action = action;
+ Argument = argument;
}
}
@@ -279,6 +279,7 @@ namespace osu.Game.Online.Chat
JoinMultiplayerMatch,
Spectate,
OpenUserProfile,
+ Custom
}
public class Link : IComparable
diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs
index 9387482f14..623db07938 100644
--- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs
+++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs
@@ -21,6 +21,7 @@ using osu.Game.Users.Drawables;
using osuTK;
using osuTK.Graphics;
using Humanizer;
+using osu.Game.Online.API;
namespace osu.Game.Online.Leaderboards
{
@@ -37,6 +38,7 @@ namespace osu.Game.Online.Leaderboards
private readonly ScoreInfo score;
private readonly int rank;
+ private readonly bool allowHighlight;
private Box background;
private Container content;
@@ -49,17 +51,18 @@ namespace osu.Game.Online.Leaderboards
private List statisticsLabels;
- public LeaderboardScore(ScoreInfo score, int rank)
+ public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true)
{
this.score = score;
this.rank = rank;
+ this.allowHighlight = allowHighlight;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
}
[BackgroundDependencyLoader]
- private void load()
+ private void load(IAPIProvider api, OsuColour colour)
{
var user = score.User;
@@ -100,7 +103,7 @@ namespace osu.Game.Online.Leaderboards
background = new Box
{
RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black,
+ Colour = user.Id == api.LocalUser.Value.Id && allowHighlight ? colour.Green : Color4.Black,
Alpha = background_alpha,
},
},
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index 4dcc181bea..1f823e6eba 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -215,31 +215,102 @@ namespace osu.Game
private ExternalLinkOpener externalLinkOpener;
- public void OpenUrlExternally(string url)
+ ///
+ /// Handle an arbitrary URL. Displays via in-game overlays where possible.
+ /// This can be called from a non-thread-safe non-game-loaded state.
+ ///
+ /// The URL to load.
+ public void HandleLink(string url) => HandleLink(MessageFormatter.GetLinkDetails(url));
+
+ ///
+ /// Handle a specific .
+ /// This can be called from a non-thread-safe non-game-loaded state.
+ ///
+ /// The link to load.
+ public void HandleLink(LinkDetails link) => Schedule(() =>
+ {
+ switch (link.Action)
+ {
+ case LinkAction.OpenBeatmap:
+ // TODO: proper query params handling
+ if (link.Argument != null && int.TryParse(link.Argument.Contains('?') ? link.Argument.Split('?')[0] : link.Argument, out int beatmapId))
+ ShowBeatmap(beatmapId);
+ break;
+
+ case LinkAction.OpenBeatmapSet:
+ if (int.TryParse(link.Argument, out int setId))
+ ShowBeatmapSet(setId);
+ break;
+
+ case LinkAction.OpenChannel:
+ ShowChannel(link.Argument);
+ break;
+
+ case LinkAction.OpenEditorTimestamp:
+ case LinkAction.JoinMultiplayerMatch:
+ case LinkAction.Spectate:
+ waitForReady(() => notifications, _ => notifications?.Post(new SimpleNotification
+ {
+ Text = @"This link type is not yet supported!",
+ Icon = FontAwesome.Solid.LifeRing,
+ }));
+ break;
+
+ case LinkAction.External:
+ OpenUrlExternally(link.Argument);
+ break;
+
+ case LinkAction.OpenUserProfile:
+ if (long.TryParse(link.Argument, out long userId))
+ ShowUser(userId);
+ break;
+
+ default:
+ throw new NotImplementedException($"This {nameof(LinkAction)} ({link.Action.ToString()}) is missing an associated action.");
+ }
+ });
+
+ public void OpenUrlExternally(string url) => waitForReady(() => externalLinkOpener, _ =>
{
if (url.StartsWith("/"))
url = $"{API.Endpoint}{url}";
externalLinkOpener.OpenUrlExternally(url);
- }
+ });
+
+ ///
+ /// Open a specific channel in chat.
+ ///
+ /// The channel to display.
+ public void ShowChannel(string channel) => waitForReady(() => channelManager, _ =>
+ {
+ try
+ {
+ channelManager.OpenChannel(channel);
+ }
+ catch (ChannelNotFoundException)
+ {
+ Logger.Log($"The requested channel \"{channel}\" does not exist");
+ }
+ });
///
/// Show a beatmap set as an overlay.
///
/// The set to display.
- public void ShowBeatmapSet(int setId) => beatmapSetOverlay.FetchAndShowBeatmapSet(setId);
+ public void ShowBeatmapSet(int setId) => waitForReady(() => beatmapSetOverlay, _ => beatmapSetOverlay.FetchAndShowBeatmapSet(setId));
///
/// Show a user's profile as an overlay.
///
/// The user to display.
- public void ShowUser(long userId) => userProfile.ShowUser(userId);
+ public void ShowUser(long userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
///
/// Show a beatmap's set as an overlay, displaying the given beatmap.
///
/// The beatmap to show.
- public void ShowBeatmap(int beatmapId) => beatmapSetOverlay.FetchAndShowBeatmap(beatmapId);
+ public void ShowBeatmap(int beatmapId) => waitForReady(() => beatmapSetOverlay, _ => beatmapSetOverlay.FetchAndShowBeatmap(beatmapId));
///
/// Present a beatmap at song select immediately.
@@ -397,6 +468,23 @@ namespace osu.Game
performFromMainMenuTask = Schedule(() => performFromMainMenu(action, taskName));
}
+ ///
+ /// Wait for the game (and target component) to become loaded and then run an action.
+ ///
+ /// A function to retrieve a (potentially not-yet-constructed) target instance.
+ /// The action to perform on the instance when load is confirmed.
+ /// The type of the target instance.
+ private void waitForReady(Func retrieveInstance, Action action)
+ where T : Drawable
+ {
+ var instance = retrieveInstance();
+
+ if (ScreenStack == null || ScreenStack.CurrentScreen is StartupScreen || instance?.IsLoaded != true)
+ Schedule(() => waitForReady(retrieveInstance, action));
+ else
+ action(instance);
+ }
+
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs
index 28947b6f22..bf2a92cd4f 100644
--- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs
@@ -17,6 +17,7 @@ using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
+using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
@@ -27,10 +28,11 @@ namespace osu.Game.Overlays.BeatmapSet
private const float tile_icon_padding = 7;
private const float tile_spacing = 2;
- private readonly DifficultiesContainer difficulties;
private readonly OsuSpriteText version, starRating;
private readonly Statistic plays, favourites;
+ public readonly DifficultiesContainer Difficulties;
+
public readonly Bindable Beatmap = new Bindable();
private BeatmapSetInfo beatmapSet;
@@ -43,38 +45,10 @@ namespace osu.Game.Overlays.BeatmapSet
if (value == beatmapSet) return;
beatmapSet = value;
-
updateDisplay();
}
}
- private void updateDisplay()
- {
- difficulties.Clear();
-
- if (BeatmapSet != null)
- {
- difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty).Select(b => new DifficultySelectorButton(b)
- {
- State = DifficultySelectorState.NotSelected,
- OnHovered = beatmap =>
- {
- showBeatmap(beatmap);
- starRating.Text = beatmap.StarDifficulty.ToString("Star Difficulty 0.##");
- starRating.FadeIn(100);
- },
- OnClicked = beatmap => { Beatmap.Value = beatmap; },
- });
- }
-
- starRating.FadeOut(100);
- Beatmap.Value = BeatmapSet?.Beatmaps.FirstOrDefault();
- plays.Value = BeatmapSet?.OnlineInfo.PlayCount ?? 0;
- favourites.Value = BeatmapSet?.OnlineInfo.FavouriteCount ?? 0;
-
- updateDifficultyButtons();
- }
-
public BeatmapPicker()
{
RelativeSizeAxes = Axes.X;
@@ -89,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
- difficulties = new DifficultiesContainer
+ Difficulties = new DifficultiesContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@@ -147,6 +121,9 @@ namespace osu.Game.Overlays.BeatmapSet
};
}
+ [Resolved]
+ private IBindable ruleset { get; set; }
+
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@@ -158,10 +135,39 @@ namespace osu.Game.Overlays.BeatmapSet
{
base.LoadComplete();
+ ruleset.ValueChanged += r => updateDisplay();
+
// done here so everything can bind in intialization and get the first trigger
Beatmap.TriggerChange();
}
+ private void updateDisplay()
+ {
+ Difficulties.Clear();
+
+ if (BeatmapSet != null)
+ {
+ Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps.Where(b => b.Ruleset.Equals(ruleset.Value)).OrderBy(b => b.StarDifficulty).Select(b => new DifficultySelectorButton(b)
+ {
+ State = DifficultySelectorState.NotSelected,
+ OnHovered = beatmap =>
+ {
+ showBeatmap(beatmap);
+ starRating.Text = beatmap.StarDifficulty.ToString("Star Difficulty 0.##");
+ starRating.FadeIn(100);
+ },
+ OnClicked = beatmap => { Beatmap.Value = beatmap; },
+ });
+ }
+
+ starRating.FadeOut(100);
+ Beatmap.Value = Difficulties.FirstOrDefault()?.Beatmap;
+ plays.Value = BeatmapSet?.OnlineInfo.PlayCount ?? 0;
+ favourites.Value = BeatmapSet?.OnlineInfo.FavouriteCount ?? 0;
+
+ updateDifficultyButtons();
+ }
+
private void showBeatmap(BeatmapInfo beatmap)
{
version.Text = beatmap?.Version;
@@ -169,10 +175,10 @@ namespace osu.Game.Overlays.BeatmapSet
private void updateDifficultyButtons()
{
- difficulties.Children.ToList().ForEach(diff => diff.State = diff.Beatmap == Beatmap.Value ? DifficultySelectorState.Selected : DifficultySelectorState.NotSelected);
+ Difficulties.Children.ToList().ForEach(diff => diff.State = diff.Beatmap == Beatmap.Value ? DifficultySelectorState.Selected : DifficultySelectorState.NotSelected);
}
- private class DifficultiesContainer : FillFlowContainer
+ public class DifficultiesContainer : FillFlowContainer
{
public Action OnLostHover;
@@ -183,7 +189,7 @@ namespace osu.Game.Overlays.BeatmapSet
}
}
- private class DifficultySelectorButton : OsuClickableContainer, IStateful
+ public class DifficultySelectorButton : OsuClickableContainer, IStateful
{
private const float transition_duration = 100;
private const float size = 52;
@@ -320,7 +326,7 @@ namespace osu.Game.Overlays.BeatmapSet
}
}
- private enum DifficultySelectorState
+ public enum DifficultySelectorState
{
Selected,
NotSelected,
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
new file mode 100644
index 0000000000..a0bedc848e
--- /dev/null
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs
@@ -0,0 +1,48 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Bindables;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.UserInterface;
+using osu.Game.Beatmaps;
+using osu.Game.Rulesets;
+using osuTK;
+using System.Linq;
+
+namespace osu.Game.Overlays.BeatmapSet
+{
+ public class BeatmapRulesetSelector : RulesetSelector
+ {
+ private readonly Bindable beatmapSet = new Bindable();
+
+ public BeatmapSetInfo BeatmapSet
+ {
+ get => beatmapSet.Value;
+ set
+ {
+ // propagate value to tab items first to enable only available rulesets.
+ beatmapSet.Value = value;
+
+ SelectTab(TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value));
+ }
+ }
+
+ public BeatmapRulesetSelector()
+ {
+ AutoSizeAxes = Axes.Both;
+ }
+
+ protected override TabItem CreateTabItem(RulesetInfo value) => new BeatmapRulesetTabItem(value)
+ {
+ BeatmapSet = { BindTarget = beatmapSet }
+ };
+
+ protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Spacing = new Vector2(10, 0),
+ };
+ }
+}
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs
new file mode 100644
index 0000000000..cdea49afe7
--- /dev/null
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs
@@ -0,0 +1,145 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Input.Events;
+using osu.Game.Beatmaps;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Rulesets;
+using osuTK;
+using osuTK.Graphics;
+using System.Linq;
+
+namespace osu.Game.Overlays.BeatmapSet
+{
+ public class BeatmapRulesetTabItem : TabItem
+ {
+ private readonly OsuSpriteText name, count;
+ private readonly Box bar;
+
+ public readonly Bindable BeatmapSet = new Bindable();
+
+ public override bool PropagatePositionalInputSubTree => Enabled.Value && !Active.Value && base.PropagatePositionalInputSubTree;
+
+ public BeatmapRulesetTabItem(RulesetInfo value)
+ : base(value)
+ {
+ AutoSizeAxes = Axes.Both;
+
+ FillFlowContainer nameContainer;
+
+ Children = new Drawable[]
+ {
+ nameContainer = new FillFlowContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Margin = new MarginPadding { Bottom = 7.5f },
+ Spacing = new Vector2(2.5f),
+ Children = new Drawable[]
+ {
+ name = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Text = value.Name,
+ Font = OsuFont.Default.With(size: 18),
+ },
+ new Container
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Both,
+ Masking = true,
+ CornerRadius = 4f,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black.Opacity(0.5f),
+ },
+ count = new OsuSpriteText
+ {
+ Alpha = 0,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Margin = new MarginPadding { Horizontal = 5f },
+ Font = OsuFont.Default.With(weight: FontWeight.SemiBold),
+ }
+ }
+ }
+ }
+ },
+ bar = new Box
+ {
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
+ RelativeSizeAxes = Axes.X,
+ },
+ new HoverClickSounds(),
+ };
+
+ BeatmapSet.BindValueChanged(setInfo =>
+ {
+ var beatmapsCount = setInfo.NewValue?.Beatmaps.Count(b => b.Ruleset.Equals(Value)) ?? 0;
+
+ count.Text = beatmapsCount.ToString();
+ count.Alpha = beatmapsCount > 0 ? 1f : 0f;
+
+ Enabled.Value = beatmapsCount > 0;
+ }, true);
+
+ Enabled.BindValueChanged(v => nameContainer.Alpha = v.NewValue ? 1f : 0.5f, true);
+ }
+
+ [Resolved]
+ private OsuColour colour { get; set; }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ count.Colour = colour.Gray9;
+ bar.Colour = colour.Blue;
+
+ updateState();
+ }
+
+ private void updateState()
+ {
+ var isHoveredOrActive = IsHovered || Active.Value;
+
+ bar.ResizeHeightTo(isHoveredOrActive ? 4 : 0, 200, Easing.OutQuint);
+
+ name.Colour = isHoveredOrActive ? colour.GrayE : colour.GrayC;
+ name.Font = name.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Regular);
+ }
+
+ #region Hovering and activation logic
+
+ protected override void OnActivated() => updateState();
+
+ protected override void OnDeactivated() => updateState();
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ updateState();
+ return false;
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e) => updateState();
+
+ #endregion
+ }
+}
diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs
index 260a989628..7b42e7e459 100644
--- a/osu.Game/Overlays/BeatmapSet/Header.cs
+++ b/osu.Game/Overlays/BeatmapSet/Header.cs
@@ -3,6 +3,7 @@
using System.Linq;
using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@@ -16,6 +17,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
using osu.Game.Overlays.BeatmapSet.Buttons;
using osu.Game.Overlays.Direct;
+using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
@@ -39,6 +41,7 @@ namespace osu.Game.Overlays.BeatmapSet
public bool DownloadButtonsVisible => downloadButtonsContainer.Any();
+ public readonly BeatmapRulesetSelector RulesetSelector;
public readonly BeatmapPicker Picker;
private readonly FavouriteButton favouriteButton;
@@ -47,6 +50,9 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly LoadingAnimation loading;
+ [Cached(typeof(IBindable))]
+ private readonly Bindable ruleset = new Bindable();
+
public Header()
{
ExternalLinkButton externalLink;
@@ -69,12 +75,18 @@ namespace osu.Game.Overlays.BeatmapSet
{
RelativeSizeAxes = Axes.X,
Height = tabs_height,
- Children = new[]
+ Children = new Drawable[]
{
tabsBg = new Box
{
RelativeSizeAxes = Axes.Both,
},
+ RulesetSelector = new BeatmapRulesetSelector
+ {
+ Current = ruleset,
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
+ }
},
},
new Container
@@ -223,7 +235,7 @@ namespace osu.Game.Overlays.BeatmapSet
BeatmapSet.BindValueChanged(setInfo =>
{
- Picker.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
+ Picker.BeatmapSet = RulesetSelector.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
cover.BeatmapSet = setInfo.NewValue;
if (setInfo.NewValue == null)
diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs
index bce1be5941..d8488b21ab 100644
--- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs
+++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs
@@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Changelog
t.Font = fontLarge;
t.Colour = entryColour;
});
- title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External,
+ title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl,
creationParameters: t =>
{
t.Font = fontLarge;
@@ -140,7 +140,7 @@ namespace osu.Game.Overlays.Changelog
t.Colour = entryColour;
});
else if (entry.GithubUser.GithubUrl != null)
- title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t =>
+ title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
{
t.Font = fontMedium;
t.Colour = entryColour;
diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs
index 9c3504f477..adcd33fb48 100644
--- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs
+++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs
@@ -44,7 +44,17 @@ namespace osu.Game.Overlays.Changelog
req.Failure += _ => complete = true;
// This is done on a separate thread to support cancellation below
- Task.Run(() => req.Perform(api));
+ Task.Run(() =>
+ {
+ try
+ {
+ req.Perform(api);
+ }
+ catch
+ {
+ complete = true;
+ }
+ });
while (!complete)
{
diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs
index dfe3669813..559989af5c 100644
--- a/osu.Game/Overlays/ChangelogOverlay.cs
+++ b/osu.Game/Overlays/ChangelogOverlay.cs
@@ -170,6 +170,7 @@ namespace osu.Game.Overlays
var tcs = new TaskCompletionSource();
var req = new GetChangelogRequest();
+
req.Success += res => Schedule(() =>
{
// remap streams to builds to ensure model equality
@@ -183,8 +184,22 @@ namespace osu.Game.Overlays
tcs.SetResult(true);
});
- req.Failure += _ => initialFetchTask = null;
- req.Perform(API);
+
+ req.Failure += _ =>
+ {
+ initialFetchTask = null;
+ tcs.SetResult(false);
+ };
+
+ try
+ {
+ req.Perform(API);
+ }
+ catch
+ {
+ initialFetchTask = null;
+ tcs.SetResult(false);
+ }
await tcs.Task;
});
diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs
index 6cdbfabe0f..427bd8dcde 100644
--- a/osu.Game/Overlays/Chat/DrawableChannel.cs
+++ b/osu.Game/Overlays/Chat/DrawableChannel.cs
@@ -1,4 +1,4 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
@@ -89,8 +89,10 @@ namespace osu.Game.Overlays.Chat
private void newMessagesArrived(IEnumerable newMessages)
{
+ bool shouldScrollToEnd = scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage);
+
// Add up to last Channel.MAX_HISTORY messages
- var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MaxHistory));
+ var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
Message lastMessage = chatLines.LastOrDefault()?.Message;
@@ -103,19 +105,32 @@ namespace osu.Game.Overlays.Chat
lastMessage = message;
}
- if (scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage))
- scrollToEnd();
-
var staleMessages = chatLines.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
- int count = staleMessages.Length - Channel.MaxHistory;
+ int count = staleMessages.Length - Channel.MAX_HISTORY;
- for (int i = 0; i < count; i++)
+ if (count > 0)
{
- var d = staleMessages[i];
- if (!scroll.IsScrolledToEnd(10))
+ void expireAndAdjustScroll(Drawable d)
+ {
scroll.OffsetScrollPosition(-d.DrawHeight);
- d.Expire();
+ d.Expire();
+ }
+
+ for (int i = 0; i < count; i++)
+ expireAndAdjustScroll(staleMessages[i]);
+
+ // remove all adjacent day separators after stale message removal
+ for (int i = 0; i < ChatLineFlow.Count - 1; i++)
+ {
+ if (!(ChatLineFlow[i] is DaySeparator)) break;
+ if (!(ChatLineFlow[i + 1] is DaySeparator)) break;
+
+ expireAndAdjustScroll(ChatLineFlow[i]);
+ }
}
+
+ if (shouldScrollToEnd)
+ scrollToEnd();
}
private void pendingMessageResolved(Message existing, Message updated)
@@ -141,7 +156,7 @@ namespace osu.Game.Overlays.Chat
private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd());
- protected class DaySeparator : Container
+ public class DaySeparator : Container
{
public float TextSize
{
diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs
index b02b1a5489..a8bbccb168 100644
--- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs
@@ -200,6 +200,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
private TextBox username;
private TextBox password;
+ private ShakeContainer shakeSignIn;
private IAPIProvider api;
public Action RequestHide;
@@ -208,6 +209,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text))
api.Login(username.Text, password.Text);
+ else
+ shakeSignIn.Shake();
}
[BackgroundDependencyLoader(permitNulls: true)]
@@ -244,10 +247,23 @@ namespace osu.Game.Overlays.Settings.Sections.General
LabelText = "Stay signed in",
Bindable = config.GetBindable(OsuSetting.SavePassword),
},
- new SettingsButton
+ new Container
{
- Text = "Sign in",
- Action = performLogin
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Children = new Drawable[]
+ {
+ shakeSignIn = new ShakeContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Child = new SettingsButton
+ {
+ Text = "Sign in",
+ Action = performLogin
+ },
+ }
+ }
},
new SettingsButton
{
diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs
index 5922bfba78..1c942e52ce 100644
--- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs
+++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs
@@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Edit
EditorBeatmap = new EditorBeatmap(playableBeatmap);
EditorBeatmap.HitObjectAdded += addHitObject;
EditorBeatmap.HitObjectRemoved += removeHitObject;
- EditorBeatmap.StartTimeChanged += updateHitObject;
+ EditorBeatmap.StartTimeChanged += UpdateHitObject;
var dependencies = new DependencyContainer(parent);
dependencies.CacheAs(EditorBeatmap);
@@ -225,11 +225,7 @@ namespace osu.Game.Rulesets.Edit
private ScheduledDelegate scheduledUpdate;
- private void addHitObject(HitObject hitObject) => updateHitObject(hitObject);
-
- private void removeHitObject(HitObject hitObject) => updateHitObject(null);
-
- private void updateHitObject([CanBeNull] HitObject hitObject)
+ public override void UpdateHitObject(HitObject hitObject)
{
scheduledUpdate?.Cancel();
scheduledUpdate = Schedule(() =>
@@ -240,6 +236,10 @@ namespace osu.Game.Rulesets.Edit
});
}
+ private void addHitObject(HitObject hitObject) => UpdateHitObject(hitObject);
+
+ private void removeHitObject(HitObject hitObject) => UpdateHitObject(null);
+
public override IEnumerable HitObjects => drawableRulesetWrapper.Playfield.AllHitObjects;
public override bool CursorInPlacementArea => drawableRulesetWrapper.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
@@ -351,11 +351,22 @@ namespace osu.Game.Rulesets.Edit
[CanBeNull]
protected virtual DistanceSnapGrid CreateDistanceSnapGrid([NotNull] IEnumerable selectedHitObjects) => null;
+ ///
+ /// Updates a , invoking and re-processing the beatmap.
+ ///
+ /// The to update.
+ public abstract void UpdateHitObject([CanBeNull] HitObject hitObject);
+
public abstract (Vector2 position, double time) GetSnappedPosition(Vector2 position, double time);
+
public abstract float GetBeatSnapDistanceAt(double referenceTime);
+
public abstract float DurationToDistance(double referenceTime, double duration);
+
public abstract double DistanceToDuration(double referenceTime, float distance);
+
public abstract double GetSnappedDurationFromDistance(double referenceTime, float distance);
+
public abstract float GetSnappedDistanceFromDistance(double referenceTime, float distance);
}
}
diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs
index 44f38acfd4..2923411ce1 100644
--- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs
+++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs
@@ -3,10 +3,12 @@
using System;
using osu.Framework;
+using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.UserInterface;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
@@ -36,6 +38,9 @@ namespace osu.Game.Rulesets.Edit
public override bool HandlePositionalInput => ShouldBeAlive;
public override bool RemoveWhenNotAlive => false;
+ [Resolved(CanBeNull = true)]
+ private HitObjectComposer composer { get; set; }
+
protected SelectionBlueprint(DrawableHitObject drawableObject)
{
DrawableObject = drawableObject;
@@ -77,6 +82,9 @@ namespace osu.Game.Rulesets.Edit
}
}
+ // When not selected, input is only required for the blueprint itself to receive IsHovering
+ protected override bool ShouldBeConsideredForInput(Drawable child) => State == SelectionState.Selected;
+
///
/// Selects this , causing it to become visible.
///
@@ -89,6 +97,11 @@ namespace osu.Game.Rulesets.Edit
public bool IsSelected => State == SelectionState.Selected;
+ ///
+ /// Updates the , invoking and re-processing the beatmap.
+ ///
+ protected void UpdateHitObject() => composer?.UpdateHitObject(DrawableObject.HitObject);
+
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.ReceivePositionalInputAt(screenSpacePos);
///
diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs
index d5b3df27df..e005eea831 100644
--- a/osu.Game/Rulesets/UI/DrawableRuleset.cs
+++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs
@@ -239,6 +239,12 @@ namespace osu.Game.Rulesets.UI
continueResume();
}
+ public override void CancelResume()
+ {
+ // called if the user pauses while the resume overlay is open
+ ResumeOverlay?.Hide();
+ }
+
///
/// Creates and adds the visual representation of a to this .
///
@@ -453,6 +459,11 @@ namespace osu.Game.Rulesets.UI
/// The action to run when resuming is to be completed.
public abstract void RequestResume(Action continueResume);
+ ///
+ /// Invoked when the user requests to pause while the resume overlay is active.
+ ///
+ public abstract void CancelResume();
+
///
/// Create a for the associated ruleset and link with this
/// .
diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
index e00597dd56..857929ff9e 100644
--- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
+++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
@@ -13,12 +13,6 @@ namespace osu.Game.Rulesets.UI.Scrolling
{
public class ScrollingHitObjectContainer : HitObjectContainer
{
- ///
- /// A multiplier applied to the length of the scrolling area to determine a safe default lifetime end for hitobjects.
- /// This is only used to limit the lifetime end within reason, as proper lifetime management should be implemented on hitobjects themselves.
- ///
- private const float safe_lifetime_end_multiplier = 2;
-
private readonly IBindable timeRange = new BindableDouble();
private readonly IBindable direction = new Bindable();
@@ -123,28 +117,22 @@ namespace osu.Game.Rulesets.UI.Scrolling
if (cached.IsValid)
return;
- double endTime = hitObject.HitObject.StartTime;
-
if (hitObject.HitObject is IHasEndTime e)
{
- endTime = e.EndTime;
-
switch (direction.Value)
{
case ScrollingDirection.Up:
case ScrollingDirection.Down:
- hitObject.Height = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, endTime, timeRange.Value, scrollLength);
+ hitObject.Height = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, e.EndTime, timeRange.Value, scrollLength);
break;
case ScrollingDirection.Left:
case ScrollingDirection.Right:
- hitObject.Width = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, endTime, timeRange.Value, scrollLength);
+ hitObject.Width = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, e.EndTime, timeRange.Value, scrollLength);
break;
}
}
- hitObject.LifetimeEnd = scrollingInfo.Algorithm.TimeAt(scrollLength * safe_lifetime_end_multiplier, endTime, timeRange.Value, scrollLength);
-
foreach (var obj in hitObject.NestedHitObjects)
{
computeInitialStateRecursive(obj);
diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
index a145dea6af..288c712bde 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
@@ -254,6 +254,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
Debug.Assert(!clickSelectionBegan);
+ // If a select blueprint is already hovered, disallow changes in selection.
+ // Exception is made when holding control, as deselection should still be allowed.
+ if (!e.CurrentState.Keyboard.ControlPressed &&
+ selectionHandler.SelectedBlueprints.Any(s => s.IsHovered))
+ return;
+
foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints)
{
if (blueprint.IsHovered)
diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs
index d7821eff07..1722476e53 100644
--- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs
@@ -8,21 +8,21 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
-using osu.Framework.Input.Events;
+using osu.Framework.Input;
+using osu.Framework.Input.Bindings;
using osu.Framework.Input.States;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
-using osuTK.Input;
namespace osu.Game.Screens.Edit.Compose.Components
{
///
/// A component which outlines s and handles movement of selections.
///
- public class SelectionHandler : CompositeDrawable
+ public class SelectionHandler : CompositeDrawable, IKeyBindingHandler
{
public const float BORDER_RADIUS = 2;
@@ -72,22 +72,21 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
}
- protected override bool OnKeyDown(KeyDownEvent e)
+ public bool OnPressed(PlatformAction action)
{
- if (e.Repeat)
- return base.OnKeyDown(e);
-
- switch (e.Key)
+ switch (action.ActionMethod)
{
- case Key.Delete:
+ case PlatformActionMethod.Delete:
foreach (var h in selectedBlueprints.ToList())
placementHandler.Delete(h.DrawableObject.HitObject);
return true;
}
- return base.OnKeyDown(e);
+ return false;
}
+ public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
+
#endregion
#region Selection Handling
diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs
index 1cfb123f25..bd2db4ae2b 100644
--- a/osu.Game/Screens/Edit/EditorClock.cs
+++ b/osu.Game/Screens/Edit/EditorClock.cs
@@ -3,7 +3,6 @@
using System;
using System.Linq;
-using Microsoft.EntityFrameworkCore.Internal;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
@@ -86,12 +85,8 @@ namespace osu.Game.Screens.Edit
var timingPoint = ControlPointInfo.TimingPointAt(CurrentTime);
if (direction < 0 && timingPoint.Time == CurrentTime)
- {
// When going backwards and we're at the boundary of two timing points, we compute the seek distance with the timing point which we are seeking into
- int activeIndex = ControlPointInfo.TimingPoints.IndexOf(timingPoint);
- while (activeIndex > 0 && CurrentTime == timingPoint.Time)
- timingPoint = ControlPointInfo.TimingPoints[--activeIndex];
- }
+ timingPoint = ControlPointInfo.TimingPointAt(CurrentTime - 1);
double seekAmount = timingPoint.BeatLength / beatDivisor.Value * amount;
double seekTime = CurrentTime + seekAmount * direction;
diff --git a/osu.Game/Screens/Edit/Timing/DifficultySection.cs b/osu.Game/Screens/Edit/Timing/DifficultySection.cs
index d3e1b2a84f..58a7f97e5f 100644
--- a/osu.Game/Screens/Edit/Timing/DifficultySection.cs
+++ b/osu.Game/Screens/Edit/Timing/DifficultySection.cs
@@ -3,6 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using osu.Framework.Bindables;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Overlays.Settings;
@@ -26,17 +27,12 @@ namespace osu.Game.Screens.Edit.Timing
});
}
- protected override void LoadComplete()
+ protected override void OnControlPointChanged(ValueChangedEvent point)
{
- base.LoadComplete();
-
- ControlPoint.BindValueChanged(point =>
+ if (point.NewValue != null)
{
- if (point.NewValue != null)
- {
- multiplier.Bindable = point.NewValue.SpeedMultiplierBindable;
- }
- }, true);
+ multiplier.Bindable = point.NewValue.SpeedMultiplierBindable;
+ }
}
protected override DifficultyControlPoint CreatePoint()
diff --git a/osu.Game/Screens/Edit/Timing/EffectSection.cs b/osu.Game/Screens/Edit/Timing/EffectSection.cs
index fcd733cf00..71e7f42713 100644
--- a/osu.Game/Screens/Edit/Timing/EffectSection.cs
+++ b/osu.Game/Screens/Edit/Timing/EffectSection.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterfaceV2;
@@ -22,18 +23,13 @@ namespace osu.Game.Screens.Edit.Timing
});
}
- protected override void LoadComplete()
+ protected override void OnControlPointChanged(ValueChangedEvent point)
{
- base.LoadComplete();
-
- ControlPoint.BindValueChanged(point =>
+ if (point.NewValue != null)
{
- if (point.NewValue != null)
- {
- kiai.Current = point.NewValue.KiaiModeBindable;
- omitBarLine.Current = point.NewValue.OmitFirstBarLineBindable;
- }
- });
+ kiai.Current = point.NewValue.KiaiModeBindable;
+ omitBarLine.Current = point.NewValue.OmitFirstBarLineBindable;
+ }
}
protected override EffectControlPoint CreatePoint()
diff --git a/osu.Game/Screens/Edit/Timing/SampleSection.cs b/osu.Game/Screens/Edit/Timing/SampleSection.cs
index 816f90d19e..4665c77991 100644
--- a/osu.Game/Screens/Edit/Timing/SampleSection.cs
+++ b/osu.Game/Screens/Edit/Timing/SampleSection.cs
@@ -3,6 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using osu.Framework.Bindables;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays.Settings;
@@ -31,6 +32,15 @@ namespace osu.Game.Screens.Edit.Timing
});
}
+ protected override void OnControlPointChanged(ValueChangedEvent point)
+ {
+ if (point.NewValue != null)
+ {
+ bank.Current = point.NewValue.SampleBankBindable;
+ volume.Bindable = point.NewValue.SampleVolumeBindable;
+ }
+ }
+
protected override SampleControlPoint CreatePoint()
{
var reference = Beatmap.Value.Beatmap.ControlPointInfo.SamplePointAt(SelectedGroup.Value.Time);
@@ -41,19 +51,5 @@ namespace osu.Game.Screens.Edit.Timing
SampleVolume = reference.SampleVolume,
};
}
-
- protected override void LoadComplete()
- {
- base.LoadComplete();
-
- ControlPoint.BindValueChanged(point =>
- {
- if (point.NewValue != null)
- {
- bank.Current = point.NewValue.SampleBankBindable;
- volume.Bindable = point.NewValue.SampleVolumeBindable;
- }
- });
- }
}
}
diff --git a/osu.Game/Screens/Edit/Timing/Section.cs b/osu.Game/Screens/Edit/Timing/Section.cs
index c6140ff497..ccf1582486 100644
--- a/osu.Game/Screens/Edit/Timing/Section.cs
+++ b/osu.Game/Screens/Edit/Timing/Section.cs
@@ -119,8 +119,12 @@ namespace osu.Game.Screens.Edit.Timing
ControlPoint.Value = points.NewValue?.ControlPoints.OfType().FirstOrDefault();
checkbox.Current.Value = ControlPoint.Value != null;
}, true);
+
+ ControlPoint.BindValueChanged(OnControlPointChanged, true);
}
+ protected abstract void OnControlPointChanged(ValueChangedEvent point);
+
protected abstract T CreatePoint();
}
}
diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs
index 6ae01e056f..d9da3ff92d 100644
--- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs
+++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs
@@ -20,7 +20,7 @@ namespace osu.Game.Screens.Edit.Timing
public class TimingScreen : EditorScreenWithTimeline
{
[Cached]
- private Bindable selectedPoints = new Bindable();
+ private Bindable selectedGroup = new Bindable();
[Resolved]
private IAdjustableClock clock { get; set; }
@@ -47,7 +47,11 @@ namespace osu.Game.Screens.Edit.Timing
{
base.LoadComplete();
- selectedPoints.BindValueChanged(selected => { clock.Seek(selected.NewValue.Time); });
+ selectedGroup.BindValueChanged(selected =>
+ {
+ if (selected.NewValue != null)
+ clock.Seek(selected.NewValue.Time);
+ });
}
public class ControlPointList : CompositeDrawable
diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs
index 9aecbe9160..906644ce14 100644
--- a/osu.Game/Screens/Edit/Timing/TimingSection.cs
+++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs
@@ -32,18 +32,13 @@ namespace osu.Game.Screens.Edit.Timing
});
}
- protected override void LoadComplete()
+ protected override void OnControlPointChanged(ValueChangedEvent point)
{
- base.LoadComplete();
-
- ControlPoint.BindValueChanged(point =>
+ if (point.NewValue != null)
{
- if (point.NewValue != null)
- {
- bpm.Bindable = point.NewValue.BeatLengthBindable;
- timeSignature.Bindable = point.NewValue.TimeSignatureBindable;
- }
- });
+ bpm.Bindable = point.NewValue.BeatLengthBindable;
+ timeSignature.Bindable = point.NewValue.TimeSignatureBindable;
+ }
}
protected override TimingControlPoint CreatePoint()
diff --git a/osu.Game/Screens/Menu/IntroSequence.cs b/osu.Game/Screens/Menu/IntroSequence.cs
index 093d01f12d..e2dd14b18c 100644
--- a/osu.Game/Screens/Menu/IntroSequence.cs
+++ b/osu.Game/Screens/Menu/IntroSequence.cs
@@ -42,6 +42,7 @@ namespace osu.Game.Screens.Menu
public IntroSequence()
{
RelativeSizeAxes = Axes.Both;
+ Alpha = 0;
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs
index e096fb33da..f79cac7649 100644
--- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs
+++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs
@@ -81,7 +81,7 @@ namespace osu.Game.Screens.Multi.Components
Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)),
Font = OsuFont.GetFont(size: TextSize),
}
- }, null, LinkAction.OpenBeatmap, beatmap.OnlineBeatmapID.ToString(), "Open beatmap");
+ }, LinkAction.OpenBeatmap, beatmap.OnlineBeatmapID.ToString(), "Open beatmap");
}
}
}
diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs
index 90806bab6e..86d52ff791 100644
--- a/osu.Game/Screens/Multi/Multiplayer.cs
+++ b/osu.Game/Screens/Multi/Multiplayer.cs
@@ -167,14 +167,17 @@ namespace osu.Game.Screens.Multi
public void APIStateChanged(IAPIProvider api, APIState state)
{
if (state != APIState.Online)
- forcefullyExit();
+ Schedule(forcefullyExit);
}
private void forcefullyExit()
{
// This is temporary since we don't currently have a way to force screens to be exited
if (this.IsCurrentScreen())
- this.Exit();
+ {
+ while (this.IsCurrentScreen())
+ this.Exit();
+ }
else
{
this.MakeCurrent();
@@ -212,6 +215,8 @@ namespace osu.Game.Screens.Multi
public override bool OnExiting(IScreen next)
{
+ roomManager.PartRoom();
+
if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen))
{
screenStack.Exit();
diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs
index 6f473aaafa..cdaba85b9e 100644
--- a/osu.Game/Screens/Multi/RoomManager.cs
+++ b/osu.Game/Screens/Multi/RoomManager.cs
@@ -87,9 +87,8 @@ namespace osu.Game.Screens.Multi
public void JoinRoom(Room room, Action onSuccess = null, Action onError = null)
{
currentJoinRoomRequest?.Cancel();
- currentJoinRoomRequest = null;
-
currentJoinRoomRequest = new JoinRoomRequest(room, api.LocalUser.Value);
+
currentJoinRoomRequest.Success += () =>
{
joinedRoom = room;
@@ -98,7 +97,8 @@ namespace osu.Game.Screens.Multi
currentJoinRoomRequest.Failure += exception =>
{
- Logger.Log($"Failed to join room: {exception}", level: LogLevel.Important);
+ if (!(exception is OperationCanceledException))
+ Logger.Log($"Failed to join room: {exception}", level: LogLevel.Important);
onError?.Invoke(exception.ToString());
};
@@ -107,6 +107,8 @@ namespace osu.Game.Screens.Multi
public void PartRoom()
{
+ currentJoinRoomRequest?.Cancel();
+
if (joinedRoom == null)
return;
diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs
index 6a03271b86..f2efbe6073 100644
--- a/osu.Game/Screens/Play/GameplayClockContainer.cs
+++ b/osu.Game/Screens/Play/GameplayClockContainer.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
+using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -29,7 +30,7 @@ namespace osu.Game.Screens.Play
///
/// The original source (usually a 's track).
///
- private readonly IAdjustableClock sourceClock;
+ private IAdjustableClock sourceClock;
public readonly BindableBool IsPaused = new BindableBool();
@@ -153,6 +154,18 @@ namespace osu.Game.Screens.Play
IsPaused.Value = true;
}
+ ///
+ /// Changes the backing clock to avoid using the originally provided beatmap's track.
+ ///
+ public void StopUsingBeatmapClock()
+ {
+ if (sourceClock != beatmap.Track)
+ return;
+
+ sourceClock = new TrackVirtual(beatmap.Track.Length);
+ adjustableClock.ChangeSource(sourceClock);
+ }
+
public void ResetLocalAdjustments()
{
// In the case of replays, we may have changed the playback rate.
diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs
index b2c3952f38..d201b5d30e 100644
--- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs
+++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs
@@ -45,8 +45,6 @@ namespace osu.Game.Screens.Play.HUD
VisualSettings = new VisualSettings { Expanded = false }
}
};
-
- Show();
}
protected override void PopIn() => this.FadeIn(fade_duration);
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 0b363eac4d..a3c39d9cc1 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -30,6 +30,7 @@ using osu.Game.Users;
namespace osu.Game.Screens.Play
{
+ [Cached]
public class Player : ScreenWithBeatmapBackground
{
public override bool AllowBackButton => false; // handled by HoldForMenuButton
@@ -311,14 +312,19 @@ namespace osu.Game.Screens.Play
this.Exit();
}
+ ///
+ /// Restart gameplay via a parent .
+ /// This can be called from a child screen in order to trigger the restart process.
+ ///
public void Restart()
{
- if (!this.IsCurrentScreen()) return;
-
sampleRestart?.Play();
-
RestartRequested?.Invoke();
- performImmediateExit();
+
+ if (this.IsCurrentScreen())
+ performImmediateExit();
+ else
+ this.MakeCurrent();
}
private ScheduledDelegate completionProgressDelegate;
@@ -443,7 +449,12 @@ namespace osu.Game.Screens.Play
{
if (!canPause) return;
- IsResuming = false;
+ if (IsResuming)
+ {
+ DrawableRuleset.CancelResume();
+ IsResuming = false;
+ }
+
GameplayClockContainer.Stop();
PauseOverlay.Show();
lastPauseActionTime = GameplayClockContainer.GameplayClock.CurrentTime;
@@ -527,6 +538,10 @@ namespace osu.Game.Screens.Play
GameplayClockContainer.ResetLocalAdjustments();
+ // GameplayClockContainer performs seeks / start / stop operations on the beatmap's track.
+ // as we are no longer the current screen, we cannot guarantee the track is still usable.
+ GameplayClockContainer.StopUsingBeatmapClock();
+
fadeOut();
return base.OnExiting(next);
}
diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs
index 6642efdf8b..3df06ebfa8 100644
--- a/osu.Game/Screens/Play/SongProgress.cs
+++ b/osu.Game/Screens/Play/SongProgress.cs
@@ -106,6 +106,8 @@ namespace osu.Game.Screens.Play
protected override void LoadComplete()
{
+ base.LoadComplete();
+
Show();
replayLoaded.ValueChanged += loaded => AllowSeeking = loaded.NewValue;
diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Ranking/Pages/ReplayDownloadButton.cs
similarity index 96%
rename from osu.Game/Screens/Play/ReplayDownloadButton.cs
rename to osu.Game/Screens/Ranking/Pages/ReplayDownloadButton.cs
index 290e00f287..73c647d6fa 100644
--- a/osu.Game/Screens/Play/ReplayDownloadButton.cs
+++ b/osu.Game/Screens/Ranking/Pages/ReplayDownloadButton.cs
@@ -4,12 +4,13 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
-using osu.Game.Online;
-using osu.Game.Scoring;
-using osu.Game.Online.API.Requests.Responses;
using osu.Game.Graphics.UserInterface;
+using osu.Game.Online;
+using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Scoring;
+using osuTK;
-namespace osu.Game.Screens.Play
+namespace osu.Game.Screens.Ranking.Pages
{
public class ReplayDownloadButton : DownloadTrackingComposite
{
@@ -33,6 +34,7 @@ namespace osu.Game.Screens.Play
public ReplayDownloadButton(ScoreInfo score)
: base(score)
{
+ Size = new Vector2(50, 30);
}
[BackgroundDependencyLoader(true)]
diff --git a/osu.Game/Screens/Ranking/Pages/RetryButton.cs b/osu.Game/Screens/Ranking/Pages/RetryButton.cs
new file mode 100644
index 0000000000..2a281224c1
--- /dev/null
+++ b/osu.Game/Screens/Ranking/Pages/RetryButton.cs
@@ -0,0 +1,54 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Graphics;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Screens.Play;
+using osuTK;
+
+namespace osu.Game.Screens.Ranking.Pages
+{
+ public class RetryButton : OsuAnimatedButton
+ {
+ private readonly Box background;
+
+ [Resolved(canBeNull: true)]
+ private Player player { get; set; }
+
+ public RetryButton()
+ {
+ Size = new Vector2(50, 30);
+
+ Children = new Drawable[]
+ {
+ background = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Depth = float.MaxValue
+ },
+ new SpriteIcon
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(13),
+ Icon = FontAwesome.Solid.ArrowCircleLeft,
+ },
+ };
+
+ TooltipText = "Retry";
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ background.Colour = colours.Green;
+
+ if (player != null)
+ Action = () => player.Restart();
+ }
+ }
+}
diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs
index 56ae069a26..27cea99f1c 100644
--- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs
+++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs
@@ -169,12 +169,19 @@ namespace osu.Game.Screens.Ranking.Pages
},
},
},
- new ReplayDownloadButton(score)
+ new FillFlowContainer
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Margin = new MarginPadding { Bottom = 10 },
- Size = new Vector2(50, 30),
+ Spacing = new Vector2(5),
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Children = new Drawable[]
+ {
+ new ReplayDownloadButton(score),
+ new RetryButton()
+ }
},
};
diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs
index cac26b3dbf..d063988b3f 100644
--- a/osu.Game/Screens/Ranking/Results.cs
+++ b/osu.Game/Screens/Ranking/Results.cs
@@ -19,6 +19,7 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
+using osu.Game.Screens.Play;
namespace osu.Game.Screens.Ranking
{
@@ -34,6 +35,9 @@ namespace osu.Game.Screens.Ranking
private ResultModeTabControl modeChangeButtons;
+ [Resolved(canBeNull: true)]
+ private Player player { get; set; }
+
public override bool DisallowExternalBeatmapRulesetChanges => true;
protected readonly ScoreInfo Score;
@@ -100,10 +104,7 @@ namespace osu.Game.Screens.Ranking
public override bool OnExiting(IScreen next)
{
- allCircles.ForEach(c =>
- {
- c.ScaleTo(0, transition_time, Easing.OutSine);
- });
+ allCircles.ForEach(c => c.ScaleTo(0, transition_time, Easing.OutSine));
Background.ScaleTo(1f, transition_time / 4, Easing.OutQuint);
@@ -115,147 +116,157 @@ namespace osu.Game.Screens.Ranking
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
- InternalChildren = new Drawable[]
+ InternalChild = new AspectContainer
{
- new AspectContainer
+ RelativeSizeAxes = Axes.Y,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Height = overscan,
+ Children = new Drawable[]
{
- RelativeSizeAxes = Axes.Y,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Height = overscan,
- Children = new Drawable[]
+ circleOuterBackground = new CircularContainer
{
- circleOuterBackground = new CircularContainer
+ RelativeSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Masking = true,
+ Children = new Drawable[]
{
- RelativeSizeAxes = Axes.Both,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Masking = true,
- Children = new Drawable[]
+ new Box
{
- new Box
- {
- Alpha = 0.2f,
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black,
- }
+ Alpha = 0.2f,
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black,
}
- },
- circleOuter = new CircularContainer
+ }
+ },
+ circleOuter = new CircularContainer
+ {
+ Size = new Vector2(circle_outer_scale),
+ EdgeEffect = new EdgeEffectParameters
{
- Size = new Vector2(circle_outer_scale),
- EdgeEffect = new EdgeEffectParameters
+ Colour = Color4.Black.Opacity(0.4f),
+ Type = EdgeEffectType.Shadow,
+ Radius = 15,
+ },
+ RelativeSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Masking = true,
+ Children = new Drawable[]
+ {
+ new Box
{
- Colour = Color4.Black.Opacity(0.4f),
- Type = EdgeEffectType.Shadow,
- Radius = 15,
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.White,
},
- RelativeSizeAxes = Axes.Both,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Masking = true,
- Children = new Drawable[]
+ backgroundParallax = new ParallaxContainer
{
- new Box
+ RelativeSizeAxes = Axes.Both,
+ ParallaxAmount = 0.01f,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Children = new Drawable[]
{
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.White,
- },
- backgroundParallax = new ParallaxContainer
- {
- RelativeSizeAxes = Axes.Both,
- ParallaxAmount = 0.01f,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Children = new Drawable[]
+ new Sprite
{
- new Sprite
- {
- RelativeSizeAxes = Axes.Both,
- Alpha = 0.2f,
- Texture = Beatmap.Value.Background,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- FillMode = FillMode.Fill
- }
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0.2f,
+ Texture = Beatmap.Value.Background,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ FillMode = FillMode.Fill
}
- },
- modeChangeButtons = new ResultModeTabControl
- {
- Anchor = Anchor.BottomCentre,
- Origin = Anchor.BottomCentre,
- RelativeSizeAxes = Axes.X,
- Height = 50,
- Margin = new MarginPadding { Bottom = 110 },
- },
- new OsuSpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.BottomCentre,
- Text = $"{Score.MaxCombo}x",
- RelativePositionAxes = Axes.X,
- Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40),
- X = 0.1f,
- Colour = colours.BlueDarker,
- },
- new OsuSpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.TopCentre,
- Text = "max combo",
- Font = OsuFont.GetFont(size: 20),
- RelativePositionAxes = Axes.X,
- X = 0.1f,
- Colour = colours.Gray6,
- },
- new OsuSpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.BottomCentre,
- Text = $"{Score.Accuracy:P2}",
- Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40),
- RelativePositionAxes = Axes.X,
- X = 0.9f,
- Colour = colours.BlueDarker,
- },
- new OsuSpriteText
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.TopCentre,
- Text = "accuracy",
- Font = OsuFont.GetFont(size: 20),
- RelativePositionAxes = Axes.X,
- X = 0.9f,
- Colour = colours.Gray6,
- },
- }
- },
- circleInner = new CircularContainer
- {
- Size = new Vector2(0.6f),
- EdgeEffect = new EdgeEffectParameters
- {
- Colour = Color4.Black.Opacity(0.4f),
- Type = EdgeEffectType.Shadow,
- Radius = 15,
+ }
},
- RelativeSizeAxes = Axes.Both,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Masking = true,
- Children = new Drawable[]
+ modeChangeButtons = new ResultModeTabControl
{
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.White,
- },
- }
+ Anchor = Anchor.BottomCentre,
+ Origin = Anchor.BottomCentre,
+ RelativeSizeAxes = Axes.X,
+ Height = 50,
+ Margin = new MarginPadding { Bottom = 110 },
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.BottomCentre,
+ Text = $"{Score.MaxCombo}x",
+ RelativePositionAxes = Axes.X,
+ Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40),
+ X = 0.1f,
+ Colour = colours.BlueDarker,
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.TopCentre,
+ Text = "max combo",
+ Font = OsuFont.GetFont(size: 20),
+ RelativePositionAxes = Axes.X,
+ X = 0.1f,
+ Colour = colours.Gray6,
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.BottomCentre,
+ Text = $"{Score.Accuracy:P2}",
+ Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40),
+ RelativePositionAxes = Axes.X,
+ X = 0.9f,
+ Colour = colours.BlueDarker,
+ },
+ new OsuSpriteText
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.TopCentre,
+ Text = "accuracy",
+ Font = OsuFont.GetFont(size: 20),
+ RelativePositionAxes = Axes.X,
+ X = 0.9f,
+ Colour = colours.Gray6,
+ },
+ }
+ },
+ circleInner = new CircularContainer
+ {
+ Size = new Vector2(0.6f),
+ EdgeEffect = new EdgeEffectParameters
+ {
+ Colour = Color4.Black.Opacity(0.4f),
+ Type = EdgeEffectType.Shadow,
+ Radius = 15,
+ },
+ RelativeSizeAxes = Axes.Both,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Masking = true,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.White,
+ },
}
}
}
};
+ if (player != null)
+ {
+ AddInternal(new HotkeyRetryOverlay
+ {
+ Action = () =>
+ {
+ if (!this.IsCurrentScreen()) return;
+
+ player?.Restart();
+ },
+ });
+ }
+
var pages = CreateResultPages();
foreach (var p in pages)
diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
index 09b728abeb..aa48d1a04e 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
+using System.Linq;
namespace osu.Game.Screens.Select.Carousel
{
@@ -81,12 +82,10 @@ namespace osu.Game.Screens.Select.Carousel
{
base.Filter(criteria);
- var children = new List(InternalChildren);
-
- children.ForEach(c => c.Filter(criteria));
- children.Sort((x, y) => x.CompareTo(criteria, y));
-
- InternalChildren = children;
+ InternalChildren.ForEach(c => c.Filter(criteria));
+ // IEnumerable.OrderBy() is used instead of List.Sort() to ensure sorting stability
+ var criteriaComparer = Comparer.Create((x, y) => x.CompareTo(criteria, y));
+ InternalChildren = InternalChildren.OrderBy(c => c, criteriaComparer).ToList();
}
protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value)
diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs
index 337d46ecdd..3ef1fe5bc5 100644
--- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs
+++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs
@@ -179,7 +179,7 @@ namespace osu.Game.Screens.Select.Leaderboards
return req;
}
- protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index)
+ protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
{
Action = () => ScoreSelected?.Invoke(model)
};
diff --git a/osu.Game/Screens/Select/Leaderboards/UserTopScoreContainer.cs b/osu.Game/Screens/Select/Leaderboards/UserTopScoreContainer.cs
index da8f676cd0..a787eb5629 100644
--- a/osu.Game/Screens/Select/Leaderboards/UserTopScoreContainer.cs
+++ b/osu.Game/Screens/Select/Leaderboards/UserTopScoreContainer.cs
@@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select.Leaderboards
if (newScore == null)
return;
- LoadComponentAsync(new LeaderboardScore(newScore.Score, newScore.Position)
+ LoadComponentAsync(new LeaderboardScore(newScore.Score, newScore.Position, false)
{
Action = () => ScoreSelected?.Invoke(newScore.Score)
}, drawableScore =>
diff --git a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
index f53c12b047..3233ee160d 100644
--- a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
+++ b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs
@@ -8,7 +8,7 @@ using osu.Game.Rulesets.Edit;
namespace osu.Game.Tests.Visual
{
- public abstract class SelectionBlueprintTestScene : OsuTestScene
+ public abstract class SelectionBlueprintTestScene : ManualInputManagerTestScene
{
protected override Container Content => content ?? base.Content;
private readonly Container content;
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index e898a001de..0cb09d9b14 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -26,7 +26,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index 656c60543e..719aced705 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -118,8 +118,8 @@
-
-
+
+
diff --git a/osu.iOS/AppDelegate.cs b/osu.iOS/AppDelegate.cs
index 9ef21e014c..164a182ebe 100644
--- a/osu.iOS/AppDelegate.cs
+++ b/osu.iOS/AppDelegate.cs
@@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Foundation;
using osu.Framework.iOS;
-using osu.Game;
+using osu.Framework.Threading;
using UIKit;
namespace osu.iOS
@@ -16,9 +16,12 @@ namespace osu.iOS
protected override Framework.Game CreateGame() => game = new OsuGameIOS();
- public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
+ public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
- Task.Run(() => game.Import(url.Path));
+ if (url.IsFileUrl)
+ Task.Run(() => game.Import(url.Path));
+ else
+ Task.Run(() => game.HandleLink(url.AbsoluteString));
return true;
}
}
diff --git a/osu.iOS/Info.plist b/osu.iOS/Info.plist
index a118b329aa..5ceccdf99f 100644
--- a/osu.iOS/Info.plist
+++ b/osu.iOS/Info.plist
@@ -14,6 +14,8 @@
0.1.0
LSRequiresIPhoneOS
+ LSSupportsOpeningDocumentsInPlace
+
MinimumOSVersion
10.0
UIDeviceFamily
@@ -32,9 +34,9 @@
UIStatusBarHidden
NSCameraUsageDescription
- We don't really use the camera.
- NSMicrophoneUsageDescription
- We don't really use the microphone.
+ We don't really use the camera.
+ NSMicrophoneUsageDescription
+ We don't really use the microphone.
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
@@ -109,5 +111,17 @@
+ CFBundleURLTypes
+
+
+ CFBundleURLSchemes
+
+ osu
+ osump
+
+ CFBundleTypeRole
+ Editor
+
+