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