2017-03-11 23:34:21 +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
|
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
2017-03-11 23:34:21 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-04-17 14:44:46 +08:00
|
|
|
|
using System;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
|
|
|
|
using osu.Game.Rulesets.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-05-11 21:16:50 +08:00
|
|
|
|
using OpenTK;
|
2017-03-11 23:34:21 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Mania.Beatmaps
|
2017-03-11 23:34:21 +08:00
|
|
|
|
{
|
2017-05-03 11:44:19 +08:00
|
|
|
|
internal class ManiaBeatmapConverter : BeatmapConverter<ManiaHitObject>
|
2017-03-11 23:34:21 +08:00
|
|
|
|
{
|
2017-04-18 13:24:16 +08:00
|
|
|
|
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
|
2017-04-17 14:44:46 +08:00
|
|
|
|
|
2017-05-03 11:44:19 +08:00
|
|
|
|
protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
2017-03-11 23:34:21 +08:00
|
|
|
|
{
|
2017-05-11 21:16:50 +08:00
|
|
|
|
int availableColumns = (int)Math.Round(beatmap.BeatmapInfo.Difficulty.CircleSize);
|
2017-05-11 11:32:30 +08:00
|
|
|
|
|
|
|
|
|
var positionData = original as IHasXPosition;
|
|
|
|
|
|
2017-05-11 21:16:50 +08:00
|
|
|
|
float localWDivisor = 512.0f / availableColumns;
|
|
|
|
|
int column = MathHelper.Clamp((int)Math.Floor((positionData?.X ?? 1) / localWDivisor), 0, availableColumns - 1);
|
2017-05-11 11:32:30 +08:00
|
|
|
|
|
2017-05-10 15:32:11 +08:00
|
|
|
|
yield return new Note
|
|
|
|
|
{
|
|
|
|
|
StartTime = original.StartTime,
|
2017-05-11 11:32:30 +08:00
|
|
|
|
Column = column,
|
2017-05-10 15:32:11 +08:00
|
|
|
|
};
|
2017-03-11 23:34:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|