1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 22:37:24 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs

32 lines
1.1 KiB
C#
Raw Normal View History

2017-03-12 00:34:21 +09: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 16:05:58 +09:00
using osu.Game.Rulesets.Catch.Objects;
2017-03-12 00:34:21 +09:00
using System.Collections.Generic;
2017-04-17 15:44:46 +09:00
using System;
2017-04-18 16:05:58 +09:00
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.UI;
2017-03-12 00:34:21 +09:00
2017-04-18 16:05:58 +09:00
namespace osu.Game.Rulesets.Catch.Beatmaps
2017-03-12 00:34:21 +09:00
{
internal class CatchBeatmapConverter : BeatmapConverter<CatchBaseHit>
2017-03-12 00:34:21 +09:00
{
2017-04-18 14:24:16 +09:00
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
2017-04-17 15:44:46 +09:00
2017-08-07 16:02:14 +09:00
protected override IEnumerable<CatchBaseHit> ConvertHitObject(HitObject obj, Beatmap beatmap)
2017-03-12 00:34:21 +09:00
{
2017-08-08 12:57:38 +09:00
if (!(obj is IHasXPosition))
yield break;
2017-08-07 16:02:14 +09:00
yield return new Fruit
{
2017-08-07 16:02:14 +09:00
StartTime = obj.StartTime,
NewCombo = (obj as IHasCombo)?.NewCombo ?? false,
2017-09-19 21:40:38 +09:00
X = ((IHasXPosition)obj).X / OsuPlayfield.BASE_SIZE.X
};
2017-03-12 00:34:21 +09:00
}
}
}