1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 20:12:57 +08:00

Construct mania playfield with proper column count.

This commit is contained in:
smoogipooo 2017-05-10 16:32:11 +09:00
parent 2edc39ae16
commit bcc8a94e36
3 changed files with 11 additions and 6 deletions

View File

@ -8,6 +8,7 @@ using System;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Beatmaps namespace osu.Game.Rulesets.Mania.Beatmaps
{ {
@ -17,7 +18,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap) protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
{ {
yield return null; yield return new Note
{
StartTime = original.StartTime,
Column = 1,
};
} }
} }
} }

View File

@ -5,6 +5,7 @@ using System;
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.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Beatmaps;
@ -22,12 +23,11 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
public class ManiaHitRenderer : HitRenderer<ManiaHitObject, ManiaJudgement> public class ManiaHitRenderer : HitRenderer<ManiaHitObject, ManiaJudgement>
{ {
private readonly int columns; public int? Columns;
public ManiaHitRenderer(WorkingBeatmap beatmap, int columns = 5) public ManiaHitRenderer(WorkingBeatmap beatmap)
: base(beatmap) : base(beatmap)
{ {
this.columns = columns;
// Has to be done before drawable hit objects are generated in load() // Has to be done before drawable hit objects are generated in load()
loadTimingSections(); loadTimingSections();
} }
@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Mania.UI
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter(); protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter();
protected override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(columns); protected override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(Columns ?? (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize));
protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h) => null; protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h) => null;
} }

View File

@ -161,6 +161,6 @@ namespace osu.Game.Rulesets.Mania.UI
} }
} }
public void Add(TimingSection timingSection) => columns.Children.ForEach(c => c.Add(timingSection)); public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> h) => Columns.Children.ElementAt(h.HitObject.Column).Add(h);
} }
} }