1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

Add actual banana conversion/reading

(cherry picked from commit d353158)
This commit is contained in:
Dean Herbert 2018-01-10 15:38:12 +09:00
parent 5c79bdc41c
commit 5b15073010
2 changed files with 19 additions and 5 deletions

View File

@ -11,7 +11,7 @@ using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Catch.Beatmaps
{
internal class CatchBeatmapConverter : BeatmapConverter<CatchHitObject>
public class CatchBeatmapConverter : BeatmapConverter<CatchHitObject>
{
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
var curveData = obj as IHasCurve;
var positionData = obj as IHasXPosition;
var comboData = obj as IHasCombo;
var endTime = obj as IHasEndTime;
if (positionData == null)
yield break;
@ -42,6 +43,19 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
yield break;
}
if (endTime != null)
{
yield return new BananaShower
{
StartTime = obj.StartTime,
Samples = obj.Samples,
Duration = endTime.Duration,
NewCombo = comboData?.NewCombo ?? false
};
yield break;
}
yield return new Fruit
{
StartTime = obj.StartTime,

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
public class DrawableBananaShower : DrawableCatchHitObject<BananaShower>
{
private readonly Container dropletContainer;
private readonly Container bananaContainer;
public DrawableBananaShower(BananaShower s) : base(s)
{
@ -19,21 +19,21 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Height = (float)HitObject.Duration;
X = 0;
Child = dropletContainer = new Container
Child = bananaContainer = new Container
{
RelativeSizeAxes = Axes.Both,
RelativeChildOffset = new Vector2(0, (float)HitObject.StartTime),
RelativeChildSize = new Vector2(1, (float)HitObject.Duration)
};
foreach (var b in s.NestedHitObjects.OfType<BananaShower.Banana>())
foreach (var b in s.NestedHitObjects.Cast<BananaShower.Banana>())
AddNested(new DrawableFruit(b));
}
protected override void AddNested(DrawableHitObject<CatchHitObject> h)
{
((DrawableCatchHitObject)h).CheckPosition = o => CheckPosition?.Invoke(o) ?? false;
dropletContainer.Add(h);
bananaContainer.Add(h);
base.AddNested(h);
}
}