mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 15:53:19 +08:00
Make bar lines work again.
This commit is contained in:
parent
1f56848442
commit
de35ea22b1
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mania.Timing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Timing;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
@ -34,9 +35,9 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
hitObjectTimingChanges[maniaObject.Column].Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
||||
}
|
||||
|
||||
foreach (BarLine barLine in hitRenderer.BarLines)
|
||||
foreach (DrawableBarLine barLine in hitRenderer.BarLines)
|
||||
{
|
||||
var controlPoint = hitRenderer.CreateControlPointAt(barLine.StartTime);
|
||||
var controlPoint = hitRenderer.CreateControlPointAt(barLine.HitObject.StartTime);
|
||||
controlPoint.TimingPoint.BeatLength = 1000;
|
||||
|
||||
barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
||||
|
@ -6,7 +6,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Lists;
|
||||
using osu.Framework.MathUtils;
|
||||
@ -36,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// </summary>
|
||||
public int PreferredColumns;
|
||||
|
||||
public readonly List<BarLine> BarLines = new List<BarLine>();
|
||||
public IEnumerable<DrawableBarLine> BarLines;
|
||||
|
||||
/// <summary>
|
||||
/// Per-column timing changes.
|
||||
@ -58,9 +60,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
for (int i = 0; i < PreferredColumns; i++)
|
||||
hitObjectTimingChanges[i] = new List<SpeedAdjustmentContainer>();
|
||||
|
||||
// Generate the bar line list
|
||||
// Generate the bar lines
|
||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
||||
|
||||
SortedList<TimingControlPoint> timingPoints = Beatmap.ControlPointInfo.TimingPoints;
|
||||
var barLines = new List<DrawableBarLine>();
|
||||
|
||||
for (int i = 0; i < timingPoints.Count; i++)
|
||||
{
|
||||
TimingControlPoint point = timingPoints[i];
|
||||
@ -71,15 +76,17 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
int index = 0;
|
||||
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
|
||||
{
|
||||
BarLines.Add(new BarLine
|
||||
barLines.Add(new DrawableBarLine(new BarLine
|
||||
{
|
||||
StartTime = t,
|
||||
ControlPoint = point,
|
||||
BeatIndex = index
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
BarLines = barLines;
|
||||
|
||||
// Generate speed adjustments from mods first
|
||||
bool useDefaultSpeedAdjustments = true;
|
||||
|
||||
@ -97,6 +104,16 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
generateDefaultSpeedAdjustments();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var maniaPlayfield = Playfield as ManiaPlayfield;
|
||||
if (maniaPlayfield == null)
|
||||
return;
|
||||
|
||||
BarLines.ForEach(maniaPlayfield.Add);
|
||||
}
|
||||
|
||||
private void generateDefaultSpeedAdjustments()
|
||||
{
|
||||
defaultControlPoints.ForEach(c =>
|
||||
|
@ -127,7 +127,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
Name = "Bar lines",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.Y
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
VisibleTimeRange = visibleTimeRange
|
||||
// Width is set in the Update method
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user