mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 18:32:55 +08:00
Merge branch 'master' of https://github.com/ppy/osu into present-recommended
Conflicts: osu.Game/Screens/Select/SongSelect.cs
This commit is contained in:
commit
33a608fd15
@ -4,3 +4,5 @@ M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(
|
|||||||
M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead.
|
M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead.
|
||||||
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
|
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
|
||||||
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.
|
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.
|
||||||
|
T:Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions;Don't use internal extension methods.
|
||||||
|
T:Microsoft.EntityFrameworkCore.Internal.TypeExtensions;Don't use internal extension methods.
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.412.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.421.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.501.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
174
osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectComposer.cs
Normal file
174
osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectComposer.cs
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mania.Edit;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneManiaHitObjectComposer : EditorClockTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(ManiaBlueprintContainer)
|
||||||
|
};
|
||||||
|
|
||||||
|
private TestComposer composer;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup() => Schedule(() =>
|
||||||
|
{
|
||||||
|
BeatDivisor.Value = 8;
|
||||||
|
Clock.Seek(0);
|
||||||
|
|
||||||
|
Child = composer = new TestComposer { RelativeSizeAxes = Axes.Both };
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDragOffscreenSelectionVerticallyUpScroll()
|
||||||
|
{
|
||||||
|
DrawableHitObject lastObject = null;
|
||||||
|
Vector2 originalPosition = Vector2.Zero;
|
||||||
|
|
||||||
|
AddStep("seek to last object", () =>
|
||||||
|
{
|
||||||
|
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
||||||
|
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("select all objects", () => composer.EditorBeatmap.SelectedHitObjects.AddRange(composer.EditorBeatmap.HitObjects));
|
||||||
|
|
||||||
|
AddStep("click last object", () =>
|
||||||
|
{
|
||||||
|
originalPosition = lastObject.DrawPosition;
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(lastObject);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("move mouse downwards", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(lastObject, new Vector2(0, 20));
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("hitobjects not moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 0));
|
||||||
|
AddAssert("hitobjects moved downwards", () => lastObject.DrawPosition.Y - originalPosition.Y > 0);
|
||||||
|
AddAssert("hitobjects not moved too far", () => lastObject.DrawPosition.Y - originalPosition.Y < 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDragOffscreenSelectionVerticallyDownScroll()
|
||||||
|
{
|
||||||
|
DrawableHitObject lastObject = null;
|
||||||
|
Vector2 originalPosition = Vector2.Zero;
|
||||||
|
|
||||||
|
AddStep("set down scroll", () => ((Bindable<ScrollingDirection>)composer.Composer.ScrollingInfo.Direction).Value = ScrollingDirection.Down);
|
||||||
|
|
||||||
|
AddStep("seek to last object", () =>
|
||||||
|
{
|
||||||
|
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
||||||
|
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("select all objects", () => composer.EditorBeatmap.SelectedHitObjects.AddRange(composer.EditorBeatmap.HitObjects));
|
||||||
|
|
||||||
|
AddStep("click last object", () =>
|
||||||
|
{
|
||||||
|
originalPosition = lastObject.DrawPosition;
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(lastObject);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("move mouse upwards", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(lastObject, new Vector2(0, -20));
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("hitobjects not moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 0));
|
||||||
|
AddAssert("hitobjects moved upwards", () => originalPosition.Y - lastObject.DrawPosition.Y > 0);
|
||||||
|
AddAssert("hitobjects not moved too far", () => originalPosition.Y - lastObject.DrawPosition.Y < 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDragOffscreenSelectionHorizontally()
|
||||||
|
{
|
||||||
|
DrawableHitObject lastObject = null;
|
||||||
|
Vector2 originalPosition = Vector2.Zero;
|
||||||
|
|
||||||
|
AddStep("seek to last object", () =>
|
||||||
|
{
|
||||||
|
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
||||||
|
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("select all objects", () => composer.EditorBeatmap.SelectedHitObjects.AddRange(composer.EditorBeatmap.HitObjects));
|
||||||
|
|
||||||
|
AddStep("click last object", () =>
|
||||||
|
{
|
||||||
|
originalPosition = lastObject.DrawPosition;
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(lastObject);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("move mouse right", () =>
|
||||||
|
{
|
||||||
|
var firstColumn = composer.Composer.Playfield.GetColumn(0);
|
||||||
|
var secondColumn = composer.Composer.Playfield.GetColumn(1);
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(lastObject, new Vector2(secondColumn.ScreenSpaceDrawQuad.Centre.X - firstColumn.ScreenSpaceDrawQuad.Centre.X + 1, 0));
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("hitobjects moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 1));
|
||||||
|
|
||||||
|
// Todo: They'll move vertically by the height of a note since there's no snapping and the selection point is the middle of the note.
|
||||||
|
AddAssert("hitobjects not moved vertically", () => lastObject.DrawPosition.Y - originalPosition.Y <= DefaultNotePiece.NOTE_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestComposer : CompositeDrawable
|
||||||
|
{
|
||||||
|
[Cached(typeof(EditorBeatmap))]
|
||||||
|
[Cached(typeof(IBeatSnapProvider))]
|
||||||
|
public readonly EditorBeatmap EditorBeatmap;
|
||||||
|
|
||||||
|
public readonly ManiaHitObjectComposer Composer;
|
||||||
|
|
||||||
|
public TestComposer()
|
||||||
|
{
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
EditorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 }))
|
||||||
|
{
|
||||||
|
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }
|
||||||
|
},
|
||||||
|
Composer = new ManiaHitObjectComposer(new ManiaRuleset())
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
EditorBeatmap.Add(new Note { StartTime = 100 * i });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -76,5 +76,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
||||||
|
|
||||||
|
public override Vector2 SelectionPoint => DrawableObject.Head.ScreenSpaceDrawQuad.Centre;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -15,13 +13,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
public class ManiaSelectionBlueprint : OverlaySelectionBlueprint
|
public class ManiaSelectionBlueprint : OverlaySelectionBlueprint
|
||||||
{
|
{
|
||||||
public Vector2 ScreenSpaceDragPosition { get; private set; }
|
|
||||||
public Vector2 DragPosition { get; private set; }
|
|
||||||
|
|
||||||
public new DrawableManiaHitObject DrawableObject => (DrawableManiaHitObject)base.DrawableObject;
|
public new DrawableManiaHitObject DrawableObject => (DrawableManiaHitObject)base.DrawableObject;
|
||||||
|
|
||||||
protected IClock EditorClock { get; private set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IScrollingInfo scrollingInfo { get; set; }
|
private IScrollingInfo scrollingInfo { get; set; }
|
||||||
|
|
||||||
@ -34,12 +27,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
RelativeSizeAxes = Axes.None;
|
RelativeSizeAxes = Axes.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(IAdjustableClock clock)
|
|
||||||
{
|
|
||||||
EditorClock = clock;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -47,22 +34,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
Position = Parent.ToLocalSpace(DrawableObject.ToScreenSpace(Vector2.Zero));
|
Position = Parent.ToLocalSpace(DrawableObject.ToScreenSpace(Vector2.Zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
|
||||||
{
|
|
||||||
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
|
||||||
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
|
||||||
|
|
||||||
return base.OnMouseDown(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDrag(DragEvent e)
|
|
||||||
{
|
|
||||||
base.OnDrag(e);
|
|
||||||
|
|
||||||
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
|
||||||
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Show()
|
public override void Show()
|
||||||
{
|
{
|
||||||
DrawableObject.AlwaysAlive = true;
|
DrawableObject.AlwaysAlive = true;
|
||||||
|
@ -30,5 +30,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
return base.CreateBlueprintFor(hitObject);
|
return base.CreateBlueprintFor(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override SelectionHandler CreateSelectionHandler() => new ManiaSelectionHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -37,7 +38,33 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
public int TotalColumns => ((ManiaPlayfield)drawableRuleset.Playfield).TotalColumns;
|
public ManiaPlayfield Playfield => ((ManiaPlayfield)drawableRuleset.Playfield);
|
||||||
|
|
||||||
|
public IScrollingInfo ScrollingInfo => drawableRuleset.ScrollingInfo;
|
||||||
|
|
||||||
|
public int TotalColumns => Playfield.TotalColumns;
|
||||||
|
|
||||||
|
public override (Vector2 position, double time) GetSnappedPosition(Vector2 position, double time)
|
||||||
|
{
|
||||||
|
var hoc = Playfield.GetColumn(0).HitObjectContainer;
|
||||||
|
|
||||||
|
float targetPosition = hoc.ToLocalSpace(ToScreenSpace(position)).Y;
|
||||||
|
|
||||||
|
if (drawableRuleset.ScrollingInfo.Direction.Value == ScrollingDirection.Down)
|
||||||
|
{
|
||||||
|
// We're dealing with screen coordinates in which the position decreases towards the centre of the screen resulting in an increase in start time.
|
||||||
|
// The scrolling algorithm instead assumes a top anchor meaning an increase in time corresponds to an increase in position,
|
||||||
|
// so when scrolling downwards the coordinates need to be flipped.
|
||||||
|
targetPosition = hoc.DrawHeight - targetPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
double targetTime = drawableRuleset.ScrollingInfo.Algorithm.TimeAt(targetPosition,
|
||||||
|
EditorClock.CurrentTime,
|
||||||
|
drawableRuleset.ScrollingInfo.TimeRange.Value,
|
||||||
|
hoc.DrawHeight);
|
||||||
|
|
||||||
|
return base.GetSnappedPosition(position, targetTime);
|
||||||
|
}
|
||||||
|
|
||||||
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
|
||||||
@ -22,85 +19,16 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IManiaHitObjectComposer composer { get; set; }
|
private IManiaHitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
private IClock editorClock;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(IAdjustableClock clock)
|
|
||||||
{
|
|
||||||
editorClock = clock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleMovement(MoveSelectionEvent moveEvent)
|
public override bool HandleMovement(MoveSelectionEvent moveEvent)
|
||||||
{
|
{
|
||||||
var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint;
|
var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint;
|
||||||
int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column;
|
int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column;
|
||||||
|
|
||||||
adjustOrigins(maniaBlueprint);
|
|
||||||
performDragMovement(moveEvent);
|
|
||||||
performColumnMovement(lastColumn, moveEvent);
|
performColumnMovement(lastColumn, moveEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ensures that the position of hitobjects remains centred to the mouse position.
|
|
||||||
/// E.g. The hitobject position will change if the editor scrolls while a hitobject is dragged.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="reference">The <see cref="ManiaSelectionBlueprint"/> that received the drag event.</param>
|
|
||||||
private void adjustOrigins(ManiaSelectionBlueprint reference)
|
|
||||||
{
|
|
||||||
var referenceParent = (HitObjectContainer)reference.DrawableObject.Parent;
|
|
||||||
|
|
||||||
float offsetFromReferenceOrigin = reference.DragPosition.Y - reference.DrawableObject.OriginPosition.Y;
|
|
||||||
float targetPosition = referenceParent.ToLocalSpace(reference.ScreenSpaceDragPosition).Y - offsetFromReferenceOrigin;
|
|
||||||
|
|
||||||
// Flip the vertical coordinate space when scrolling downwards
|
|
||||||
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
|
||||||
targetPosition -= referenceParent.DrawHeight;
|
|
||||||
|
|
||||||
float movementDelta = targetPosition - reference.DrawableObject.Position.Y;
|
|
||||||
|
|
||||||
foreach (var b in SelectedBlueprints.OfType<ManiaSelectionBlueprint>())
|
|
||||||
b.DrawableObject.Y += movementDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void performDragMovement(MoveSelectionEvent moveEvent)
|
|
||||||
{
|
|
||||||
float delta = moveEvent.InstantDelta.Y;
|
|
||||||
|
|
||||||
// When scrolling downwards the anchor position is at the bottom of the screen, however the movement event assumes the anchor is at the top of the screen.
|
|
||||||
// This causes the delta to assume a positive hitobject position, and which can be corrected for by subtracting the parent height.
|
|
||||||
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
|
||||||
delta -= moveEvent.Blueprint.Parent.DrawHeight; // todo: probably wrong
|
|
||||||
|
|
||||||
foreach (var selectionBlueprint in SelectedBlueprints)
|
|
||||||
{
|
|
||||||
var b = (OverlaySelectionBlueprint)selectionBlueprint;
|
|
||||||
|
|
||||||
var hitObject = b.DrawableObject;
|
|
||||||
var objectParent = (HitObjectContainer)hitObject.Parent;
|
|
||||||
|
|
||||||
// StartTime could be used to adjust the position if only one movement event was received per frame.
|
|
||||||
// However this is not the case and ScrollingHitObjectContainer performs movement in UpdateAfterChildren() so the position must also be updated to be valid for further movement events
|
|
||||||
hitObject.Y += delta;
|
|
||||||
|
|
||||||
float targetPosition = hitObject.Position.Y;
|
|
||||||
|
|
||||||
// The scrolling algorithm always assumes an anchor at the top of the screen, so the position must be flipped when scrolling downwards to reflect a top anchor
|
|
||||||
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
|
||||||
targetPosition = -targetPosition;
|
|
||||||
|
|
||||||
objectParent.Remove(hitObject);
|
|
||||||
|
|
||||||
hitObject.HitObject.StartTime = scrollingInfo.Algorithm.TimeAt(targetPosition,
|
|
||||||
editorClock.CurrentTime,
|
|
||||||
scrollingInfo.TimeRange.Value,
|
|
||||||
objectParent.DrawHeight);
|
|
||||||
|
|
||||||
objectParent.Add(hitObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent)
|
private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent)
|
||||||
{
|
{
|
||||||
var currentColumn = composer.ColumnAt(moveEvent.ScreenSpacePosition);
|
var currentColumn = composer.ColumnAt(moveEvent.ScreenSpacePosition);
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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.Edit;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Masks
|
|
||||||
{
|
|
||||||
public abstract class ManiaSelectionBlueprint : OverlaySelectionBlueprint
|
|
||||||
{
|
|
||||||
protected ManiaSelectionBlueprint(DrawableHitObject drawableObject)
|
|
||||||
: base(drawableObject)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,11 +13,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public abstract class DrawableManiaHitObject : DrawableHitObject<ManiaHitObject>
|
public abstract class DrawableManiaHitObject : DrawableHitObject<ManiaHitObject>
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Whether this <see cref="DrawableManiaHitObject"/> should always remain alive.
|
|
||||||
/// </summary>
|
|
||||||
internal bool AlwaysAlive;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="ManiaAction"/> which causes this <see cref="DrawableManiaHitObject{TObject}"/> to be hit.
|
/// The <see cref="ManiaAction"/> which causes this <see cref="DrawableManiaHitObject{TObject}"/> to be hit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,7 +49,62 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Direction.BindValueChanged(OnDirectionChanged, true);
|
Direction.BindValueChanged(OnDirectionChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ShouldBeAlive => AlwaysAlive || base.ShouldBeAlive;
|
private double computedLifetimeStart;
|
||||||
|
|
||||||
|
public override double LifetimeStart
|
||||||
|
{
|
||||||
|
get => base.LifetimeStart;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
computedLifetimeStart = value;
|
||||||
|
|
||||||
|
if (!AlwaysAlive)
|
||||||
|
base.LifetimeStart = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double computedLifetimeEnd;
|
||||||
|
|
||||||
|
public override double LifetimeEnd
|
||||||
|
{
|
||||||
|
get => base.LifetimeEnd;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
computedLifetimeEnd = value;
|
||||||
|
|
||||||
|
if (!AlwaysAlive)
|
||||||
|
base.LifetimeEnd = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool alwaysAlive;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this <see cref="DrawableManiaHitObject"/> should always remain alive.
|
||||||
|
/// </summary>
|
||||||
|
internal bool AlwaysAlive
|
||||||
|
{
|
||||||
|
get => alwaysAlive;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (alwaysAlive == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
alwaysAlive = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
// Set the base lifetimes directly, to avoid mangling the computed lifetimes
|
||||||
|
base.LifetimeStart = double.MinValue;
|
||||||
|
base.LifetimeEnd = double.MaxValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LifetimeStart = computedLifetimeStart;
|
||||||
|
LifetimeEnd = computedLifetimeEnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
protected virtual void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -48,6 +50,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
||||||
|
|
||||||
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
||||||
|
private readonly Bindable<double> configTimeRange = new BindableDouble();
|
||||||
|
|
||||||
|
// Stores the current speed adjustment active in gameplay.
|
||||||
|
private readonly Track speedAdjustmentTrack = new TrackVirtual(0);
|
||||||
|
|
||||||
public DrawableManiaRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
public DrawableManiaRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
@ -58,6 +64,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
foreach (var mod in Mods.OfType<IApplicableToTrack>())
|
||||||
|
mod.ApplyToTrack(speedAdjustmentTrack);
|
||||||
|
|
||||||
bool isForCurrentRuleset = Beatmap.BeatmapInfo.Ruleset.Equals(Ruleset.RulesetInfo);
|
bool isForCurrentRuleset = Beatmap.BeatmapInfo.Ruleset.Equals(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
foreach (var p in ControlPoints)
|
foreach (var p in ControlPoints)
|
||||||
@ -76,7 +85,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Config.BindWith(ManiaRulesetSetting.ScrollDirection, configDirection);
|
Config.BindWith(ManiaRulesetSetting.ScrollDirection, configDirection);
|
||||||
configDirection.BindValueChanged(direction => Direction.Value = (ScrollingDirection)direction.NewValue, true);
|
configDirection.BindValueChanged(direction => Direction.Value = (ScrollingDirection)direction.NewValue, true);
|
||||||
|
|
||||||
Config.BindWith(ManiaRulesetSetting.ScrollTime, TimeRange);
|
Config.BindWith(ManiaRulesetSetting.ScrollTime, configTimeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AdjustScrollSpeed(int amount)
|
protected override void AdjustScrollSpeed(int amount)
|
||||||
@ -86,10 +95,19 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
private double relativeTimeRange
|
private double relativeTimeRange
|
||||||
{
|
{
|
||||||
get => MAX_TIME_RANGE / TimeRange.Value;
|
get => MAX_TIME_RANGE / configTimeRange.Value;
|
||||||
set => TimeRange.Value = MAX_TIME_RANGE / value;
|
set => configTimeRange.Value = MAX_TIME_RANGE / value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
updateTimeRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTimeRange() => TimeRange.Value = configTimeRange.Value * speedAdjustmentTrack.AggregateTempo.Value * speedAdjustmentTrack.AggregateFrequency.Value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the column that intersects a screen-space position.
|
/// Retrieves the column that intersects a screen-space position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
foreach (var column in stage.Columns)
|
foreach (var column in stage.Columns)
|
||||||
{
|
{
|
||||||
if (column.ReceivePositionalInputAt(screenSpacePosition))
|
if (column.ReceivePositionalInputAt(new Vector2(screenSpacePosition.X, column.ScreenSpaceDrawQuad.Centre.Y)))
|
||||||
{
|
{
|
||||||
found = column;
|
found = column;
|
||||||
break;
|
break;
|
||||||
@ -87,6 +87,31 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a <see cref="Column"/> by index.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">The index of the column.</param>
|
||||||
|
/// <returns>The <see cref="Column"/> corresponding to the given index.</returns>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="index"/> is less than 0 or greater than <see cref="TotalColumns"/>.</exception>
|
||||||
|
public Column GetColumn(int index)
|
||||||
|
{
|
||||||
|
if (index < 0 || index > TotalColumns - 1)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(index));
|
||||||
|
|
||||||
|
foreach (var stage in stages)
|
||||||
|
{
|
||||||
|
if (index >= stage.Columns.Count)
|
||||||
|
{
|
||||||
|
index -= stage.Columns.Count;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stage.Columns[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(index));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the total amount of columns across all stages in this playfield.
|
/// Retrieves the total amount of columns across all stages in this playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
29
osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs
Normal file
29
osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
|
{
|
||||||
|
internal class DrawableTestHit : DrawableTaikoHitObject
|
||||||
|
{
|
||||||
|
private readonly HitResult type;
|
||||||
|
|
||||||
|
public DrawableTestHit(Hit hit, HitResult type = HitResult.Great)
|
||||||
|
: base(hit)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Result.Type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool OnPressed(TaikoAction action) => false;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,111 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Taiko.Skinning;
|
||||||
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneDrawableBarLine : TaikoSkinnableTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
|
||||||
|
{
|
||||||
|
typeof(DrawableBarLine),
|
||||||
|
typeof(LegacyBarLine),
|
||||||
|
typeof(BarLine),
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
[Cached(typeof(IScrollingInfo))]
|
||||||
|
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
|
||||||
|
{
|
||||||
|
Direction = { Value = ScrollingDirection.Left },
|
||||||
|
TimeRange = { Value = 5000 },
|
||||||
|
};
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AddStep("Bar line", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
ScrollingHitObjectContainer hoc;
|
||||||
|
|
||||||
|
var cont = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Height = 0.8f,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new TaikoPlayfield(new ControlPointInfo()),
|
||||||
|
hoc = new ScrollingHitObjectContainer()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime())
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
|
|
||||||
|
return cont;
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("Bar line (major)", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
ScrollingHitObjectContainer hoc;
|
||||||
|
|
||||||
|
var cont = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Height = 0.8f,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new TaikoPlayfield(new ControlPointInfo()),
|
||||||
|
hoc = new ScrollingHitObjectContainer()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
hoc.Add(new DrawableBarLineMajor(createBarLineAtCurrentTime(true))
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
|
|
||||||
|
return cont;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private BarLine createBarLineAtCurrentTime(bool major = false)
|
||||||
|
{
|
||||||
|
var barline = new BarLine
|
||||||
|
{
|
||||||
|
Major = major,
|
||||||
|
StartTime = Time.Current + 2000,
|
||||||
|
};
|
||||||
|
|
||||||
|
var cpi = new ControlPointInfo();
|
||||||
|
cpi.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
|
||||||
|
barline.ApplyDefaults(cpi, new BeatmapDifficulty());
|
||||||
|
|
||||||
|
return barline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,8 +21,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
|
||||||
{
|
{
|
||||||
typeof(DrawableHit),
|
typeof(DrawableHit),
|
||||||
typeof(DrawableCentreHit),
|
|
||||||
typeof(DrawableRimHit),
|
|
||||||
typeof(LegacyHit),
|
typeof(LegacyHit),
|
||||||
typeof(LegacyCirclePiece),
|
typeof(LegacyCirclePiece),
|
||||||
}).ToList();
|
}).ToList();
|
||||||
@ -30,25 +28,25 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AddStep("Centre hit", () => SetContents(() => new DrawableCentreHit(createHitAtCurrentTime())
|
AddStep("Centre hit", () => SetContents(() => new DrawableHit(createHitAtCurrentTime())
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("Centre hit (strong)", () => SetContents(() => new DrawableCentreHit(createHitAtCurrentTime(true))
|
AddStep("Centre hit (strong)", () => SetContents(() => new DrawableHit(createHitAtCurrentTime(true))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("Rim hit", () => SetContents(() => new DrawableRimHit(createHitAtCurrentTime())
|
AddStep("Rim hit", () => SetContents(() => new DrawableHit(createHitAtCurrentTime())
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("Rim hit (strong)", () => SetContents(() => new DrawableRimHit(createHitAtCurrentTime(true))
|
AddStep("Rim hit (strong)", () => SetContents(() => new DrawableHit(createHitAtCurrentTime(true))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Taiko.Skinning;
|
||||||
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneHitExplosion : TaikoSkinnableTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
|
||||||
|
{
|
||||||
|
typeof(HitExplosion),
|
||||||
|
typeof(LegacyHitExplosion),
|
||||||
|
typeof(DefaultHitExplosion),
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AddStep("Great", () => SetContents(() => getContentFor(HitResult.Great)));
|
||||||
|
AddStep("Good", () => SetContents(() => getContentFor(HitResult.Good)));
|
||||||
|
AddStep("Miss", () => SetContents(() => getContentFor(HitResult.Miss)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getContentFor(HitResult type)
|
||||||
|
{
|
||||||
|
DrawableTaikoHitObject hit;
|
||||||
|
|
||||||
|
return new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
hit = createHit(type),
|
||||||
|
new HitExplosion(hit)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrawableTaikoHitObject createHit(HitResult type) => new DrawableTestHit(new Hit { StartTime = Time.Current }, type);
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
using osu.Game.Rulesets.Taiko.Skinning;
|
using osu.Game.Rulesets.Taiko.Skinning;
|
||||||
using osu.Game.Rulesets.Taiko.UI;
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
@ -34,6 +35,18 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
|
|
||||||
public TestSceneTaikoPlayfield()
|
public TestSceneTaikoPlayfield()
|
||||||
{
|
{
|
||||||
|
TaikoBeatmap beatmap;
|
||||||
|
bool kiai = false;
|
||||||
|
|
||||||
|
AddStep("set beatmap", () =>
|
||||||
|
{
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(beatmap = new TaikoBeatmap());
|
||||||
|
|
||||||
|
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });
|
||||||
|
|
||||||
|
Beatmap.Value.Track.Start();
|
||||||
|
});
|
||||||
|
|
||||||
AddStep("Load playfield", () => SetContents(() => new TaikoPlayfield(new ControlPointInfo())
|
AddStep("Load playfield", () => SetContents(() => new TaikoPlayfield(new ControlPointInfo())
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -41,6 +54,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
AddRepeatStep("change height", () => this.ChildrenOfType<TaikoPlayfield>().ForEach(p => p.Height = Math.Max(0.2f, (p.Height + 0.2f) % 1f)), 50);
|
AddRepeatStep("change height", () => this.ChildrenOfType<TaikoPlayfield>().ForEach(p => p.Height = Math.Max(0.2f, (p.Height + 0.2f) % 1f)), 50);
|
||||||
|
|
||||||
|
AddStep("Toggle kiai", () =>
|
||||||
|
{
|
||||||
|
Beatmap.Value.Beatmap.ControlPointInfo.Add(0, new EffectControlPoint { KiaiMode = (kiai = !kiai) });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneHits : OsuTestScene
|
public class TestSceneHits : OsuTestScene
|
||||||
{
|
{
|
||||||
private const double default_duration = 1000;
|
private const double default_duration = 3000;
|
||||||
private const float scroll_time = 1000;
|
private const float scroll_time = 1000;
|
||||||
|
|
||||||
protected override double TimePerAction => default_duration * 2;
|
protected override double TimePerAction => default_duration * 2;
|
||||||
@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
AddStep("Miss :(", addMissJudgement);
|
AddStep("Miss :(", addMissJudgement);
|
||||||
AddStep("DrumRoll", () => addDrumRoll(false));
|
AddStep("DrumRoll", () => addDrumRoll(false));
|
||||||
AddStep("Strong DrumRoll", () => addDrumRoll(true));
|
AddStep("Strong DrumRoll", () => addDrumRoll(true));
|
||||||
|
AddStep("Kiai DrumRoll", () => addDrumRoll(true, kiai: true));
|
||||||
AddStep("Swell", () => addSwell());
|
AddStep("Swell", () => addSwell());
|
||||||
AddStep("Centre", () => addCentreHit(false));
|
AddStep("Centre", () => addCentreHit(false));
|
||||||
AddStep("Strong Centre", () => addCentreHit(true));
|
AddStep("Strong Centre", () => addCentreHit(true));
|
||||||
@ -148,6 +149,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||||
|
|
||||||
|
Add(h);
|
||||||
|
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +166,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||||
|
|
||||||
|
Add(h);
|
||||||
|
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new HitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new HitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
||||||
}
|
}
|
||||||
@ -192,7 +197,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
drawableRuleset.Playfield.Add(new DrawableSwell(swell));
|
drawableRuleset.Playfield.Add(new DrawableSwell(swell));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDrumRoll(bool strong, double duration = default_duration)
|
private void addDrumRoll(bool strong, double duration = default_duration, bool kiai = false)
|
||||||
{
|
{
|
||||||
addBarLine(true);
|
addBarLine(true);
|
||||||
addBarLine(true, scroll_time + duration);
|
addBarLine(true, scroll_time + duration);
|
||||||
@ -202,9 +207,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
|
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
Duration = duration,
|
Duration = duration,
|
||||||
|
TickRate = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
d.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
var cpi = new ControlPointInfo();
|
||||||
|
cpi.Add(-10000, new EffectControlPoint { KiaiMode = kiai });
|
||||||
|
|
||||||
|
d.ApplyDefaults(cpi, new BeatmapDifficulty());
|
||||||
|
|
||||||
drawableRuleset.Playfield.Add(new DrawableDrumRoll(d));
|
drawableRuleset.Playfield.Add(new DrawableDrumRoll(d));
|
||||||
}
|
}
|
||||||
@ -219,7 +228,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
drawableRuleset.Playfield.Add(new DrawableCentreHit(h));
|
drawableRuleset.Playfield.Add(new DrawableHit(h));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRimHit(bool strong)
|
private void addRimHit(bool strong)
|
||||||
@ -232,7 +241,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
drawableRuleset.Playfield.Add(new DrawableRimHit(h));
|
drawableRuleset.Playfield.Add(new DrawableHit(h));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestStrongNestedHit : DrawableStrongNestedHit
|
private class TestStrongNestedHit : DrawableStrongNestedHit
|
||||||
@ -244,13 +253,5 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
public override bool OnPressed(TaikoAction action) => false;
|
public override bool OnPressed(TaikoAction action) => false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DrawableTestHit : DrawableHitObject<TaikoHitObject>
|
|
||||||
{
|
|
||||||
public DrawableTestHit(TaikoHitObject hitObject)
|
|
||||||
: base(hitObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The visual line tracker.
|
/// The visual line tracker.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Box Tracker;
|
protected SkinnableDrawable Line;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bar line.
|
/// The bar line.
|
||||||
@ -45,13 +46,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
Width = tracker_width;
|
Width = tracker_width;
|
||||||
|
|
||||||
AddInternal(Tracker = new Box
|
AddInternal(Line = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.BarLine), _ => new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
EdgeSmoothness = new Vector2(0.5f, 0),
|
||||||
|
})
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
Alpha = 0.75f,
|
||||||
EdgeSmoothness = new Vector2(0.5f, 0),
|
|
||||||
Alpha = 0.75f
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Tracker.Alpha = 1f;
|
Line.Alpha = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|
||||||
{
|
|
||||||
public class DrawableCentreHit : DrawableHit
|
|
||||||
{
|
|
||||||
public override TaikoAction[] HitActions { get; } = { TaikoAction.LeftCentre, TaikoAction.RightCentre };
|
|
||||||
|
|
||||||
public DrawableCentreHit(Hit hit)
|
|
||||||
: base(hit)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.CentreHit),
|
|
||||||
_ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
|
|
||||||
}
|
|
||||||
}
|
|
@ -121,8 +121,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int countHit = NestedHitObjects.Count(o => o.IsHit);
|
int countHit = NestedHitObjects.Count(o => o.IsHit);
|
||||||
|
|
||||||
if (countHit >= HitObject.RequiredGoodHits)
|
if (countHit >= HitObject.RequiredGoodHits)
|
||||||
|
{
|
||||||
ApplyResult(r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good);
|
ApplyResult(r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ApplyResult(r => r.Type = HitResult.Miss);
|
ApplyResult(r => r.Type = HitResult.Miss);
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The hit type corresponding to the <see cref="TaikoAction"/> that the user pressed to hit this <see cref="DrawableDrumRollTick"/>.
|
||||||
|
/// </summary>
|
||||||
|
public HitType JudgementType;
|
||||||
|
|
||||||
public DrawableDrumRollTick(DrumRollTick tick)
|
public DrawableDrumRollTick(DrumRollTick tick)
|
||||||
: base(tick)
|
: base(tick)
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fit;
|
FillMode = FillMode.Fit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool DisplayResult => false;
|
|
||||||
|
|
||||||
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
|
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
|
||||||
_ => new TickPiece
|
_ => new TickPiece
|
||||||
{
|
{
|
||||||
@ -51,7 +54,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPressed(TaikoAction action) => UpdateResult(true);
|
public override bool OnPressed(TaikoAction action)
|
||||||
|
{
|
||||||
|
JudgementType = action == TaikoAction.LeftRim || action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
|
||||||
|
return UpdateResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this);
|
protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this);
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A hit used specifically for drum rolls, where spawning flying hits is required.
|
||||||
|
/// </summary>
|
||||||
|
public class DrawableFlyingHit : DrawableHit
|
||||||
|
{
|
||||||
|
public DrawableFlyingHit(DrawableDrumRollTick drumRollTick)
|
||||||
|
: base(new IgnoreHit
|
||||||
|
{
|
||||||
|
StartTime = drumRollTick.HitObject.StartTime + drumRollTick.Result.TimeOffset,
|
||||||
|
IsStrong = drumRollTick.HitObject.IsStrong,
|
||||||
|
Type = drumRollTick.JudgementType
|
||||||
|
})
|
||||||
|
{
|
||||||
|
HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,31 +8,45 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||||
{
|
{
|
||||||
public abstract class DrawableHit : DrawableTaikoHitObject<Hit>
|
public class DrawableHit : DrawableTaikoHitObject<Hit>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of keys which can result in hits for this HitObject.
|
/// A list of keys which can result in hits for this HitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract TaikoAction[] HitActions { get; }
|
public TaikoAction[] HitActions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The action that caused this <see cref="DrawableHit"/> to be hit.
|
/// The action that caused this <see cref="DrawableHit"/> to be hit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TaikoAction? HitAction { get; private set; }
|
public TaikoAction? HitAction
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
private bool validActionPressed;
|
private bool validActionPressed;
|
||||||
|
|
||||||
private bool pressHandledThisFrame;
|
private bool pressHandledThisFrame;
|
||||||
|
|
||||||
protected DrawableHit(Hit hit)
|
public DrawableHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fit;
|
FillMode = FillMode.Fit;
|
||||||
|
|
||||||
|
HitActions =
|
||||||
|
HitObject.Type == HitType.Centre
|
||||||
|
? new[] { TaikoAction.LeftCentre, TaikoAction.RightCentre }
|
||||||
|
: new[] { TaikoAction.LeftRim, TaikoAction.RightRim };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override SkinnableDrawable CreateMainPiece() => HitObject.Type == HitType.Centre
|
||||||
|
? new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.CentreHit), _ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit)
|
||||||
|
: new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.RimHit), _ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
Debug.Assert(HitObject.HitWindows != null);
|
Debug.Assert(HitObject.HitWindows != null);
|
||||||
@ -58,7 +72,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (pressHandledThisFrame)
|
if (pressHandledThisFrame)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Judged)
|
if (Judged)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -66,14 +79,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
|
|
||||||
// Only count this as handled if the new judgement is a hit
|
// Only count this as handled if the new judgement is a hit
|
||||||
var result = UpdateResult(true);
|
var result = UpdateResult(true);
|
||||||
|
|
||||||
if (IsHit)
|
if (IsHit)
|
||||||
HitAction = action;
|
HitAction = action;
|
||||||
|
|
||||||
// Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded
|
// Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded
|
||||||
// E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note
|
// E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note
|
||||||
pressHandledThisFrame = true;
|
pressHandledThisFrame = true;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +92,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (action == HitAction)
|
if (action == HitAction)
|
||||||
HitAction = null;
|
HitAction = null;
|
||||||
|
|
||||||
base.OnReleased(action);
|
base.OnReleased(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|
||||||
{
|
|
||||||
public class DrawableRimHit : DrawableHit
|
|
||||||
{
|
|
||||||
public override TaikoAction[] HitActions { get; } = { TaikoAction.LeftRim, TaikoAction.RightRim };
|
|
||||||
|
|
||||||
public DrawableRimHit(Hit hit)
|
|
||||||
: base(hit)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.RimHit),
|
|
||||||
_ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
|
|
||||||
}
|
|
||||||
}
|
|
12
osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs
Normal file
12
osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Objects
|
||||||
|
{
|
||||||
|
public class IgnoreHit : Hit
|
||||||
|
{
|
||||||
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
}
|
||||||
|
}
|
27
osu.Game.Rulesets.Taiko/Skinning/LegacyBarLine.cs
Normal file
27
osu.Game.Rulesets.Taiko/Skinning/LegacyBarLine.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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.Sprites;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
||||||
|
{
|
||||||
|
public class LegacyBarLine : Sprite
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("taiko-barline");
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Size = new Vector2(1, 0.88f);
|
||||||
|
FillMode = FillMode.Fill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
osu.Game.Rulesets.Taiko/Skinning/LegacyHitExplosion.cs
Normal file
37
osu.Game.Rulesets.Taiko/Skinning/LegacyHitExplosion.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
||||||
|
{
|
||||||
|
public class LegacyHitExplosion : CompositeDrawable
|
||||||
|
{
|
||||||
|
public LegacyHitExplosion(Drawable sprite)
|
||||||
|
{
|
||||||
|
InternalChild = sprite;
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
const double animation_time = 120;
|
||||||
|
|
||||||
|
this.FadeInFromZero(animation_time).Then().FadeOut(animation_time * 1.5);
|
||||||
|
|
||||||
|
this.ScaleTo(0.6f)
|
||||||
|
.Then().ScaleTo(1.1f, animation_time * 0.8)
|
||||||
|
.Then().ScaleTo(0.9f, animation_time * 0.4)
|
||||||
|
.Then().ScaleTo(1f, animation_time * 0.2);
|
||||||
|
|
||||||
|
Expire(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
|||||||
{
|
{
|
||||||
Texture = skin.GetTexture("approachcircle"),
|
Texture = skin.GetTexture("approachcircle"),
|
||||||
Scale = new Vector2(0.73f),
|
Scale = new Vector2(0.73f),
|
||||||
Alpha = 0.7f,
|
Alpha = 0.47f, // eyeballed to match stable
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
|||||||
{
|
{
|
||||||
Texture = skin.GetTexture("taikobigcircle"),
|
Texture = skin.GetTexture("taikobigcircle"),
|
||||||
Scale = new Vector2(0.7f),
|
Scale = new Vector2(0.7f),
|
||||||
Alpha = 0.5f,
|
Alpha = 0.22f, // eyeballed to match stable
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
||||||
|
{
|
||||||
|
public class TaikoLegacyPlayfieldBackgroundRight : BeatSyncedContainer
|
||||||
|
{
|
||||||
|
private Sprite kiai;
|
||||||
|
|
||||||
|
private bool kiaiDisplayed;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("taiko-bar-right"),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = Vector2.One,
|
||||||
|
},
|
||||||
|
kiai = new Sprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("taiko-bar-right-glow"),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = Vector2.One,
|
||||||
|
Alpha = 0,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
|
{
|
||||||
|
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||||
|
|
||||||
|
if (effectPoint.KiaiMode != kiaiDisplayed)
|
||||||
|
{
|
||||||
|
kiaiDisplayed = effectPoint.KiaiMode;
|
||||||
|
|
||||||
|
kiai.ClearTransforms();
|
||||||
|
kiai.FadeTo(kiaiDisplayed ? 1 : 0, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -8,7 +9,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Skinning
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
||||||
{
|
{
|
||||||
@ -59,13 +59,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
|||||||
|
|
||||||
case TaikoSkinComponents.PlayfieldBackgroundRight:
|
case TaikoSkinComponents.PlayfieldBackgroundRight:
|
||||||
if (GetTexture("taiko-bar-right") != null)
|
if (GetTexture("taiko-bar-right") != null)
|
||||||
{
|
return new TaikoLegacyPlayfieldBackgroundRight();
|
||||||
return this.GetAnimation("taiko-bar-right", false, false).With(d =>
|
|
||||||
{
|
|
||||||
d.RelativeSizeAxes = Axes.Both;
|
|
||||||
d.Size = Vector2.One;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -75,11 +69,44 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
|||||||
return Drawable.Empty();
|
return Drawable.Empty();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
case TaikoSkinComponents.BarLine:
|
||||||
|
if (GetTexture("taiko-barline") != null)
|
||||||
|
return new LegacyBarLine();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
case TaikoSkinComponents.TaikoExplosionGood:
|
||||||
|
case TaikoSkinComponents.TaikoExplosionGreat:
|
||||||
|
case TaikoSkinComponents.TaikoExplosionMiss:
|
||||||
|
|
||||||
|
var sprite = this.GetAnimation(getHitName(taikoComponent.Component), true, false);
|
||||||
|
if (sprite != null)
|
||||||
|
return new LegacyHitExplosion(sprite);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return source.GetDrawableComponent(component);
|
return source.GetDrawableComponent(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string getHitName(TaikoSkinComponents component)
|
||||||
|
{
|
||||||
|
switch (component)
|
||||||
|
{
|
||||||
|
case TaikoSkinComponents.TaikoExplosionMiss:
|
||||||
|
return "taiko-hit0";
|
||||||
|
|
||||||
|
case TaikoSkinComponents.TaikoExplosionGood:
|
||||||
|
return "taiko-hit100";
|
||||||
|
|
||||||
|
case TaikoSkinComponents.TaikoExplosionGreat:
|
||||||
|
return "taiko-hit300";
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(component), "Invalid result type");
|
||||||
|
}
|
||||||
|
|
||||||
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
|
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));
|
public SampleChannel GetSample(ISampleInfo sampleInfo) => source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));
|
||||||
|
@ -13,6 +13,10 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
Swell,
|
Swell,
|
||||||
HitTarget,
|
HitTarget,
|
||||||
PlayfieldBackgroundLeft,
|
PlayfieldBackgroundLeft,
|
||||||
PlayfieldBackgroundRight
|
PlayfieldBackgroundRight,
|
||||||
|
BarLine,
|
||||||
|
TaikoExplosionMiss,
|
||||||
|
TaikoExplosionGood,
|
||||||
|
TaikoExplosionGreat,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
59
osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs
Normal file
59
osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
|
{
|
||||||
|
internal class DefaultHitExplosion : CircularContainer
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private DrawableHitObject judgedObject { get; set; }
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
BorderColour = Color4.White;
|
||||||
|
BorderThickness = 1;
|
||||||
|
|
||||||
|
Blending = BlendingParameters.Additive;
|
||||||
|
|
||||||
|
Alpha = 0.15f;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
if (judgedObject.Result.Type == HitResult.Miss)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
|
||||||
|
|
||||||
|
InternalChildren = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
this.ScaleTo(3f, 1000, Easing.OutQuint);
|
||||||
|
this.FadeOut(500);
|
||||||
|
|
||||||
|
Expire(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -49,10 +49,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
switch (h)
|
switch (h)
|
||||||
{
|
{
|
||||||
case Hit hit:
|
case Hit hit:
|
||||||
if (hit.Type == HitType.Centre)
|
return new DrawableHit(hit);
|
||||||
return new DrawableCentreHit(hit);
|
|
||||||
else
|
|
||||||
return new DrawableRimHit(hit);
|
|
||||||
|
|
||||||
case DrumRoll drumRoll:
|
case DrumRoll drumRoll:
|
||||||
return new DrawableDrumRoll(drumRoll);
|
return new DrawableDrumRoll(drumRoll);
|
||||||
|
35
osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs
Normal file
35
osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
|
{
|
||||||
|
internal class DrumRollHitContainer : ScrollingHitObjectContainer
|
||||||
|
{
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
// Remove any auxiliary hit notes that were spawned during a drum roll but subsequently rewound.
|
||||||
|
for (var i = AliveInternalChildren.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
var flyingHit = (DrawableFlyingHit)AliveInternalChildren[i];
|
||||||
|
if (Time.Current <= flyingHit.HitObject.StartTime)
|
||||||
|
Remove(flyingHit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnChildLifetimeBoundaryCrossed(LifetimeBoundaryCrossedEvent e)
|
||||||
|
{
|
||||||
|
base.OnChildLifetimeBoundaryCrossed(e);
|
||||||
|
|
||||||
|
// ensure all old hits are removed on becoming alive (may miss being in the AliveInternalChildren list above).
|
||||||
|
if (e.Kind == LifetimeBoundaryKind.Start && e.Direction == LifetimeBoundaryCrossingDirection.Backward)
|
||||||
|
Remove((DrawableHitObject)e.Child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
{
|
{
|
||||||
@ -20,16 +20,17 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
public override bool RemoveWhenNotAlive => true;
|
public override bool RemoveWhenNotAlive => true;
|
||||||
|
|
||||||
|
[Cached(typeof(DrawableHitObject))]
|
||||||
public readonly DrawableHitObject JudgedObject;
|
public readonly DrawableHitObject JudgedObject;
|
||||||
|
|
||||||
private readonly Box innerFill;
|
private SkinnableDrawable skinnable;
|
||||||
|
|
||||||
private readonly bool isRim;
|
public override double LifetimeStart => skinnable.Drawable.LifetimeStart;
|
||||||
|
|
||||||
public HitExplosion(DrawableHitObject judgedObject, bool isRim)
|
public override double LifetimeEnd => skinnable.Drawable.LifetimeEnd;
|
||||||
|
|
||||||
|
public HitExplosion(DrawableHitObject judgedObject)
|
||||||
{
|
{
|
||||||
this.isRim = isRim;
|
|
||||||
|
|
||||||
JudgedObject = judgedObject;
|
JudgedObject = judgedObject;
|
||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
@ -39,36 +40,29 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE);
|
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE);
|
||||||
|
|
||||||
RelativePositionAxes = Axes.Both;
|
RelativePositionAxes = Axes.Both;
|
||||||
|
|
||||||
BorderColour = Color4.White;
|
|
||||||
BorderThickness = 1;
|
|
||||||
|
|
||||||
Alpha = 0.15f;
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
innerFill = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load()
|
||||||
{
|
{
|
||||||
innerFill.Colour = isRim ? colours.BlueDarker : colours.PinkDarker;
|
Child = skinnable = new SkinnableDrawable(new TaikoSkinComponent(getComponentName(JudgedObject.Result?.Type ?? HitResult.Great)), _ => new DefaultHitExplosion());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
private TaikoSkinComponents getComponentName(HitResult resultType)
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
switch (resultType)
|
||||||
|
{
|
||||||
|
case HitResult.Miss:
|
||||||
|
return TaikoSkinComponents.TaikoExplosionMiss;
|
||||||
|
|
||||||
this.ScaleTo(3f, 1000, Easing.OutQuint);
|
case HitResult.Good:
|
||||||
this.FadeOut(500);
|
return TaikoSkinComponents.TaikoExplosionGood;
|
||||||
|
|
||||||
Expire(true);
|
case HitResult.Great:
|
||||||
|
return TaikoSkinComponents.TaikoExplosionGreat;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(resultType), "Invalid result type");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -18,14 +18,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
public override bool RemoveWhenNotAlive => true;
|
public override bool RemoveWhenNotAlive => true;
|
||||||
|
|
||||||
public readonly DrawableHitObject JudgedObject;
|
public readonly DrawableHitObject JudgedObject;
|
||||||
|
private readonly HitType type;
|
||||||
|
|
||||||
private readonly bool isRim;
|
public KiaiHitExplosion(DrawableHitObject judgedObject, HitType type)
|
||||||
|
|
||||||
public KiaiHitExplosion(DrawableHitObject judgedObject, bool isRim)
|
|
||||||
{
|
{
|
||||||
this.isRim = isRim;
|
|
||||||
|
|
||||||
JudgedObject = judgedObject;
|
JudgedObject = judgedObject;
|
||||||
|
this.type = type;
|
||||||
|
|
||||||
Anchor = Anchor.CentreLeft;
|
Anchor = Anchor.CentreLeft;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
@ -33,6 +31,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE, 1);
|
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE, 1);
|
||||||
|
|
||||||
|
Blending = BlendingParameters.Additive;
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
Alpha = 0.25f;
|
Alpha = 0.25f;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
|
Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker,
|
||||||
Radius = 60,
|
Radius = 60,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
private Container<HitExplosion> hitExplosionContainer;
|
private Container<HitExplosion> hitExplosionContainer;
|
||||||
private Container<KiaiHitExplosion> kiaiExplosionContainer;
|
private Container<KiaiHitExplosion> kiaiExplosionContainer;
|
||||||
private JudgementContainer<DrawableTaikoJudgement> judgementContainer;
|
private JudgementContainer<DrawableTaikoJudgement> judgementContainer;
|
||||||
|
private ScrollingHitObjectContainer drumRollHitContainer;
|
||||||
internal Drawable HitTarget;
|
internal Drawable HitTarget;
|
||||||
|
|
||||||
private ProxyContainer topLevelHitContainer;
|
private ProxyContainer topLevelHitContainer;
|
||||||
@ -47,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
|
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
|
||||||
rightArea = new Container
|
rightArea = new Container
|
||||||
@ -67,7 +68,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
hitExplosionContainer = new Container<HitExplosion>
|
hitExplosionContainer = new Container<HitExplosion>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Blending = BlendingParameters.Additive,
|
|
||||||
},
|
},
|
||||||
HitTarget = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget())
|
HitTarget = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget())
|
||||||
{
|
{
|
||||||
@ -88,20 +88,22 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
Name = "Hit objects",
|
Name = "Hit objects",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = HitObjectContainer
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
HitObjectContainer,
|
||||||
|
drumRollHitContainer = new DrumRollHitContainer()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
kiaiExplosionContainer = new Container<KiaiHitExplosion>
|
kiaiExplosionContainer = new Container<KiaiHitExplosion>
|
||||||
{
|
{
|
||||||
Name = "Kiai hit explosions",
|
Name = "Kiai hit explosions",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
Blending = BlendingParameters.Additive
|
|
||||||
},
|
},
|
||||||
judgementContainer = new JudgementContainer<DrawableTaikoJudgement>
|
judgementContainer = new JudgementContainer<DrawableTaikoJudgement>
|
||||||
{
|
{
|
||||||
Name = "Judgements",
|
Name = "Judgements",
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Blending = BlendingParameters.Additive
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -127,7 +129,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
Name = "Top level hit objects",
|
Name = "Top level hit objects",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
}
|
},
|
||||||
|
drumRollHitContainer.CreateProxy()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +147,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
public override void Add(DrawableHitObject h)
|
public override void Add(DrawableHitObject h)
|
||||||
{
|
{
|
||||||
h.OnNewResult += OnNewResult;
|
h.OnNewResult += OnNewResult;
|
||||||
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
|
|
||||||
switch (h)
|
switch (h)
|
||||||
@ -163,7 +165,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
if (!DisplayJudgements.Value)
|
if (!DisplayJudgements.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!judgedObject.DisplayResult)
|
if (!judgedObject.DisplayResult)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -174,6 +175,15 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit();
|
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TaikoDrumRollTickJudgement _:
|
||||||
|
if (!result.IsHit)
|
||||||
|
break;
|
||||||
|
|
||||||
|
var drawableTick = (DrawableDrumRollTick)judgedObject;
|
||||||
|
|
||||||
|
addDrumRollHit(drawableTick);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
|
judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
|
||||||
{
|
{
|
||||||
@ -186,17 +196,23 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
if (!result.IsHit)
|
if (!result.IsHit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
|
var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
|
||||||
|
|
||||||
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
|
|
||||||
|
|
||||||
if (judgedObject.HitObject.Kiai)
|
|
||||||
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
|
|
||||||
|
|
||||||
|
addExplosion(judgedObject, type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addDrumRollHit(DrawableDrumRollTick drawableTick) =>
|
||||||
|
drumRollHitContainer.Add(new DrawableFlyingHit(drawableTick));
|
||||||
|
|
||||||
|
private void addExplosion(DrawableHitObject drawableObject, HitType type)
|
||||||
|
{
|
||||||
|
hitExplosionContainer.Add(new HitExplosion(drawableObject));
|
||||||
|
if (drawableObject.HitObject.Kiai)
|
||||||
|
kiaiExplosionContainer.Add(new KiaiHitExplosion(drawableObject, type));
|
||||||
|
}
|
||||||
|
|
||||||
private class ProxyContainer : LifetimeManagementContainer
|
private class ProxyContainer : LifetimeManagementContainer
|
||||||
{
|
{
|
||||||
public new MarginPadding Padding
|
public new MarginPadding Padding
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -137,7 +137,7 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
var hitCircle = new HitCircle { StartTime = 1000 };
|
var hitCircle = new HitCircle { StartTime = 1000 };
|
||||||
editorBeatmap.Add(hitCircle);
|
editorBeatmap.Add(hitCircle);
|
||||||
Assert.That(editorBeatmap.HitObjects.Count(h => h == hitCircle), Is.EqualTo(1));
|
Assert.That(editorBeatmap.HitObjects.Count(h => h == hitCircle), Is.EqualTo(1));
|
||||||
Assert.That(editorBeatmap.HitObjects.IndexOf(hitCircle), Is.EqualTo(3));
|
Assert.That(Array.IndexOf(editorBeatmap.HitObjects.ToArray(), hitCircle), Is.EqualTo(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -161,7 +161,7 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
|
|
||||||
hitCircle.StartTime = 0;
|
hitCircle.StartTime = 0;
|
||||||
Assert.That(editorBeatmap.HitObjects.Count(h => h == hitCircle), Is.EqualTo(1));
|
Assert.That(editorBeatmap.HitObjects.Count(h => h == hitCircle), Is.EqualTo(1));
|
||||||
Assert.That(editorBeatmap.HitObjects.IndexOf(hitCircle), Is.EqualTo(1));
|
Assert.That(Array.IndexOf(editorBeatmap.HitObjects.ToArray(), hitCircle), Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -304,6 +304,31 @@ namespace osu.Game.Tests.Editing
|
|||||||
runTest(patch);
|
runTest(patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeHitObjectAtSameTime()
|
||||||
|
{
|
||||||
|
current.AddRange(new[]
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(50) },
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(100) },
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(150) },
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(200) },
|
||||||
|
});
|
||||||
|
|
||||||
|
var patch = new OsuBeatmap
|
||||||
|
{
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(150) },
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(100) },
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(50) },
|
||||||
|
new HitCircle { StartTime = 500, Position = new Vector2(200) },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
runTest(patch);
|
||||||
|
}
|
||||||
|
|
||||||
private void runTest(IBeatmap patch)
|
private void runTest(IBeatmap patch)
|
||||||
{
|
{
|
||||||
// Due to the method of testing, "patch" comes in without having been decoded via a beatmap decoder.
|
// Due to the method of testing, "patch" comes in without having been decoded via a beatmap decoder.
|
||||||
|
@ -5,13 +5,17 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Overlays.Toolbar;
|
using osu.Game.Overlays.Toolbar;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Menus
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneToolbar : OsuTestScene
|
public class TestSceneToolbar : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -21,24 +25,62 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
typeof(ToolbarNotificationButton),
|
typeof(ToolbarNotificationButton),
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestSceneToolbar()
|
private Toolbar toolbar;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
|
Child = toolbar = new Toolbar { State = { Value = Visibility.Visible } };
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNotificationCounter()
|
||||||
{
|
{
|
||||||
var toolbar = new Toolbar { State = { Value = Visibility.Visible } };
|
|
||||||
ToolbarNotificationButton notificationButton = null;
|
ToolbarNotificationButton notificationButton = null;
|
||||||
|
|
||||||
AddStep("create toolbar", () =>
|
AddStep("retrieve notification button", () => notificationButton = toolbar.ChildrenOfType<ToolbarNotificationButton>().Single());
|
||||||
{
|
|
||||||
Add(toolbar);
|
|
||||||
notificationButton = toolbar.Children.OfType<FillFlowContainer>().Last().Children.OfType<ToolbarNotificationButton>().First();
|
|
||||||
});
|
|
||||||
|
|
||||||
void setNotifications(int count) => AddStep($"set notification count to {count}", () => notificationButton.NotificationCount.Value = count);
|
|
||||||
|
|
||||||
setNotifications(1);
|
setNotifications(1);
|
||||||
setNotifications(2);
|
setNotifications(2);
|
||||||
setNotifications(3);
|
setNotifications(3);
|
||||||
setNotifications(0);
|
setNotifications(0);
|
||||||
setNotifications(144);
|
setNotifications(144);
|
||||||
|
|
||||||
|
void setNotifications(int count)
|
||||||
|
=> AddStep($"set notification count to {count}",
|
||||||
|
() => notificationButton.NotificationCount.Value = count);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(false)]
|
||||||
|
[TestCase(true)]
|
||||||
|
public void TestRulesetSwitchingShortcut(bool toolbarHidden)
|
||||||
|
{
|
||||||
|
ToolbarRulesetSelector rulesetSelector = null;
|
||||||
|
|
||||||
|
if (toolbarHidden)
|
||||||
|
AddStep("hide toolbar", () => toolbar.Hide());
|
||||||
|
|
||||||
|
AddStep("retrieve ruleset selector", () => rulesetSelector = toolbar.ChildrenOfType<ToolbarRulesetSelector>().Single());
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
var expected = rulesets.AvailableRulesets.ElementAt(i);
|
||||||
|
var numberKey = Key.Number1 + i;
|
||||||
|
|
||||||
|
AddStep($"switch to ruleset {i} via shortcut", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.PressKey(numberKey);
|
||||||
|
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
InputManager.ReleaseKey(numberKey);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("ruleset switched", () => rulesetSelector.Current.Value.Equals(expected));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ using osu.Game.Rulesets.Osu;
|
|||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Screens.Ranking.Expanded;
|
using osu.Game.Screens.Ranking.Expanded;
|
||||||
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
||||||
using osu.Game.Screens.Ranking.Expanded.Statistics;
|
using osu.Game.Screens.Ranking.Expanded.Statistics;
|
||||||
@ -74,6 +75,8 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
{
|
{
|
||||||
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0));
|
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0));
|
||||||
beatmap.Metadata.Author = author;
|
beatmap.Metadata.Author = author;
|
||||||
|
beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title";
|
||||||
|
beatmap.Metadata.Artist = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap artist";
|
||||||
|
|
||||||
return new TestWorkingBeatmap(beatmap);
|
return new TestWorkingBeatmap(beatmap);
|
||||||
}
|
}
|
||||||
@ -114,7 +117,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Size = new Vector2(500, 700);
|
Size = new Vector2(ScorePanel.EXPANDED_WIDTH, 700);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
|
@ -797,6 +797,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
|
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
|
||||||
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addManyTestMaps()
|
private void addManyTestMaps()
|
||||||
|
@ -14,8 +14,6 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Overlays.Mods.Sections;
|
using osu.Game.Overlays.Mods.Sections;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mania;
|
|
||||||
using osu.Game.Rulesets.Mania.Mods;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
@ -117,8 +115,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestManiaMods()
|
public void TestManiaMods()
|
||||||
{
|
{
|
||||||
changeRuleset(3);
|
changeRuleset(3);
|
||||||
|
|
||||||
testRankedText(new ManiaRuleset().GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -217,15 +213,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
checkLabelColor(() => Color4.White);
|
checkLabelColor(() => Color4.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testRankedText(Mod mod)
|
|
||||||
{
|
|
||||||
AddUntilStep("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
|
||||||
selectNext(mod);
|
|
||||||
AddUntilStep("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
|
||||||
selectPrevious(mod);
|
|
||||||
AddUntilStep("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1));
|
private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1));
|
||||||
|
|
||||||
private void selectPrevious(Mod mod) => AddStep($"right click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(-1));
|
private void selectPrevious(Mod mod) => AddStep($"right click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(-1));
|
||||||
@ -272,7 +259,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
public new OsuSpriteText MultiplierLabel => base.MultiplierLabel;
|
public new OsuSpriteText MultiplierLabel => base.MultiplierLabel;
|
||||||
public new OsuSpriteText UnrankedLabel => base.UnrankedLabel;
|
|
||||||
public new TriangleButton DeselectAllButton => base.DeselectAllButton;
|
public new TriangleButton DeselectAllButton => base.DeselectAllButton;
|
||||||
|
|
||||||
public new Color4 LowMultiplierColour => base.LowMultiplierColour;
|
public new Color4 LowMultiplierColour => base.LowMultiplierColour;
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
@ -21,9 +24,14 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private NowPlayingOverlay nowPlayingOverlay;
|
private NowPlayingOverlay nowPlayingOverlay;
|
||||||
|
|
||||||
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(AudioManager audio, GameHost host)
|
||||||
{
|
{
|
||||||
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
|
||||||
nowPlayingOverlay = new NowPlayingOverlay
|
nowPlayingOverlay = new NowPlayingOverlay
|
||||||
@ -44,21 +52,43 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddStep(@"hide", () => nowPlayingOverlay.Hide());
|
AddStep(@"hide", () => nowPlayingOverlay.Hide());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BeatmapManager manager { get; set; }
|
||||||
|
|
||||||
|
private int importId;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPrevTrackBehavior()
|
public void TestPrevTrackBehavior()
|
||||||
{
|
{
|
||||||
AddStep(@"Play track", () =>
|
// ensure we have at least two beatmaps available.
|
||||||
|
AddRepeatStep("import beatmap", () => manager.Import(new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
musicController.NextTrack();
|
Beatmaps = new List<BeatmapInfo>
|
||||||
currentBeatmap = Beatmap.Value;
|
{
|
||||||
});
|
new BeatmapInfo
|
||||||
|
{
|
||||||
|
BaseDifficulty = new BeatmapDifficulty(),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = $"a test map {importId++}",
|
||||||
|
Title = "title",
|
||||||
|
}
|
||||||
|
}).Wait(), 5);
|
||||||
|
|
||||||
|
AddStep(@"Next track", () => musicController.NextTrack());
|
||||||
|
AddStep("Store track", () => currentBeatmap = Beatmap.Value);
|
||||||
|
|
||||||
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
|
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
|
||||||
AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000);
|
AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000);
|
||||||
AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart);
|
|
||||||
AddUntilStep("Wait for current time to update", () => Precision.AlmostEquals(currentBeatmap.Track.CurrentTime, 0));
|
AddStep(@"Set previous", () => musicController.PreviousTrack());
|
||||||
AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value);
|
|
||||||
AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart);
|
AddAssert(@"Check beatmap didn't change", () => currentBeatmap == Beatmap.Value);
|
||||||
|
AddUntilStep("Wait for current time to update", () => currentBeatmap.Track.CurrentTime < 5000);
|
||||||
|
|
||||||
|
AddStep(@"Set previous", () => musicController.PreviousTrack());
|
||||||
|
AddAssert(@"Check beatmap did change", () => currentBeatmap != Beatmap.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
private BeatmapInfo beatmap;
|
private BeatmapInfo beatmap;
|
||||||
|
|
||||||
private const float height = 145;
|
public const float HEIGHT = 145 / 2f;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
@ -157,7 +157,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = height / 2,
|
Height = HEIGHT,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
@ -229,7 +229,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
Height = height / 2,
|
Height = HEIGHT,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,42 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Showcase
|
namespace osu.Game.Tournament.Screens.Showcase
|
||||||
{
|
{
|
||||||
public class ShowcaseScreen : BeatmapInfoScreen
|
public class ShowcaseScreen : BeatmapInfoScreen // IProvideVideo
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AddInternal(new TournamentLogo());
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new TournamentLogo(),
|
||||||
|
new TourneyVideo("showcase")
|
||||||
|
{
|
||||||
|
Loop = true,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Padding = new MarginPadding { Bottom = SongBar.HEIGHT },
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
// chroma key area for stable gameplay
|
||||||
|
Name = "chroma",
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = new Color4(0, 255, 0, 255),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,6 +246,12 @@ namespace osu.Game.Beatmaps
|
|||||||
if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
||||||
return DefaultBeatmap;
|
return DefaultBeatmap;
|
||||||
|
|
||||||
|
if (beatmapInfo.BeatmapSet.Files == null)
|
||||||
|
{
|
||||||
|
var info = beatmapInfo;
|
||||||
|
beatmapInfo = QueryBeatmap(b => b.ID == info.ID);
|
||||||
|
}
|
||||||
|
|
||||||
lock (workingCache)
|
lock (workingCache)
|
||||||
{
|
{
|
||||||
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
||||||
@ -287,13 +293,37 @@ namespace osu.Game.Beatmaps
|
|||||||
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
||||||
public List<BeatmapSetInfo> GetAllUsableBeatmapSets() => GetAllUsableBeatmapSetsEnumerable().ToList();
|
public List<BeatmapSetInfo> GetAllUsableBeatmapSets(IncludedDetails includes = IncludedDetails.All) => GetAllUsableBeatmapSetsEnumerable(includes).ToList();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s. Note that files are not populated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="includes">The level of detail to include in the returned objects.</param>
|
||||||
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
||||||
public IQueryable<BeatmapSetInfo> GetAllUsableBeatmapSetsEnumerable() => beatmaps.ConsumableItems.Where(s => !s.DeletePending && !s.Protected);
|
public IEnumerable<BeatmapSetInfo> GetAllUsableBeatmapSetsEnumerable(IncludedDetails includes)
|
||||||
|
{
|
||||||
|
IQueryable<BeatmapSetInfo> queryable;
|
||||||
|
|
||||||
|
switch (includes)
|
||||||
|
{
|
||||||
|
case IncludedDetails.Minimal:
|
||||||
|
queryable = beatmaps.BeatmapSetsOverview;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IncludedDetails.AllButFiles:
|
||||||
|
queryable = beatmaps.BeatmapSetsWithoutFiles;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
queryable = beatmaps.ConsumableItems;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsEnumerable used here to avoid applying the WHERE in sql. When done so, ef core 2.x uses an incorrect ORDER BY
|
||||||
|
// clause which causes queries to take 5-10x longer.
|
||||||
|
// TODO: remove if upgrading to EF core 3.x.
|
||||||
|
return queryable.AsEnumerable().Where(s => !s.DeletePending && !s.Protected);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
||||||
@ -482,4 +512,25 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The level of detail to include in database results.
|
||||||
|
/// </summary>
|
||||||
|
public enum IncludedDetails
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Only include beatmap difficulties and set level metadata.
|
||||||
|
/// </summary>
|
||||||
|
Minimal,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include all difficulties, rulesets, difficulty metadata but no files.
|
||||||
|
/// </summary>
|
||||||
|
AllButFiles,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include everything.
|
||||||
|
/// </summary>
|
||||||
|
All
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,18 @@ namespace osu.Game.Beatmaps
|
|||||||
base.Purge(items, context);
|
base.Purge(items, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IQueryable<BeatmapSetInfo> BeatmapSetsOverview => ContextFactory.Get().BeatmapSetInfo
|
||||||
|
.Include(s => s.Metadata)
|
||||||
|
.Include(s => s.Beatmaps)
|
||||||
|
.AsNoTracking();
|
||||||
|
|
||||||
|
public IQueryable<BeatmapSetInfo> BeatmapSetsWithoutFiles => ContextFactory.Get().BeatmapSetInfo
|
||||||
|
.Include(s => s.Metadata)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(s => s.Ruleset)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
|
||||||
|
.AsNoTracking();
|
||||||
|
|
||||||
public IQueryable<BeatmapInfo> Beatmaps =>
|
public IQueryable<BeatmapInfo> Beatmaps =>
|
||||||
ContextFactory.Get().BeatmapInfo
|
ContextFactory.Get().BeatmapInfo
|
||||||
.Include(b => b.BeatmapSet).ThenInclude(s => s.Metadata)
|
.Include(b => b.BeatmapSet).ThenInclude(s => s.Metadata)
|
||||||
|
@ -240,7 +240,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hitObject is IHasEndTime _)
|
if (hitObject is IHasEndTime)
|
||||||
addEndTimeData(writer, hitObject);
|
addEndTimeData(writer, hitObject);
|
||||||
|
|
||||||
writer.Write(getSampleBank(hitObject.Samples));
|
writer.Write(getSampleBank(hitObject.Samples));
|
||||||
|
@ -197,7 +197,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public override string ToString() => BeatmapInfo.ToString();
|
public override string ToString() => BeatmapInfo.ToString();
|
||||||
|
|
||||||
public bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
||||||
|
|
||||||
public IBeatmap Beatmap
|
public IBeatmap Beatmap
|
||||||
{
|
{
|
||||||
@ -233,7 +233,7 @@ namespace osu.Game.Beatmaps
|
|||||||
protected abstract Texture GetBackground();
|
protected abstract Texture GetBackground();
|
||||||
private readonly RecyclableLazy<Texture> background;
|
private readonly RecyclableLazy<Texture> background;
|
||||||
|
|
||||||
public bool TrackLoaded => track.IsResultAvailable;
|
public virtual bool TrackLoaded => track.IsResultAvailable;
|
||||||
public Track Track => track.Value;
|
public Track Track => track.Value;
|
||||||
protected abstract Track GetTrack();
|
protected abstract Track GetTrack();
|
||||||
private RecyclableLazy<Track> track;
|
private RecyclableLazy<Track> track;
|
||||||
|
@ -93,6 +93,12 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel))
|
if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel))
|
||||||
JoinChannel(e.NewValue);
|
JoinChannel(e.NewValue);
|
||||||
|
|
||||||
|
if (e.NewValue?.MessagesLoaded == false)
|
||||||
|
{
|
||||||
|
// let's fetch a small number of messages to bring us up-to-date with the backlog.
|
||||||
|
fetchInitalMessages(e.NewValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -375,12 +381,6 @@ namespace osu.Game.Online.Chat
|
|||||||
if (CurrentChannel.Value == null)
|
if (CurrentChannel.Value == null)
|
||||||
CurrentChannel.Value = channel;
|
CurrentChannel.Value = channel;
|
||||||
|
|
||||||
if (!channel.MessagesLoaded)
|
|
||||||
{
|
|
||||||
// let's fetch a small number of messages to bring us up-to-date with the backlog.
|
|
||||||
fetchInitalMessages(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,10 +924,7 @@ namespace osu.Game
|
|||||||
if (ScreenStack.CurrentScreen is Loader)
|
if (ScreenStack.CurrentScreen is Loader)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (introScreen == null)
|
if (introScreen.DidLoadMenu && !(ScreenStack.CurrentScreen is IntroScreen))
|
||||||
return true;
|
|
||||||
|
|
||||||
if (!introScreen.DidLoadMenu || !(ScreenStack.CurrentScreen is IntroScreen))
|
|
||||||
{
|
{
|
||||||
Scheduler.Add(introScreen.MakeCurrent);
|
Scheduler.Add(introScreen.MakeCurrent);
|
||||||
return true;
|
return true;
|
||||||
|
@ -105,6 +105,14 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private void newMessagesArrived(IEnumerable<Message> newMessages)
|
private void newMessagesArrived(IEnumerable<Message> newMessages)
|
||||||
{
|
{
|
||||||
|
if (newMessages.Min(m => m.Id) < chatLines.Max(c => c.Message.Id))
|
||||||
|
{
|
||||||
|
// there is a case (on initial population) that we may receive past messages and need to reorder.
|
||||||
|
// easiest way is to just combine messages and recreate drawables (less worrying about day separators etc.)
|
||||||
|
newMessages = newMessages.Concat(chatLines.Select(c => c.Message)).OrderBy(m => m.Id).ToList();
|
||||||
|
ChatLineFlow.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool shouldScrollToEnd = scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage);
|
bool shouldScrollToEnd = scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage);
|
||||||
|
|
||||||
// Add up to last Channel.MAX_HISTORY messages
|
// Add up to last Channel.MAX_HISTORY messages
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
@ -9,7 +10,11 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
public class GlobalKeyBindingsSection : SettingsSection
|
public class GlobalKeyBindingsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Globe;
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Globe
|
||||||
|
};
|
||||||
|
|
||||||
public override string Header => "Global";
|
public override string Header => "Global";
|
||||||
|
|
||||||
public GlobalKeyBindingsSection(GlobalActionContainer manager)
|
public GlobalKeyBindingsSection(GlobalActionContainer manager)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
@ -10,7 +11,11 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
public class RulesetBindingsSection : SettingsSection
|
public class RulesetBindingsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override IconUsage Icon => (ruleset.CreateInstance().CreateIcon() as SpriteIcon)?.Icon ?? OsuIcon.Hot;
|
public override Drawable CreateIcon() => ruleset?.CreateInstance()?.CreateIcon() ?? new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = OsuIcon.Hot
|
||||||
|
};
|
||||||
|
|
||||||
public override string Header => ruleset.Name;
|
public override string Header => ruleset.Name;
|
||||||
|
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
@ -37,7 +37,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
protected readonly TriangleButton CloseButton;
|
protected readonly TriangleButton CloseButton;
|
||||||
|
|
||||||
protected readonly OsuSpriteText MultiplierLabel;
|
protected readonly OsuSpriteText MultiplierLabel;
|
||||||
protected readonly OsuSpriteText UnrankedLabel;
|
|
||||||
|
|
||||||
protected override bool BlockNonPositionalInput => false;
|
protected override bool BlockNonPositionalInput => false;
|
||||||
|
|
||||||
@ -57,6 +56,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
protected Color4 HighMultiplierColour;
|
protected Color4 HighMultiplierColour;
|
||||||
|
|
||||||
private const float content_width = 0.8f;
|
private const float content_width = 0.8f;
|
||||||
|
private const float footer_button_spacing = 20;
|
||||||
|
|
||||||
private readonly FillFlowContainer footerContainer;
|
private readonly FillFlowContainer footerContainer;
|
||||||
|
|
||||||
private SampleChannel sampleOn, sampleOff;
|
private SampleChannel sampleOn, sampleOff;
|
||||||
@ -103,7 +104,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.Absolute, 90),
|
new Dimension(GridSizeMode.Absolute, 90),
|
||||||
new Dimension(GridSizeMode.Distributed),
|
new Dimension(GridSizeMode.Distributed),
|
||||||
new Dimension(GridSizeMode.Absolute, 70),
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
},
|
},
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
@ -197,7 +198,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
// Footer
|
// Footer
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -215,7 +217,9 @@ namespace osu.Game.Overlays.Mods
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = content_width,
|
Width = content_width,
|
||||||
Direction = FillDirection.Horizontal,
|
Spacing = new Vector2(footer_button_spacing, footer_button_spacing / 2),
|
||||||
|
LayoutDuration = 100,
|
||||||
|
LayoutEasing = Easing.OutQuint,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Vertical = 15,
|
Vertical = 15,
|
||||||
@ -228,10 +232,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Width = 180,
|
Width = 180,
|
||||||
Text = "Deselect All",
|
Text = "Deselect All",
|
||||||
Action = DeselectAll,
|
Action = DeselectAll,
|
||||||
Margin = new MarginPadding
|
Origin = Anchor.CentreLeft,
|
||||||
{
|
Anchor = Anchor.CentreLeft,
|
||||||
Right = 20
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
CustomiseButton = new TriangleButton
|
CustomiseButton = new TriangleButton
|
||||||
{
|
{
|
||||||
@ -239,49 +241,41 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Text = "Customisation",
|
Text = "Customisation",
|
||||||
Action = () => ModSettingsContainer.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
|
Action = () => ModSettingsContainer.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
|
||||||
Enabled = { Value = false },
|
Enabled = { Value = false },
|
||||||
Margin = new MarginPadding
|
Origin = Anchor.CentreLeft,
|
||||||
{
|
Anchor = Anchor.CentreLeft,
|
||||||
Right = 20
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
CloseButton = new TriangleButton
|
CloseButton = new TriangleButton
|
||||||
{
|
{
|
||||||
Width = 180,
|
Width = 180,
|
||||||
Text = "Close",
|
Text = "Close",
|
||||||
Action = Hide,
|
Action = Hide,
|
||||||
Margin = new MarginPadding
|
Origin = Anchor.CentreLeft,
|
||||||
{
|
Anchor = Anchor.CentreLeft,
|
||||||
Right = 20
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Text = @"Score Multiplier:",
|
AutoSizeAxes = Axes.Both,
|
||||||
Font = OsuFont.GetFont(size: 30),
|
Spacing = new Vector2(footer_button_spacing / 2, 0),
|
||||||
Margin = new MarginPadding
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Top = 5,
|
new OsuSpriteText
|
||||||
Right = 10
|
{
|
||||||
}
|
Text = @"Score Multiplier:",
|
||||||
|
Font = OsuFont.GetFont(size: 30),
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
MultiplierLabel = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Width = 70, // make width fixed so reflow doesn't occur when multiplier number changes.
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
MultiplierLabel = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
|
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Top = 5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
UnrankedLabel = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = @"(Unranked)",
|
|
||||||
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
|
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Top = 5,
|
|
||||||
Left = 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -327,7 +321,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
LowMultiplierColour = colours.Red;
|
LowMultiplierColour = colours.Red;
|
||||||
HighMultiplierColour = colours.Green;
|
HighMultiplierColour = colours.Green;
|
||||||
UnrankedLabel.Colour = colours.Blue;
|
|
||||||
|
|
||||||
availableMods = osu.AvailableMods.GetBoundCopy();
|
availableMods = osu.AvailableMods.GetBoundCopy();
|
||||||
|
|
||||||
@ -431,12 +424,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
private void updateMods()
|
private void updateMods()
|
||||||
{
|
{
|
||||||
var multiplier = 1.0;
|
var multiplier = 1.0;
|
||||||
var ranked = true;
|
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value)
|
foreach (var mod in SelectedMods.Value)
|
||||||
{
|
{
|
||||||
multiplier *= mod.ScoreMultiplier;
|
multiplier *= mod.ScoreMultiplier;
|
||||||
ranked &= mod.Ranked;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiplierLabel.Text = $"{multiplier:N2}x";
|
MultiplierLabel.Text = $"{multiplier:N2}x";
|
||||||
@ -446,8 +437,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
|
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
|
||||||
else
|
else
|
||||||
MultiplierLabel.FadeColour(Color4.White, 200);
|
MultiplierLabel.FadeColour(Color4.White, 200);
|
||||||
|
|
||||||
UnrankedLabel.FadeTo(ranked ? 0 : 1, 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateModSettings(ValueChangedEvent<IReadOnlyList<Mod>> selectedMods)
|
private void updateModSettings(ValueChangedEvent<IReadOnlyList<Mod>> selectedMods)
|
||||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Overlays
|
|||||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
||||||
|
|
||||||
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets().OrderBy(_ => RNG.Next()));
|
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal).OrderBy(_ => RNG.Next()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -172,10 +172,15 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>
|
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The <see cref="PreviousTrackResult"/> that indicate the decided action</returns>
|
public void PreviousTrack() => Schedule(() => prev());
|
||||||
public PreviousTrackResult PreviousTrack()
|
|
||||||
|
/// <summary>
|
||||||
|
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The <see cref="PreviousTrackResult"/> that indicate the decided action.</returns>
|
||||||
|
private PreviousTrackResult prev()
|
||||||
{
|
{
|
||||||
var currentTrackPosition = current?.Track.CurrentTime;
|
var currentTrackPosition = current?.Track.CurrentTime;
|
||||||
|
|
||||||
@ -204,8 +209,7 @@ namespace osu.Game.Overlays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Play the next random or playlist track.
|
/// Play the next random or playlist track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Whether the operation was successful.</returns>
|
public void NextTrack() => Schedule(() => next());
|
||||||
public bool NextTrack() => next();
|
|
||||||
|
|
||||||
private bool next(bool instant = false)
|
private bool next(bool instant = false)
|
||||||
{
|
{
|
||||||
@ -319,13 +323,13 @@ namespace osu.Game.Overlays
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.MusicNext:
|
case GlobalAction.MusicNext:
|
||||||
if (NextTrack())
|
if (next())
|
||||||
onScreenDisplay?.Display(new MusicControllerToast("Next track"));
|
onScreenDisplay?.Display(new MusicControllerToast("Next track"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.MusicPrev:
|
case GlobalAction.MusicPrev:
|
||||||
switch (PreviousTrack())
|
switch (prev())
|
||||||
{
|
{
|
||||||
case PreviousTrackResult.Restart:
|
case PreviousTrackResult.Restart:
|
||||||
onScreenDisplay?.Display(new MusicControllerToast("Restart track"));
|
onScreenDisplay?.Display(new MusicControllerToast("Restart track"));
|
||||||
|
@ -13,9 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
{
|
{
|
||||||
public override string Header => "Audio";
|
public override string Header => "Audio";
|
||||||
|
|
||||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "sound" });
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.VolumeUp
|
||||||
|
};
|
||||||
|
|
||||||
public override IconUsage Icon => FontAwesome.Solid.VolumeUp;
|
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "sound" });
|
||||||
|
|
||||||
public AudioSection()
|
public AudioSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class DebugSection : SettingsSection
|
public class DebugSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Debug";
|
public override string Header => "Debug";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Bug;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Bug
|
||||||
|
};
|
||||||
|
|
||||||
public DebugSection()
|
public DebugSection()
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class GameplaySection : SettingsSection
|
public class GameplaySection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Gameplay";
|
public override string Header => "Gameplay";
|
||||||
public override IconUsage Icon => FontAwesome.Regular.Circle;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Regular.Circle
|
||||||
|
};
|
||||||
|
|
||||||
public GameplaySection()
|
public GameplaySection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class GeneralSection : SettingsSection
|
public class GeneralSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "General";
|
public override string Header => "General";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Cog;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Cog
|
||||||
|
};
|
||||||
|
|
||||||
public GeneralSection()
|
public GeneralSection()
|
||||||
{
|
{
|
||||||
|
@ -209,15 +209,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
private IReadOnlyList<Size> getResolutions()
|
private IReadOnlyList<Size> getResolutions()
|
||||||
{
|
{
|
||||||
var resolutions = new List<Size> { new Size(9999, 9999) };
|
var resolutions = new List<Size> { new Size(9999, 9999) };
|
||||||
|
var currentDisplay = game.Window?.CurrentDisplay.Value;
|
||||||
|
|
||||||
if (game.Window != null)
|
if (currentDisplay != null)
|
||||||
{
|
{
|
||||||
resolutions.AddRange(game.Window.AvailableResolutions
|
resolutions.AddRange(currentDisplay.DisplayModes
|
||||||
.Where(r => r.Width >= 800 && r.Height >= 600)
|
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
|
||||||
.OrderByDescending(r => r.Width)
|
.OrderByDescending(m => m.Size.Width)
|
||||||
.ThenByDescending(r => r.Height)
|
.ThenByDescending(m => m.Size.Height)
|
||||||
.Select(res => new Size(res.Width, res.Height))
|
.Select(m => m.Size)
|
||||||
.Distinct());
|
.Distinct());
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolutions;
|
return resolutions;
|
||||||
|
@ -10,7 +10,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class GraphicsSection : SettingsSection
|
public class GraphicsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Graphics";
|
public override string Header => "Graphics";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Laptop;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Laptop
|
||||||
|
};
|
||||||
|
|
||||||
public GraphicsSection()
|
public GraphicsSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class InputSection : SettingsSection
|
public class InputSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Input";
|
public override string Header => "Input";
|
||||||
public override IconUsage Icon => FontAwesome.Regular.Keyboard;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Keyboard
|
||||||
|
};
|
||||||
|
|
||||||
public InputSection(KeyBindingPanel keyConfig)
|
public InputSection(KeyBindingPanel keyConfig)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class MaintenanceSection : SettingsSection
|
public class MaintenanceSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Maintenance";
|
public override string Header => "Maintenance";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Wrench;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Wrench
|
||||||
|
};
|
||||||
|
|
||||||
public MaintenanceSection()
|
public MaintenanceSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class OnlineSection : SettingsSection
|
public class OnlineSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Online";
|
public override string Header => "Online";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.GlobeAsia;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.GlobeAsia
|
||||||
|
};
|
||||||
|
|
||||||
public OnlineSection()
|
public OnlineSection()
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,10 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
|
|
||||||
public override string Header => "Skin";
|
public override string Header => "Skin";
|
||||||
|
|
||||||
public override IconUsage Icon => FontAwesome.Solid.PaintBrush;
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.PaintBrush
|
||||||
|
};
|
||||||
|
|
||||||
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default };
|
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default };
|
||||||
private readonly Bindable<int> configBindable = new Bindable<int>();
|
private readonly Bindable<int> configBindable = new Bindable<int>();
|
||||||
|
@ -11,7 +11,6 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
@ -20,7 +19,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
protected FillFlowContainer FlowContent;
|
protected FillFlowContainer FlowContent;
|
||||||
protected override Container<Drawable> Content => FlowContent;
|
protected override Container<Drawable> Content => FlowContent;
|
||||||
|
|
||||||
public abstract IconUsage Icon { get; }
|
public abstract Drawable CreateIcon();
|
||||||
public abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
||||||
|
@ -11,12 +11,13 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
public class SidebarButton : OsuButton
|
public class SidebarButton : OsuButton
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon drawableIcon;
|
private readonly ConstrainedIconContainer iconContainer;
|
||||||
private readonly SpriteText headerText;
|
private readonly SpriteText headerText;
|
||||||
private readonly Box selectionIndicator;
|
private readonly Box selectionIndicator;
|
||||||
private readonly Container text;
|
private readonly Container text;
|
||||||
@ -30,7 +31,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
{
|
{
|
||||||
section = value;
|
section = value;
|
||||||
headerText.Text = value.Header;
|
headerText.Text = value.Header;
|
||||||
drawableIcon.Icon = value.Icon;
|
iconContainer.Icon = value.CreateIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
},
|
},
|
||||||
drawableIcon = new SpriteIcon
|
iconContainer = new ConstrainedIconContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -33,6 +33,9 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
private readonly Bindable<OverlayActivation> overlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
private readonly Bindable<OverlayActivation> overlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||||
|
|
||||||
|
// Toolbar components like RulesetSelector should receive keyboard input events even when the toolbar is hidden.
|
||||||
|
public override bool PropagateNonPositionalInputSubTree => true;
|
||||||
|
|
||||||
public Toolbar()
|
public Toolbar()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -148,7 +151,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
userButton?.StateContainer.Hide();
|
userButton.StateContainer?.Hide();
|
||||||
|
|
||||||
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
||||||
this.FadeOut(transition_time);
|
this.FadeOut(transition_time);
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PassThroughInputManager KeyBindingInputManager;
|
public PassThroughInputManager KeyBindingInputManager;
|
||||||
|
|
||||||
public override double GameplayStartTime => Objects.First().StartTime - 2000;
|
public override double GameplayStartTime => Objects.FirstOrDefault()?.StartTime - 2000 ?? 0;
|
||||||
|
|
||||||
private readonly Lazy<Playfield> playfield;
|
private readonly Lazy<Playfield> playfield;
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// The mods which are to be applied.
|
/// The mods which are to be applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Cached(typeof(IReadOnlyList<Mod>))]
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
private readonly IReadOnlyList<Mod> mods;
|
protected readonly IReadOnlyList<Mod> Mods;
|
||||||
|
|
||||||
private FrameStabilityContainer frameStabilityContainer;
|
private FrameStabilityContainer frameStabilityContainer;
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
throw new ArgumentException($"{GetType()} expected the beatmap to contain hitobjects of type {typeof(TObject)}.", nameof(beatmap));
|
throw new ArgumentException($"{GetType()} expected the beatmap to contain hitobjects of type {typeof(TObject)}.", nameof(beatmap));
|
||||||
|
|
||||||
Beatmap = tBeatmap;
|
Beatmap = tBeatmap;
|
||||||
this.mods = mods?.ToArray() ?? Array.Empty<Mod>();
|
Mods = mods?.ToArray() ?? Array.Empty<Mod>();
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
.WithChild(ResumeOverlay)));
|
.WithChild(ResumeOverlay)));
|
||||||
}
|
}
|
||||||
|
|
||||||
applyRulesetMods(mods, config);
|
applyRulesetMods(Mods, config);
|
||||||
|
|
||||||
loadObjects(cancellationToken);
|
loadObjects(cancellationToken);
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
Playfield.PostProcess();
|
Playfield.PostProcess();
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(Playfield.AllHitObjects);
|
mod.ApplyToDrawableHitObjects(Playfield.AllHitObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,12 +401,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
HitObject draggedObject = movementBlueprint.HitObject;
|
HitObject draggedObject = movementBlueprint.HitObject;
|
||||||
|
|
||||||
// The final movement position, relative to screenSpaceMovementStartPosition
|
// The final movement position, relative to movementBlueprintOriginalPosition.
|
||||||
Vector2 movePosition = movementBlueprintOriginalPosition.Value + e.ScreenSpaceMousePosition - e.ScreenSpaceMouseDownPosition;
|
Vector2 movePosition = movementBlueprintOriginalPosition.Value + e.ScreenSpaceMousePosition - e.ScreenSpaceMouseDownPosition;
|
||||||
|
|
||||||
|
// Retrieve a snapped position.
|
||||||
(Vector2 snappedPosition, double snappedTime) = snapProvider.GetSnappedPosition(ToLocalSpace(movePosition), draggedObject.StartTime);
|
(Vector2 snappedPosition, double snappedTime) = snapProvider.GetSnappedPosition(ToLocalSpace(movePosition), draggedObject.StartTime);
|
||||||
|
|
||||||
// Move the hitobjects
|
// Move the hitobjects.
|
||||||
if (!selectionHandler.HandleMovement(new MoveSelectionEvent(movementBlueprint, ToScreenSpace(snappedPosition))))
|
if (!selectionHandler.HandleMovement(new MoveSelectionEvent(movementBlueprint, ToScreenSpace(snappedPosition))))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -12,14 +12,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
public class CentreMarker : CompositeDrawable
|
public class CentreMarker : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const float triangle_width = 20;
|
private const float triangle_width = 15;
|
||||||
private const float triangle_height = 10;
|
private const float triangle_height = 10;
|
||||||
private const float bar_width = 2;
|
private const float bar_width = 2;
|
||||||
|
|
||||||
public CentreMarker()
|
public CentreMarker()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
Size = new Vector2(20, 1);
|
Size = new Vector2(triangle_width, 1);
|
||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
@ -39,6 +39,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Size = new Vector2(triangle_width, triangle_height),
|
Size = new Vector2(triangle_width, triangle_height),
|
||||||
Scale = new Vector2(1, -1)
|
Scale = new Vector2(1, -1)
|
||||||
|
},
|
||||||
|
new Triangle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
Size = new Vector2(triangle_width, triangle_height),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -46,7 +52,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Colour = colours.Red;
|
Colour = colours.RedDark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
});
|
});
|
||||||
|
|
||||||
// We don't want the centre marker to scroll
|
// We don't want the centre marker to scroll
|
||||||
AddInternal(new CentreMarker());
|
AddInternal(new CentreMarker { Depth = float.MaxValue });
|
||||||
|
|
||||||
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
|
|
||||||
|
@ -136,14 +136,26 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
public void Add(HitObject hitObject)
|
public void Add(HitObject hitObject)
|
||||||
{
|
{
|
||||||
trackStartTime(hitObject);
|
|
||||||
|
|
||||||
// Preserve existing sorting order in the beatmap
|
// Preserve existing sorting order in the beatmap
|
||||||
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
Insert(insertionIndex + 1, hitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Inserts a <see cref="HitObject"/> into this <see cref="EditorBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// It is the invoker's responsibility to make sure that <see cref="HitObject"/> sorting order is maintained.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="index">The index to insert the <see cref="HitObject"/> at.</param>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to insert.</param>
|
||||||
|
public void Insert(int index, HitObject hitObject)
|
||||||
|
{
|
||||||
|
trackStartTime(hitObject);
|
||||||
|
|
||||||
|
mutableHitObjects.Insert(index, hitObject);
|
||||||
|
|
||||||
HitObjectAdded?.Invoke(hitObject);
|
HitObjectAdded?.Invoke(hitObject);
|
||||||
|
|
||||||
updateHitObject(hitObject, true);
|
updateHitObject(hitObject, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +63,10 @@ namespace osu.Game.Screens.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the removal indices are sorted so that iteration order doesn't get messed up post-removal.
|
// Sort the indices to ensure that removal + insertion indices don't get jumbled up post-removal or post-insertion.
|
||||||
|
// This isn't strictly required, but the differ makes no guarantees about order.
|
||||||
toRemove.Sort();
|
toRemove.Sort();
|
||||||
|
toAdd.Sort();
|
||||||
|
|
||||||
// Apply the changes.
|
// Apply the changes.
|
||||||
for (int i = toRemove.Count - 1; i >= 0; i--)
|
for (int i = toRemove.Count - 1; i >= 0; i--)
|
||||||
@ -74,7 +76,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
IBeatmap newBeatmap = readBeatmap(newState);
|
IBeatmap newBeatmap = readBeatmap(newState);
|
||||||
foreach (var i in toAdd)
|
foreach (var i in toAdd)
|
||||||
editorBeatmap.Add(newBeatmap.HitObjects[i]);
|
editorBeatmap.Insert(i, newBeatmap.HitObjects[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +86,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
using (var stream = new MemoryStream(state))
|
using (var stream = new MemoryStream(state))
|
||||||
using (var reader = new LineBufferedReader(stream, true))
|
using (var reader = new LineBufferedReader(stream, true))
|
||||||
return new PassThroughWorkingBeatmap(Decoder.GetDecoder<Beatmap>(reader).Decode(reader)).GetPlayableBeatmap(editorBeatmap.BeatmapInfo.Ruleset);
|
{
|
||||||
|
var decoded = Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
|
||||||
|
decoded.BeatmapInfo.Ruleset = editorBeatmap.BeatmapInfo.Ruleset;
|
||||||
|
return new PassThroughWorkingBeatmap(decoded).GetPlayableBeatmap(editorBeatmap.BeatmapInfo.Ruleset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PassThroughWorkingBeatmap : WorkingBeatmap
|
private class PassThroughWorkingBeatmap : WorkingBeatmap
|
||||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
if (!MenuMusic.Value)
|
if (!MenuMusic.Value)
|
||||||
{
|
{
|
||||||
var sets = beatmaps.GetAllUsableBeatmapSets();
|
var sets = beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal);
|
||||||
if (sets.Count > 0)
|
if (sets.Count > 0)
|
||||||
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
|
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
|
||||||
}
|
}
|
||||||
@ -96,8 +96,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
Track = introBeatmap.Track;
|
Track = introBeatmap.Track;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next) => !DidLoadMenu;
|
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
this.FadeIn(300);
|
this.FadeIn(300);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -31,7 +30,7 @@ namespace osu.Game.Screens
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A user-facing title for this screen.
|
/// A user-facing title for this screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string Title => GetType().ShortDisplayName();
|
public virtual string Title => GetType().Name;
|
||||||
|
|
||||||
public string Description => Title;
|
public string Description => Title;
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
|
|
||||||
private RollingCounter<long> scoreCounter;
|
private RollingCounter<long> scoreCounter;
|
||||||
|
|
||||||
|
private const float padding = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -46,7 +48,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
Padding = new MarginPadding { Vertical = 10, Horizontal = 10 };
|
Padding = new MarginPadding(padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -92,13 +94,17 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
|
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
|
||||||
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
|
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
|
||||||
|
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
|
||||||
|
Truncate = true,
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)),
|
Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)),
|
||||||
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold)
|
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
|
||||||
|
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
|
||||||
|
Truncate = true,
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of the panel when expanded.
|
/// Width of the panel when expanded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const float expanded_width = 360;
|
public const float EXPANDED_WIDTH = 360;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Height of the panel when expanded.
|
/// Height of the panel when expanded.
|
||||||
@ -183,7 +183,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case PanelState.Expanded:
|
case PanelState.Expanded:
|
||||||
this.ResizeTo(new Vector2(expanded_width, expanded_height), resize_duration, Easing.OutQuint);
|
this.ResizeTo(new Vector2(EXPANDED_WIDTH, expanded_height), resize_duration, Easing.OutQuint);
|
||||||
|
|
||||||
topLayerBackground.FadeColour(expanded_top_layer_colour, resize_duration, Easing.OutQuint);
|
topLayerBackground.FadeColour(expanded_top_layer_colour, resize_duration, Easing.OutQuint);
|
||||||
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
|
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
|
||||||
|
@ -169,7 +169,7 @@ namespace osu.Game.Screens.Select
|
|||||||
loadBeatmapSets(GetLoadableBeatmaps());
|
loadBeatmapSets(GetLoadableBeatmaps());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual IEnumerable<BeatmapSetInfo> GetLoadableBeatmaps() => beatmaps.GetAllUsableBeatmapSetsEnumerable();
|
protected virtual IEnumerable<BeatmapSetInfo> GetLoadableBeatmaps() => beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.AllButFiles);
|
||||||
|
|
||||||
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
@ -90,6 +91,8 @@ namespace osu.Game.Screens.Select
|
|||||||
private SampleChannel sampleChangeDifficulty;
|
private SampleChannel sampleChangeDifficulty;
|
||||||
private SampleChannel sampleChangeBeatmap;
|
private SampleChannel sampleChangeBeatmap;
|
||||||
|
|
||||||
|
private Container carouselContainer;
|
||||||
|
|
||||||
protected BeatmapDetailArea BeatmapDetails { get; private set; }
|
protected BeatmapDetailArea BeatmapDetails { get; private set; }
|
||||||
|
|
||||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
||||||
@ -103,6 +106,19 @@ namespace osu.Game.Screens.Select
|
|||||||
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
|
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
|
||||||
transferRulesetValue();
|
transferRulesetValue();
|
||||||
|
|
||||||
|
LoadComponentAsync(Carousel = new BeatmapCarousel
|
||||||
|
{
|
||||||
|
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
BleedTop = FilterControl.HEIGHT,
|
||||||
|
BleedBottom = Footer.HEIGHT,
|
||||||
|
SelectionChanged = updateSelectedBeatmap,
|
||||||
|
BeatmapSetsChanged = carouselBeatmapsLoaded,
|
||||||
|
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
|
||||||
|
}, c => carouselContainer.Child = c);
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new ResetScrollContainer(() => Carousel.ScrollToSelected())
|
new ResetScrollContainer(() => Carousel.ScrollToSelected())
|
||||||
@ -136,7 +152,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Padding = new MarginPadding { Right = -150 },
|
Padding = new MarginPadding { Right = -150 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new Container
|
carouselContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
@ -144,18 +160,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Top = FilterControl.HEIGHT,
|
Top = FilterControl.HEIGHT,
|
||||||
Bottom = Footer.HEIGHT
|
Bottom = Footer.HEIGHT
|
||||||
},
|
},
|
||||||
Child = Carousel = new BeatmapCarousel
|
Child = new LoadingSpinner(true) { State = { Value = Visibility.Visible } }
|
||||||
{
|
|
||||||
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
BleedTop = FilterControl.HEIGHT,
|
|
||||||
BleedBottom = Footer.HEIGHT,
|
|
||||||
SelectionChanged = updateSelectedBeatmap,
|
|
||||||
BeatmapSetsChanged = carouselBeatmapsLoaded,
|
|
||||||
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -283,7 +288,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
// if we have no beatmaps but osu-stable is found, let's prompt the user to import.
|
// if we have no beatmaps but osu-stable is found, let's prompt the user to import.
|
||||||
if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
|
if (!beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.Minimal).Any() && beatmaps.StableInstallationAvailable)
|
||||||
{
|
{
|
||||||
dialogOverlay.Push(new ImportFromStablePopup(() =>
|
dialogOverlay.Push(new ImportFromStablePopup(() =>
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,10 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
this.storyboard = storyboard;
|
this.storyboard = storyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool TrackLoaded => true;
|
||||||
|
|
||||||
|
public override bool BeatmapLoaded => true;
|
||||||
|
|
||||||
protected override IBeatmap GetBeatmap() => beatmap;
|
protected override IBeatmap GetBeatmap() => beatmap;
|
||||||
|
|
||||||
protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();
|
protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// Provides a clock, beat-divisor, and scrolling capability for test cases of editor components that
|
/// Provides a clock, beat-divisor, and scrolling capability for test cases of editor components that
|
||||||
/// are preferrably tested within the presence of a clock and seek controls.
|
/// are preferrably tested within the presence of a clock and seek controls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EditorClockTestScene : OsuTestScene
|
public abstract class EditorClockTestScene : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor();
|
protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor();
|
||||||
protected new readonly EditorClock Clock;
|
protected new readonly EditorClock Clock;
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.421.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.501.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.412.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.1" />
|
<PackageReference Include="Sentry" Version="2.1.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.25.0" />
|
<PackageReference Include="SharpCompress" Version="0.25.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
|
@ -70,8 +70,8 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.421.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.501.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.412.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
@ -80,7 +80,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.421.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.501.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.25.0" />
|
<PackageReference Include="SharpCompress" Version="0.25.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user