mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into leaderboard-scores
This commit is contained in:
@ -26,21 +26,19 @@ namespace osu.Game.Rulesets.Beatmaps
|
||||
/// Converts a Beatmap using this Beatmap Converter.
|
||||
/// </summary>
|
||||
/// <param name="original">The un-converted Beatmap.</param>
|
||||
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
|
||||
/// <returns>The converted Beatmap.</returns>
|
||||
public Beatmap<T> Convert(Beatmap original, bool isForCurrentRuleset)
|
||||
public Beatmap<T> Convert(Beatmap original)
|
||||
{
|
||||
// We always operate on a clone of the original beatmap, to not modify it game-wide
|
||||
return ConvertBeatmap(new Beatmap(original), isForCurrentRuleset);
|
||||
return ConvertBeatmap(new Beatmap(original));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the conversion of a Beatmap using this Beatmap Converter.
|
||||
/// </summary>
|
||||
/// <param name="original">The un-converted Beatmap.</param>
|
||||
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
|
||||
/// <returns>The converted Beatmap.</returns>
|
||||
protected virtual Beatmap<T> ConvertBeatmap(Beatmap original, bool isForCurrentRuleset)
|
||||
protected virtual Beatmap<T> ConvertBeatmap(Beatmap original)
|
||||
{
|
||||
return new Beatmap<T>
|
||||
{
|
||||
|
@ -106,6 +106,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <returns>Whether a hit was processed.</returns>
|
||||
protected bool UpdateJudgement(bool userTriggered)
|
||||
{
|
||||
if (Judgement == null)
|
||||
return false;
|
||||
|
||||
var partial = Judgement as IPartialJudgement;
|
||||
|
||||
// Never re-process non-partial hits
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
||||
DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(StartTime);
|
||||
|
||||
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / difficultyPoint.SpeedMultiplier;
|
||||
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
|
||||
|
||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Input.Handlers;
|
||||
@ -18,7 +17,7 @@ namespace osu.Game.Rulesets.Replays
|
||||
/// The ReplayHandler will take a replay and handle the propagation of updates to the input stack.
|
||||
/// It handles logic of any frames which *must* be executed.
|
||||
/// </summary>
|
||||
public class FramedReplayInputHandler : ReplayInputHandler
|
||||
public abstract class FramedReplayInputHandler : ReplayInputHandler
|
||||
{
|
||||
private readonly Replay replay;
|
||||
|
||||
@ -31,7 +30,7 @@ namespace osu.Game.Rulesets.Replays
|
||||
|
||||
private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, Frames.Count - 1);
|
||||
|
||||
public FramedReplayInputHandler(Replay replay)
|
||||
protected FramedReplayInputHandler(Replay replay)
|
||||
{
|
||||
this.replay = replay;
|
||||
}
|
||||
@ -51,7 +50,7 @@ namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
}
|
||||
|
||||
private Vector2? position
|
||||
protected Vector2? Position
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -62,23 +61,7 @@ namespace osu.Game.Rulesets.Replays
|
||||
}
|
||||
}
|
||||
|
||||
public override List<InputState> GetPendingStates()
|
||||
{
|
||||
var buttons = new HashSet<MouseButton>();
|
||||
if (CurrentFrame?.MouseLeft ?? false)
|
||||
buttons.Add(MouseButton.Left);
|
||||
if (CurrentFrame?.MouseRight ?? false)
|
||||
buttons.Add(MouseButton.Right);
|
||||
|
||||
return new List<InputState>
|
||||
{
|
||||
new InputState
|
||||
{
|
||||
Mouse = new ReplayMouseState(ToScreenSpace(position ?? Vector2.Zero), buttons),
|
||||
Keyboard = new ReplayKeyboardState(new List<Key>())
|
||||
}
|
||||
};
|
||||
}
|
||||
public override List<InputState> GetPendingStates() => new List<InputState>();
|
||||
|
||||
public bool AtLastFrame => currentFrameIndex == Frames.Count - 1;
|
||||
public bool AtFirstFrame => currentFrameIndex == 0;
|
||||
@ -133,10 +116,9 @@ namespace osu.Game.Rulesets.Replays
|
||||
|
||||
protected class ReplayMouseState : MouseState
|
||||
{
|
||||
public ReplayMouseState(Vector2 position, IEnumerable<MouseButton> list)
|
||||
public ReplayMouseState(Vector2 position)
|
||||
{
|
||||
Position = position;
|
||||
list.ForEach(b => SetPressed(b, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -57,8 +57,6 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public abstract string Description { get; }
|
||||
|
||||
public abstract IEnumerable<KeyCounter> CreateGameplayKeys();
|
||||
|
||||
public virtual SettingsSubsection CreateSettings() => null;
|
||||
|
||||
/// <summary>
|
||||
@ -77,5 +75,12 @@ namespace osu.Game.Rulesets
|
||||
/// <param name="variant">A variant.</param>
|
||||
/// <returns>A list of valid <see cref="KeyBinding"/>s.</returns>
|
||||
public virtual IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new KeyBinding[] { };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name for a key binding variant. This is used for display in the settings overlay.
|
||||
/// </summary>
|
||||
/// <param name="variant">The variant.</param>
|
||||
/// <returns>A descriptive name of the variant.</returns>
|
||||
public virtual string GetVariantName(int variant) => string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
var version = sr.ReadInt32();
|
||||
/* score.FileChecksum = */
|
||||
var beatmapHash = sr.ReadString();
|
||||
score.Beatmap = beatmaps.QueryBeatmap(b => b.Hash == beatmapHash);
|
||||
score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash);
|
||||
/* score.PlayerName = */
|
||||
sr.ReadString();
|
||||
/* var localScoreChecksum = */
|
||||
@ -137,7 +137,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
frames.Add(new ReplayFrame(
|
||||
lastTime,
|
||||
float.Parse(split[1]),
|
||||
384 - float.Parse(split[2]),
|
||||
float.Parse(split[2]),
|
||||
(ReplayButtonState)int.Parse(split[3])
|
||||
));
|
||||
}
|
||||
|
@ -10,12 +10,10 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// </summary>
|
||||
internal class LinearScrollingContainer : ScrollingContainer
|
||||
{
|
||||
private readonly Axes scrollingAxes;
|
||||
private readonly MultiplierControlPoint controlPoint;
|
||||
|
||||
public LinearScrollingContainer(Axes scrollingAxes, MultiplierControlPoint controlPoint)
|
||||
public LinearScrollingContainer(MultiplierControlPoint controlPoint)
|
||||
{
|
||||
this.scrollingAxes = scrollingAxes;
|
||||
this.controlPoint = controlPoint;
|
||||
}
|
||||
|
||||
@ -23,8 +21,8 @@ namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if ((scrollingAxes & Axes.X) > 0) X = (float)(controlPoint.StartTime - Time.Current);
|
||||
if ((scrollingAxes & Axes.Y) > 0) Y = (float)(controlPoint.StartTime - Time.Current);
|
||||
if ((ScrollingAxes & Axes.X) > 0) X = (float)(controlPoint.StartTime - Time.Current);
|
||||
if ((ScrollingAxes & Axes.Y) > 0) Y = (float)(controlPoint.StartTime - Time.Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// <summary>
|
||||
/// The multiplier which this <see cref="MultiplierControlPoint"/> provides.
|
||||
/// </summary>
|
||||
public double Multiplier => 1000 / TimingPoint.BeatLength / DifficultyPoint.SpeedMultiplier;
|
||||
public double Multiplier => 1000 / TimingPoint.BeatLength * DifficultyPoint.SpeedMultiplier;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="TimingControlPoint"/> that provides the timing information for this <see cref="MultiplierControlPoint"/>.
|
||||
@ -62,4 +62,4 @@ namespace osu.Game.Rulesets.Timing
|
||||
|
||||
public int CompareTo(MultiplierControlPoint other) => StartTime.CompareTo(other?.StartTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Configuration;
|
||||
@ -45,50 +46,34 @@ namespace osu.Game.Rulesets.Timing
|
||||
RelativePositionAxes = Axes.Both;
|
||||
}
|
||||
|
||||
public override void InvalidateFromChild(Invalidation invalidation)
|
||||
protected override int Compare(Drawable x, Drawable y)
|
||||
{
|
||||
// We only want to re-compute our size when a child's size or position has changed
|
||||
if ((invalidation & Invalidation.RequiredParentSizeToFit) == 0)
|
||||
{
|
||||
base.InvalidateFromChild(invalidation);
|
||||
return;
|
||||
}
|
||||
var hX = (DrawableHitObject)x;
|
||||
var hY = (DrawableHitObject)y;
|
||||
|
||||
int result = hY.HitObject.StartTime.CompareTo(hX.HitObject.StartTime);
|
||||
if (result != 0)
|
||||
return result;
|
||||
return base.Compare(y, x);
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject drawable)
|
||||
{
|
||||
durationBacking.Invalidate();
|
||||
|
||||
base.InvalidateFromChild(invalidation);
|
||||
base.Add(drawable);
|
||||
}
|
||||
|
||||
private double computeDuration()
|
||||
public override bool Remove(DrawableHitObject drawable)
|
||||
{
|
||||
if (!Children.Any())
|
||||
return 0;
|
||||
|
||||
double baseDuration = Children.Max(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime) - ControlPoint.StartTime;
|
||||
|
||||
// If we have a singular hit object at the timing section's start time, let's set a sane default duration
|
||||
if (baseDuration == 0)
|
||||
baseDuration = 1;
|
||||
|
||||
// This container needs to resize such that it completely encloses the hit objects to avoid masking optimisations. This is done by converting the largest
|
||||
// absolutely-sized element along the scrolling axes and adding a corresponding duration value. This introduces a bit of error, but will never under-estimate.ion.
|
||||
|
||||
// Find the largest element that is absolutely-sized along ScrollingAxes
|
||||
float maxAbsoluteSize = Children.Where(c => (c.RelativeSizeAxes & ScrollingAxes) == 0)
|
||||
.Select(c => (ScrollingAxes & Axes.X) > 0 ? c.Width : c.Height)
|
||||
.DefaultIfEmpty().Max();
|
||||
|
||||
float ourAbsoluteSize = (ScrollingAxes & Axes.X) > 0 ? DrawWidth : DrawHeight;
|
||||
|
||||
// Add the extra duration to account for the absolute size
|
||||
baseDuration *= 1 + maxAbsoluteSize / ourAbsoluteSize;
|
||||
|
||||
return baseDuration;
|
||||
durationBacking.Invalidate();
|
||||
return base.Remove(drawable);
|
||||
}
|
||||
|
||||
// Todo: This may underestimate the size of the hit object in some cases, but won't be too much of a problem for now
|
||||
private double computeDuration() => Math.Max(0, Children.Select(c => (c.HitObject as IHasEndTime)?.EndTime ?? c.HitObject.StartTime).DefaultIfEmpty().Max() - ControlPoint.StartTime) + 1000;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum duration of any one hit object inside this <see cref="ScrollingContainer"/>. This is calculated as the maximum
|
||||
/// duration of all hit objects relative to this <see cref="ScrollingContainer"/>'s <see cref="MultiplierControlPoint.StartTime"/>.
|
||||
/// An approximate total duration of this scrolling container.
|
||||
/// </summary>
|
||||
public double Duration => durationBacking.IsValid ? durationBacking : (durationBacking.Value = computeDuration());
|
||||
|
||||
@ -96,6 +81,8 @@ namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
base.Update();
|
||||
|
||||
RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0);
|
||||
|
||||
// We want our size and position-space along the scrolling axes to span our duration to completely enclose all the hit objects
|
||||
Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)Duration : Size.X, (ScrollingAxes & Axes.Y) > 0 ? (float)Duration : Size.Y);
|
||||
// And we need to make sure the hit object's position-space doesn't change due to our resizing
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -27,12 +26,16 @@ namespace osu.Game.Rulesets.Timing
|
||||
public readonly BindableBool Reversed = new BindableBool();
|
||||
|
||||
protected override Container<DrawableHitObject> Content => content;
|
||||
private Container<DrawableHitObject> content;
|
||||
private readonly Container<DrawableHitObject> content;
|
||||
|
||||
/// <summary>
|
||||
/// The axes which the content of this container will scroll through.
|
||||
/// </summary>
|
||||
public Axes ScrollingAxes { get; internal set; }
|
||||
public Axes ScrollingAxes
|
||||
{
|
||||
get { return scrollingContainer.ScrollingAxes; }
|
||||
set { scrollingContainer.ScrollingAxes = value; }
|
||||
}
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
@ -41,7 +44,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// </summary>
|
||||
public readonly MultiplierControlPoint ControlPoint;
|
||||
|
||||
private ScrollingContainer scrollingContainer;
|
||||
private readonly ScrollingContainer scrollingContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpeedAdjustmentContainer"/>.
|
||||
@ -51,17 +54,10 @@ namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
ControlPoint = controlPoint;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
scrollingContainer = CreateScrollingContainer();
|
||||
|
||||
scrollingContainer.ScrollingAxes = ScrollingAxes;
|
||||
scrollingContainer.ControlPoint = ControlPoint;
|
||||
scrollingContainer.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
scrollingContainer.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0);
|
||||
|
||||
AddInternal(content = scrollingContainer);
|
||||
}
|
||||
@ -103,11 +99,6 @@ namespace osu.Game.Rulesets.Timing
|
||||
base.Add(drawable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a <see cref="DrawableHitObject"/> falls within this <see cref="SpeedAdjustmentContainer"/>s affecting timespan.
|
||||
/// </summary>
|
||||
public bool CanContain(DrawableHitObject hitObject) => CanContain(hitObject.HitObject.StartTime);
|
||||
|
||||
/// <summary>
|
||||
/// Whether a point in time falls within this <see cref="SpeedAdjustmentContainer"/>s affecting timespan.
|
||||
/// </summary>
|
||||
@ -117,6 +108,6 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// Creates the <see cref="ScrollingContainer"/> which contains the scrolling <see cref="DrawableHitObject"/>s of this container.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="ScrollingContainer"/>.</returns>
|
||||
protected virtual ScrollingContainer CreateScrollingContainer() => new LinearScrollingContainer(ScrollingAxes, ControlPoint);
|
||||
protected virtual ScrollingContainer CreateScrollingContainer() => new LinearScrollingContainer(ControlPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Screens.Play;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@ -43,12 +42,12 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// The input manager for this RulesetContainer.
|
||||
/// </summary>
|
||||
internal readonly PlayerInputManager InputManager = new PlayerInputManager();
|
||||
internal IHasReplayHandler ReplayInputManager => KeyBindingInputManager as IHasReplayHandler;
|
||||
|
||||
/// <summary>
|
||||
/// The key conversion input manager for this RulesetContainer.
|
||||
/// </summary>
|
||||
protected readonly PassThroughInputManager KeyConversionInputManager;
|
||||
public PassThroughInputManager KeyBindingInputManager;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we are currently providing the local user a gameplay cursor.
|
||||
@ -58,7 +57,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// Whether we have a replay loaded currently.
|
||||
/// </summary>
|
||||
public bool HasReplayLoaded => InputManager.ReplayInputHandler != null;
|
||||
public bool HasReplayLoaded => ReplayInputManager?.ReplayInputHandler != null;
|
||||
|
||||
public abstract IEnumerable<HitObject> Objects { get; }
|
||||
|
||||
@ -76,8 +75,13 @@ namespace osu.Game.Rulesets.UI
|
||||
internal RulesetContainer(Ruleset ruleset)
|
||||
{
|
||||
Ruleset = ruleset;
|
||||
KeyConversionInputManager = CreateKeyBindingInputManager();
|
||||
KeyConversionInputManager.RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
KeyBindingInputManager = CreateInputManager();
|
||||
KeyBindingInputManager.RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -92,12 +96,12 @@ namespace osu.Game.Rulesets.UI
|
||||
public abstract ScoreProcessor CreateScoreProcessor();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a key conversion input manager.
|
||||
/// Creates a key conversion input manager. An exception will be thrown if a valid <see cref="RulesetInputManager{T}"/> is not returned.
|
||||
/// </summary>
|
||||
/// <returns>The input manager.</returns>
|
||||
public virtual PassThroughInputManager CreateKeyBindingInputManager() => new PassThroughInputManager();
|
||||
public abstract PassThroughInputManager CreateInputManager();
|
||||
|
||||
protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay);
|
||||
protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => null;
|
||||
|
||||
public Replay Replay { get; private set; }
|
||||
|
||||
@ -105,10 +109,13 @@ namespace osu.Game.Rulesets.UI
|
||||
/// Sets a replay to be used, overriding local input.
|
||||
/// </summary>
|
||||
/// <param name="replay">The replay, null for local input.</param>
|
||||
public void SetReplay(Replay replay)
|
||||
public virtual void SetReplay(Replay replay)
|
||||
{
|
||||
if (ReplayInputManager == null)
|
||||
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available");
|
||||
|
||||
Replay = replay;
|
||||
InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
ReplayInputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,16 +146,30 @@ namespace osu.Game.Rulesets.UI
|
||||
protected IEnumerable<Mod> Mods;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="WorkingBeatmap"/> this <see cref="RulesetContainer{TObject}"/> was created with.
|
||||
/// </summary>
|
||||
protected readonly WorkingBeatmap WorkingBeatmap;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the specified beatmap is assumed to be specific to the current ruleset.
|
||||
/// </summary>
|
||||
protected readonly bool IsForCurrentRuleset;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to assume the beatmap passed into this <see cref="RulesetContainer{TObject}"/> is for the current ruleset.
|
||||
/// Creates a hit renderer for a beatmap.
|
||||
/// </summary>
|
||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
||||
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
||||
/// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param>
|
||||
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
|
||||
internal RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset)
|
||||
internal RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap, bool isForCurrentRuleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
Debug.Assert(beatmap != null, "RulesetContainer initialized with a null beatmap.");
|
||||
Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap.");
|
||||
|
||||
Mods = beatmap.Mods.Value;
|
||||
WorkingBeatmap = workingBeatmap;
|
||||
IsForCurrentRuleset = isForCurrentRuleset;
|
||||
Mods = workingBeatmap.Mods.Value;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -156,11 +177,11 @@ namespace osu.Game.Rulesets.UI
|
||||
BeatmapProcessor<TObject> processor = CreateBeatmapProcessor();
|
||||
|
||||
// Check if the beatmap can be converted
|
||||
if (!converter.CanConvert(beatmap.Beatmap))
|
||||
if (!converter.CanConvert(workingBeatmap.Beatmap))
|
||||
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can not be converted for the current ruleset (converter: {converter}).");
|
||||
|
||||
// Convert the beatmap
|
||||
Beatmap = converter.Convert(beatmap.Beatmap, isForCurrentRuleset);
|
||||
Beatmap = converter.Convert(workingBeatmap.Beatmap);
|
||||
|
||||
// Apply difficulty adjustments from mods before using Difficulty.
|
||||
foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
|
||||
@ -173,8 +194,6 @@ namespace osu.Game.Rulesets.UI
|
||||
// Post-process the beatmap
|
||||
processor.PostProcess(Beatmap);
|
||||
|
||||
ApplyBeatmap();
|
||||
|
||||
// Add mods, should always be the last thing applied to give full control to mods
|
||||
applyMods(Mods);
|
||||
}
|
||||
@ -192,11 +211,6 @@ namespace osu.Game.Rulesets.UI
|
||||
mod.ApplyToRulesetContainer(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the beatmap of this hit renderer has been set. Used to apply any default values from the beatmap.
|
||||
/// </summary>
|
||||
protected virtual void ApplyBeatmap() { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a processor to perform post-processing operations
|
||||
/// on HitObjects in converted Beatmaps.
|
||||
@ -237,7 +251,7 @@ namespace osu.Game.Rulesets.UI
|
||||
public Playfield<TObject, TJudgement> Playfield { get; private set; }
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container content;
|
||||
private Container content;
|
||||
|
||||
private readonly List<DrawableHitObject<TObject, TJudgement>> drawableObjects = new List<DrawableHitObject<TObject, TJudgement>>();
|
||||
|
||||
@ -250,24 +264,28 @@ namespace osu.Game.Rulesets.UI
|
||||
protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(ruleset, beatmap, isForCurrentRuleset)
|
||||
{
|
||||
InputManager.Add(content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[] { KeyConversionInputManager }
|
||||
});
|
||||
|
||||
AddInternal(InputManager);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
KeyConversionInputManager.Add(Playfield = CreatePlayfield());
|
||||
KeyBindingInputManager.Add(content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
AddInternal(KeyBindingInputManager);
|
||||
KeyBindingInputManager.Add(Playfield = CreatePlayfield());
|
||||
|
||||
loadObjects();
|
||||
}
|
||||
|
||||
if (InputManager?.ReplayInputHandler != null)
|
||||
InputManager.ReplayInputHandler.ToScreenSpace = Playfield.ScaledContent.ToScreenSpace;
|
||||
public override void SetReplay(Replay replay)
|
||||
{
|
||||
base.SetReplay(replay);
|
||||
|
||||
if (ReplayInputManager?.ReplayInputHandler != null)
|
||||
ReplayInputManager.ReplayInputHandler.ToScreenSpace = input => Playfield.ScaledContent.ToScreenSpace(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
232
osu.Game/Rulesets/UI/RulesetInputManager.cs
Normal file
232
osu.Game/Rulesets/UI/RulesetInputManager.cs
Normal file
@ -0,0 +1,232 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Input.Handlers;
|
||||
using osu.Game.Screens.Play;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
public abstract class RulesetInputManager<T> : DatabasedKeyBindingInputManager<T>, ICanAttachKeyCounter, IHasReplayHandler
|
||||
where T : struct
|
||||
{
|
||||
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) : base(ruleset, variant, unique)
|
||||
{
|
||||
}
|
||||
|
||||
#region Action mapping (for replays)
|
||||
|
||||
private List<T> lastPressedActions = new List<T>();
|
||||
|
||||
protected override void HandleNewState(InputState state)
|
||||
{
|
||||
base.HandleNewState(state);
|
||||
|
||||
var replayState = state as ReplayInputHandler.ReplayState<T>;
|
||||
|
||||
if (replayState == null) return;
|
||||
|
||||
// Here we handle states specifically coming from a replay source.
|
||||
// These have extra action information rather than keyboard keys or mouse buttons.
|
||||
|
||||
List<T> newActions = replayState.PressedActions;
|
||||
|
||||
foreach (var released in lastPressedActions.Except(newActions))
|
||||
PropagateReleased(KeyBindingInputQueue, released);
|
||||
|
||||
foreach (var pressed in newActions.Except(lastPressedActions))
|
||||
PropagatePressed(KeyBindingInputQueue, pressed);
|
||||
|
||||
lastPressedActions = newActions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasReplayHandler
|
||||
|
||||
private ReplayInputHandler replayInputHandler;
|
||||
public ReplayInputHandler ReplayInputHandler
|
||||
{
|
||||
get
|
||||
{
|
||||
return replayInputHandler;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (replayInputHandler != null) RemoveHandler(replayInputHandler);
|
||||
|
||||
replayInputHandler = value;
|
||||
UseParentState = replayInputHandler == null;
|
||||
|
||||
if (replayInputHandler != null)
|
||||
AddHandler(replayInputHandler);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Clock control
|
||||
|
||||
private ManualClock clock;
|
||||
private IFrameBasedClock parentClock;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
//our clock will now be our parent's clock, but we want to replace this to allow manual control.
|
||||
parentClock = Clock;
|
||||
|
||||
Clock = new FramedClock(clock = new ManualClock
|
||||
{
|
||||
CurrentTime = parentClock.CurrentTime,
|
||||
Rate = parentClock.Rate,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether we are running up-to-date with our parent clock.
|
||||
/// If not, we will need to keep processing children until we catch up.
|
||||
/// </summary>
|
||||
private bool requireMoreUpdateLoops;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we are in a valid state (ie. should we keep processing children frames).
|
||||
/// This should be set to false when the replay is, for instance, waiting for future frames to arrive.
|
||||
/// </summary>
|
||||
private bool validState;
|
||||
|
||||
protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate && validState;
|
||||
|
||||
private bool isAttached => replayInputHandler != null && !UseParentState;
|
||||
|
||||
private const int max_catch_up_updates_per_frame = 50;
|
||||
|
||||
public override bool UpdateSubTree()
|
||||
{
|
||||
requireMoreUpdateLoops = true;
|
||||
validState = true;
|
||||
|
||||
int loops = 0;
|
||||
|
||||
while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame)
|
||||
if (!base.UpdateSubTree())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
if (parentClock == null) return;
|
||||
|
||||
clock.Rate = parentClock.Rate;
|
||||
clock.IsRunning = parentClock.IsRunning;
|
||||
|
||||
if (!isAttached)
|
||||
{
|
||||
clock.CurrentTime = parentClock.CurrentTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
double? newTime = replayInputHandler.SetFrameFromTime(parentClock.CurrentTime);
|
||||
|
||||
if (newTime == null)
|
||||
{
|
||||
// we shouldn't execute for this time value. probably waiting on more replay data.
|
||||
validState = false;
|
||||
return;
|
||||
}
|
||||
|
||||
clock.CurrentTime = newTime.Value;
|
||||
}
|
||||
|
||||
requireMoreUpdateLoops = clock.CurrentTime != parentClock.CurrentTime;
|
||||
base.Update();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Setting application (disables etc.)
|
||||
|
||||
private Bindable<bool> mouseDisabled;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
|
||||
}
|
||||
|
||||
protected override void TransformState(InputState state)
|
||||
{
|
||||
base.TransformState(state);
|
||||
|
||||
// we don't want to transform the state if a replay is present (for now, at least).
|
||||
if (replayInputHandler != null) return;
|
||||
|
||||
var mouse = state.Mouse as Framework.Input.MouseState;
|
||||
|
||||
if (mouse != null)
|
||||
{
|
||||
if (mouseDisabled.Value)
|
||||
{
|
||||
mouse.SetPressed(MouseButton.Left, false);
|
||||
mouse.SetPressed(MouseButton.Right, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Key Counter Attachment
|
||||
|
||||
public void Attach(KeyCounterCollection keyCounter)
|
||||
{
|
||||
var receptor = new ActionReceptor(keyCounter);
|
||||
Add(receptor);
|
||||
keyCounter.SetReceptor(receptor);
|
||||
|
||||
keyCounter.AddRange(DefaultKeyBindings.Select(b => b.GetAction<T>()).Distinct().Select(b => new KeyCounterAction<T>(b)));
|
||||
}
|
||||
|
||||
public class ActionReceptor : KeyCounterCollection.Receptor, IKeyBindingHandler<T>
|
||||
{
|
||||
public ActionReceptor(KeyCounterCollection target)
|
||||
: base(target)
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnPressed(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnPressed(action));
|
||||
|
||||
public bool OnReleased(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnReleased(action));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expose the <see cref="ReplayInputHandler"/> in a capable <see cref="InputManager"/>.
|
||||
/// </summary>
|
||||
public interface IHasReplayHandler
|
||||
{
|
||||
ReplayInputHandler ReplayInputHandler { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supports attaching a <see cref="KeyCounterCollection"/>.
|
||||
/// Keys will be populated automatically and a receptor will be injected inside.
|
||||
/// </summary>
|
||||
public interface ICanAttachKeyCounter
|
||||
{
|
||||
void Attach(KeyCounterCollection keyCounter);
|
||||
}
|
||||
}
|
@ -55,14 +55,14 @@ namespace osu.Game.Rulesets.UI
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Whether to reverse the scrolling direction is reversed.
|
||||
/// Whether to reverse the scrolling direction is reversed. Note that this does _not_ invert the hit objects.
|
||||
/// </summary>
|
||||
public readonly BindableBool Reversed = new BindableBool();
|
||||
protected readonly BindableBool Reversed = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// The container that contains the <see cref="SpeedAdjustmentContainer"/>s and <see cref="DrawableHitObject"/>s.
|
||||
/// </summary>
|
||||
internal new readonly ScrollingHitObjectContainer HitObjects;
|
||||
public new readonly ScrollingHitObjectContainer HitObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ScrollingPlayfield{TObject, TJudgement}"/>.
|
||||
@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// A container that provides the foundation for sorting <see cref="DrawableHitObject"/>s into <see cref="SpeedAdjustmentContainer"/>s.
|
||||
/// </summary>
|
||||
internal class ScrollingHitObjectContainer : HitObjectContainer
|
||||
public class ScrollingHitObjectContainer : HitObjectContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
||||
@ -151,11 +151,10 @@ namespace osu.Game.Rulesets.UI
|
||||
/// </summary>
|
||||
public readonly BindableBool Reversed = new BindableBool();
|
||||
|
||||
/// <summary>
|
||||
/// Hit objects that are to be re-processed on the next update.
|
||||
/// </summary>
|
||||
private readonly List<DrawableHitObject> queuedHitObjects = new List<DrawableHitObject>();
|
||||
private readonly Container<SpeedAdjustmentContainer> speedAdjustments;
|
||||
private readonly SortedContainer speedAdjustments;
|
||||
public IReadOnlyList<SpeedAdjustmentContainer> SpeedAdjustments => speedAdjustments;
|
||||
|
||||
private readonly SpeedAdjustmentContainer defaultSpeedAdjustment;
|
||||
|
||||
private readonly Axes scrollingAxes;
|
||||
|
||||
@ -167,11 +166,15 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
this.scrollingAxes = scrollingAxes;
|
||||
|
||||
AddInternal(speedAdjustments = new Container<SpeedAdjustmentContainer> { RelativeSizeAxes = Axes.Both });
|
||||
AddInternal(speedAdjustments = new SortedContainer { RelativeSizeAxes = Axes.Both });
|
||||
|
||||
// Default speed adjustment
|
||||
AddSpeedAdjustment(defaultSpeedAdjustment = new SpeedAdjustmentContainer(new MultiplierControlPoint(0)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a <see cref="SpeedAdjustmentContainer"/> to this container.
|
||||
/// Adds a <see cref="SpeedAdjustmentContainer"/> to this container, re-sorting all hit objects
|
||||
/// in the last <see cref="SpeedAdjustmentContainer"/> that occurred (time-wise) before it.
|
||||
/// </summary>
|
||||
/// <param name="speedAdjustment">The <see cref="SpeedAdjustmentContainer"/>.</param>
|
||||
public void AddSpeedAdjustment(SpeedAdjustmentContainer speedAdjustment)
|
||||
@ -179,9 +182,51 @@ namespace osu.Game.Rulesets.UI
|
||||
speedAdjustment.ScrollingAxes = scrollingAxes;
|
||||
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
speedAdjustment.Reversed.BindTo(Reversed);
|
||||
|
||||
if (speedAdjustments.Count > 0)
|
||||
{
|
||||
// We need to re-sort all hit objects in the speed adjustment container prior to figure out if they
|
||||
// should now lie within this one
|
||||
var existingAdjustment = adjustmentContainerAt(speedAdjustment.ControlPoint.StartTime);
|
||||
for (int i = 0; i < existingAdjustment.Count; i++)
|
||||
{
|
||||
DrawableHitObject hitObject = existingAdjustment[i];
|
||||
|
||||
if (!speedAdjustment.CanContain(hitObject.HitObject.StartTime))
|
||||
continue;
|
||||
|
||||
existingAdjustment.Remove(hitObject);
|
||||
speedAdjustment.Add(hitObject);
|
||||
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
speedAdjustments.Add(speedAdjustment);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a <see cref="SpeedAdjustmentContainer"/> from this container, re-sorting all hit objects
|
||||
/// which it contained into new <see cref="SpeedAdjustmentContainer"/>s.
|
||||
/// </summary>
|
||||
/// <param name="speedAdjustment">The <see cref="SpeedAdjustmentContainer"/> to remove.</param>
|
||||
public void RemoveSpeedAdjustment(SpeedAdjustmentContainer speedAdjustment)
|
||||
{
|
||||
if (speedAdjustment == defaultSpeedAdjustment)
|
||||
throw new InvalidOperationException($"The default {nameof(SpeedAdjustmentContainer)} must not be removed.");
|
||||
|
||||
if (!speedAdjustments.Remove(speedAdjustment))
|
||||
return;
|
||||
|
||||
while (speedAdjustment.Count > 0)
|
||||
{
|
||||
DrawableHitObject hitObject = speedAdjustment[0];
|
||||
|
||||
speedAdjustment.Remove(hitObject);
|
||||
Add(hitObject);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<DrawableHitObject> Objects => speedAdjustments.SelectMany(s => s.Children);
|
||||
|
||||
/// <summary>
|
||||
@ -194,39 +239,10 @@ namespace osu.Game.Rulesets.UI
|
||||
if (!(hitObject is IScrollingHitObject))
|
||||
throw new InvalidOperationException($"Hit objects added to a {nameof(ScrollingHitObjectContainer)} must implement {nameof(IScrollingHitObject)}.");
|
||||
|
||||
queuedHitObjects.Add(hitObject);
|
||||
adjustmentContainerAt(hitObject.HitObject.StartTime).Add(hitObject);
|
||||
}
|
||||
|
||||
public override bool Remove(DrawableHitObject hitObject) => speedAdjustments.Any(s => s.Remove(hitObject)) || queuedHitObjects.Remove(hitObject);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// Todo: At the moment this is going to re-process every single Update, however this will only be a null-op
|
||||
// when there are no SpeedAdjustmentContainers available. This should probably error or something, but it's okay for now.
|
||||
|
||||
for (int i = queuedHitObjects.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var hitObject = queuedHitObjects[i];
|
||||
|
||||
var target = adjustmentContainerFor(hitObject);
|
||||
if (target == null)
|
||||
continue;
|
||||
|
||||
target.Add(hitObject);
|
||||
queuedHitObjects.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the <see cref="SpeedAdjustmentContainer"/> which provides the speed adjustment active at the start time
|
||||
/// of a hit object. If there is no <see cref="SpeedAdjustmentContainer"/> active at the start time of the hit object,
|
||||
/// then the first (time-wise) speed adjustment is returned.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The hit object to find the active <see cref="SpeedAdjustmentContainer"/> for.</param>
|
||||
/// <returns>The <see cref="SpeedAdjustmentContainer"/> active at <paramref name="hitObject"/>'s start time. Null if there are no speed adjustments.</returns>
|
||||
private SpeedAdjustmentContainer adjustmentContainerFor(DrawableHitObject hitObject) => speedAdjustments.FirstOrDefault(c => c.CanContain(hitObject)) ?? speedAdjustments.LastOrDefault();
|
||||
public override bool Remove(DrawableHitObject hitObject) => speedAdjustments.Any(s => s.Remove(hitObject));
|
||||
|
||||
/// <summary>
|
||||
/// Finds the <see cref="SpeedAdjustmentContainer"/> which provides the speed adjustment active at a time.
|
||||
@ -234,7 +250,21 @@ namespace osu.Game.Rulesets.UI
|
||||
/// </summary>
|
||||
/// <param name="time">The time to find the active <see cref="SpeedAdjustmentContainer"/> at.</param>
|
||||
/// <returns>The <see cref="SpeedAdjustmentContainer"/> active at <paramref name="time"/>. Null if there are no speed adjustments.</returns>
|
||||
private SpeedAdjustmentContainer adjustmentContainerAt(double time) => speedAdjustments.FirstOrDefault(c => c.CanContain(time)) ?? speedAdjustments.LastOrDefault();
|
||||
private SpeedAdjustmentContainer adjustmentContainerAt(double time) => speedAdjustments.FirstOrDefault(c => c.CanContain(time)) ?? defaultSpeedAdjustment;
|
||||
|
||||
private class SortedContainer : Container<SpeedAdjustmentContainer>
|
||||
{
|
||||
protected override int Compare(Drawable x, Drawable y)
|
||||
{
|
||||
var sX = (SpeedAdjustmentContainer)x;
|
||||
var sY = (SpeedAdjustmentContainer)y;
|
||||
|
||||
int result = sY.ControlPoint.StartTime.CompareTo(sX.ControlPoint.StartTime);
|
||||
if (result != 0)
|
||||
return result;
|
||||
return base.Compare(y, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,17 +39,6 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield));
|
||||
}
|
||||
|
||||
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield<TObject, TJudgement> playfield)
|
||||
{
|
||||
playfield.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint));
|
||||
playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p));
|
||||
}
|
||||
|
||||
protected override void ApplyBeatmap()
|
||||
{
|
||||
// Calculate default multiplier control points
|
||||
var lastTimingPoint = new TimingControlPoint();
|
||||
@ -95,6 +84,14 @@ namespace osu.Game.Rulesets.UI
|
||||
// If we have no control points, add a default one
|
||||
if (DefaultControlPoints.Count == 0)
|
||||
DefaultControlPoints.Add(new MultiplierControlPoint());
|
||||
|
||||
DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield));
|
||||
}
|
||||
|
||||
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield<TObject, TJudgement> playfield)
|
||||
{
|
||||
playfield.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint));
|
||||
playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user