2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-03-11 23:34:21 +08:00
|
|
|
|
// 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.Catch.Objects;
|
2017-03-11 23:34:21 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-04-17 14:44:46 +08:00
|
|
|
|
using System;
|
2017-10-10 15:34:01 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-03-11 23:34:21 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Beatmaps
|
2017-03-11 23:34:21 +08:00
|
|
|
|
{
|
2018-01-10 14:38:12 +08:00
|
|
|
|
public class CatchBeatmapConverter : BeatmapConverter<CatchHitObject>
|
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-11-28 17:37:41 +08:00
|
|
|
|
protected override IEnumerable<CatchHitObject> ConvertHitObject(HitObject obj, Beatmap beatmap)
|
2017-03-11 23:34:21 +08:00
|
|
|
|
{
|
2017-10-10 15:34:01 +08:00
|
|
|
|
var curveData = obj as IHasCurve;
|
2017-11-24 10:49:10 +08:00
|
|
|
|
var positionData = obj as IHasXPosition;
|
2017-10-10 15:34:01 +08:00
|
|
|
|
var comboData = obj as IHasCombo;
|
2018-01-10 14:38:12 +08:00
|
|
|
|
var endTime = obj as IHasEndTime;
|
2017-10-10 15:34:01 +08:00
|
|
|
|
|
|
|
|
|
if (positionData == null)
|
|
|
|
|
yield break;
|
|
|
|
|
|
|
|
|
|
if (curveData != null)
|
|
|
|
|
{
|
|
|
|
|
yield return new JuiceStream
|
|
|
|
|
{
|
|
|
|
|
StartTime = obj.StartTime,
|
|
|
|
|
Samples = obj.Samples,
|
|
|
|
|
ControlPoints = curveData.ControlPoints,
|
|
|
|
|
CurveType = curveData.CurveType,
|
|
|
|
|
Distance = curveData.Distance,
|
|
|
|
|
RepeatSamples = curveData.RepeatSamples,
|
|
|
|
|
RepeatCount = curveData.RepeatCount,
|
|
|
|
|
X = positionData.X / CatchPlayfield.BASE_WIDTH,
|
|
|
|
|
NewCombo = comboData?.NewCombo ?? false
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-08 11:57:38 +08:00
|
|
|
|
yield break;
|
2017-10-10 15:34:01 +08:00
|
|
|
|
}
|
2017-08-02 18:37:20 +08:00
|
|
|
|
|
2018-01-10 14:38:12 +08:00
|
|
|
|
if (endTime != null)
|
|
|
|
|
{
|
|
|
|
|
yield return new BananaShower
|
|
|
|
|
{
|
|
|
|
|
StartTime = obj.StartTime,
|
|
|
|
|
Samples = obj.Samples,
|
|
|
|
|
Duration = endTime.Duration,
|
|
|
|
|
NewCombo = comboData?.NewCombo ?? false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
yield break;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-07 15:02:14 +08:00
|
|
|
|
yield return new Fruit
|
2017-08-02 18:37:20 +08:00
|
|
|
|
{
|
2017-08-07 15:02:14 +08:00
|
|
|
|
StartTime = obj.StartTime,
|
2017-10-11 17:18:06 +08:00
|
|
|
|
Samples = obj.Samples,
|
2017-10-10 15:34:01 +08:00
|
|
|
|
NewCombo = comboData?.NewCombo ?? false,
|
|
|
|
|
X = positionData.X / CatchPlayfield.BASE_WIDTH
|
2017-08-02 18:37:20 +08:00
|
|
|
|
};
|
2017-03-11 23:34:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|