diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 58c24181d3..b51ecb4f7e 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -31,6 +31,12 @@
"commands": [
"CodeFileSanity"
]
+ },
+ "ppy.localisationanalyser.tools": {
+ "version": "2021.524.0",
+ "commands": [
+ "localisation"
+ ]
}
}
}
\ No newline at end of file
diff --git a/osu.Android.props b/osu.Android.props
index 90d131b117..b3842a528d 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -52,6 +52,6 @@
-
+
diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs
index bba42dea97..7bad4c79cb 100644
--- a/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs
+++ b/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs
@@ -28,10 +28,12 @@ namespace osu.Game.Rulesets.Catch.Mods
catchPlayfield.CatcherArea.MovableCatcher.CatchFruitOnPlate = false;
}
+ protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
+ {
+ }
+
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
{
- base.ApplyNormalVisibilityState(hitObject, state);
-
if (!(hitObject is DrawableCatchHitObject catchDrawable))
return;
@@ -54,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Mods
var offset = hitObject.TimePreempt * fade_out_offset_multiplier;
var duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier;
- using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset, true))
+ using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset))
drawable.FadeOut(duration);
}
}
diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs
index 24f4c6858e..5e99264d7d 100644
--- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs
@@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
}
};
- AddBlueprint(new HoldNoteSelectionBlueprint(drawableObject));
+ AddBlueprint(new HoldNoteSelectionBlueprint(holdNote), drawableObject);
}
protected override void Update()
diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs
index aaf96c63a6..8474279b01 100644
--- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs
@@ -184,8 +184,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
AddAssert("head note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.BottomLeft, holdNote.Head.ScreenSpaceDrawQuad.BottomLeft));
AddAssert("tail note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.TopLeft, holdNote.Tail.ScreenSpaceDrawQuad.BottomLeft));
- AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
- AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
+ AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
+ AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
}
private void setScrollStep(ScrollingDirection direction)
diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
index 36c34a8fb9..a162c5ec44 100644
--- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
@@ -15,7 +15,6 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
-using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Mania.Tests.Editor
@@ -35,7 +34,11 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
[Test]
public void TestPlaceBeforeCurrentTimeDownwards()
{
- AddStep("move mouse before current time", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single().ScreenSpaceDrawQuad.BottomLeft - new Vector2(0, 10)));
+ AddStep("move mouse before current time", () =>
+ {
+ var column = this.ChildrenOfType().Single();
+ InputManager.MoveMouseTo(column.ScreenSpacePositionAtTime(-100));
+ });
AddStep("click", () => InputManager.Click(MouseButton.Left));
@@ -45,7 +48,11 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
[Test]
public void TestPlaceAfterCurrentTimeDownwards()
{
- AddStep("move mouse after current time", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single()));
+ AddStep("move mouse after current time", () =>
+ {
+ var column = this.ChildrenOfType().Single();
+ InputManager.MoveMouseTo(column.ScreenSpacePositionAtTime(100));
+ });
AddStep("click", () => InputManager.Click(MouseButton.Left));
diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs
index 0e47a12a8e..9c3ad0b4ff 100644
--- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs
@@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
Child = drawableObject = new DrawableNote(note)
};
- AddBlueprint(new NoteSelectionBlueprint(drawableObject));
+ AddBlueprint(new NoteSelectionBlueprint(note), drawableObject);
}
}
}
diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs
index bde323f187..ca323b5911 100644
--- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
- Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground, 0), _ => new DefaultColumnBackground())
+ Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
{
RelativeSizeAxes = Axes.Both
}
@@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
- Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground, 1), _ => new DefaultColumnBackground())
+ Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
{
RelativeSizeAxes = Axes.Both
}
diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs
index 7e80419944..c58c07c83b 100644
--- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
- Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea, 0), _ => new DefaultKeyArea())
+ Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea())
{
RelativeSizeAxes = Axes.Both
},
@@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
- Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea, 1), _ => new DefaultKeyArea())
+ Child = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea())
{
RelativeSizeAxes = Axes.Both
},
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs
new file mode 100644
index 0000000000..4a6c59e297
--- /dev/null
+++ b/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs
@@ -0,0 +1,67 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using NUnit.Framework;
+using osu.Framework.Graphics;
+using osu.Framework.Timing;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Rulesets.Mania.Objects;
+using osu.Game.Rulesets.Mania.Objects.Drawables;
+using osu.Game.Rulesets.Mania.UI;
+using osu.Game.Rulesets.UI.Scrolling;
+using osu.Game.Tests.Visual;
+using osuTK.Graphics;
+
+namespace osu.Game.Rulesets.Mania.Tests
+{
+ public class TestSceneDrawableManiaHitObject : OsuTestScene
+ {
+ private readonly ManualClock clock = new ManualClock();
+
+ private Column column;
+
+ [SetUp]
+ public void SetUp() => Schedule(() =>
+ {
+ Child = new ScrollingTestContainer(ScrollingDirection.Down)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.X,
+ RelativeSizeAxes = Axes.Y,
+ TimeRange = 2000,
+ Clock = new FramedClock(clock),
+ Child = column = new Column(0)
+ {
+ Action = { Value = ManiaAction.Key1 },
+ Height = 0.85f,
+ AccentColour = Color4.Gray
+ },
+ };
+ });
+
+ [Test]
+ public void TestHoldNoteHeadVisibility()
+ {
+ DrawableHoldNote note = null;
+ AddStep("Add hold note", () =>
+ {
+ var h = new HoldNote
+ {
+ StartTime = 0,
+ Duration = 1000
+ };
+ h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
+ column.Add(note = new DrawableHoldNote(h));
+ });
+ AddStep("Hold key", () =>
+ {
+ clock.CurrentTime = 0;
+ note.OnPressed(ManiaAction.Key1);
+ });
+ AddStep("progress time", () => clock.CurrentTime = 500);
+ AddAssert("head is visible", () => note.Head.Alpha == 1);
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs
index 668487f673..471dad87d5 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs
@@ -5,13 +5,11 @@ using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Screens;
-using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Replays;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Objects;
-using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Mania.Scoring;
using osu.Game.Rulesets.Objects;
@@ -414,14 +412,7 @@ namespace osu.Game.Rulesets.Mania.Tests
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
- AddUntilStep("wait for head", () => currentPlayer.GameplayClockContainer.GameplayClock.CurrentTime >= time_head);
- AddAssert("head is visible",
- () => currentPlayer.ChildrenOfType()
- .Single(note => note.HitObject == beatmap.HitObjects[0])
- .Head
- .Alpha == 1);
-
- AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
+ AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor?.HasCompleted.Value == true);
}
private class ScoreAccessibleReplayPlayer : ReplayPlayer
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteNoteOverlay.cs
similarity index 61%
rename from osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteNoteSelectionBlueprint.cs
rename to osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteNoteOverlay.cs
index 4e73883de0..6933571be8 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteNoteOverlay.cs
@@ -2,34 +2,35 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
- public class HoldNoteNoteSelectionBlueprint : ManiaSelectionBlueprint
+ public class HoldNoteNoteOverlay : CompositeDrawable
{
- protected new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject;
-
+ private readonly HoldNoteSelectionBlueprint holdNoteBlueprint;
private readonly HoldNotePosition position;
- public HoldNoteNoteSelectionBlueprint(DrawableHoldNote holdNote, HoldNotePosition position)
- : base(holdNote)
+ public HoldNoteNoteOverlay(HoldNoteSelectionBlueprint holdNoteBlueprint, HoldNotePosition position)
{
+ this.holdNoteBlueprint = holdNoteBlueprint;
this.position = position;
- InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
- Select();
+ InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
}
protected override void Update()
{
base.Update();
+ var drawableObject = holdNoteBlueprint.DrawableObject;
+
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
- if (DrawableObject.IsLoaded)
+ if (drawableObject.IsLoaded)
{
- DrawableNote note = position == HoldNotePosition.Start ? (DrawableNote)DrawableObject.Head : DrawableObject.Tail;
+ DrawableNote note = position == HoldNotePosition.Start ? (DrawableNote)drawableObject.Head : drawableObject.Tail;
Anchor = note.Anchor;
Origin = note.Origin;
@@ -38,8 +39,5 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
Position = note.DrawPosition;
}
}
-
- // Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input.
- public override bool HandlePositionalInput => false;
}
}
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs
index 1737c4d2e5..d04c5cd4aa 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs
@@ -8,13 +8,14 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
- public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint
+ public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint
{
public new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject;
@@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
[Resolved]
private OsuColour colours { get; set; }
- public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
+ public HoldNoteSelectionBlueprint(HoldNote hold)
: base(hold)
{
}
@@ -32,16 +33,11 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
private void load(IScrollingInfo scrollingInfo)
{
direction.BindTo(scrollingInfo.Direction);
- }
-
- protected override void LoadComplete()
- {
- base.LoadComplete();
InternalChildren = new Drawable[]
{
- new HoldNoteNoteSelectionBlueprint(DrawableObject, HoldNotePosition.Start),
- new HoldNoteNoteSelectionBlueprint(DrawableObject, HoldNotePosition.End),
+ new HoldNoteNoteOverlay(this, HoldNotePosition.Start),
+ new HoldNoteNoteOverlay(this, HoldNotePosition.End),
new Container
{
RelativeSizeAxes = Axes.Both,
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs
index 384f49d9b2..e744bd3c83 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs
@@ -4,22 +4,23 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Edit;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
-using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
- public abstract class ManiaSelectionBlueprint : OverlaySelectionBlueprint
+ public abstract class ManiaSelectionBlueprint : HitObjectSelectionBlueprint
+ where T : ManiaHitObject
{
public new DrawableManiaHitObject DrawableObject => (DrawableManiaHitObject)base.DrawableObject;
[Resolved]
private IScrollingInfo scrollingInfo { get; set; }
- protected ManiaSelectionBlueprint(DrawableHitObject drawableObject)
- : base(drawableObject)
+ protected ManiaSelectionBlueprint(T hitObject)
+ : base(hitObject)
{
RelativeSizeAxes = Axes.None;
}
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs
index 2bff33c4cf..e2b6ee0048 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs
@@ -3,13 +3,13 @@
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
-using osu.Game.Rulesets.Mania.Objects.Drawables;
+using osu.Game.Rulesets.Mania.Objects;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
- public class NoteSelectionBlueprint : ManiaSelectionBlueprint
+ public class NoteSelectionBlueprint : ManiaSelectionBlueprint
{
- public NoteSelectionBlueprint(DrawableNote note)
+ public NoteSelectionBlueprint(Note note)
: base(note)
{
AddInternal(new EditNotePiece { RelativeSizeAxes = Axes.X });
diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs
index afc08dcc96..9d1f5429a1 100644
--- a/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs
+++ b/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs
@@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Mania.Edit
foreach (var line in grid.Objects.OfType())
availableLines.Push(line);
- grid.Clear(false);
+ grid.Clear();
}
if (selectionTimeRange == null)
diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
index c4429176d1..c5a109a6d1 100644
--- a/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
+++ b/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
@@ -3,9 +3,8 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints;
-using osu.Game.Rulesets.Mania.Objects.Drawables;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects;
-using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Rulesets.Mania.Edit
@@ -17,18 +16,18 @@ namespace osu.Game.Rulesets.Mania.Edit
{
}
- public override OverlaySelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
+ public override HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObject hitObject)
{
switch (hitObject)
{
- case DrawableNote note:
+ case Note note:
return new NoteSelectionBlueprint(note);
- case DrawableHoldNote holdNote:
+ case HoldNote holdNote:
return new HoldNoteSelectionBlueprint(holdNote);
}
- return base.CreateBlueprintFor(hitObject);
+ return base.CreateHitObjectBlueprintFor(hitObject);
}
protected override SelectionHandler CreateSelectionHandler() => new ManiaSelectionHandler();
diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs b/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
index 7042110423..dc858fb54f 100644
--- a/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
+++ b/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
@@ -5,7 +5,6 @@ using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
-using osu.Game.Rulesets.Mania.Edit.Blueprints;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI.Scrolling;
@@ -23,8 +22,8 @@ namespace osu.Game.Rulesets.Mania.Edit
public override bool HandleMovement(MoveSelectionEvent moveEvent)
{
- var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint;
- int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column;
+ var hitObjectBlueprint = (HitObjectSelectionBlueprint)moveEvent.Blueprint;
+ int lastColumn = ((ManiaHitObject)hitObjectBlueprint.Item).Column;
performColumnMovement(lastColumn, moveEvent);
@@ -59,8 +58,9 @@ namespace osu.Game.Rulesets.Mania.Edit
EditorBeatmap.PerformOnSelection(h =>
{
- if (h is ManiaHitObject maniaObj)
- maniaObj.Column += columnDelta;
+ maniaPlayfield.Remove(h);
+ ((ManiaHitObject)h).Column += columnDelta;
+ maniaPlayfield.Add(h);
});
}
}
diff --git a/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs b/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs
index f078345fc1..9aebf51576 100644
--- a/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs
+++ b/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs
@@ -9,12 +9,6 @@ namespace osu.Game.Rulesets.Mania
{
public class ManiaSkinComponent : GameplaySkinComponent
{
- ///
- /// The intended index for this component.
- /// May be null if the component does not exist in a .
- ///
- public readonly int? TargetColumn;
-
///
/// The intended for this component.
/// May be null if the component is not a direct member of a .
@@ -25,12 +19,10 @@ namespace osu.Game.Rulesets.Mania
/// Creates a new .
///
/// The component.
- /// The intended index for this component. May be null if the component does not exist in a .
/// The intended for this component. May be null if the component is not a direct member of a .
- public ManiaSkinComponent(ManiaSkinComponents component, int? targetColumn = null, StageDefinition? stageDefinition = null)
+ public ManiaSkinComponent(ManiaSkinComponents component, StageDefinition? stageDefinition = null)
: base(component)
{
- TargetColumn = targetColumn;
StageDefinition = stageDefinition;
}
diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs
index 87501d07a5..3c24e91d54 100644
--- a/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs
+++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs
@@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.Mods
@@ -39,5 +40,13 @@ namespace osu.Game.Rulesets.Mania.Mods
}));
}
}
+
+ protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
+ {
+ }
+
+ protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
+ {
+ }
}
}
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
index 02829d87bd..d1310d42eb 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -12,6 +13,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
+using osuTK;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
@@ -29,21 +31,21 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public DrawableHoldNoteHead Head => headContainer.Child;
public DrawableHoldNoteTail Tail => tailContainer.Child;
- private readonly Container headContainer;
- private readonly Container tailContainer;
- private readonly Container tickContainer;
+ private Container headContainer;
+ private Container tailContainer;
+ private Container tickContainer;
///
/// Contains the size of the hold note covering the whole head/tail bounds. The size of this container changes as the hold note is being pressed.
///
- private readonly Container sizingContainer;
+ private Container sizingContainer;
///
/// Contains the contents of the hold note that should be masked as the hold note is being pressed. Follows changes in the size of .
///
- private readonly Container maskingContainer;
+ private Container maskingContainer;
- private readonly SkinnableDrawable bodyPiece;
+ private SkinnableDrawable bodyPiece;
///
/// Time at which the user started holding this hold note. Null if the user is not holding this hold note.
@@ -60,11 +62,19 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
///
private double? releaseTime;
+ public DrawableHoldNote()
+ : this(null)
+ {
+ }
+
public DrawableHoldNote(HoldNote hitObject)
: base(hitObject)
{
- RelativeSizeAxes = Axes.X;
+ }
+ [BackgroundDependencyLoader]
+ private void load()
+ {
Container maskedContents;
AddRangeInternal(new Drawable[]
@@ -86,7 +96,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
headContainer = new Container { RelativeSizeAxes = Axes.Both }
}
},
- bodyPiece = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HoldNoteBody, hitObject.Column), _ => new DefaultBodyPiece
+ bodyPiece = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HoldNoteBody), _ => new DefaultBodyPiece
{
RelativeSizeAxes = Axes.Both,
})
@@ -105,6 +115,16 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
});
}
+ protected override void OnApply()
+ {
+ base.OnApply();
+
+ sizingContainer.Size = Vector2.One;
+ HoldStartTime = null;
+ HoldBrokenTime = null;
+ releaseTime = null;
+ }
+
protected override void AddNestedHitObject(DrawableHitObject hitObject)
{
base.AddNestedHitObject(hitObject);
@@ -128,37 +148,23 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected override void ClearNestedHitObjects()
{
base.ClearNestedHitObjects();
- headContainer.Clear();
- tailContainer.Clear();
- tickContainer.Clear();
+ headContainer.Clear(false);
+ tailContainer.Clear(false);
+ tickContainer.Clear(false);
}
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
{
switch (hitObject)
{
- case TailNote _:
- return new DrawableHoldNoteTail(this)
- {
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- AccentColour = { BindTarget = AccentColour }
- };
+ case TailNote tail:
+ return new DrawableHoldNoteTail(tail);
- case Note _:
- return new DrawableHoldNoteHead(this)
- {
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- AccentColour = { BindTarget = AccentColour }
- };
+ case HeadNote head:
+ return new DrawableHoldNoteHead(head);
case HoldNoteTick tick:
- return new DrawableHoldNoteTick(tick)
- {
- HoldStartTime = () => HoldStartTime,
- AccentColour = { BindTarget = AccentColour }
- };
+ return new DrawableHoldNoteTick(tick);
}
return base.CreateNestedHitObject(hitObject);
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs
index 35ba2465fa..be600f0d47 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
@@ -12,11 +13,18 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteHead;
- public DrawableHoldNoteHead(DrawableHoldNote holdNote)
- : base(holdNote.HitObject.Head)
+ public DrawableHoldNoteHead()
+ : this(null)
{
}
+ public DrawableHoldNoteHead(HeadNote headNote)
+ : base(headNote)
+ {
+ Anchor = Anchor.TopCentre;
+ Origin = Anchor.TopCentre;
+ }
+
public void UpdateResult() => base.UpdateResult(true);
protected override void UpdateInitialTransforms()
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs
index 3a00933e4d..18aa3f66d4 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
+using osu.Framework.Graphics;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
@@ -20,12 +21,18 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteTail;
- private readonly DrawableHoldNote holdNote;
+ protected DrawableHoldNote HoldNote => (DrawableHoldNote)ParentHitObject;
- public DrawableHoldNoteTail(DrawableHoldNote holdNote)
- : base(holdNote.HitObject.Tail)
+ public DrawableHoldNoteTail()
+ : this(null)
{
- this.holdNote = holdNote;
+ }
+
+ public DrawableHoldNoteTail(TailNote tailNote)
+ : base(tailNote)
+ {
+ Anchor = Anchor.TopCentre;
+ Origin = Anchor.TopCentre;
}
public void UpdateResult() => base.UpdateResult(true);
@@ -54,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
ApplyResult(r =>
{
// If the head wasn't hit or the hold note was broken, cap the max score to Meh.
- if (result > HitResult.Meh && (!holdNote.Head.IsHit || holdNote.HoldBrokenTime != null))
+ if (result > HitResult.Meh && (!HoldNote.Head.IsHit || HoldNote.HoldBrokenTime != null))
result = HitResult.Meh;
r.Type = result;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs
index 98931dceed..f040dad135 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs
@@ -2,7 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using osuTK;
+using System.Diagnostics;
+using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -19,38 +20,48 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
///
/// References the time at which the user started holding the hold note.
///
- public Func HoldStartTime;
+ private Func holdStartTime;
+
+ private Container glowContainer;
+
+ public DrawableHoldNoteTick()
+ : this(null)
+ {
+ }
public DrawableHoldNoteTick(HoldNoteTick hitObject)
: base(hitObject)
{
- Container glowContainer;
-
Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre;
RelativeSizeAxes = Axes.X;
- Size = new Vector2(1);
+ }
- AddRangeInternal(new[]
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ AddInternal(glowContainer = new CircularContainer
{
- glowContainer = new CircularContainer
+ Anchor = Anchor.TopCentre,
+ Origin = Anchor.TopCentre,
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ Children = new[]
{
- Anchor = Anchor.TopCentre,
- Origin = Anchor.TopCentre,
- RelativeSizeAxes = Axes.Both,
- Masking = true,
- Children = new[]
+ new Box
{
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Alpha = 0,
- AlwaysPresent = true
- }
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0,
+ AlwaysPresent = true
}
}
});
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
AccentColour.BindValueChanged(colour =>
{
@@ -64,12 +75,29 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}, true);
}
+ protected override void OnApply()
+ {
+ base.OnApply();
+
+ Debug.Assert(ParentHitObject != null);
+
+ var holdNote = (DrawableHoldNote)ParentHitObject;
+ holdStartTime = () => holdNote.HoldStartTime;
+ }
+
+ protected override void OnFree()
+ {
+ base.OnFree();
+
+ holdStartTime = null;
+ }
+
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (Time.Current < HitObject.StartTime)
return;
- var startTime = HoldStartTime?.Invoke();
+ var startTime = holdStartTime?.Invoke();
if (startTime == null || startTime > HitObject.StartTime)
ApplyResult(r => r.Type = r.Judgement.MinResult);
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs
index 003646d654..380ab35339 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs
@@ -50,6 +50,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected DrawableManiaHitObject(ManiaHitObject hitObject)
: base(hitObject)
{
+ RelativeSizeAxes = Axes.X;
}
[BackgroundDependencyLoader(true)]
@@ -59,9 +60,31 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Action.BindTo(action);
Direction.BindTo(scrollingInfo.Direction);
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
Direction.BindValueChanged(OnDirectionChanged, true);
}
+ protected override void OnApply()
+ {
+ base.OnApply();
+
+ if (ParentHitObject != null)
+ AccentColour.BindTo(ParentHitObject.AccentColour);
+ }
+
+ protected override void OnFree()
+ {
+ base.OnFree();
+
+ if (ParentHitObject != null)
+ AccentColour.UnbindFrom(ParentHitObject.AccentColour);
+ }
+
private double computedLifetimeStart;
public override double LifetimeStart
@@ -147,12 +170,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public abstract class DrawableManiaHitObject : DrawableManiaHitObject
where TObject : ManiaHitObject
{
- public new readonly TObject HitObject;
+ public new TObject HitObject => (TObject)base.HitObject;
protected DrawableManiaHitObject(TObject hitObject)
: base(hitObject)
{
- HitObject = hitObject;
}
}
}
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
index 36565e14aa..33d872dfb6 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
@@ -33,31 +33,37 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected virtual ManiaSkinComponents Component => ManiaSkinComponents.Note;
- private readonly Drawable headPiece;
+ private Drawable headPiece;
+
+ public DrawableNote()
+ : this(null)
+ {
+ }
public DrawableNote(Note hitObject)
: base(hitObject)
{
- RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
-
- AddInternal(headPiece = new SkinnableDrawable(new ManiaSkinComponent(Component, hitObject.Column), _ => new DefaultNotePiece())
- {
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y
- });
}
[BackgroundDependencyLoader(true)]
private void load(ManiaRulesetConfigManager rulesetConfig)
{
rulesetConfig?.BindWith(ManiaRulesetSetting.TimingBasedNoteColouring, configTimingBasedNoteColouring);
+
+ AddInternal(headPiece = new SkinnableDrawable(new ManiaSkinComponent(Component), _ => new DefaultNotePiece())
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y
+ });
}
protected override void LoadComplete()
{
- HitObject.StartTimeBindable.BindValueChanged(_ => updateSnapColour());
- configTimingBasedNoteColouring.BindValueChanged(_ => updateSnapColour(), true);
+ base.LoadComplete();
+
+ configTimingBasedNoteColouring.BindValueChanged(_ => updateSnapColour());
+ StartTimeBindable.BindValueChanged(_ => updateSnapColour(), true);
}
protected override void OnDirectionChanged(ValueChangedEvent e)
@@ -102,7 +108,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
private void updateSnapColour()
{
- if (beatmap == null) return;
+ if (beatmap == null || HitObject == null) return;
int snapDivisor = beatmap.ControlPointInfo.GetClosestBeatDivisor(HitObject.StartTime);
diff --git a/osu.Game.Rulesets.Mania/Objects/HeadNote.cs b/osu.Game.Rulesets.Mania/Objects/HeadNote.cs
new file mode 100644
index 0000000000..e69cc62aed
--- /dev/null
+++ b/osu.Game.Rulesets.Mania/Objects/HeadNote.cs
@@ -0,0 +1,9 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+namespace osu.Game.Rulesets.Mania.Objects
+{
+ public class HeadNote : Note
+ {
+ }
+}
diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs
index 6cc7ff92d3..43e876b7aa 100644
--- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs
+++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs
@@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Mania.Objects
///
/// The head note of the hold.
///
- public Note Head { get; private set; }
+ public HeadNote Head { get; private set; }
///
/// The tail note of the hold.
@@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Mania.Objects
createTicks(cancellationToken);
- AddNested(Head = new Note
+ AddNested(Head = new HeadNote
{
StartTime = StartTime,
Column = Column,
diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs
index 0f02e2cd4b..9b5893b268 100644
--- a/osu.Game.Rulesets.Mania/UI/Column.cs
+++ b/osu.Game.Rulesets.Mania/UI/Column.cs
@@ -17,6 +17,7 @@ using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
using osuTK;
using osu.Game.Rulesets.Mania.Beatmaps;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.UI
@@ -55,7 +56,7 @@ namespace osu.Game.Rulesets.Mania.UI
RelativeSizeAxes = Axes.Y;
Width = COLUMN_WIDTH;
- Drawable background = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground, Index), _ => new DefaultColumnBackground())
+ Drawable background = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
{
RelativeSizeAxes = Axes.Both
};
@@ -66,7 +67,7 @@ namespace osu.Game.Rulesets.Mania.UI
// For input purposes, the background is added at the highest depth, but is then proxied back below all other elements
background.CreateProxy(),
HitObjectArea = new ColumnHitObjectArea(Index, HitObjectContainer) { RelativeSizeAxes = Axes.Both },
- new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea, Index), _ => new DefaultKeyArea())
+ new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea())
{
RelativeSizeAxes = Axes.Both
},
@@ -83,6 +84,19 @@ namespace osu.Game.Rulesets.Mania.UI
hitPolicy = new OrderedHitPolicy(HitObjectContainer);
TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy());
+
+ RegisterPool(10, 50);
+ RegisterPool(10, 50);
+ RegisterPool(10, 50);
+ RegisterPool(10, 50);
+ RegisterPool(50, 250);
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ NewResult += OnNewResult;
}
public ColumnType ColumnType { get; set; }
@@ -98,28 +112,14 @@ namespace osu.Game.Rulesets.Mania.UI
return dependencies;
}
- ///
- /// Adds a DrawableHitObject to this Playfield.
- ///
- /// The DrawableHitObject to add.
- public override void Add(DrawableHitObject hitObject)
+ protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObject)
{
- hitObject.AccentColour.Value = AccentColour;
- hitObject.OnNewResult += OnNewResult;
+ base.OnNewDrawableHitObject(drawableHitObject);
- DrawableManiaHitObject maniaObject = (DrawableManiaHitObject)hitObject;
+ DrawableManiaHitObject maniaObject = (DrawableManiaHitObject)drawableHitObject;
+
+ maniaObject.AccentColour.Value = AccentColour;
maniaObject.CheckHittable = hitPolicy.IsHittable;
-
- base.Add(hitObject);
- }
-
- public override bool Remove(DrawableHitObject h)
- {
- if (!base.Remove(h))
- return false;
-
- h.OnNewResult -= OnNewResult;
- return true;
}
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs
index b365ae45a9..f69d2aafdc 100644
--- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs
+++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs
@@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
RelativeSizeAxes = Axes.Both,
Depth = 2,
},
- hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget, columnIndex), _ => new DefaultHitTarget())
+ hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget), _ => new DefaultHitTarget())
{
RelativeSizeAxes = Axes.X,
Depth = 1
diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs
index 4ee060e91e..e497646a13 100644
--- a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs
+++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs
@@ -18,7 +18,6 @@ using osu.Game.Replays;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Objects;
-using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
@@ -134,20 +133,7 @@ namespace osu.Game.Rulesets.Mania.UI
protected override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant);
- public override DrawableHitObject CreateDrawableRepresentation(ManiaHitObject h)
- {
- switch (h)
- {
- case HoldNote holdNote:
- return new DrawableHoldNote(holdNote);
-
- case Note note:
- return new DrawableNote(note);
-
- default:
- return null;
- }
- }
+ public override DrawableHitObject CreateDrawableRepresentation(ManiaHitObject h) => null;
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new ManiaFramedReplayInputHandler(replay);
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
index 271e432e8d..8830c440c0 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
@@ -9,6 +9,7 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
@@ -56,6 +57,10 @@ namespace osu.Game.Rulesets.Mania.UI
}
}
+ public override void Add(HitObject hitObject) => getStageByColumn(((ManiaHitObject)hitObject).Column).Add(hitObject);
+
+ public override bool Remove(HitObject hitObject) => getStageByColumn(((ManiaHitObject)hitObject).Column).Remove(hitObject);
+
public override void Add(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h);
public override bool Remove(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Remove(h);
diff --git a/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs b/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
index 64b7d7d550..90d3c6c4c7 100644
--- a/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
+++ b/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.UI
[BackgroundDependencyLoader]
private void load()
{
- InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, column.Index), _ => new DefaultHitExplosion())
+ InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion), _ => new DefaultHitExplosion())
{
RelativeSizeAxes = Axes.Both
};
diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs
index dc34bffab1..8c703e7a8a 100644
--- a/osu.Game.Rulesets.Mania/UI/Stage.cs
+++ b/osu.Game.Rulesets.Mania/UI/Stage.cs
@@ -11,6 +11,7 @@ using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI.Components;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
@@ -132,33 +133,19 @@ namespace osu.Game.Rulesets.Mania.UI
}
}
- public override void Add(DrawableHitObject h)
+ protected override void LoadComplete()
{
- var maniaObject = (ManiaHitObject)h.HitObject;
-
- int columnIndex = -1;
-
- maniaObject.ColumnBindable.BindValueChanged(_ =>
- {
- if (columnIndex != -1)
- Columns.ElementAt(columnIndex).Remove(h);
-
- columnIndex = maniaObject.Column - firstColumnIndex;
- Columns.ElementAt(columnIndex).Add(h);
- }, true);
-
- h.OnNewResult += OnNewResult;
+ base.LoadComplete();
+ NewResult += OnNewResult;
}
- public override bool Remove(DrawableHitObject h)
- {
- var maniaObject = (ManiaHitObject)h.HitObject;
- int columnIndex = maniaObject.Column - firstColumnIndex;
- Columns.ElementAt(columnIndex).Remove(h);
+ public override void Add(HitObject hitObject) => Columns.ElementAt(((ManiaHitObject)hitObject).Column - firstColumnIndex).Add(hitObject);
- h.OnNewResult -= OnNewResult;
- return true;
- }
+ public override bool Remove(HitObject hitObject) => Columns.ElementAt(((ManiaHitObject)hitObject).Column - firstColumnIndex).Remove(hitObject);
+
+ public override void Add(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column - firstColumnIndex).Add(h);
+
+ public override bool Remove(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column - firstColumnIndex).Remove(h);
public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline));
diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs
index 66cd405195..315493318d 100644
--- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
Add(drawableObject = new DrawableHitCircle(hitCircle));
- AddBlueprint(blueprint = new TestBlueprint(drawableObject));
+ AddBlueprint(blueprint = new TestBlueprint(hitCircle), drawableObject);
});
[Test]
@@ -63,8 +63,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public new HitCirclePiece CirclePiece => base.CirclePiece;
- public TestBlueprint(DrawableHitCircle drawableCircle)
- : base(drawableCircle)
+ public TestBlueprint(HitCircle circle)
+ : base(circle)
{
}
}
diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs
index d7dfc3bd42..24b947c854 100644
--- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs
@@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
Add(drawableObject = new DrawableSlider(slider));
- AddBlueprint(new TestSliderBlueprint(drawableObject));
+ AddBlueprint(new TestSliderBlueprint(slider), drawableObject);
});
[Test]
@@ -150,23 +150,23 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
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 TestSliderCircleOverlay HeadOverlay => (TestSliderCircleOverlay)base.HeadOverlay;
+ public new TestSliderCircleOverlay TailOverlay => (TestSliderCircleOverlay)base.TailOverlay;
public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
- public TestSliderBlueprint(DrawableSlider slider)
+ public TestSliderBlueprint(Slider slider)
: base(slider)
{
}
- protected override SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new TestSliderCircleBlueprint(slider, position);
+ protected override SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new TestSliderCircleOverlay(slider, position);
}
- private class TestSliderCircleBlueprint : SliderCircleSelectionBlueprint
+ private class TestSliderCircleOverlay : SliderCircleOverlay
{
public new HitCirclePiece CirclePiece => base.CirclePiece;
- public TestSliderCircleBlueprint(DrawableSlider slider, SliderPosition position)
+ public TestSliderCircleOverlay(Slider slider, SliderPosition position)
: base(slider, position)
{
}
diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs
index f6e1be693b..0d828a79c8 100644
--- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs
@@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
Add(drawableObject = new DrawableSlider(slider));
- AddBlueprint(blueprint = new TestSliderBlueprint(drawableObject));
+ AddBlueprint(blueprint = new TestSliderBlueprint(slider), drawableObject);
});
[Test]
@@ -174,10 +174,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("body positioned correctly", () => blueprint.BodyPiece.Position == slider.StackedPosition);
AddAssert("head positioned correctly",
- () => Precision.AlmostEquals(blueprint.HeadBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
+ () => Precision.AlmostEquals(blueprint.HeadOverlay.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
AddAssert("tail positioned correctly",
- () => Precision.AlmostEquals(blueprint.TailBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
+ () => Precision.AlmostEquals(blueprint.TailOverlay.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
}
private void moveMouseToControlPoint(int index)
@@ -195,23 +195,23 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
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 TestSliderCircleOverlay HeadOverlay => (TestSliderCircleOverlay)base.HeadOverlay;
+ public new TestSliderCircleOverlay TailOverlay => (TestSliderCircleOverlay)base.TailOverlay;
public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
- public TestSliderBlueprint(DrawableSlider slider)
+ public TestSliderBlueprint(Slider slider)
: base(slider)
{
}
- protected override SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new TestSliderCircleBlueprint(slider, position);
+ protected override SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new TestSliderCircleOverlay(slider, position);
}
- private class TestSliderCircleBlueprint : SliderCircleSelectionBlueprint
+ private class TestSliderCircleOverlay : SliderCircleOverlay
{
public new HitCirclePiece CirclePiece => base.CirclePiece;
- public TestSliderCircleBlueprint(DrawableSlider slider, SliderPosition position)
+ public TestSliderCircleOverlay(Slider slider, SliderPosition position)
: base(slider, position)
{
}
diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs
index 4248f68a60..5007841805 100644
--- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs
@@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
Child = drawableSpinner = new DrawableSpinner(spinner)
});
- AddBlueprint(new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) });
+ AddBlueprint(new SpinnerSelectionBlueprint(spinner) { Size = new Vector2(0.5f) }, drawableSpinner);
}
}
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs
index f697a77d94..0a7ef443b1 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs
@@ -5,12 +5,14 @@ using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
+using osu.Framework.Testing;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
+using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
@@ -32,6 +34,16 @@ namespace osu.Game.Rulesets.Osu.Tests
AddStep($"{term} Small", () => SetContents(() => testSingle(7, autoplay)));
}
+ [Test]
+ public void TestSpinningSamplePitchShift()
+ {
+ AddStep("Add spinner", () => SetContents(() => testSingle(5, true, 4000)));
+ AddUntilStep("Pitch starts low", () => getSpinningSample().Frequency.Value < 0.8);
+ AddUntilStep("Pitch increases", () => getSpinningSample().Frequency.Value > 0.8);
+
+ PausableSkinnableSound getSpinningSample() => drawableSpinner.ChildrenOfType().FirstOrDefault(s => s.Samples.Any(i => i.LookupNames.Any(l => l.Contains("spinnerspin"))));
+ }
+
[TestCase(false)]
[TestCase(true)]
public void TestLongSpinner(bool autoplay)
@@ -93,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
base.Update();
if (auto)
- RotationTracker.AddRotation((float)(Clock.ElapsedFrameTime * 3));
+ RotationTracker.AddRotation((float)(Clock.ElapsedFrameTime * 2));
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
index abbb54e3c1..b21a3e038e 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs
@@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
protected readonly HitCirclePiece CirclePiece;
- public HitCircleSelectionBlueprint(DrawableHitCircle drawableCircle)
- : base(drawableCircle)
+ public HitCircleSelectionBlueprint(HitCircle circle)
+ : base(circle)
{
InternalChild = CirclePiece = new HitCirclePiece();
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
index 299f8fc43a..994c5cebeb 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
@@ -2,20 +2,20 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Edit;
-using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
- public abstract class OsuSelectionBlueprint : OverlaySelectionBlueprint
+ public abstract class OsuSelectionBlueprint : HitObjectSelectionBlueprint
where T : OsuHitObject
{
- protected T HitObject => (T)DrawableObject.HitObject;
+ protected new DrawableOsuHitObject DrawableObject => (DrawableOsuHitObject)base.DrawableObject;
protected override bool AlwaysShowWhenSelected => true;
- protected OsuSelectionBlueprint(DrawableHitObject drawableObject)
- : base(drawableObject)
+ protected OsuSelectionBlueprint(T hitObject)
+ : base(hitObject)
{
}
}
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 44c3056910..c36768baba 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -243,7 +243,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
int totalCount = Pieces.Count(p => p.IsSelected.Value);
int countOfState = Pieces.Where(p => p.IsSelected.Value).Count(p => p.ControlPoint.Type.Value == type);
- var item = new PathTypeMenuItem(type, () =>
+ var item = new TernaryStateRadioMenuItem(type == null ? "Inherit" : type.ToString().Humanize(), MenuItemType.Standard, _ =>
{
foreach (var p in Pieces.Where(p => p.IsSelected.Value))
updatePathType(p, type);
@@ -258,15 +258,5 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
return item;
}
-
- private class PathTypeMenuItem : TernaryStateMenuItem
- {
- public PathTypeMenuItem(PathType? type, Action action)
- : base(type == null ? "Inherit" : type.ToString().Humanize(), changeState, MenuItemType.Standard, _ => action?.Invoke())
- {
- }
-
- private static TernaryState changeState(TernaryState state) => TernaryState.True;
- }
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs
similarity index 50%
rename from osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs
index dec9cd8622..241ff70a18 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs
@@ -1,36 +1,32 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
-using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
- public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint
+ public class SliderCircleOverlay : CompositeDrawable
{
protected readonly HitCirclePiece CirclePiece;
+ private readonly Slider slider;
private readonly SliderPosition position;
- public SliderCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position)
- : base(slider)
+ public SliderCircleOverlay(Slider slider, SliderPosition position)
{
+ this.slider = slider;
this.position = position;
InternalChild = CirclePiece = new HitCirclePiece();
-
- Select();
}
protected override void Update()
{
base.Update();
- CirclePiece.UpdateFrom(position == SliderPosition.Start ? (HitCircle)HitObject.HeadCircle : HitObject.TailCircle);
+ CirclePiece.UpdateFrom(position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle);
}
-
- // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
- public override bool HandlePositionalInput => false;
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
index 88fcb1e715..e810d2fe0c 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
@@ -26,15 +26,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public class SliderSelectionBlueprint : OsuSelectionBlueprint
{
+ protected new DrawableSlider DrawableObject => (DrawableSlider)base.DrawableObject;
+
protected SliderBodyPiece BodyPiece { get; private set; }
- protected SliderCircleSelectionBlueprint HeadBlueprint { get; private set; }
- protected SliderCircleSelectionBlueprint TailBlueprint { get; private set; }
+ protected SliderCircleOverlay HeadOverlay { get; private set; }
+ protected SliderCircleOverlay TailOverlay { get; private set; }
[CanBeNull]
protected PathControlPointVisualiser ControlPointVisualiser { get; private set; }
- private readonly DrawableSlider slider;
-
[Resolved(CanBeNull = true)]
private HitObjectComposer composer { get; set; }
@@ -52,10 +52,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
private readonly BindableList controlPoints = new BindableList();
private readonly IBindable pathVersion = new Bindable();
- public SliderSelectionBlueprint(DrawableSlider slider)
+ public SliderSelectionBlueprint(Slider slider)
: base(slider)
{
- this.slider = slider;
}
[BackgroundDependencyLoader]
@@ -64,8 +63,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
InternalChildren = new Drawable[]
{
BodyPiece = new SliderBodyPiece(),
- HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
- TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
+ HeadOverlay = CreateCircleOverlay(HitObject, SliderPosition.Start),
+ TailOverlay = CreateCircleOverlay(HitObject, SliderPosition.End),
};
}
@@ -103,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
protected override void OnSelected()
{
- AddInternal(ControlPointVisualiser = new PathControlPointVisualiser(slider.HitObject, true)
+ AddInternal(ControlPointVisualiser = new PathControlPointVisualiser(HitObject, true)
{
RemoveControlPointsRequested = removeControlPoints
});
@@ -215,7 +214,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
}
// If there are 0 or 1 remaining control points, the slider is in a degenerate (single point) form and should be deleted
- if (controlPoints.Count <= 1 || !slider.HitObject.Path.HasValidLength)
+ if (controlPoints.Count <= 1 || !HitObject.Path.HasValidLength)
{
placementHandler?.Delete(HitObject);
return;
@@ -240,11 +239,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
new OsuMenuItem("Add control point", MenuItemType.Standard, () => addControlPoint(rightClickPosition)),
};
- public override Vector2 ScreenSpaceSelectionPoint => BodyPiece.ToScreenSpace(BodyPiece.PathStartLocation);
+ // Always refer to the drawable object's slider body so subsequent movement deltas are calculated with updated positions.
+ public override Vector2 ScreenSpaceSelectionPoint => DrawableObject.SliderBody?.ToScreenSpace(DrawableObject.SliderBody.PathOffset)
+ ?? BodyPiece.ToScreenSpace(BodyPiece.PathStartLocation);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
BodyPiece.ReceivePositionalInputAt(screenSpacePos) || ControlPointVisualiser?.Pieces.Any(p => p.ReceivePositionalInputAt(screenSpacePos)) == true;
- protected virtual SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new SliderCircleSelectionBlueprint(slider, position);
+ protected virtual SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new SliderCircleOverlay(slider, position);
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
index f05d4f8435..ee573d1a01 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
@@ -3,7 +3,6 @@
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
-using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
@@ -12,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
private readonly SpinnerPiece piece;
- public SpinnerSelectionBlueprint(DrawableSpinner spinner)
+ public SpinnerSelectionBlueprint(Spinner spinner)
: base(spinner)
{
InternalChild = piece = new SpinnerPiece();
diff --git a/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
index abac5eb56e..dc8c3d6107 100644
--- a/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
+++ b/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
@@ -3,11 +3,10 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
-using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
-using osu.Game.Rulesets.Osu.Objects.Drawables;
+using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Rulesets.Osu.Edit
@@ -21,21 +20,21 @@ namespace osu.Game.Rulesets.Osu.Edit
protected override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
- public override OverlaySelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
+ public override HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObject hitObject)
{
switch (hitObject)
{
- case DrawableHitCircle circle:
+ case HitCircle circle:
return new HitCircleSelectionBlueprint(circle);
- case DrawableSlider slider:
+ case Slider slider:
return new SliderSelectionBlueprint(slider);
- case DrawableSpinner spinner:
+ case Spinner spinner:
return new SpinnerSelectionBlueprint(spinner);
}
- return base.CreateBlueprintFor(hitObject);
+ return base.CreateHitObjectBlueprintFor(hitObject);
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs b/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs
index c2c1f6d602..57d0cd859d 100644
--- a/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs
+++ b/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
@@ -18,6 +17,17 @@ namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuSelectionHandler : EditorSelectionHandler
{
+ ///
+ /// During a transform, the initial origin is stored so it can be used throughout the operation.
+ ///
+ private Vector2? referenceOrigin;
+
+ ///
+ /// During a transform, the initial path types of a single selected slider are stored so they
+ /// can be maintained throughout the operation.
+ ///
+ private List referencePathTypes;
+
protected override void OnSelectionChanged()
{
base.OnSelectionChanged();
@@ -50,17 +60,6 @@ namespace osu.Game.Rulesets.Osu.Edit
return true;
}
- ///
- /// During a transform, the initial origin is stored so it can be used throughout the operation.
- ///
- private Vector2? referenceOrigin;
-
- ///
- /// During a transform, the initial path types of a single selected slider are stored so they
- /// can be maintained throughout the operation.
- ///
- private List referencePathTypes;
-
public override bool HandleReverse()
{
var hitObjects = EditorBeatmap.SelectedHitObjects;
@@ -114,24 +113,10 @@ namespace osu.Game.Rulesets.Osu.Edit
var hitObjects = selectedMovableObjects;
var selectedObjectsQuad = getSurroundingQuad(hitObjects);
- var centre = selectedObjectsQuad.Centre;
foreach (var h in hitObjects)
{
- var pos = h.Position;
-
- switch (direction)
- {
- case Direction.Horizontal:
- pos.X = centre.X - (pos.X - centre.X);
- break;
-
- case Direction.Vertical:
- pos.Y = centre.Y - (pos.Y - centre.Y);
- break;
- }
-
- h.Position = pos;
+ h.Position = GetFlippedPosition(direction, selectedObjectsQuad, h.Position);
if (h is Slider slider)
{
@@ -187,12 +172,12 @@ namespace osu.Game.Rulesets.Osu.Edit
foreach (var h in hitObjects)
{
- h.Position = rotatePointAroundOrigin(h.Position, referenceOrigin.Value, delta);
+ h.Position = RotatePointAroundOrigin(h.Position, referenceOrigin.Value, delta);
if (h is IHasPath path)
{
foreach (var point in path.Path.ControlPoints)
- point.Position.Value = rotatePointAroundOrigin(point.Position.Value, Vector2.Zero, delta);
+ point.Position.Value = RotatePointAroundOrigin(point.Position.Value, Vector2.Zero, delta);
}
}
@@ -204,7 +189,7 @@ namespace osu.Game.Rulesets.Osu.Edit
{
referencePathTypes ??= slider.Path.ControlPoints.Select(p => p.Type.Value).ToList();
- Quad sliderQuad = getSurroundingQuad(slider.Path.ControlPoints.Select(p => p.Position.Value));
+ Quad sliderQuad = GetSurroundingQuad(slider.Path.ControlPoints.Select(p => p.Position.Value));
// Limit minimum distance between control points after scaling to almost 0. Less than 0 causes the slider to flip, exactly 0 causes a crash through division by 0.
scale = Vector2.ComponentMax(new Vector2(Precision.FLOAT_EPSILON), sliderQuad.Size + scale) - sliderQuad.Size;
@@ -239,26 +224,10 @@ namespace osu.Game.Rulesets.Osu.Edit
private void scaleHitObjects(OsuHitObject[] hitObjects, Anchor reference, Vector2 scale)
{
scale = getClampedScale(hitObjects, reference, scale);
-
- // move the selection before scaling if dragging from top or left anchors.
- float xOffset = ((reference & Anchor.x0) > 0) ? -scale.X : 0;
- float yOffset = ((reference & Anchor.y0) > 0) ? -scale.Y : 0;
-
Quad selectionQuad = getSurroundingQuad(hitObjects);
foreach (var h in hitObjects)
- {
- var newPosition = h.Position;
-
- // guard against no-ops and NaN.
- if (scale.X != 0 && selectionQuad.Width > 0)
- newPosition.X = selectionQuad.TopLeft.X + xOffset + (h.X - selectionQuad.TopLeft.X) / selectionQuad.Width * (selectionQuad.Width + scale.X);
-
- if (scale.Y != 0 && selectionQuad.Height > 0)
- newPosition.Y = selectionQuad.TopLeft.Y + yOffset + (h.Y - selectionQuad.TopLeft.Y) / selectionQuad.Height * (selectionQuad.Height + scale.Y);
-
- h.Position = newPosition;
- }
+ h.Position = GetScaledPosition(reference, scale, selectionQuad, h.Position);
}
private (bool X, bool Y) isQuadInBounds(Quad quad)
@@ -333,7 +302,7 @@ namespace osu.Game.Rulesets.Osu.Edit
///
/// The hit objects to calculate a quad for.
private Quad getSurroundingQuad(OsuHitObject[] hitObjects) =>
- getSurroundingQuad(hitObjects.SelectMany(h =>
+ GetSurroundingQuad(hitObjects.SelectMany(h =>
{
if (h is IHasPath path)
{
@@ -348,58 +317,11 @@ namespace osu.Game.Rulesets.Osu.Edit
return new[] { h.Position };
}));
- ///
- /// Returns a gamefield-space quad surrounding the provided points.
- ///
- /// The points to calculate a quad for.
- private Quad getSurroundingQuad(IEnumerable points)
- {
- if (!EditorBeatmap.SelectedHitObjects.Any())
- return new Quad();
-
- Vector2 minPosition = new Vector2(float.MaxValue, float.MaxValue);
- Vector2 maxPosition = new Vector2(float.MinValue, float.MinValue);
-
- // Go through all hitobjects to make sure they would remain in the bounds of the editor after movement, before any movement is attempted
- foreach (var p in points)
- {
- minPosition = Vector2.ComponentMin(minPosition, p);
- maxPosition = Vector2.ComponentMax(maxPosition, p);
- }
-
- Vector2 size = maxPosition - minPosition;
-
- return new Quad(minPosition.X, minPosition.Y, size.X, size.Y);
- }
-
///
/// All osu! hitobjects which can be moved/rotated/scaled.
///
private OsuHitObject[] selectedMovableObjects => SelectedItems.OfType()
.Where(h => !(h is Spinner))
.ToArray();
-
- ///
- /// Rotate a point around an arbitrary origin.
- ///
- /// The point.
- /// The centre origin to rotate around.
- /// The angle to rotate (in degrees).
- private static Vector2 rotatePointAroundOrigin(Vector2 point, Vector2 origin, float angle)
- {
- angle = -angle;
-
- point.X -= origin.X;
- point.Y -= origin.Y;
-
- Vector2 ret;
- ret.X = point.X * MathF.Cos(MathUtils.DegreesToRadians(angle)) + point.Y * MathF.Sin(MathUtils.DegreesToRadians(angle));
- ret.Y = point.X * -MathF.Sin(MathUtils.DegreesToRadians(angle)) + point.Y * MathF.Cos(MathUtils.DegreesToRadians(angle));
-
- ret.X += origin.X;
- ret.Y += origin.Y;
-
- return ret;
- }
}
}
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
index 45f314af7b..2752feb0a1 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
@@ -43,13 +43,11 @@ namespace osu.Game.Rulesets.Osu.Mods
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
{
- base.ApplyIncreasedVisibilityState(hitObject, state);
applyState(hitObject, true);
}
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
{
- base.ApplyNormalVisibilityState(hitObject, state);
applyState(hitObject, false);
}
@@ -60,20 +58,20 @@ namespace osu.Game.Rulesets.Osu.Mods
OsuHitObject hitObject = drawableOsuObject.HitObject;
- (double startTime, double duration) fadeOut = getFadeOutParameters(drawableOsuObject);
+ (double fadeStartTime, double fadeDuration) = getFadeOutParameters(drawableOsuObject);
switch (drawableObject)
{
case DrawableSliderTail _:
- using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime, true))
- drawableObject.FadeOut(fadeOut.duration);
+ using (drawableObject.BeginAbsoluteSequence(fadeStartTime))
+ drawableObject.FadeOut(fadeDuration);
break;
case DrawableSliderRepeat sliderRepeat:
- using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime, true))
+ using (drawableObject.BeginAbsoluteSequence(fadeStartTime))
// only apply to circle piece – reverse arrow is not affected by hidden.
- sliderRepeat.CirclePiece.FadeOut(fadeOut.duration);
+ sliderRepeat.CirclePiece.FadeOut(fadeDuration);
break;
@@ -88,23 +86,23 @@ namespace osu.Game.Rulesets.Osu.Mods
else
{
// we don't want to see the approach circle
- using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt, true))
+ using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
circle.ApproachCircle.Hide();
}
- using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime, true))
- fadeTarget.FadeOut(fadeOut.duration);
+ using (drawableObject.BeginAbsoluteSequence(fadeStartTime))
+ fadeTarget.FadeOut(fadeDuration);
break;
case DrawableSlider slider:
- using (slider.BeginAbsoluteSequence(fadeOut.startTime, true))
- slider.Body.FadeOut(fadeOut.duration, Easing.Out);
+ using (slider.BeginAbsoluteSequence(fadeStartTime))
+ slider.Body.FadeOut(fadeDuration, Easing.Out);
break;
case DrawableSliderTick sliderTick:
- using (sliderTick.BeginAbsoluteSequence(fadeOut.startTime, true))
- sliderTick.FadeOut(fadeOut.duration);
+ using (sliderTick.BeginAbsoluteSequence(fadeStartTime))
+ sliderTick.FadeOut(fadeDuration);
break;
@@ -112,14 +110,14 @@ namespace osu.Game.Rulesets.Osu.Mods
// hide elements we don't care about.
// todo: hide background
- using (spinner.BeginAbsoluteSequence(fadeOut.startTime, true))
- spinner.FadeOut(fadeOut.duration);
+ using (spinner.BeginAbsoluteSequence(fadeStartTime))
+ spinner.FadeOut(fadeDuration);
break;
}
}
- private (double startTime, double duration) getFadeOutParameters(DrawableOsuHitObject drawableObject)
+ private (double fadeStartTime, double fadeDuration) getFadeOutParameters(DrawableOsuHitObject drawableObject)
{
switch (drawableObject)
{
@@ -137,7 +135,7 @@ namespace osu.Game.Rulesets.Osu.Mods
return getParameters(drawableObject.HitObject);
}
- static (double startTime, double duration) getParameters(OsuHitObject hitObject)
+ static (double fadeStartTime, double fadeDuration) getParameters(OsuHitObject hitObject)
{
var fadeOutStartTime = hitObject.StartTime - hitObject.TimePreempt + hitObject.TimeFadeIn;
var fadeOutDuration = hitObject.TimePreempt * fade_out_duration_multiplier;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
index 82b5492de6..0bec33bf77 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
@@ -34,7 +34,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public override bool DisplayResult => !HitObject.OnlyJudgeNestedObjects;
- private PlaySliderBody sliderBody => Body.Drawable as PlaySliderBody;
+ [CanBeNull]
+ public PlaySliderBody SliderBody => Body.Drawable as PlaySliderBody;
public IBindable PathVersion => pathVersion;
private readonly Bindable pathVersion = new Bindable();
@@ -215,16 +216,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);
Ball.UpdateProgress(completionProgress);
- sliderBody?.UpdateProgress(completionProgress);
+ SliderBody?.UpdateProgress(completionProgress);
foreach (DrawableHitObject hitObject in NestedHitObjects)
{
- if (hitObject is ITrackSnaking s) s.UpdateSnakingPosition(HitObject.Path.PositionAt(sliderBody?.SnakedStart ?? 0), HitObject.Path.PositionAt(sliderBody?.SnakedEnd ?? 0));
+ if (hitObject is ITrackSnaking s) s.UpdateSnakingPosition(HitObject.Path.PositionAt(SliderBody?.SnakedStart ?? 0), HitObject.Path.PositionAt(SliderBody?.SnakedEnd ?? 0));
if (hitObject is IRequireTracking t) t.Tracking = Ball.Tracking;
}
- Size = sliderBody?.Size ?? Vector2.Zero;
- OriginPosition = sliderBody?.PathOffset ?? Vector2.Zero;
+ Size = SliderBody?.Size ?? Vector2.Zero;
+ OriginPosition = SliderBody?.PathOffset ?? Vector2.Zero;
if (DrawSize != Vector2.Zero)
{
@@ -238,7 +239,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public override void OnKilled()
{
base.OnKilled();
- sliderBody?.RecyclePath();
+ SliderBody?.RecyclePath();
}
protected override void ApplySkin(ISkinSource skin, bool allowFallback)
@@ -324,7 +325,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
case ArmedState.Hit:
Ball.ScaleTo(HitObject.Scale * 1.4f, fade_out_time, Easing.Out);
- if (sliderBody?.SnakingOut.Value == true)
+ if (SliderBody?.SnakingOut.Value == true)
Body.FadeOut(40); // short fade to allow for any body colour to smoothly disappear.
break;
}
@@ -332,7 +333,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
this.FadeOut(fade_out_time, Easing.OutQuint).Expire();
}
- public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => sliderBody?.ReceivePositionalInputAt(screenSpacePos) ?? base.ReceivePositionalInputAt(screenSpacePos);
+ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => SliderBody?.ReceivePositionalInputAt(screenSpacePos) ?? base.ReceivePositionalInputAt(screenSpacePos);
private class DefaultSliderBody : PlaySliderBody
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
index 3a4753761a..19cee61f26 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
@@ -39,6 +39,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private Bindable isSpinning;
private bool spinnerFrequencyModulate;
+ private const float spinning_sample_initial_frequency = 1.0f;
+ private const float spinning_sample_modulated_base_frequency = 0.5f;
+
///
/// The amount of bonus score gained from spinning after the required number of spins, for display purposes.
///
@@ -106,9 +109,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
isSpinning.BindValueChanged(updateSpinningSample);
}
- private const float spinning_sample_initial_frequency = 1.0f;
- private const float spinning_sample_modulated_base_frequency = 0.5f;
-
protected override void OnFree()
{
base.OnFree();
diff --git a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
index 88c855d768..cb769c31b8 100644
--- a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
+++ b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
@@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Osu.Statistics
var point = new HitPoint(pointType, this)
{
- Colour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
+ BaseColour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
};
points[r][c] = point;
@@ -234,6 +234,11 @@ namespace osu.Game.Rulesets.Osu.Statistics
private class HitPoint : Circle
{
+ ///
+ /// The base colour which will be lightened/darkened depending on the value of this .
+ ///
+ public Color4 BaseColour;
+
private readonly HitPointType pointType;
private readonly AccuracyHeatmap heatmap;
@@ -284,7 +289,7 @@ namespace osu.Game.Rulesets.Osu.Statistics
Alpha = Math.Min(amount / lighten_cutoff, 1);
if (pointType == HitPointType.Hit)
- Colour = ((Color4)Colour).Lighten(Math.Max(0, amount - lighten_cutoff));
+ Colour = BaseColour.Lighten(Math.Max(0, amount - lighten_cutoff));
}
}
diff --git a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs
index a1d000386f..ac01508081 100644
--- a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs
+++ b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs
@@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
[SetUpSteps]
public void SetUp()
- => AddStep("clear SHOC", () => hitObjectContainer.Clear(false));
+ => AddStep("clear SHOC", () => hitObjectContainer.Clear());
protected void AddHitObject(DrawableHitObject hitObject)
=> AddStep("add to SHOC", () => hitObjectContainer.Add(hitObject));
diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs
index 17e7fb81f6..0d0fd136a7 100644
--- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs
@@ -14,10 +14,10 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
{
private readonly HitPiece piece;
- private static Hit hit;
+ public new Hit HitObject => (Hit)base.HitObject;
public HitPlacementBlueprint()
- : base(hit = new Hit())
+ : base(new Hit())
{
InternalChild = piece = new HitPiece
{
@@ -30,12 +30,12 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
switch (e.Button)
{
case MouseButton.Left:
- hit.Type = HitType.Centre;
+ HitObject.Type = HitType.Centre;
EndPlacement(true);
return true;
case MouseButton.Right:
- hit.Type = HitType.Rim;
+ HitObject.Type = HitType.Rim;
EndPlacement(true);
return true;
}
diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs
index 62f69122cc..01b90c4bca 100644
--- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs
@@ -3,14 +3,14 @@
using osu.Framework.Graphics;
using osu.Game.Rulesets.Edit;
-using osu.Game.Rulesets.Objects.Drawables;
+using osu.Game.Rulesets.Objects;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
{
- public class TaikoSelectionBlueprint : OverlaySelectionBlueprint
+ public class TaikoSelectionBlueprint : HitObjectSelectionBlueprint
{
- public TaikoSelectionBlueprint(DrawableHitObject hitObject)
+ public TaikoSelectionBlueprint(HitObject hitObject)
: base(hitObject)
{
RelativeSizeAxes = Axes.None;
diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs
index b1b08a9461..a465638779 100644
--- a/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs
+++ b/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs
@@ -3,7 +3,6 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
-using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Edit.Blueprints;
using osu.Game.Screens.Edit.Compose.Components;
@@ -18,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Edit
protected override SelectionHandler CreateSelectionHandler() => new TaikoSelectionHandler();
- public override OverlaySelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) =>
+ public override HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObject hitObject) =>
new TaikoSelectionBlueprint(hitObject);
}
}
diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
index 48ee0d4cf4..a24130d6ac 100644
--- a/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
+++ b/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
@@ -76,10 +76,10 @@ namespace osu.Game.Rulesets.Taiko.Edit
protected override IEnumerable