mirror of
https://github.com/ppy/osu
synced 2025-03-02 17:42:13 +00:00
Use hit object pooling for Fruit
and Banana
.
This commit is contained in:
parent
94fd607a7c
commit
b76ae525b2
@ -10,14 +10,12 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Judgements;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Utils;
|
||||
|
||||
@ -10,7 +11,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
protected override FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => FruitVisualRepresentation.Banana;
|
||||
|
||||
public DrawableBanana(Banana h)
|
||||
public DrawableBanana()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public DrawableBanana([CanBeNull] Banana h)
|
||||
: base(h)
|
||||
{
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Utils;
|
||||
@ -16,7 +17,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
|
||||
|
||||
public DrawableFruit(CatchHitObject h)
|
||||
public DrawableFruit()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public DrawableFruit([CanBeNull] Fruit h)
|
||||
: base(h)
|
||||
{
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
RegisterPool<Droplet, DrawableDroplet>(1);
|
||||
RegisterPool<TinyDroplet, DrawableTinyDroplet>(1);
|
||||
RegisterPool<Fruit, DrawableFruit>(1);
|
||||
RegisterPool<Banana, DrawableBanana>(1);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -44,12 +44,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
switch (h)
|
||||
{
|
||||
case Banana banana:
|
||||
return new DrawableBanana(banana);
|
||||
|
||||
case Fruit fruit:
|
||||
return new DrawableFruit(fruit);
|
||||
|
||||
case JuiceStream stream:
|
||||
return new DrawableJuiceStream(stream, CreateDrawableRepresentation);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user