mirror of
https://github.com/ppy/osu.git
synced 2025-03-14 05:47:20 +08:00
Merge pull request #24550 from smoogipoo/mania-edit-disable-sv
Adjust osu!taiko and osu!mania editors to not visualise velocity changes by default
This commit is contained in:
commit
08ef840370
@ -25,6 +25,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Edit
|
||||
{
|
||||
// we're also a ScrollingHitObjectComposer candidate, but can't be everything can we?
|
||||
public partial class CatchHitObjectComposer : DistancedHitObjectComposer<CatchHitObject>
|
||||
{
|
||||
private const float distance_snap_radius = 50;
|
||||
@ -140,7 +141,7 @@ namespace osu.Game.Rulesets.Catch.Edit
|
||||
return base.OnPressed(e);
|
||||
}
|
||||
|
||||
protected override DrawableRuleset<CatchHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods = null) =>
|
||||
protected override DrawableRuleset<CatchHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods) =>
|
||||
new DrawableCatchEditorRuleset(ruleset, beatmap, mods)
|
||||
{
|
||||
TimeRangeMultiplier = { BindTarget = timeRangeMultiplier, }
|
||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
public partial class DrawableCatchRuleset : DrawableScrollingRuleset<CatchHitObject>
|
||||
{
|
||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant;
|
||||
|
||||
protected override bool UserScrollSpeedAdjustment => false;
|
||||
|
||||
public DrawableCatchRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods = null)
|
||||
@ -30,6 +28,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
Direction.Value = ScrollingDirection.Down;
|
||||
TimeRange.Value = GetTimeRange(beatmap.Difficulty.ApproachRate);
|
||||
VisualisationMethod = ScrollVisualisationMethod.Constant;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
|
||||
PassCondition = () =>
|
||||
{
|
||||
var hitObject = Player.ChildrenOfType<DrawableManiaHitObject>().FirstOrDefault();
|
||||
return hitObject?.Dependencies.Get<IScrollingInfo>().Algorithm is ConstantScrollAlgorithm;
|
||||
return hitObject?.Dependencies.Get<IScrollingInfo>().Algorithm.Value is ConstantScrollAlgorithm;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||
|
||||
IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
|
||||
IBindable<double> IScrollingInfo.TimeRange { get; } = new Bindable<double>(5000);
|
||||
IScrollAlgorithm IScrollingInfo.Algorithm { get; } = new ConstantScrollAlgorithm();
|
||||
IBindable<IScrollAlgorithm> IScrollingInfo.Algorithm { get; } = new Bindable<IScrollAlgorithm>(new ConstantScrollAlgorithm());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,22 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osuTK;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit
|
||||
{
|
||||
public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset
|
||||
public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset, ISupportConstantAlgorithmToggle
|
||||
{
|
||||
public BindableBool ShowSpeedChanges { get; set; } = new BindableBool();
|
||||
|
||||
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
||||
|
||||
public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods)
|
||||
@ -21,6 +25,13 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
{
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ShowSpeedChanges.BindValueChanged(showChanges => VisualisationMethod = showChanges.NewValue ? ScrollVisualisationMethod.Sequential : ScrollVisualisationMethod.Constant, true);
|
||||
}
|
||||
|
||||
protected override Playfield CreatePlayfield() => new ManiaEditorPlayfield(Beatmap.Stages)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
|
@ -21,7 +21,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit
|
||||
{
|
||||
public partial class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>
|
||||
public partial class ManiaHitObjectComposer : ScrollingHitObjectComposer<ManiaHitObject>
|
||||
{
|
||||
private DrawableManiaEditorRuleset drawableRuleset;
|
||||
private ManiaBeatSnapGrid beatSnapGrid;
|
||||
@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
||||
Playfield.GetColumnByPosition(screenSpacePosition);
|
||||
|
||||
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)
|
||||
{
|
||||
drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods);
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
||||
{
|
||||
var maniaRuleset = (DrawableManiaRuleset)drawableRuleset;
|
||||
maniaRuleset.ScrollMethod = ScrollVisualisationMethod.Constant;
|
||||
maniaRuleset.VisualisationMethod = ScrollVisualisationMethod.Constant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
@ -14,7 +13,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Input.Handlers;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
@ -52,22 +50,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
||||
|
||||
public ScrollVisualisationMethod ScrollMethod
|
||||
{
|
||||
get => scrollMethod;
|
||||
set
|
||||
{
|
||||
if (IsLoaded)
|
||||
throw new InvalidOperationException($"Can't alter {nameof(ScrollMethod)} after ruleset is already loaded");
|
||||
|
||||
scrollMethod = value;
|
||||
}
|
||||
}
|
||||
|
||||
private ScrollVisualisationMethod scrollMethod = ScrollVisualisationMethod.Sequential;
|
||||
|
||||
protected override ScrollVisualisationMethod VisualisationMethod => scrollMethod;
|
||||
|
||||
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
||||
private readonly BindableInt configScrollSpeed = new BindableInt();
|
||||
private double smoothTimeRange;
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
}
|
||||
|
||||
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||
=> new DrawableOsuEditorRuleset(ruleset, beatmap, mods);
|
||||
|
||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||
|
37
osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.cs
Normal file
37
osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.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 System.Collections.Generic;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Taiko.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Edit
|
||||
{
|
||||
public partial class DrawableTaikoEditorRuleset : DrawableTaikoRuleset, ISupportConstantAlgorithmToggle
|
||||
{
|
||||
public BindableBool ShowSpeedChanges { get; set; } = new BindableBool();
|
||||
|
||||
public DrawableTaikoEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||
: base(ruleset, beatmap, mods)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ShowSpeedChanges.BindValueChanged(showChanges => VisualisationMethod = showChanges.NewValue ? ScrollVisualisationMethod.Overlapping : ScrollVisualisationMethod.Constant, true);
|
||||
}
|
||||
|
||||
protected override double ComputeTimeRange()
|
||||
{
|
||||
// Adjust when we're using constant algorithm to not be sluggish.
|
||||
double multiplier = ShowSpeedChanges.Value ? 1 : 4;
|
||||
return base.ComputeTimeRange() / multiplier;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,14 +2,17 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Edit
|
||||
{
|
||||
public partial class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject>
|
||||
public partial class TaikoHitObjectComposer : ScrollingHitObjectComposer<TaikoHitObject>
|
||||
{
|
||||
protected override bool ApplyHorizontalCentering => false;
|
||||
|
||||
@ -25,6 +28,9 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
||||
new SwellCompositionTool()
|
||||
};
|
||||
|
||||
protected override DrawableRuleset<TaikoHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods) =>
|
||||
new DrawableTaikoEditorRuleset(ruleset, beatmap, mods);
|
||||
|
||||
protected override ComposeBlueprintContainer CreateBlueprintContainer()
|
||||
=> new TaikoBlueprintContainer(this);
|
||||
}
|
||||
|
@ -35,8 +35,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
public new TaikoInputManager KeyBindingInputManager => (TaikoInputManager)base.KeyBindingInputManager;
|
||||
|
||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||
|
||||
protected override bool UserScrollSpeedAdjustment => false;
|
||||
|
||||
private SkinnableDrawable scroller;
|
||||
@ -45,6 +43,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
: base(ruleset, beatmap, mods)
|
||||
{
|
||||
Direction.Value = ScrollingDirection.Left;
|
||||
VisualisationMethod = ScrollVisualisationMethod.Overlapping;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -65,6 +64,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
base.Update();
|
||||
|
||||
TimeRange.Value = ComputeTimeRange();
|
||||
}
|
||||
|
||||
protected virtual double ComputeTimeRange()
|
||||
{
|
||||
// Taiko scrolls at a constant 100px per 1000ms. More notes become visible as the playfield is lengthened.
|
||||
const float scroll_rate = 10;
|
||||
|
||||
@ -73,7 +77,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
// We clamp the ratio to the maximum aspect ratio to keep scroll speed consistent on widths lower than the default.
|
||||
float ratio = Math.Max(DrawSize.X / 768f, TaikoPlayfieldAdjustmentContainer.MAXIMUM_ASPECT);
|
||||
|
||||
TimeRange.Value = (Playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate;
|
||||
return (Playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
|
@ -311,14 +311,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
protected override bool RelativeScaleBeatLengths => RelativeScaleBeatLengthsOverride;
|
||||
|
||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||
|
||||
public new Bindable<double> TimeRange => base.TimeRange;
|
||||
|
||||
public TestDrawableScrollingRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||
: base(ruleset, beatmap, mods)
|
||||
{
|
||||
TimeRange.Value = time_range;
|
||||
VisualisationMethod = ScrollVisualisationMethod.Overlapping;
|
||||
}
|
||||
|
||||
public override DrawableHitObject<TestHitObject> CreateDrawableRepresentation(TestHitObject h)
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
private void load()
|
||||
{
|
||||
RightToolbox.Add(new EditorToolboxGroup("snapping")
|
||||
{
|
||||
|
@ -87,6 +87,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
private IBindable<bool> hasTiming;
|
||||
private Bindable<bool> autoSeekOnPlacement;
|
||||
|
||||
protected DrawableRuleset<TObject> DrawableRuleset { get; private set; }
|
||||
|
||||
protected HitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
@ -104,7 +106,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
try
|
||||
{
|
||||
drawableRulesetWrapper = new DrawableEditorRulesetWrapper<TObject>(CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap, new[] { Ruleset.GetAutoplayMod() }))
|
||||
DrawableRuleset = CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap, new[] { Ruleset.GetAutoplayMod() });
|
||||
drawableRulesetWrapper = new DrawableEditorRulesetWrapper<TObject>(DrawableRuleset)
|
||||
{
|
||||
Clock = EditorClock,
|
||||
ProcessCustomClock = false
|
||||
@ -304,7 +307,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// <param name="beatmap">The loaded beatmap.</param>
|
||||
/// <param name="mods">The mods to be applied.</param>
|
||||
/// <returns>An editor-relevant <see cref="DrawableRuleset{TObject}"/>.</returns>
|
||||
protected virtual DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||
protected virtual DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||
=> (DrawableRuleset<TObject>)ruleset.CreateDrawableRulesetWith(beatmap, mods);
|
||||
|
||||
#region Tool selection logic
|
||||
|
51
osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs
Normal file
51
osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs
Normal file
@ -0,0 +1,51 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectComposer<TObject>
|
||||
where TObject : HitObject
|
||||
{
|
||||
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
|
||||
|
||||
protected ScrollingHitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (DrawableRuleset is ISupportConstantAlgorithmToggle toggleRuleset)
|
||||
{
|
||||
LeftToolbox.Add(new EditorToolboxGroup("playfield")
|
||||
{
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 5),
|
||||
Children = new[]
|
||||
{
|
||||
new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt }))
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
showSpeedChanges.BindValueChanged(state => toggleRuleset.ShowSpeedChanges.Value = state.NewValue == TernaryState.True, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -64,8 +64,6 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
MaxValue = time_span_max
|
||||
};
|
||||
|
||||
protected virtual ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Sequential;
|
||||
|
||||
ScrollVisualisationMethod IDrawableScrollingRuleset.VisualisationMethod => VisualisationMethod;
|
||||
|
||||
/// <summary>
|
||||
@ -99,20 +97,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
switch (VisualisationMethod)
|
||||
{
|
||||
case ScrollVisualisationMethod.Sequential:
|
||||
scrollingInfo.Algorithm = new SequentialScrollAlgorithm(ControlPoints);
|
||||
break;
|
||||
|
||||
case ScrollVisualisationMethod.Overlapping:
|
||||
scrollingInfo.Algorithm = new OverlappingScrollAlgorithm(ControlPoints);
|
||||
break;
|
||||
|
||||
case ScrollVisualisationMethod.Constant:
|
||||
scrollingInfo.Algorithm = new ConstantScrollAlgorithm();
|
||||
break;
|
||||
}
|
||||
updateScrollAlgorithm();
|
||||
|
||||
double lastObjectTime = Beatmap.HitObjects.Any() ? Beatmap.GetLastObjectTime() : double.MaxValue;
|
||||
double baseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH;
|
||||
@ -178,6 +163,36 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset<TObject>)}.");
|
||||
}
|
||||
|
||||
private ScrollVisualisationMethod visualisationMethod = ScrollVisualisationMethod.Sequential;
|
||||
|
||||
public ScrollVisualisationMethod VisualisationMethod
|
||||
{
|
||||
get => visualisationMethod;
|
||||
set
|
||||
{
|
||||
visualisationMethod = value;
|
||||
updateScrollAlgorithm();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateScrollAlgorithm()
|
||||
{
|
||||
switch (VisualisationMethod)
|
||||
{
|
||||
case ScrollVisualisationMethod.Sequential:
|
||||
scrollingInfo.Algorithm.Value = new SequentialScrollAlgorithm(ControlPoints);
|
||||
break;
|
||||
|
||||
case ScrollVisualisationMethod.Overlapping:
|
||||
scrollingInfo.Algorithm.Value = new OverlappingScrollAlgorithm(ControlPoints);
|
||||
break;
|
||||
|
||||
case ScrollVisualisationMethod.Constant:
|
||||
scrollingInfo.Algorithm.Value = new ConstantScrollAlgorithm();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjusts the scroll speed of <see cref="HitObject"/>s.
|
||||
/// </summary>
|
||||
@ -217,7 +232,9 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
|
||||
public IBindable<double> TimeRange { get; } = new BindableDouble();
|
||||
|
||||
public IScrollAlgorithm Algorithm { get; set; }
|
||||
public readonly Bindable<IScrollAlgorithm> Algorithm = new Bindable<IScrollAlgorithm>(new ConstantScrollAlgorithm());
|
||||
|
||||
IBindable<IScrollAlgorithm> IScrollingInfo.Algorithm => Algorithm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
IBindable<ScrollingDirection> Direction { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The span of time that is visible by the length of the scrolling axes.
|
||||
/// </summary>
|
||||
IBindable<double> TimeRange { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The algorithm which controls <see cref="HitObject"/> positions and sizes.
|
||||
/// </summary>
|
||||
IScrollAlgorithm Algorithm { get; }
|
||||
IBindable<IScrollAlgorithm> Algorithm { get; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
// 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;
|
||||
|
||||
namespace osu.Game.Rulesets.UI.Scrolling
|
||||
{
|
||||
/// <summary>
|
||||
/// Denotes a <see cref="IDrawableScrollingRuleset"/> which supports toggling constant algorithm for better display in the editor.
|
||||
/// </summary>
|
||||
public interface ISupportConstantAlgorithmToggle : IDrawableScrollingRuleset
|
||||
{
|
||||
public BindableBool ShowSpeedChanges { get; }
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ using osu.Framework.Layout;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.UI.Scrolling
|
||||
@ -21,6 +22,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
{
|
||||
private readonly IBindable<double> timeRange = new BindableDouble();
|
||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||
private readonly IBindable<IScrollAlgorithm> algorithm = new Bindable<IScrollAlgorithm>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the scrolling direction is horizontal or vertical.
|
||||
@ -59,9 +61,11 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
{
|
||||
direction.BindTo(scrollingInfo.Direction);
|
||||
timeRange.BindTo(scrollingInfo.TimeRange);
|
||||
algorithm.BindTo(scrollingInfo.Algorithm);
|
||||
|
||||
direction.ValueChanged += _ => layoutCache.Invalidate();
|
||||
timeRange.ValueChanged += _ => layoutCache.Invalidate();
|
||||
algorithm.ValueChanged += _ => layoutCache.Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -73,7 +77,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
public double TimeAtPosition(float localPosition, double currentTime)
|
||||
{
|
||||
float scrollPosition = axisInverted ? -localPosition : localPosition;
|
||||
return scrollingInfo.Algorithm.TimeAt(scrollPosition, currentTime, timeRange.Value, scrollLength);
|
||||
return algorithm.Value.TimeAt(scrollPosition, currentTime, timeRange.Value, scrollLength);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -95,7 +99,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
/// </summary>
|
||||
public float PositionAtTime(double time, double currentTime, double? originTime = null)
|
||||
{
|
||||
float scrollPosition = scrollingInfo.Algorithm.PositionAt(time, currentTime, timeRange.Value, scrollLength, originTime);
|
||||
float scrollPosition = algorithm.Value.PositionAt(time, currentTime, timeRange.Value, scrollLength, originTime);
|
||||
return axisInverted ? -scrollPosition : scrollPosition;
|
||||
}
|
||||
|
||||
@ -122,7 +126,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
/// </summary>
|
||||
public float LengthAtTime(double startTime, double endTime)
|
||||
{
|
||||
return scrollingInfo.Algorithm.GetLength(startTime, endTime, timeRange.Value, scrollLength);
|
||||
return algorithm.Value.GetLength(startTime, endTime, timeRange.Value, scrollLength);
|
||||
}
|
||||
|
||||
private float scrollLength => scrollingAxis == Direction.Horizontal ? DrawWidth : DrawHeight;
|
||||
@ -169,7 +173,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
foreach (var entry in Entries)
|
||||
setComputedLifetimeStart(entry);
|
||||
|
||||
scrollingInfo.Algorithm.Reset();
|
||||
algorithm.Value.Reset();
|
||||
|
||||
layoutCache.Validate();
|
||||
}
|
||||
@ -224,7 +228,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
break;
|
||||
}
|
||||
|
||||
return scrollingInfo.Algorithm.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength);
|
||||
return algorithm.Value.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength);
|
||||
}
|
||||
|
||||
private void setComputedLifetimeStart(HitObjectLifetimeEntry entry)
|
||||
|
@ -14,7 +14,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Components.TernaryButtons
|
||||
{
|
||||
internal partial class DrawableTernaryButton : OsuButton
|
||||
public partial class DrawableTernaryButton : OsuButton
|
||||
{
|
||||
private Color4 defaultBackgroundColour;
|
||||
private Color4 defaultIconColour;
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual
|
||||
IBindable<double> IScrollingInfo.TimeRange => TimeRange;
|
||||
|
||||
public readonly TestScrollAlgorithm Algorithm = new TestScrollAlgorithm();
|
||||
IScrollAlgorithm IScrollingInfo.Algorithm => Algorithm;
|
||||
IBindable<IScrollAlgorithm> IScrollingInfo.Algorithm => new Bindable<IScrollAlgorithm>(Algorithm);
|
||||
}
|
||||
|
||||
public class TestScrollAlgorithm : IScrollAlgorithm
|
||||
|
Loading…
x
Reference in New Issue
Block a user