1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Allow changing scrolling speed in catch editor

Scroll speed is not saved and doesn't affect gameplay.
It is purely a feature for a better visualization.
It is currently bind to scroll speed increase/decrease.
Default F3/F4 crashes with editor shortcuts so it has to be changed.
This commit is contained in:
ekrctb 2022-10-06 18:06:16 +09:00
parent e8cd9a5d11
commit 9247ff3e0a
3 changed files with 35 additions and 4 deletions

View File

@ -12,8 +12,10 @@ using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Edit;
@ -37,6 +39,12 @@ namespace osu.Game.Rulesets.Catch.Edit
private InputManager inputManager;
private readonly BindableDouble timeRangeMultiplier = new BindableDouble(1)
{
MinValue = 1,
MaxValue = 10,
};
public CatchHitObjectComposer(CatchRuleset ruleset)
: base(ruleset)
{
@ -80,8 +88,27 @@ namespace osu.Game.Rulesets.Catch.Edit
updateDistanceSnapGrid();
}
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.IncreaseScrollSpeed:
this.TransformBindableTo(timeRangeMultiplier, timeRangeMultiplier.Value - 1, 200, Easing.OutQuint);
break;
case GlobalAction.DecreaseScrollSpeed:
this.TransformBindableTo(timeRangeMultiplier, timeRangeMultiplier.Value + 1, 200, Easing.OutQuint);
break;
}
return base.OnPressed(e);
}
protected override DrawableRuleset<CatchHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null) =>
new DrawableCatchEditorRuleset(ruleset, beatmap, mods);
new DrawableCatchEditorRuleset(ruleset, beatmap, mods)
{
TimeRangeMultiplier = { BindTarget = timeRangeMultiplier, }
};
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
{

View File

@ -4,6 +4,7 @@
#nullable disable
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
@ -13,6 +14,8 @@ namespace osu.Game.Rulesets.Catch.Edit
{
public class DrawableCatchEditorRuleset : DrawableCatchRuleset
{
public readonly BindableDouble TimeRangeMultiplier = new BindableDouble(1);
public DrawableCatchEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
: base(ruleset, beatmap, mods)
{
@ -23,7 +26,8 @@ namespace osu.Game.Rulesets.Catch.Edit
base.Update();
double gamePlayTimeRange = GetTimeRange(Beatmap.Difficulty.ApproachRate);
TimeRange.Value = gamePlayTimeRange * (Playfield.DrawHeight / CatchPlayfield.HEIGHT);
float playfieldStretch = Playfield.DrawHeight / CatchPlayfield.HEIGHT;
TimeRange.Value = gamePlayTimeRange * TimeRangeMultiplier.Value * playfieldStretch;
}
protected override Playfield CreatePlayfield() => new CatchEditorPlayfield(Beatmap.Difficulty);

View File

@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Edit
}
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (e.Action)
{
@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Edit
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
public virtual void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}