2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-10-13 09:10:15 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2016-11-14 17:54:24 +08:00
|
|
|
|
using osu.Game.Modes.Objects;
|
|
|
|
|
using osu.Game.Modes.Osu.Objects;
|
2017-02-09 13:56:39 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2016-10-13 09:10:15 +08:00
|
|
|
|
|
2016-11-14 17:54:24 +08:00
|
|
|
|
namespace osu.Game.Modes.Mania.Objects
|
2016-10-13 09:10:15 +08:00
|
|
|
|
{
|
|
|
|
|
class ManiaConverter : HitObjectConverter<ManiaBaseHit>
|
|
|
|
|
{
|
|
|
|
|
private readonly int columns;
|
|
|
|
|
|
|
|
|
|
public ManiaConverter(int columns)
|
|
|
|
|
{
|
|
|
|
|
this.columns = columns;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-09 13:56:39 +08:00
|
|
|
|
public override List<ManiaBaseHit> Convert(Beatmap beatmap)
|
2016-10-13 09:10:15 +08:00
|
|
|
|
{
|
|
|
|
|
List<ManiaBaseHit> output = new List<ManiaBaseHit>();
|
|
|
|
|
|
2017-02-09 13:56:39 +08:00
|
|
|
|
foreach (HitObject i in beatmap.HitObjects)
|
2016-10-13 09:10:15 +08:00
|
|
|
|
{
|
|
|
|
|
ManiaBaseHit h = i as ManiaBaseHit;
|
|
|
|
|
|
|
|
|
|
if (h == null)
|
|
|
|
|
{
|
2016-11-19 18:07:57 +08:00
|
|
|
|
OsuHitObject o = i as OsuHitObject;
|
2016-10-13 09:10:15 +08:00
|
|
|
|
|
2016-10-13 20:53:42 +08:00
|
|
|
|
if (o == null) throw new HitObjectConvertException(@"Mania", i);
|
2016-10-13 09:10:15 +08:00
|
|
|
|
|
|
|
|
|
h = new Note
|
|
|
|
|
{
|
|
|
|
|
StartTime = o.StartTime,
|
|
|
|
|
Column = (int)Math.Round(o.Position.X / 512 * columns)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output.Add(h);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|