mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Implement basic Taiko HitObject conversion.
This commit is contained in:
parent
a292a16c36
commit
ccc2253068
@ -2,8 +2,12 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Objects.Types;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Beatmaps
|
||||
{
|
||||
@ -11,9 +15,52 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
||||
{
|
||||
public Beatmap<TaikoHitObject> Convert(Beatmap original)
|
||||
{
|
||||
if (original is IIsLegacy)
|
||||
original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4);
|
||||
|
||||
return new Beatmap<TaikoHitObject>(original)
|
||||
{
|
||||
HitObjects = new List<TaikoHitObject>() // Todo: Implement
|
||||
HitObjects = convertHitObjects(original.HitObjects)
|
||||
};
|
||||
}
|
||||
|
||||
private List<TaikoHitObject> convertHitObjects(List<HitObject> hitObjects)
|
||||
{
|
||||
return hitObjects.Select(convertHitObject).ToList();
|
||||
}
|
||||
|
||||
private TaikoHitObject convertHitObject(HitObject original)
|
||||
{
|
||||
IHasDistance distanceData = original as IHasDistance;
|
||||
IHasRepeats repeatsData = original as IHasRepeats;
|
||||
IHasEndTime endTimeData = original as IHasEndTime;
|
||||
|
||||
if (distanceData != null)
|
||||
{
|
||||
return new DrumRoll
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
|
||||
Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1)
|
||||
};
|
||||
}
|
||||
|
||||
if (endTimeData != null)
|
||||
{
|
||||
return new Bash
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
|
||||
EndTime = endTimeData.EndTime
|
||||
};
|
||||
}
|
||||
|
||||
return new TaikoHitObject
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user