mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:42:55 +08:00
Implement ScrollingPlayfield, now containing ScrollingHitObjectContainer (prev. SpeedAdjustmentCollection).
Also removing a lot of mania code relating to gravity mod for now.
This commit is contained in:
parent
54503eef71
commit
b1d25ed388
@ -13,6 +13,9 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Desktop.Tests.Visual
|
namespace osu.Desktop.Tests.Visual
|
||||||
{
|
{
|
||||||
@ -28,7 +31,7 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
public TestCaseScrollingHitObjects()
|
public TestCaseScrollingHitObjects()
|
||||||
{
|
{
|
||||||
OsuSpriteText timeRangeText;
|
OsuSpriteText timeRangeText;
|
||||||
SpeedAdjustmentCollection adjustmentCollection;
|
ScrollingPlayfield<HitObject, Judgement>.ScrollingHitObjectContainer scrollingHitObjectContainer;
|
||||||
|
|
||||||
timeRangeBindable = new BindableDouble(2000)
|
timeRangeBindable = new BindableDouble(2000)
|
||||||
{
|
{
|
||||||
@ -68,7 +71,7 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0.25f
|
Alpha = 0.25f
|
||||||
},
|
},
|
||||||
adjustmentCollection = new SpeedAdjustmentCollection(Axes.Y)
|
scrollingHitObjectContainer = new ScrollingPlayfield<HitObject, Judgement>.ScrollingHitObjectContainer(Axes.Y)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
VisibleTimeRange = timeRangeBindable,
|
VisibleTimeRange = timeRangeBindable,
|
||||||
@ -109,9 +112,9 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
timeRangeBindable.TriggerChange();
|
timeRangeBindable.TriggerChange();
|
||||||
|
|
||||||
adjustmentCollection.Add(new TestSpeedAdjustmentContainer(new MultiplierControlPoint()));
|
scrollingHitObjectContainer.AddSpeedAdjustment(new TestSpeedAdjustmentContainer(new MultiplierControlPoint()));
|
||||||
|
|
||||||
AddStep("Add hit object", () => adjustmentCollection.Add(new TestDrawableHitObject(new HitObject { StartTime = Time.Current + 2000 })));
|
AddStep("Add hit object", () => scrollingHitObjectContainer.Add(new TestDrawableHitObject(new HitObject { StartTime = Time.Current + 2000 })));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -151,7 +154,7 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestDrawableHitObject : DrawableHitObject, IScrollingHitObject
|
private class TestDrawableHitObject : DrawableHitObject<HitObject, Judgement>, IScrollingHitObject
|
||||||
{
|
{
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private const float height = 14;
|
private const float height = 14;
|
||||||
@ -204,6 +207,18 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
if (Time.Current >= HitObject.StartTime)
|
if (Time.Current >= HitObject.StartTime)
|
||||||
background.Colour = Color4.Red;
|
background.Colour = Color4.Red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Judgement CreateJudgement() => new TestJudgement();
|
||||||
|
|
||||||
|
protected override void UpdateState(ArmedState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestJudgement : Judgement
|
||||||
|
{
|
||||||
|
public override string ResultString { get { throw new NotImplementedException(); } }
|
||||||
|
public override string MaxResultString { get { throw new NotImplementedException(); } }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,15 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class Column : Container, IHasAccentColour
|
public class Column : ScrollingPlayfield<ManiaHitObject, ManiaJudgement>, IHasAccentColour
|
||||||
{
|
{
|
||||||
private const float key_icon_size = 10;
|
private const float key_icon_size = 10;
|
||||||
private const float key_icon_corner_radius = 3;
|
private const float key_icon_corner_radius = 3;
|
||||||
@ -30,13 +35,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private const float column_width = 45;
|
private const float column_width = 45;
|
||||||
private const float special_column_width = 70;
|
private const float special_column_width = 70;
|
||||||
|
|
||||||
private readonly BindableDouble visibleTimeRange = new BindableDouble();
|
|
||||||
public BindableDouble VisibleTimeRange
|
|
||||||
{
|
|
||||||
get { return visibleTimeRange; }
|
|
||||||
set { visibleTimeRange.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key that will trigger input actions for this column and hit objects contained inside it.
|
/// The key that will trigger input actions for this column and hit objects contained inside it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -46,14 +44,15 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private readonly Container hitTargetBar;
|
private readonly Container hitTargetBar;
|
||||||
private readonly Container keyIcon;
|
private readonly Container keyIcon;
|
||||||
|
|
||||||
private readonly SpeedAdjustmentCollection speedAdjustments;
|
protected override Container<Drawable> Content => content;
|
||||||
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
public Column()
|
public Column()
|
||||||
|
: base(Axes.Y)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
|
||||||
Width = column_width;
|
Width = column_width;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
@ -97,11 +96,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
speedAdjustments = new SpeedAdjustmentCollection(Axes.Y)
|
content = new Container
|
||||||
{
|
{
|
||||||
Name = "Hit objects",
|
Name = "Hit objects",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
VisibleTimeRange = VisibleTimeRange
|
|
||||||
},
|
},
|
||||||
// For column lighting, we need to capture input events before the notes
|
// For column lighting, we need to capture input events before the notes
|
||||||
new InputTarget
|
new InputTarget
|
||||||
@ -150,6 +148,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Axes RelativeSizeAxes => Axes.Y;
|
||||||
|
|
||||||
private bool isSpecial;
|
private bool isSpecial;
|
||||||
public bool IsSpecial
|
public bool IsSpecial
|
||||||
{
|
{
|
||||||
@ -192,11 +192,16 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(SpeedAdjustmentContainer speedAdjustment) => speedAdjustments.Add(speedAdjustment);
|
public void Add(SpeedAdjustmentContainer speedAdjustment) => HitObjects.AddSpeedAdjustment(speedAdjustment);
|
||||||
public void Add(DrawableHitObject hitObject)
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a DrawableHitObject to this Playfield.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="h">The DrawableHitObject to add.</param>
|
||||||
|
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> hitObject)
|
||||||
{
|
{
|
||||||
hitObject.AccentColour = AccentColour;
|
hitObject.AccentColour = AccentColour;
|
||||||
speedAdjustments.Add(hitObject);
|
HitObjects.Add(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool onKeyDown(InputState state, KeyDownEventArgs args)
|
private bool onKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
@ -39,24 +39,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public IEnumerable<DrawableBarLine> BarLines;
|
public IEnumerable<DrawableBarLine> BarLines;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Per-column timing changes.
|
|
||||||
/// </summary>
|
|
||||||
private readonly List<SpeedAdjustmentContainer>[] hitObjectSpeedAdjustments;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bar line timing changes.
|
|
||||||
/// </summary>
|
|
||||||
private readonly List<SpeedAdjustmentContainer> barLineSpeedAdjustments = new List<SpeedAdjustmentContainer>();
|
|
||||||
|
|
||||||
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(beatmap, isForCurrentRuleset)
|
: base(beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
// Generate the speed adjustment container lists
|
|
||||||
hitObjectSpeedAdjustments = new List<SpeedAdjustmentContainer>[PreferredColumns];
|
|
||||||
for (int i = 0; i < PreferredColumns; i++)
|
|
||||||
hitObjectSpeedAdjustments[i] = new List<SpeedAdjustmentContainer>();
|
|
||||||
|
|
||||||
// Generate the bar lines
|
// Generate the bar lines
|
||||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
||||||
|
|
||||||
@ -83,30 +68,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
BarLines = barLines;
|
BarLines = barLines;
|
||||||
|
|
||||||
// Generate speed adjustments from mods first
|
|
||||||
bool useDefaultSpeedAdjustments = true;
|
|
||||||
|
|
||||||
if (Mods != null)
|
|
||||||
{
|
|
||||||
foreach (var speedAdjustmentMod in Mods.OfType<IGenerateSpeedAdjustments>())
|
|
||||||
{
|
|
||||||
useDefaultSpeedAdjustments = false;
|
|
||||||
speedAdjustmentMod.ApplyToHitRenderer(this, ref hitObjectSpeedAdjustments, ref barLineSpeedAdjustments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the default speed adjustments
|
|
||||||
if (useDefaultSpeedAdjustments)
|
|
||||||
generateDefaultSpeedAdjustments();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
var maniaPlayfield = (ManiaPlayfield)Playfield;
|
BarLines.ForEach(Playfield.Add);
|
||||||
|
|
||||||
BarLines.ForEach(maniaPlayfield.Add);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyBeatmap()
|
protected override void ApplyBeatmap()
|
||||||
@ -116,28 +83,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
PreferredColumns = (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize));
|
PreferredColumns = (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplySpeedAdjustments()
|
|
||||||
{
|
|
||||||
var maniaPlayfield = (ManiaPlayfield)Playfield;
|
|
||||||
|
|
||||||
for (int i = 0; i < PreferredColumns; i++)
|
|
||||||
foreach (var change in hitObjectSpeedAdjustments[i])
|
|
||||||
maniaPlayfield.Columns.ElementAt(i).Add(change);
|
|
||||||
|
|
||||||
foreach (var change in barLineSpeedAdjustments)
|
|
||||||
maniaPlayfield.Add(change);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateDefaultSpeedAdjustments()
|
|
||||||
{
|
|
||||||
DefaultControlPoints.ForEach(c =>
|
|
||||||
{
|
|
||||||
foreach (List<SpeedAdjustmentContainer> t in hitObjectSpeedAdjustments)
|
|
||||||
t.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
|
|
||||||
barLineSpeedAdjustments.Add(new ManiaSpeedAdjustmentContainer(c, ScrollingAlgorithm.Basic));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(PreferredColumns)
|
protected sealed override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(PreferredColumns)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -168,5 +113,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Vector2 GetPlayfieldAspectAdjust() => new Vector2(1, 0.8f);
|
protected override Vector2 GetPlayfieldAspectAdjust() => new Vector2(1, 0.8f);
|
||||||
|
|
||||||
|
protected override void ApplySpeedAdjustment(MultiplierControlPoint controlPoint)
|
||||||
|
{
|
||||||
|
base.ApplySpeedAdjustment(controlPoint);
|
||||||
|
Playfield.Columns.ForEach(c => c.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override SpeedAdjustmentContainer CreateSpeedAdjustmentContainer(MultiplierControlPoint controlPoint) => new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Basic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,18 +20,14 @@ using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class ManiaPlayfield : SpeedAdjustedPlayfield<ManiaHitObject, ManiaJudgement>
|
public class ManiaPlayfield : ScrollingPlayfield<ManiaHitObject, ManiaJudgement>
|
||||||
{
|
{
|
||||||
public const float HIT_TARGET_POSITION = 50;
|
public const float HIT_TARGET_POSITION = 50;
|
||||||
|
|
||||||
private const double time_span_default = 1500;
|
|
||||||
private const double time_span_min = 50;
|
|
||||||
private const double time_span_max = 10000;
|
|
||||||
private const double time_span_step = 50;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default column keys, expanding outwards from the middle as more column are added.
|
/// Default column keys, expanding outwards from the middle as more column are added.
|
||||||
/// E.g. 2 columns use FJ, 4 columns use DFJK, 6 use SDFJKL, etc...
|
/// E.g. 2 columns use FJ, 4 columns use DFJK, 6 use SDFJKL, etc...
|
||||||
@ -56,13 +52,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private readonly FlowContainer<Column> columns;
|
private readonly FlowContainer<Column> columns;
|
||||||
public IEnumerable<Column> Columns => columns.Children;
|
public IEnumerable<Column> Columns => columns.Children;
|
||||||
|
|
||||||
private readonly BindableDouble visibleTimeRange = new BindableDouble(time_span_default)
|
private readonly ScrollingHitObjectContainer barLineContainer;
|
||||||
{
|
|
||||||
MinValue = time_span_min,
|
|
||||||
MaxValue = time_span_max
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly SpeedAdjustmentCollection barLineContainer;
|
|
||||||
|
|
||||||
private List<Color4> normalColumnColours = new List<Color4>();
|
private List<Color4> normalColumnColours = new List<Color4>();
|
||||||
private Color4 specialColumnColour;
|
private Color4 specialColumnColour;
|
||||||
@ -70,6 +60,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private readonly int columnCount;
|
private readonly int columnCount;
|
||||||
|
|
||||||
public ManiaPlayfield(int columnCount)
|
public ManiaPlayfield(int columnCount)
|
||||||
|
: base(Axes.Y)
|
||||||
{
|
{
|
||||||
this.columnCount = columnCount;
|
this.columnCount = columnCount;
|
||||||
|
|
||||||
@ -120,13 +111,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Padding = new MarginPadding { Top = HIT_TARGET_POSITION },
|
Padding = new MarginPadding { Top = HIT_TARGET_POSITION },
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
barLineContainer = new SpeedAdjustmentCollection(Axes.Y)
|
barLineContainer = new ScrollingHitObjectContainer(Axes.Y)
|
||||||
{
|
{
|
||||||
Name = "Bar lines",
|
Name = "Bar lines",
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
VisibleTimeRange = visibleTimeRange
|
VisibleTimeRange = VisibleTimeRange
|
||||||
// Width is set in the Update method
|
// Width is set in the Update method
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +127,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < columnCount; i++)
|
for (int i = 0; i < columnCount; i++)
|
||||||
columns.Add(new Column { VisibleTimeRange = visibleTimeRange });
|
columns.Add(new Column { VisibleTimeRange = VisibleTimeRange });
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -211,30 +202,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> h) => Columns.ElementAt(h.HitObject.Column).Add(h);
|
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> h) => Columns.ElementAt(h.HitObject.Column).Add(h);
|
||||||
public void Add(DrawableBarLine barline) => barLineContainer.Add(barline);
|
public void Add(DrawableBarLine barline) => barLineContainer.Add(barline);
|
||||||
public void Add(SpeedAdjustmentContainer speedAdjustment) => barLineContainer.Add(speedAdjustment);
|
public void Add(SpeedAdjustmentContainer speedAdjustment) => barLineContainer.AddSpeedAdjustment(speedAdjustment);
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
||||||
{
|
|
||||||
if (state.Keyboard.ControlPressed)
|
|
||||||
{
|
|
||||||
switch (args.Key)
|
|
||||||
{
|
|
||||||
case Key.Minus:
|
|
||||||
transformVisibleTimeRangeTo(visibleTimeRange + time_span_step, 200, Easing.OutQuint);
|
|
||||||
break;
|
|
||||||
case Key.Plus:
|
|
||||||
transformVisibleTimeRangeTo(visibleTimeRange - time_span_step, 200, Easing.OutQuint);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, Easing easing = Easing.None)
|
|
||||||
{
|
|
||||||
this.TransformTo(nameof(visibleTimeRange), newTimeRange, duration, easing);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ScrollingContainer : Container<DrawableHitObject>
|
public abstract class ScrollingContainer : Container<DrawableHitObject>
|
||||||
{
|
{
|
||||||
private readonly BindableDouble visibleTimeRange = new BindableDouble();
|
private readonly BindableDouble visibleTimeRange = new BindableDouble { Default = 1000 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the range of time that is visible by the length of this container.
|
/// Gets or sets the range of time that is visible by the length of this container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,133 +0,0 @@
|
|||||||
// 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.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Timing
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A collection of <see cref="SpeedAdjustmentContainer"/>s.
|
|
||||||
///
|
|
||||||
/// <para>
|
|
||||||
/// This container redirects any <see cref="DrawableHitObject"/>'s added to it to the <see cref="SpeedAdjustmentContainer"/>
|
|
||||||
/// which provides the speed adjustment active at the start time of the hit object. Furthermore, this container provides the
|
|
||||||
/// necessary <see cref="VisibleTimeRange"/> for the contained <see cref="SpeedAdjustmentContainer"/>s.
|
|
||||||
/// </para>
|
|
||||||
/// </summary>
|
|
||||||
public class SpeedAdjustmentCollection : Container<SpeedAdjustmentContainer>
|
|
||||||
{
|
|
||||||
private readonly BindableDouble visibleTimeRange = new BindableDouble();
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the range of time that is visible by the length of this container.
|
|
||||||
/// For example, only hit objects with start time less than or equal to 1000 will be visible with <see cref="VisibleTimeRange"/> = 1000.
|
|
||||||
/// </summary>
|
|
||||||
public Bindable<double> VisibleTimeRange
|
|
||||||
{
|
|
||||||
get { return visibleTimeRange; }
|
|
||||||
set { visibleTimeRange.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override int Compare(Drawable x, Drawable y)
|
|
||||||
{
|
|
||||||
var xSpeedAdjust = x as SpeedAdjustmentContainer;
|
|
||||||
var ySpeedAdjust = y as SpeedAdjustmentContainer;
|
|
||||||
|
|
||||||
// If either of the two drawables are not hit objects, fall back to the base comparer
|
|
||||||
if (xSpeedAdjust?.ControlPoint == null || ySpeedAdjust?.ControlPoint == null)
|
|
||||||
return CompareReverseChildID(x, y);
|
|
||||||
|
|
||||||
// Compare by start time
|
|
||||||
int i = ySpeedAdjust.ControlPoint.StartTime.CompareTo(xSpeedAdjust.ControlPoint.StartTime);
|
|
||||||
|
|
||||||
return i != 0 ? i : CompareReverseChildID(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Hit objects that are to be re-processed on the next update.
|
|
||||||
/// </summary>
|
|
||||||
private readonly Queue<DrawableHitObject> queuedHitObjects = new Queue<DrawableHitObject>();
|
|
||||||
|
|
||||||
private readonly Axes scrollingAxes;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new <see cref="SpeedAdjustmentCollection"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="scrollingAxes">The axes upon which hit objects should appear to scroll inside this container.</param>
|
|
||||||
public SpeedAdjustmentCollection(Axes scrollingAxes)
|
|
||||||
{
|
|
||||||
this.scrollingAxes = scrollingAxes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Add(SpeedAdjustmentContainer speedAdjustment)
|
|
||||||
{
|
|
||||||
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
|
|
||||||
speedAdjustment.ScrollingAxes = scrollingAxes;
|
|
||||||
base.Add(speedAdjustment);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a hit object to this <see cref="SpeedAdjustmentCollection"/>. The hit objects will be kept in a queue
|
|
||||||
/// and will be processed when new <see cref="SpeedAdjustmentContainer"/>s are added to this <see cref="SpeedAdjustmentCollection"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The hit object to add.</param>
|
|
||||||
public void Add(DrawableHitObject hitObject)
|
|
||||||
{
|
|
||||||
if (!(hitObject is IScrollingHitObject))
|
|
||||||
throw new InvalidOperationException($"Hit objects added to a {nameof(SpeedAdjustmentCollection)} must implement {nameof(IScrollingHitObject)}.");
|
|
||||||
|
|
||||||
queuedHitObjects.Enqueue(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.
|
|
||||||
|
|
||||||
// An external count is kept because hit objects that can't be added are re-queued
|
|
||||||
int count = queuedHitObjects.Count;
|
|
||||||
while (count-- > 0)
|
|
||||||
{
|
|
||||||
var hitObject = queuedHitObjects.Dequeue();
|
|
||||||
|
|
||||||
var target = adjustmentContainerFor(hitObject);
|
|
||||||
if (target == null)
|
|
||||||
{
|
|
||||||
// We can't add this hit object to a speed adjustment container yet, so re-queue it
|
|
||||||
// for re-processing when the layout next invalidated
|
|
||||||
queuedHitObjects.Enqueue(hitObject);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hitObject.RelativePositionAxes != target.ScrollingAxes)
|
|
||||||
throw new InvalidOperationException($"Make sure to set all {nameof(DrawableHitObject)}'s {nameof(RelativePositionAxes)} are equal to the correct axes of scrolling ({target.ScrollingAxes}).");
|
|
||||||
|
|
||||||
target.Add(hitObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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) => Children.FirstOrDefault(c => c.CanContain(hitObject)) ?? Children.LastOrDefault();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finds the <see cref="SpeedAdjustmentContainer"/> which provides the speed adjustment active at a time.
|
|
||||||
/// If there is no <see cref="SpeedAdjustmentContainer"/> active at the time, then the first (time-wise) speed adjustment is returned.
|
|
||||||
/// </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) => Children.FirstOrDefault(c => c.CanContain(time)) ?? Children.LastOrDefault();
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
public class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
||||||
{
|
{
|
||||||
private readonly Bindable<double> visibleTimeRange = new Bindable<double>();
|
private readonly Bindable<double> visibleTimeRange = new Bindable<double> { Default = 1000 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the range of time that is visible by the length of this container.
|
/// Gets or sets the range of time that is visible by the length of this container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The HitObjects contained in this Playfield.
|
/// The HitObjects contained in this Playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects { get; protected set; }
|
||||||
|
|
||||||
internal Container<Drawable> ScaledContent;
|
internal Container<Drawable> ScaledContent;
|
||||||
|
|
||||||
@ -99,7 +99,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale;
|
protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HitObjectContainer<U> : Container<U> where U : Drawable
|
public class HitObjectContainer<U> : Container<U>
|
||||||
|
where U : Drawable
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
190
osu.Game/Rulesets/UI/ScrollingPlayfield.cs
Normal file
190
osu.Game/Rulesets/UI/ScrollingPlayfield.cs
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Timing;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.UI
|
||||||
|
{
|
||||||
|
public class ScrollingPlayfield<TObject, TJudgement> : Playfield<TObject, TJudgement>
|
||||||
|
where TObject : HitObject
|
||||||
|
where TJudgement : Judgement
|
||||||
|
{
|
||||||
|
private const double time_span_default = 1500;
|
||||||
|
private const double time_span_min = 50;
|
||||||
|
private const double time_span_max = 10000;
|
||||||
|
private const double time_span_step = 50;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the range of time that is visible by the length of this playfield the scrolling axis direction.
|
||||||
|
/// For example, only hit objects with start time less than or equal to 1000 will be visible with <see cref="VisibleTimeRange"/> = 1000.
|
||||||
|
/// </summary>
|
||||||
|
private readonly BindableDouble visibleTimeRange = new BindableDouble(time_span_default)
|
||||||
|
{
|
||||||
|
Default = time_span_default,
|
||||||
|
MinValue = time_span_min,
|
||||||
|
MaxValue = time_span_max
|
||||||
|
};
|
||||||
|
|
||||||
|
public BindableDouble VisibleTimeRange
|
||||||
|
{
|
||||||
|
get { return visibleTimeRange; }
|
||||||
|
set { visibleTimeRange.BindTo(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public new readonly ScrollingHitObjectContainer HitObjects;
|
||||||
|
|
||||||
|
protected ScrollingPlayfield(Axes scrollingAxes, float? customWidth = null)
|
||||||
|
: base(customWidth)
|
||||||
|
{
|
||||||
|
base.HitObjects = HitObjects = new ScrollingHitObjectContainer(scrollingAxes)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
VisibleTimeRange = VisibleTimeRange
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
if (state.Keyboard.ControlPressed)
|
||||||
|
{
|
||||||
|
switch (args.Key)
|
||||||
|
{
|
||||||
|
case Key.Minus:
|
||||||
|
transformVisibleTimeRangeTo(VisibleTimeRange + time_span_step, 200, Easing.OutQuint);
|
||||||
|
break;
|
||||||
|
case Key.Plus:
|
||||||
|
transformVisibleTimeRangeTo(VisibleTimeRange - time_span_step, 200, Easing.OutQuint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, Easing easing = Easing.None)
|
||||||
|
{
|
||||||
|
this.TransformTo(nameof(VisibleTimeRange), newTimeRange, duration, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A collection of <see cref="SpeedAdjustmentContainer"/>s.
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// This container redirects any <see cref="DrawableHitObject"/>'s added to it to the <see cref="SpeedAdjustmentContainer"/>
|
||||||
|
/// which provides the speed adjustment active at the start time of the hit object. Furthermore, this container provides the
|
||||||
|
/// necessary <see cref="VisibleTimeRange"/> for the contained <see cref="SpeedAdjustmentContainer"/>s.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public class ScrollingHitObjectContainer : HitObjectContainer<DrawableHitObject<TObject, TJudgement>>
|
||||||
|
{
|
||||||
|
private readonly BindableDouble visibleTimeRange = new BindableDouble { Default = 1000 };
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the range of time that is visible by the length of this container.
|
||||||
|
/// For example, only hit objects with start time less than or equal to 1000 will be visible with <see cref="VisibleTimeRange"/> = 1000.
|
||||||
|
/// </summary>
|
||||||
|
public Bindable<double> VisibleTimeRange
|
||||||
|
{
|
||||||
|
get { return visibleTimeRange; }
|
||||||
|
set { visibleTimeRange.BindTo(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Container<DrawableHitObject<TObject, TJudgement>> Content => content;
|
||||||
|
/// <summary>
|
||||||
|
/// The following is never used - it only exists for the purpose of being able to use AddInternal below.
|
||||||
|
/// </summary>
|
||||||
|
private Container<DrawableHitObject<TObject, TJudgement>> content;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit objects that are to be re-processed on the next update.
|
||||||
|
/// </summary>
|
||||||
|
private readonly Queue<DrawableHitObject<TObject, TJudgement>> queuedHitObjects = new Queue<DrawableHitObject<TObject, TJudgement>>();
|
||||||
|
|
||||||
|
private readonly Axes scrollingAxes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="ScrollingHitObjectContainer"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scrollingAxes">The axes upon which hit objects should appear to scroll inside this container.</param>
|
||||||
|
public ScrollingHitObjectContainer(Axes scrollingAxes)
|
||||||
|
{
|
||||||
|
this.scrollingAxes = scrollingAxes;
|
||||||
|
|
||||||
|
content = new Container<DrawableHitObject<TObject, TJudgement>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddSpeedAdjustment(SpeedAdjustmentContainer speedAdjustment)
|
||||||
|
{
|
||||||
|
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||||
|
speedAdjustment.ScrollingAxes = scrollingAxes;
|
||||||
|
AddInternal(speedAdjustment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a hit object to this <see cref="ScrollingHitObjectContainer"/>. The hit objects will be kept in a queue
|
||||||
|
/// and will be processed when new <see cref="SpeedAdjustmentContainer"/>s are added to this <see cref="ScrollingHitObjectContainer"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The hit object to add.</param>
|
||||||
|
public override void Add(DrawableHitObject<TObject, TJudgement> hitObject)
|
||||||
|
{
|
||||||
|
if (!(hitObject is IScrollingHitObject))
|
||||||
|
throw new InvalidOperationException($"Hit objects added to a {nameof(ScrollingHitObjectContainer)} must implement {nameof(IScrollingHitObject)}.");
|
||||||
|
|
||||||
|
queuedHitObjects.Enqueue(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.
|
||||||
|
|
||||||
|
// An external count is kept because hit objects that can't be added are re-queued
|
||||||
|
int count = queuedHitObjects.Count;
|
||||||
|
while (count-- > 0)
|
||||||
|
{
|
||||||
|
var hitObject = queuedHitObjects.Dequeue();
|
||||||
|
|
||||||
|
var target = adjustmentContainerFor(hitObject);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
// We can't add this hit object to a speed adjustment container yet, so re-queue it
|
||||||
|
// for re-processing when the layout next invalidated
|
||||||
|
queuedHitObjects.Enqueue(hitObject);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hitObject.RelativePositionAxes != target.ScrollingAxes)
|
||||||
|
throw new InvalidOperationException($"Make sure to set all {nameof(DrawableHitObject)}'s {nameof(RelativePositionAxes)} are equal to the correct axes of scrolling ({target.ScrollingAxes}).");
|
||||||
|
|
||||||
|
target.Add(hitObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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) => InternalChildren.OfType<SpeedAdjustmentContainer>().FirstOrDefault(c => c.CanContain(hitObject)) ?? InternalChildren.OfType<SpeedAdjustmentContainer>().LastOrDefault();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the <see cref="SpeedAdjustmentContainer"/> which provides the speed adjustment active at a time.
|
||||||
|
/// If there is no <see cref="SpeedAdjustmentContainer"/> active at the time, then the first (time-wise) speed adjustment is returned.
|
||||||
|
/// </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) => InternalChildren.OfType<SpeedAdjustmentContainer>().FirstOrDefault(c => c.CanContain(time)) ?? InternalChildren.OfType<SpeedAdjustmentContainer>().LastOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
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.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public abstract class SpeedAdjustedHitRenderer<TPlayfield, TObject, TJudgement> : HitRenderer<TPlayfield, TObject, TJudgement>
|
public abstract class SpeedAdjustedHitRenderer<TPlayfield, TObject, TJudgement> : HitRenderer<TPlayfield, TObject, TJudgement>
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
where TJudgement : Judgement
|
where TJudgement : Judgement
|
||||||
where TPlayfield : SpeedAdjustedPlayfield<TObject, TJudgement>
|
where TPlayfield : ScrollingPlayfield<TObject, TJudgement>
|
||||||
{
|
{
|
||||||
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
ApplySpeedAdjustments();
|
DefaultControlPoints.ForEach(c => ApplySpeedAdjustment(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyBeatmap()
|
protected override void ApplyBeatmap()
|
||||||
@ -98,9 +99,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
return new MultiplierControlPoint(time, DefaultControlPoints[index].DeepClone());
|
return new MultiplierControlPoint(time, DefaultControlPoints[index].DeepClone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected virtual void ApplySpeedAdjustment(MultiplierControlPoint controlPoint)
|
||||||
/// Applies speed changes to the playfield.
|
{
|
||||||
/// </summary>
|
Playfield.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint));
|
||||||
protected abstract void ApplySpeedAdjustments();
|
}
|
||||||
|
|
||||||
|
protected abstract SpeedAdjustmentContainer CreateSpeedAdjustmentContainer(MultiplierControlPoint controlPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
using osu.Game.Rulesets.Judgements;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
|
||||||
{
|
|
||||||
public class SpeedAdjustedPlayfield<TObject, TJudgement> : Playfield<TObject, TJudgement>
|
|
||||||
where TObject : HitObject
|
|
||||||
where TJudgement : Judgement
|
|
||||||
{
|
|
||||||
protected SpeedAdjustedPlayfield(float? customWidth = null)
|
|
||||||
: base(customWidth)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -230,7 +230,6 @@
|
|||||||
<Compile Include="Rulesets\Timing\LinearScrollingContainer.cs" />
|
<Compile Include="Rulesets\Timing\LinearScrollingContainer.cs" />
|
||||||
<Compile Include="Rulesets\Timing\ScrollingContainer.cs" />
|
<Compile Include="Rulesets\Timing\ScrollingContainer.cs" />
|
||||||
<Compile Include="Rulesets\Timing\MultiplierControlPoint.cs" />
|
<Compile Include="Rulesets\Timing\MultiplierControlPoint.cs" />
|
||||||
<Compile Include="Rulesets\Timing\SpeedAdjustmentCollection.cs" />
|
|
||||||
<Compile Include="Screens\Menu\MenuSideFlashes.cs" />
|
<Compile Include="Screens\Menu\MenuSideFlashes.cs" />
|
||||||
<Compile Include="Screens\Play\HUD\HealthDisplay.cs" />
|
<Compile Include="Screens\Play\HUD\HealthDisplay.cs" />
|
||||||
<Compile Include="Screens\Play\HUDOverlay.cs" />
|
<Compile Include="Screens\Play\HUDOverlay.cs" />
|
||||||
@ -341,7 +340,7 @@
|
|||||||
<Compile Include="Rulesets\UI\HitRenderer.cs" />
|
<Compile Include="Rulesets\UI\HitRenderer.cs" />
|
||||||
<Compile Include="Rulesets\UI\Playfield.cs" />
|
<Compile Include="Rulesets\UI\Playfield.cs" />
|
||||||
<Compile Include="Rulesets\UI\SpeedAdjustedHitRenderer.cs" />
|
<Compile Include="Rulesets\UI\SpeedAdjustedHitRenderer.cs" />
|
||||||
<Compile Include="Rulesets\UI\SpeedAdjustedPlayfield.cs" />
|
<Compile Include="Rulesets\UI\ScrollingPlayfield.cs" />
|
||||||
<Compile Include="Screens\Select\EditSongSelect.cs" />
|
<Compile Include="Screens\Select\EditSongSelect.cs" />
|
||||||
<Compile Include="Screens\Play\HUD\ComboCounter.cs" />
|
<Compile Include="Screens\Play\HUD\ComboCounter.cs" />
|
||||||
<Compile Include="Screens\Play\HUD\ComboResultCounter.cs" />
|
<Compile Include="Screens\Play\HUD\ComboResultCounter.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user