mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Allow multiple mappings to be generated for a single hitobject
This commit is contained in:
parent
9d035fc5d0
commit
573d6d1b5f
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -26,12 +27,15 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
base.Test(beatmapId);
|
||||
}
|
||||
|
||||
protected override ConvertValue CreateConvertValue(HitObject hitObject) => new ConvertValue
|
||||
protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
|
||||
{
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
|
||||
Column = ((ManiaHitObject)hitObject).Column
|
||||
};
|
||||
yield return new ConvertValue
|
||||
{
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
|
||||
Column = ((ManiaHitObject)hitObject).Column
|
||||
};
|
||||
}
|
||||
|
||||
protected override ITestableBeatmapConverter CreateConverter(Beatmap beatmap) => new ManiaBeatmapConverter(isForCurrentRuleset, beatmap);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -24,12 +25,12 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
base.Test(beatmapId);
|
||||
}
|
||||
|
||||
protected override ConvertValue CreateConvertValue(HitObject hitObject)
|
||||
protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
|
||||
{
|
||||
var startPosition = (hitObject as IHasPosition)?.Position ?? new Vector2(256, 192);
|
||||
var endPosition = (hitObject as Slider)?.EndPosition ?? startPosition;
|
||||
|
||||
return new ConvertValue
|
||||
yield return new ConvertValue
|
||||
{
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -26,16 +27,19 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
base.Test(beatmapId);
|
||||
}
|
||||
|
||||
protected override ConvertValue CreateConvertValue(HitObject hitObject) => new ConvertValue
|
||||
protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
|
||||
{
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
|
||||
IsRim = hitObject is RimHit,
|
||||
IsCentre = hitObject is CentreHit,
|
||||
IsDrumRoll = hitObject is DrumRoll,
|
||||
IsSwell = hitObject is Swell,
|
||||
IsStrong = ((TaikoHitObject)hitObject).IsStrong
|
||||
};
|
||||
yield return new ConvertValue
|
||||
{
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
|
||||
IsRim = hitObject is RimHit,
|
||||
IsCentre = hitObject is CentreHit,
|
||||
IsDrumRoll = hitObject is DrumRoll,
|
||||
IsSwell = hitObject is Swell,
|
||||
IsStrong = ((TaikoHitObject)hitObject).IsStrong
|
||||
};
|
||||
}
|
||||
|
||||
protected override ITestableBeatmapConverter CreateConverter(Beatmap beatmap) => new TaikoBeatmapConverter(isForCurrentRuleset);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
var mapping = new ConvertMapping { StartTime = orig.StartTime };
|
||||
foreach (var obj in converted)
|
||||
mapping.Objects.Add(CreateConvertValue(obj));
|
||||
mapping.Objects.AddRange(CreateConvertValue(obj));
|
||||
result.Mappings.Add(mapping);
|
||||
};
|
||||
|
||||
@ -121,7 +121,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}");
|
||||
}
|
||||
|
||||
protected abstract TConvertValue CreateConvertValue(HitObject hitObject);
|
||||
protected abstract IEnumerable<TConvertValue> CreateConvertValue(HitObject hitObject);
|
||||
protected abstract ITestableBeatmapConverter CreateConverter(Beatmap beatmap);
|
||||
|
||||
private class ConvertMapping
|
||||
|
Loading…
Reference in New Issue
Block a user