1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 09:32:53 +08:00
This commit is contained in:
ANDY840119-PC\andy840119 2018-01-06 10:35:21 +09:00
commit 065ebe896b
9 changed files with 358 additions and 190 deletions

View File

@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Timing; using osu.Game.Rulesets.Mania.Timing;
using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.Timing;
using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
@ -35,9 +34,9 @@ namespace osu.Game.Rulesets.Mania.Mods
} }
// Like with hit objects, we need to generate one speed adjustment per bar line // Like with hit objects, we need to generate one speed adjustment per bar line
foreach (DrawableBarLine barLine in rulesetContainer.BarLines) foreach (BarLine barLine in rulesetContainer.BarLines)
{ {
var controlPoint = rulesetContainer.CreateControlPointAt(barLine.HitObject.StartTime); var controlPoint = rulesetContainer.CreateControlPointAt(barLine.StartTime);
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now // Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
controlPoint.TimingPoint.BeatLength = 1000; controlPoint.TimingPoint.BeatLength = 1000;

View File

@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Mania.Tests
RelativeChildSize = new Vector2(1, 10000), RelativeChildSize = new Vector2(1, 10000),
Children = new[] Children = new[]
{ {
new DrawableHoldNote(new HoldNote(), ManiaAction.Key1) new DrawableHoldNote(new HoldNote(){Duration = 1000}, ManiaAction.Key1)
{ {
Y = 5000, Y = 5000,
Height = 1000, Height = 1000,

View File

@ -2,12 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
@ -40,6 +41,36 @@ namespace osu.Game.Rulesets.Mania.Tests
AddStep("Right special style", () => createPlayfield(4, SpecialColumnPosition.Right)); AddStep("Right special style", () => createPlayfield(4, SpecialColumnPosition.Right));
AddStep("5 columns", () => createPlayfield(5, SpecialColumnPosition.Normal)); AddStep("5 columns", () => createPlayfield(5, SpecialColumnPosition.Normal));
AddStep("8 columns", () => createPlayfield(8, SpecialColumnPosition.Normal)); AddStep("8 columns", () => createPlayfield(8, SpecialColumnPosition.Normal));
AddStep("4 + 4 columns", () =>
{
var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = 4 },
new StageDefinition() { Columns = 4 },
};
createPlayfield(stages, SpecialColumnPosition.Normal);
});
AddStep("2 + 4 + 2 columns", () =>
{
var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = 2 },
new StageDefinition() { Columns = 4 },
new StageDefinition() { Columns = 2 },
};
createPlayfield(stages, SpecialColumnPosition.Normal);
});
AddStep("1 + 1 + 8 columns", () =>
{
var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = 1 },
new StageDefinition() { Columns = 8 },
new StageDefinition() { Columns = 1 },
};
createPlayfield(stages, SpecialColumnPosition.Normal);
});
AddStep("Left special style", () => createPlayfield(8, SpecialColumnPosition.Left)); AddStep("Left special style", () => createPlayfield(8, SpecialColumnPosition.Left));
AddStep("Right special style", () => createPlayfield(8, SpecialColumnPosition.Right)); AddStep("Right special style", () => createPlayfield(8, SpecialColumnPosition.Right));
AddStep("Reversed", () => createPlayfield(4, SpecialColumnPosition.Normal, true)); AddStep("Reversed", () => createPlayfield(4, SpecialColumnPosition.Normal, true));
@ -76,14 +107,24 @@ namespace osu.Game.Rulesets.Mania.Tests
}, gravity ? ScrollingAlgorithm.Gravity : ScrollingAlgorithm.Basic); }, gravity ? ScrollingAlgorithm.Gravity : ScrollingAlgorithm.Basic);
private ManiaPlayfield createPlayfield(int cols, SpecialColumnPosition specialPos, bool inverted = false) private ManiaPlayfield createPlayfield(int cols, SpecialColumnPosition specialPos, bool inverted = false)
{
var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = cols },
};
return createPlayfield(stages, specialPos, inverted);
}
private ManiaPlayfield createPlayfield(List<StageDefinition> stages, SpecialColumnPosition specialPos, bool inverted = false)
{ {
Clear(); Clear();
var inputManager = new ManiaInputManager(maniaRuleset, cols) { RelativeSizeAxes = Axes.Both }; var inputManager = new ManiaInputManager(maniaRuleset, stages.Sum(g => g.Columns)) { RelativeSizeAxes = Axes.Both };
Add(inputManager); Add(inputManager);
ManiaPlayfield playfield; ManiaPlayfield playfield;
inputManager.Add(playfield = new ManiaPlayfield(cols)
inputManager.Add(playfield = new ManiaPlayfield(stages)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -105,7 +146,11 @@ namespace osu.Game.Rulesets.Mania.Tests
Add(inputManager); Add(inputManager);
ManiaPlayfield playfield; ManiaPlayfield playfield;
inputManager.Add(playfield = new ManiaPlayfield(4) var stages = new List<StageDefinition>()
{
new StageDefinition() { Columns = 4 },
};
inputManager.Add(playfield = new ManiaPlayfield(stages)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
Name = "Hit target + hit objects", Name = "Hit target + hit objects",
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = ManiaPlayfield.HIT_TARGET_POSITION }, Padding = new MarginPadding { Top = ManiaColumnStage.HIT_TARGET_POSITION },
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container
@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
Name = "Key", Name = "Key",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = ManiaPlayfield.HIT_TARGET_POSITION, Height = ManiaColumnStage.HIT_TARGET_POSITION,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box

View File

@ -0,0 +1,210 @@
// 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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.UI;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Mania.UI
{
/// <summary>
/// A collection of <see cref="Column"/>s.
/// </summary>
internal class ManiaColumnStage : ScrollingPlayfield
{
public const float HIT_TARGET_POSITION = 50;
private SpecialColumnPosition specialColumnPosition;
/// <summary>
/// The style to use for the special column.
/// </summary>
public SpecialColumnPosition SpecialColumnPosition
{
get { return specialColumnPosition; }
set
{
if (IsLoaded)
throw new InvalidOperationException($"Setting {nameof(SpecialColumnPosition)} after the playfield is loaded requires re-creating the playfield.");
specialColumnPosition = value;
}
}
public IEnumerable<Column> Columns => columns.Children;
private readonly FillFlowContainer<Column> columns;
protected override Container<Drawable> Content => content;
private readonly Container<Drawable> content;
public Container<DrawableManiaJudgement> Judgements => judgements;
private readonly Container<DrawableManiaJudgement> judgements;
private readonly Container topLevelContainer;
private List<Color4> normalColumnColours = new List<Color4>();
private Color4 specialColumnColour;
public readonly int ColumnCount;
public ManiaColumnStage(int columnCount)
: base(Axes.Y)
{
ColumnCount = columnCount;
Name = "Playfield elements";
Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre;
//RelativeSizeAxes = Axes.Y;
//AutoSizeAxes = Axes.X;
InternalChildren = new Drawable[]
{
new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
new Container
{
Name = "Columns mask",
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Masking = true,
Children = new Drawable[]
{
new Box
{
Name = "Background",
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0, 0, 0, 0.8f)
},
columns = new FillFlowContainer<Column>
{
Name = "Columns",
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FillDirection.Horizontal,
Padding = new MarginPadding { Left = 1, Right = 1 },
Spacing = new Vector2(1, 0)
},
}
},
new Container
{
Name = "Barlines mask",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
Width = 1366, // Bar lines should only be masked on the vertical axis
BypassAutoSizeAxes = Axes.Both,
Masking = true,
Child = content = new Container
{
Name = "Bar lines",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = HIT_TARGET_POSITION }
}
},
judgements = new Container<DrawableManiaJudgement>
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Y = HIT_TARGET_POSITION + 150,
BypassAutoSizeAxes = Axes.Both
},
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
}
}
};
}
/// <summary>
/// Whether the column index is a special column for this playfield.
/// </summary>
/// <param name="column">The 0-based column index.</param>
/// <returns>Whether the column is a special column.</returns>
private bool isSpecialColumn(int column)
{
switch (SpecialColumnPosition)
{
default:
case SpecialColumnPosition.Normal:
return ColumnCount % 2 == 1 && column == ColumnCount / 2;
case SpecialColumnPosition.Left:
return column == 0;
case SpecialColumnPosition.Right:
return column == ColumnCount - 1;
}
}
public void AddColumn(Column c)
{
c.VisibleTimeRange.BindTo(VisibleTimeRange);
topLevelContainer.Add(c.TopLevelContainer.CreateProxy());
columns.Add(c);
}
public void AddJudgement(Judgement judgement)
{
judgements.Clear();
judgements.Add(new DrawableManiaJudgement(judgement)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
normalColumnColours = new List<Color4>
{
colours.RedDark,
colours.GreenDark
};
specialColumnColour = colours.BlueDark;
// Set the special column + colour + key
foreach (var column in Columns)
{
if (!column.IsSpecial)
continue;
column.AccentColour = specialColumnColour;
}
var nonSpecialColumns = Columns.Where(c => !c.IsSpecial).ToList();
// We'll set the colours of the non-special columns in a separate loop, because the non-special
// column colours are mirrored across their centre and special styles mess with this
for (int i = 0; i < Math.Ceiling(nonSpecialColumns.Count / 2f); i++)
{
Color4 colour = normalColumnColours[i % normalColumnColours.Count];
nonSpecialColumns[i].AccentColour = colour;
nonSpecialColumns[nonSpecialColumns.Count - 1 - i].AccentColour = colour;
}
}
protected override void Update()
{
// Due to masking differences, it is not possible to get the width of the columns container automatically
// While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually
content.Width = columns.Width;
}
}
}

View File

@ -1,154 +1,104 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // 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;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
using System;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using System.Linq;
using System.Collections.Generic;
using osu.Framework.Configuration;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
public class ManiaPlayfield : ScrollingPlayfield public class ManiaPlayfield : ScrollingPlayfield
{ {
public const float HIT_TARGET_POSITION = 50;
private SpecialColumnPosition specialColumnPosition;
/// <summary> /// <summary>
/// The style to use for the special column. /// list mania column stages
/// </summary> /// </summary>
public SpecialColumnPosition SpecialColumnPosition private readonly FillFlowContainer<ManiaColumnStage> listColumnStages;
{
get { return specialColumnPosition; }
set
{
if (IsLoaded)
throw new InvalidOperationException($"Setting {nameof(SpecialColumnPosition)} after the playfield is loaded requires re-creating the playfield.");
specialColumnPosition = value;
}
}
/// <summary> /// <summary>
/// Whether this playfield should be inverted. This flips everything inside the playfield. /// Whether this playfield should be inverted. This flips everything inside the playfield.
/// </summary> /// </summary>
public readonly Bindable<bool> Inverted = new Bindable<bool>(true); public readonly Bindable<bool> Inverted = new Bindable<bool>(true);
private readonly FlowContainer<Column> columns; /// <summary>
public IEnumerable<Column> Columns => columns.Children; /// The style to use for the special column.
/// </summary>
public SpecialColumnPosition SpecialColumnPosition
{
get => listColumnStages.FirstOrDefault()?.SpecialColumnPosition ?? SpecialColumnPosition.Normal;
set
{
foreach (var singleStage in listColumnStages)
{
singleStage.SpecialColumnPosition = value;
}
}
}
protected override Container<Drawable> Content => content; public List<Column> Columns
private readonly Container<Drawable> content; {
get
{
var list = new List<Column>();
foreach (var stage in listColumnStages)
{
list.AddRange(stage.Columns);
}
return list;
}
}
private List<Color4> normalColumnColours = new List<Color4>(); public ManiaPlayfield(List<StageDefinition> stages)
private Color4 specialColumnColour;
private readonly Container<DrawableManiaJudgement> judgements;
private readonly int columnCount;
public ManiaPlayfield(int columnCount)
: base(Axes.Y) : base(Axes.Y)
{ {
this.columnCount = columnCount; if (stages.Count <= 0)
if (columnCount <= 0)
throw new ArgumentException("Can't have zero or fewer columns."); throw new ArgumentException("Can't have zero or fewer columns.");
Inverted.Value = true; Inverted.Value = true;
Container topLevelContainer;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Container listColumnStages = new FillFlowContainer<ManiaColumnStage>
{ {
Name = "Playfield elements",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
new Container
{
Name = "Columns mask",
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Masking = true,
Children = new Drawable[]
{
new Box
{
Name = "Background",
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black
},
columns = new FillFlowContainer<Column>
{
Name = "Columns",
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Padding = new MarginPadding { Left = 1, Right = 1 },
Spacing = new Vector2(1, 0)
},
}
},
new Container
{
Name = "Barlines mask",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = 1366, // Bar lines should only be masked on the vertical axis Anchor = Anchor.Centre,
BypassAutoSizeAxes = Axes.Both,
Masking = true,
Child = content = new Container
{
Name = "Bar lines",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = HIT_TARGET_POSITION }
}
},
judgements = new Container<DrawableManiaJudgement>
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both, Spacing = new Vector2(400),
Y = HIT_TARGET_POSITION + 150,
BypassAutoSizeAxes = Axes.Both
},
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
}
} }
}; };
var currentAction = ManiaAction.Key1; var currentAction = ManiaAction.Key1;
for (int i = 0; i < columnCount; i++)
foreach (var stage in stages)
{ {
var c = new Column(); var drawableStage = new ManiaColumnStage(stage.Columns);
c.VisibleTimeRange.BindTo(VisibleTimeRange); drawableStage.VisibleTimeRange.BindTo(VisibleTimeRange);
c.IsSpecial = isSpecialColumn(i); listColumnStages.Add(drawableStage);
c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++; AddNested(drawableStage);
topLevelContainer.Add(c.TopLevelContainer.CreateProxy()); for (int i = 0; i < stage.Columns; i++)
{
var c = new Column
{
//c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++;
Action = currentAction++
};
columns.Add(c); drawableStage.AddColumn(c);
AddNested(c); AddNested(c);
} }
}
Inverted.ValueChanged += invertedChanged; Inverted.ValueChanged += invertedChanged;
Inverted.TriggerChange(); Inverted.TriggerChange();
@ -157,82 +107,45 @@ namespace osu.Game.Rulesets.Mania.UI
private void invertedChanged(bool newValue) private void invertedChanged(bool newValue)
{ {
Scale = new Vector2(1, newValue ? -1 : 1); Scale = new Vector2(1, newValue ? -1 : 1);
judgements.Scale = Scale;
}
[BackgroundDependencyLoader] foreach (var single in listColumnStages)
private void load(OsuColour colours)
{ {
normalColumnColours = new List<Color4> single.Judgements.Scale = Scale;
{
colours.RedDark,
colours.GreenDark
};
specialColumnColour = colours.BlueDark;
// Set the special column + colour + key
foreach (var column in Columns)
{
if (!column.IsSpecial)
continue;
column.AccentColour = specialColumnColour;
}
var nonSpecialColumns = Columns.Where(c => !c.IsSpecial).ToList();
// We'll set the colours of the non-special columns in a separate loop, because the non-special
// column colours are mirrored across their centre and special styles mess with this
for (int i = 0; i < Math.Ceiling(nonSpecialColumns.Count / 2f); i++)
{
Color4 colour = normalColumnColours[i % normalColumnColours.Count];
nonSpecialColumns[i].AccentColour = colour;
nonSpecialColumns[nonSpecialColumns.Count - 1 - i].AccentColour = colour;
} }
} }
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
{ {
var maniaObject = (ManiaHitObject)judgedObject.HitObject; var maniaObject = (ManiaHitObject)judgedObject.HitObject;
columns[maniaObject.Column].OnJudgement(judgedObject, judgement); int column = maniaObject.Column;
Columns[column].OnJudgement(judgedObject, judgement);
judgements.Clear(); getFallDownControlContainerByActualColumn(column).AddJudgement(judgement);
judgements.Add(new DrawableManiaJudgement(judgement)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
}
/// <summary>
/// Whether the column index is a special column for this playfield.
/// </summary>
/// <param name="column">The 0-based column index.</param>
/// <returns>Whether the column is a special column.</returns>
private bool isSpecialColumn(int column)
{
switch (SpecialColumnPosition)
{
default:
case SpecialColumnPosition.Normal:
return columnCount % 2 == 1 && column == columnCount / 2;
case SpecialColumnPosition.Left:
return column == 0;
case SpecialColumnPosition.Right:
return column == columnCount - 1;
}
} }
public override void Add(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column).Add(h); public override void Add(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column).Add(h);
public void Add(DrawableBarLine barline) => HitObjects.Add(barline); public void Add(BarLine barline)
protected override void Update()
{ {
// Due to masking differences, it is not possible to get the width of the columns container automatically foreach (var single in listColumnStages)
// While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually {
content.Width = columns.Width; single.HitObjects.Add(new DrawableBarLine(barline));
}
}
private ManiaColumnStage getFallDownControlContainerByActualColumn(int actualColumn)
{
int sum = 0;
foreach (var single in listColumnStages)
{
sum = sum + single.ColumnCount;
if (sum > actualColumn)
{
return single;
}
}
return null;
} }
} }
} }

View File

@ -3,7 +3,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenTK;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -23,6 +22,7 @@ using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.Timing;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap; public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
public IEnumerable<DrawableBarLine> BarLines; public IEnumerable<BarLine> BarLines;
public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.UI
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
var timingPoints = Beatmap.ControlPointInfo.TimingPoints; var timingPoints = Beatmap.ControlPointInfo.TimingPoints;
var barLines = new List<DrawableBarLine>(); var barLines = new List<BarLine>();
for (int i = 0; i < timingPoints.Count; i++) for (int i = 0; i < timingPoints.Count; i++)
{ {
@ -51,12 +51,12 @@ namespace osu.Game.Rulesets.Mania.UI
int index = 0; int index = 0;
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++) for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
{ {
barLines.Add(new DrawableBarLine(new BarLine barLines.Add(new BarLine
{ {
StartTime = t, StartTime = t,
ControlPoint = point, ControlPoint = point,
BeatIndex = index BeatIndex = index
})); });
} }
} }
@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Mania.UI
BarLines.ForEach(Playfield.Add); BarLines.ForEach(Playfield.Add);
} }
protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.TotalColumns) protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -94,6 +94,7 @@
<Compile Include="Timing\ScrollingAlgorithm.cs" /> <Compile Include="Timing\ScrollingAlgorithm.cs" />
<Compile Include="UI\Column.cs" /> <Compile Include="UI\Column.cs" />
<Compile Include="UI\DrawableManiaJudgement.cs" /> <Compile Include="UI\DrawableManiaJudgement.cs" />
<Compile Include="UI\ManiaColumnStage.cs" />
<Compile Include="UI\HitExplosion.cs" /> <Compile Include="UI\HitExplosion.cs" />
<Compile Include="UI\ManiaRulesetContainer.cs" /> <Compile Include="UI\ManiaRulesetContainer.cs" />
<Compile Include="UI\ManiaPlayfield.cs" /> <Compile Include="UI\ManiaPlayfield.cs" />