mirror of
https://github.com/osukey/osukey.git
synced 2025-05-05 05:37:18 +09:00
Move DistanceSpacingMultiplier
bindable to its own IDistanceSnapProvider
interface
This commit is contained in:
parent
4f8f27a58b
commit
70a93c0e7e
@ -4,7 +4,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
@ -99,8 +98,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|||||||
set => InternalChild = value;
|
set => InternalChild = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IBindable<double> DistanceSpacingMultiplier => throw new System.NotImplementedException();
|
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||||
|
|
||||||
[Cached(typeof(IPositionSnapProvider))]
|
[Cached(typeof(IDistanceSnapProvider))]
|
||||||
private readonly SnapProvider snapProvider = new SnapProvider();
|
private readonly SnapProvider snapProvider = new SnapProvider();
|
||||||
|
|
||||||
private TestOsuDistanceSnapGrid grid;
|
private TestOsuDistanceSnapGrid grid;
|
||||||
@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SnapProvider : IPositionSnapProvider
|
private class SnapProvider : IDistanceSnapProvider
|
||||||
{
|
{
|
||||||
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, null);
|
new SnapResult(screenSpacePosition, null);
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
[Cached(typeof(EditorBeatmap))]
|
[Cached(typeof(EditorBeatmap))]
|
||||||
private readonly EditorBeatmap editorBeatmap;
|
private readonly EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
[Cached(typeof(IPositionSnapProvider))]
|
[Cached(typeof(IDistanceSnapProvider))]
|
||||||
private readonly SnapProvider snapProvider = new SnapProvider();
|
private readonly SnapProvider snapProvider = new SnapProvider();
|
||||||
|
|
||||||
public TestSceneDistanceSnapGrid()
|
public TestSceneDistanceSnapGrid()
|
||||||
@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
=> (Vector2.Zero, 0);
|
=> (Vector2.Zero, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SnapProvider : IPositionSnapProvider
|
private class SnapProvider : IDistanceSnapProvider
|
||||||
{
|
{
|
||||||
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, null);
|
new SnapResult(screenSpacePosition, null);
|
||||||
|
17
osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs
Normal file
17
osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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.Bindables;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit
|
||||||
|
{
|
||||||
|
public interface IDistanceSnapProvider : IPositionSnapProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The spacing multiplier applied to beat snap distances.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="BeatmapInfo.DistanceSpacing"/>
|
||||||
|
IBindable<double> DistanceSpacingMultiplier { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,6 @@
|
|||||||
// 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.Bindables;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -10,12 +8,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
public interface IPositionSnapProvider
|
public interface IPositionSnapProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The spacing multiplier applied to beat snap distances.
|
|
||||||
/// </summary>
|
|
||||||
/// <seealso cref="BeatmapInfo.DistanceSpacing"/>
|
|
||||||
IBindable<double> DistanceSpacingMultiplier { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a position, find a valid time and position snap.
|
/// Given a position, find a valid time and position snap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -38,6 +30,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="referenceObject">An object to be used as a reference point for this operation.</param>
|
/// <param name="referenceObject">An object to be used as a reference point for this operation.</param>
|
||||||
/// <returns>The distance between two points residing in the timing point that are one beat length apart.</returns>
|
/// <returns>The distance between two points residing in the timing point that are one beat length apart.</returns>
|
||||||
|
// todo: this, and other distance-related methods below it, should move to IDistanceSnapProvider.
|
||||||
|
// needs thought on how to properly share implementation, since not all composers inherit IDistanceSnapProvider.
|
||||||
float GetBeatSnapDistanceAt(HitObject referenceObject);
|
float GetBeatSnapDistanceAt(HitObject referenceObject);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
protected OsuColour Colours { get; private set; }
|
protected OsuColour Colours { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IPositionSnapProvider SnapProvider { get; private set; }
|
protected IDistanceSnapProvider SnapProvider { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user