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

Add forgotten unsubscribes

This commit is contained in:
goodtrailer 2022-07-05 21:04:13 -07:00
parent e6a05ce3e2
commit 72fb1ae892
3 changed files with 50 additions and 12 deletions

View File

@ -1,11 +1,13 @@
// 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 System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK.Graphics;
@ -70,14 +72,23 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state)
{
// see comment in LegacySliderBall.updateStateTransforms
if (drawableObject is not DrawableSlider)
return;
const float fade_time = 450f;
const float fade_duration = 450f;
// intentionally pile on an extra FadeOut to make it happen much faster
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
// intentionally pile on an extra FadeOut to make it happen much faster.
this.FadeOut(fade_time / 4, Easing.Out);
this.FadeOut(fade_duration / 4, Easing.Out);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (parentObject != null)
parentObject.ApplyCustomUpdateState -= updateStateTransforms;
}
}
}

View File

@ -73,26 +73,27 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state)
{
// see comment in LegacySliderBall.updateStateTransforms
if (drawableObject is not DrawableSlider)
return;
const float fade_out_time = 450f;
const float fade_duration = 450f;
using (BeginAbsoluteSequence(drawableObject.StateUpdateTime))
{
this.ScaleTo(1f)
.FadeIn();
this.FadeIn()
.ScaleTo(1f);
}
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
{
// intentionally pile on an extra FadeOut to make it happen much faster
this.FadeOut(fade_out_time / 4, Easing.Out);
this.FadeOut(fade_duration / 4, Easing.Out);
switch (state)
{
case ArmedState.Hit:
this.ScaleTo(1.4f, fade_out_time, Easing.Out);
this.ScaleTo(1.4f, fade_duration, Easing.Out);
break;
}
}

View File

@ -1,13 +1,17 @@
// 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 System.Collections.Generic;
using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Logging;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
@ -23,7 +27,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
animationContent.Anchor = Anchor.Centre;
animationContent.Origin = Anchor.Centre;
Alpha = 0f;
RelativeSizeAxes = Axes.Both;
InternalChild = animationContent;
}
@ -44,6 +47,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
if (parentObject != null)
{
parentObject.HitObjectApplied += onHitObjectApplied;
onHitObjectApplied(parentObject);
parentObject.ApplyCustomUpdateState += updateStateTransforms;
updateStateTransforms(parentObject, parentObject.State.Value);
}
@ -69,18 +75,38 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
.FadeTo(tracking.NewValue ? 1f : 0f, realFadeDuration, Easing.OutQuad);
}
private void onHitObjectApplied(DrawableHitObject drawableObject)
{
this.ScaleTo(1f)
.FadeOut();
}
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state)
{
// see comment in LegacySliderBall.updateStateTransforms
if (drawableObject is not DrawableSlider)
return;
const float shrink_duration = 200f;
const float fade_duration = 240f;
const float fade_delay = 175f;
const float fade_duration = 35f;
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
{
this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.8f, shrink_duration, Easing.OutQuint)
.FadeOut(fade_duration, Easing.InQuint);
this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.75f, shrink_duration, Easing.OutQuad)
.Delay(fade_delay)
.FadeOut(fade_duration);
}
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (parentObject != null)
{
parentObject.HitObjectApplied -= onHitObjectApplied;
parentObject.ApplyCustomUpdateState -= updateStateTransforms;
}
}
}