mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 21:23:04 +08:00
Merge pull request #8887 from smoogipoo/mania-dt-speed
Fix speed adjustment mods affecting mania scroll speed
This commit is contained in:
commit
68fe3e12bc
@ -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>
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user