2017-02-07 04:59:30 +00: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 01:10:15 +00:00
|
|
|
|
|
2017-03-11 15:34:21 +00:00
|
|
|
|
using OpenTK;
|
2017-02-09 05:56:39 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2017-03-11 15:34:21 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2017-04-17 06:44:46 +00:00
|
|
|
|
using System;
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
2016-10-13 01:10:15 +00:00
|
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Beatmaps
|
2016-10-13 01:10:15 +00:00
|
|
|
|
{
|
2017-04-18 00:38:52 +00:00
|
|
|
|
internal class OsuBeatmapConverter : BeatmapConverter<OsuHitObject>
|
2016-10-13 01:10:15 +00:00
|
|
|
|
{
|
2017-04-18 05:24:16 +00:00
|
|
|
|
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasPosition) };
|
2017-04-17 06:44:46 +00:00
|
|
|
|
|
2017-04-18 05:24:16 +00:00
|
|
|
|
protected override IEnumerable<OsuHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
2017-03-11 15:34:21 +00:00
|
|
|
|
{
|
2017-04-21 11:29:27 +00:00
|
|
|
|
var curveData = original as IHasCurve;
|
|
|
|
|
var endTimeData = original as IHasEndTime;
|
|
|
|
|
var positionData = original as IHasPosition;
|
|
|
|
|
var comboData = original as IHasCombo;
|
2017-03-14 04:24:07 +00:00
|
|
|
|
|
|
|
|
|
if (curveData != null)
|
2017-03-13 10:15:25 +00:00
|
|
|
|
{
|
2017-04-18 05:24:16 +00:00
|
|
|
|
yield return new Slider
|
2017-03-13 10:15:25 +00:00
|
|
|
|
{
|
|
|
|
|
StartTime = original.StartTime,
|
2017-04-06 02:41:16 +00:00
|
|
|
|
Samples = original.Samples,
|
2017-04-21 11:42:13 +00:00
|
|
|
|
ControlPoints = curveData.ControlPoints,
|
|
|
|
|
CurveType = curveData.CurveType,
|
|
|
|
|
Distance = curveData.Distance,
|
|
|
|
|
RepeatSamples = curveData.RepeatSamples,
|
|
|
|
|
RepeatCount = curveData.RepeatCount,
|
2017-03-14 04:24:07 +00:00
|
|
|
|
Position = positionData?.Position ?? Vector2.Zero,
|
2017-03-15 03:52:25 +00:00
|
|
|
|
NewCombo = comboData?.NewCombo ?? false
|
2017-03-13 10:15:25 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2017-04-18 05:24:16 +00:00
|
|
|
|
else if (endTimeData != null)
|
2017-03-13 10:15:25 +00:00
|
|
|
|
{
|
2017-04-18 05:24:16 +00:00
|
|
|
|
yield return new Spinner
|
2017-03-13 10:15:25 +00:00
|
|
|
|
{
|
|
|
|
|
StartTime = original.StartTime,
|
2017-04-06 02:41:16 +00:00
|
|
|
|
Samples = original.Samples,
|
2017-04-17 06:44:46 +00:00
|
|
|
|
EndTime = endTimeData.EndTime,
|
|
|
|
|
|
2017-04-18 03:19:39 +00:00
|
|
|
|
Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2,
|
2017-03-13 10:15:25 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2017-04-18 05:24:16 +00:00
|
|
|
|
else
|
2017-03-13 10:15:25 +00:00
|
|
|
|
{
|
2017-04-18 05:24:16 +00:00
|
|
|
|
yield return new HitCircle
|
2017-02-09 05:56:39 +00:00
|
|
|
|
{
|
2017-04-18 05:24:16 +00:00
|
|
|
|
StartTime = original.StartTime,
|
|
|
|
|
Samples = original.Samples,
|
|
|
|
|
Position = positionData?.Position ?? Vector2.Zero,
|
|
|
|
|
NewCombo = comboData?.NewCombo ?? false
|
|
|
|
|
};
|
2017-02-09 05:56:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-13 01:10:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|