1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-11 03:32:55 +08:00

Fix weird fruit not fading out

This commit is contained in:
Dean Herbert 2018-01-12 22:07:21 +09:00
parent f03b8206da
commit 7b19353ed8
2 changed files with 26 additions and 21 deletions

View File

@ -63,10 +63,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)
{ {
using (BeginAbsoluteSequence(HitObject.StartTime - preempt)) using (BeginAbsoluteSequence(HitObject.StartTime - preempt))
{
// animation
this.FadeIn(200); this.FadeIn(200);
}
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;

View File

@ -44,14 +44,16 @@ namespace osu.Game.Rulesets.Catch.UI
}; };
} }
private DrawableCatchHitObject lastPlateableFruit;
public void OnJudgement(DrawableCatchHitObject fruit, Judgement judgement) public void OnJudgement(DrawableCatchHitObject fruit, Judgement judgement)
{ {
if (judgement.IsHit && fruit.CanBePlated) if (judgement.IsHit && fruit.CanBePlated)
{ {
var caughtFruit = (DrawableCatchHitObject)GetVisualRepresentation?.Invoke(fruit.HitObject); var caughtFruit = (DrawableCatchHitObject)GetVisualRepresentation?.Invoke(fruit.HitObject);
if (caughtFruit != null) if (caughtFruit == null) return;
{
caughtFruit.State.Value = ArmedState.Idle; caughtFruit.State.Value = ArmedState.Idle;
caughtFruit.AccentColour = fruit.AccentColour; caughtFruit.AccentColour = fruit.AccentColour;
caughtFruit.RelativePositionAxes = Axes.None; caughtFruit.RelativePositionAxes = Axes.None;
@ -61,11 +63,16 @@ namespace osu.Game.Rulesets.Catch.UI
caughtFruit.Origin = Anchor.Centre; caughtFruit.Origin = Anchor.Centre;
caughtFruit.Scale *= 0.7f; caughtFruit.Scale *= 0.7f;
caughtFruit.LifetimeEnd = double.MaxValue; caughtFruit.LifetimeEnd = double.MaxValue;
}
MovableCatcher.Add(caughtFruit); MovableCatcher.Add(caughtFruit);
lastPlateableFruit = caughtFruit;
} }
// this is required to make this run after the last caught fruit runs UpdateState at least once.
// TODO: find a better alternative
lastPlateableFruit.OnLoadComplete = _ =>
{
if (fruit.HitObject.LastInCombo) if (fruit.HitObject.LastInCombo)
{ {
if (judgement.IsHit) if (judgement.IsHit)
@ -73,6 +80,7 @@ namespace osu.Game.Rulesets.Catch.UI
else else
MovableCatcher.Drop(); MovableCatcher.Drop();
} }
};
} }
public bool OnPressed(CatchAction action) public bool OnPressed(CatchAction action)