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

Update existing implementations

This commit is contained in:
Dean Herbert 2020-11-04 16:19:07 +09:00
parent 68b7efe4d5
commit a3dc1d5730
18 changed files with 58 additions and 90 deletions

View File

@ -6,9 +6,8 @@ using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -90,22 +89,17 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? r.Judgement.MaxResult : r.Judgement.MinResult); ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? r.Judgement.MaxResult : r.Judgement.MinResult);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
var endTime = HitObject.GetEndTime(); switch (state)
using (BeginAbsoluteSequence(endTime, true))
{ {
switch (state) case ArmedState.Miss:
{ this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out);
case ArmedState.Miss: break;
this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out);
break;
case ArmedState.Hit: case ArmedState.Hit:
this.FadeOut(); this.FadeOut();
break; break;
}
} }
} }
} }

View File

@ -204,10 +204,6 @@ namespace osu.Game.Rulesets.Mania.Edit
protected override void UpdateInitialTransforms() protected override void UpdateInitialTransforms()
{ {
// don't perform any fading we are handling that ourselves. // don't perform any fading we are handling that ourselves.
}
protected override void UpdateStateTransforms(ArmedState state)
{
LifetimeEnd = HitObject.StartTime + visible_range; LifetimeEnd = HitObject.StartTime + visible_range;
} }
} }

View File

@ -1,10 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osuTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
@ -71,6 +70,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
} }
protected override void UpdateStateTransforms(ArmedState state) => this.FadeOut(150); protected override void UpdateStartTimeStateTransforms() => this.FadeOut(150);
} }
} }

View File

@ -229,12 +229,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
} }
} }
protected override void UpdateStateTransforms(ArmedState state)
{
using (BeginDelayedSequence(HitObject.Duration, true))
base.UpdateStateTransforms(state);
}
protected override void CheckForResult(bool userTriggered, double timeOffset) protected override void CheckForResult(bool userTriggered, double timeOffset)
{ {
if (Tail.AllJudged) if (Tail.AllJudged)

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
/// <summary> /// <summary>
@ -19,8 +17,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public void UpdateResult() => base.UpdateResult(true); public void UpdateResult() => base.UpdateResult(true);
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateInitialTransforms()
{ {
base.UpdateInitialTransforms();
// This hitobject should never expire, so this is just a safe maximum. // This hitobject should never expire, so this is just a safe maximum.
LifetimeEnd = LifetimeStart + 30000; LifetimeEnd = LifetimeStart + 30000;
} }

View File

@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
switch (state) switch (state)
{ {

View File

@ -164,19 +164,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
ApproachCircle.Expire(true); ApproachCircle.Expire(true);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
base.UpdateStateTransforms(state);
Debug.Assert(HitObject.HitWindows != null); Debug.Assert(HitObject.HitWindows != null);
switch (state) switch (state)
{ {
case ArmedState.Idle: case ArmedState.Idle:
this.Delay(HitObject.TimePreempt).FadeOut(500); this.Delay(HitObject.TimePreempt).FadeOut(500);
Expire(true);
HitArea.HitAction = null; HitArea.HitAction = null;
break; break;

View File

@ -51,17 +51,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected virtual void Shake(double maximumLength) => shakeContainer.Shake(maximumLength); protected virtual void Shake(double maximumLength) => shakeContainer.Shake(maximumLength);
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateInitialTransforms()
{ {
base.UpdateStateTransforms(state); base.UpdateInitialTransforms();
switch (state) // Manually set to reduce the number of future alive objects to a bare minimum.
{ LifetimeStart = HitObject.StartTime - HitObject.TimePreempt;
case ArmedState.Idle:
// Manually set to reduce the number of future alive objects to a bare minimum.
LifetimeStart = HitObject.StartTime - HitObject.TimePreempt;
break;
}
} }
/// <summary> /// <summary>

View File

@ -253,29 +253,31 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
base.PlaySamples(); base.PlaySamples();
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateStartTimeStateTransforms()
{ {
base.UpdateStateTransforms(state); base.UpdateStartTimeStateTransforms();
Ball.FadeIn(); Ball.FadeIn();
Ball.ScaleTo(HitObject.Scale); Ball.ScaleTo(HitObject.Scale);
}
using (BeginDelayedSequence(slider.Duration, true)) protected override void UpdateHitStateTransforms(ArmedState state)
{
base.UpdateHitStateTransforms(state);
const float fade_out_time = 450;
// intentionally pile on an extra FadeOut to make it happen much faster.
Ball.FadeOut(fade_out_time / 4, Easing.Out);
switch (state)
{ {
const float fade_out_time = 450; case ArmedState.Hit:
Ball.ScaleTo(HitObject.Scale * 1.4f, fade_out_time, Easing.Out);
// intentionally pile on an extra FadeOut to make it happen much faster. break;
Ball.FadeOut(fade_out_time / 4, Easing.Out);
switch (state)
{
case ArmedState.Hit:
Ball.ScaleTo(HitObject.Scale * 1.4f, fade_out_time, Easing.Out);
break;
}
this.FadeOut(fade_out_time, Easing.OutQuint);
} }
this.FadeOut(fade_out_time, Easing.OutQuint);
} }
public Drawable ProxiedLayer => HeadCircle.ProxiedLayer; public Drawable ProxiedLayer => HeadCircle.ProxiedLayer;

View File

@ -77,9 +77,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
); );
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
base.UpdateStateTransforms(state); base.UpdateHitStateTransforms(state);
switch (state) switch (state)
{ {

View File

@ -67,9 +67,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circlePiece.FadeInFromZero(HitObject.TimeFadeIn); circlePiece.FadeInFromZero(HitObject.TimeFadeIn);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
base.UpdateStateTransforms(state); base.UpdateHitStateTransforms(state);
Debug.Assert(HitObject.HitWindows != null); Debug.Assert(HitObject.HitWindows != null);
@ -77,8 +77,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
case ArmedState.Idle: case ArmedState.Idle:
this.Delay(HitObject.TimePreempt).FadeOut(500); this.Delay(HitObject.TimePreempt).FadeOut(500);
Expire(true);
break; break;
case ArmedState.Miss: case ArmedState.Miss:

View File

@ -72,9 +72,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
this.ScaleTo(0.5f).ScaleTo(1f, ANIM_DURATION * 4, Easing.OutElasticHalf); this.ScaleTo(0.5f).ScaleTo(1f, ANIM_DURATION * 4, Easing.OutElasticHalf);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
base.UpdateStateTransforms(state); base.UpdateHitStateTransforms(state);
switch (state) switch (state)
{ {

View File

@ -142,12 +142,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
} }
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
base.UpdateStateTransforms(state); base.UpdateHitStateTransforms(state);
using (BeginDelayedSequence(Spinner.Duration, true)) this.FadeOut(160);
this.FadeOut(160);
// skin change does a rewind of transforms, which will stop the spinning sound from playing if it's currently in playback. // skin change does a rewind of transforms, which will stop the spinning sound from playing if it's currently in playback.
isSpinning?.TriggerChange(); isSpinning?.TriggerChange();

View File

@ -58,6 +58,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
}); });
} }
protected override void UpdateStateTransforms(ArmedState state) => this.FadeOut(150); protected override void UpdateHitStateTransforms(ArmedState state) => this.FadeOut(150);
} }
} }

View File

@ -135,13 +135,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = r.Judgement.MinResult); ApplyResult(r => r.Type = r.Judgement.MinResult);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
switch (state) switch (state)
{ {
case ArmedState.Hit: case ArmedState.Hit:
case ArmedState.Miss: case ArmedState.Miss:
this.Delay(HitObject.Duration).FadeOut(100); this.FadeOut(100);
break; break;
} }
} }

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = r.Judgement.MaxResult); ApplyResult(r => r.Type = r.Judgement.MaxResult);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
switch (state) switch (state)
{ {

View File

@ -193,7 +193,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
pressHandledThisFrame = false; pressHandledThisFrame = false;
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
Debug.Assert(HitObject.HitWindows != null); Debug.Assert(HitObject.HitWindows != null);

View File

@ -215,15 +215,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
} }
protected override void UpdateInitialTransforms() protected override void UpdateStartTimeStateTransforms()
{ {
base.UpdateInitialTransforms(); base.UpdateStartTimeStateTransforms();
using (BeginAbsoluteSequence(HitObject.StartTime - ring_appear_offset, true)) using (BeginDelayedSequence(-ring_appear_offset, true))
targetRing.ScaleTo(target_ring_scale, 400, Easing.OutQuint); targetRing.ScaleTo(target_ring_scale, 400, Easing.OutQuint);
} }
protected override void UpdateStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)
{ {
const double transition_duration = 300; const double transition_duration = 300;
@ -235,12 +235,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
case ArmedState.Miss: case ArmedState.Miss:
case ArmedState.Hit: case ArmedState.Hit:
using (BeginDelayedSequence(HitObject.Duration, true)) this.FadeOut(transition_duration, Easing.Out);
{ bodyContainer.ScaleTo(1.4f, transition_duration);
this.FadeOut(transition_duration, Easing.Out);
bodyContainer.ScaleTo(1.4f, transition_duration);
}
break; break;
} }
} }