mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 19:32:55 +08:00
Completely remove transform flow for spm counter
This commit is contained in:
parent
4bba0eaf4b
commit
2696620d12
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -111,42 +110,26 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
|||||||
{
|
{
|
||||||
spmCounter.Text = Math.Truncate(spm.NewValue).ToString(@"#0");
|
spmCounter.Text = Math.Truncate(spm.NewValue).ToString(@"#0");
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
drawableSpinner.ApplyCustomUpdateState += updateStateTransforms;
|
|
||||||
updateStateTransforms(drawableSpinner, drawableSpinner.State.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (spmContainer.Alpha == 0)
|
updateSpmAlpha();
|
||||||
fadeCounterOnTimeStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
private void updateSpmAlpha()
|
||||||
{
|
|
||||||
if (!(drawableHitObject is DrawableSpinner))
|
|
||||||
return;
|
|
||||||
|
|
||||||
fadeCounterOnTimeStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fadeCounterOnTimeStart()
|
|
||||||
{
|
{
|
||||||
if (drawableSpinner.Result?.TimeStarted is double startTime)
|
if (drawableSpinner.Result?.TimeStarted is double startTime)
|
||||||
{
|
{
|
||||||
using (BeginAbsoluteSequence(startTime))
|
double timeOffset = Math.Clamp(Clock.CurrentTime, startTime, startTime + drawableSpinner.HitObject.TimeFadeIn) - startTime;
|
||||||
spmContainer.FadeIn(drawableSpinner.HitObject.TimeFadeIn);
|
spmContainer.Alpha = (float)(timeOffset / drawableSpinner.HitObject.TimeFadeIn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spmContainer.Alpha = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (drawableSpinner.IsNotNull())
|
|
||||||
drawableSpinner.ApplyCustomUpdateState -= updateStateTransforms;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -117,42 +116,26 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
{
|
{
|
||||||
spmCounter.Text = Math.Truncate(spm.NewValue).ToString(@"#0");
|
spmCounter.Text = Math.Truncate(spm.NewValue).ToString(@"#0");
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
drawableSpinner.ApplyCustomUpdateState += updateStateTransforms;
|
|
||||||
updateStateTransforms(drawableSpinner, drawableSpinner.State.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (spmContainer.Alpha == 0)
|
updateSpmAlpha();
|
||||||
fadeCounterOnTimeStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
private void updateSpmAlpha()
|
||||||
{
|
|
||||||
if (!(drawableHitObject is DrawableSpinner))
|
|
||||||
return;
|
|
||||||
|
|
||||||
fadeCounterOnTimeStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fadeCounterOnTimeStart()
|
|
||||||
{
|
{
|
||||||
if (drawableSpinner.Result?.TimeStarted is double startTime)
|
if (drawableSpinner.Result?.TimeStarted is double startTime)
|
||||||
{
|
{
|
||||||
using (BeginAbsoluteSequence(startTime))
|
double timeOffset = Math.Clamp(Clock.CurrentTime, startTime, startTime + drawableSpinner.HitObject.TimeFadeIn) - startTime;
|
||||||
spmContainer.FadeIn(drawableSpinner.HitObject.TimeFadeIn);
|
spmContainer.Alpha = (float)(timeOffset / drawableSpinner.HitObject.TimeFadeIn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spmContainer.Alpha = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (drawableSpinner.IsNotNull())
|
|
||||||
drawableSpinner.ApplyCustomUpdateState -= updateStateTransforms;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user