mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
More refactoring
This commit is contained in:
parent
a15f4cda44
commit
0ceb72ba42
@ -16,6 +16,7 @@ using osu.Game.GameModes.Play.Catch;
|
||||
using osu.Game.GameModes.Play.Mania;
|
||||
using osu.Game.GameModes.Play.Osu;
|
||||
using osu.Game.GameModes.Play.Taiko;
|
||||
using osu.Game.GameModes.Play;
|
||||
|
||||
namespace osu.Desktop.Tests
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
namespace osu.Game.GameModes.Play
|
||||
{
|
||||
public abstract class ComboCounter : Container
|
||||
{
|
63
osu.Game/GameModes/Play/ComboResultCounter.cs
Normal file
63
osu.Game/GameModes/Play/ComboResultCounter.cs
Normal file
@ -0,0 +1,63 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Play.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to display combo with a roll-up animation in results screen.
|
||||
/// </summary>
|
||||
public class ComboResultCounter : RollingCounter<ulong>
|
||||
{
|
||||
protected override Type TransformType => typeof(TransformComboResult);
|
||||
|
||||
public override double RollingDuration => 500;
|
||||
public override EasingTypes RollingEasing => EasingTypes.Out;
|
||||
|
||||
protected override double GetProportionalDuration(ulong currentValue, ulong newValue)
|
||||
{
|
||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||
}
|
||||
|
||||
protected override string FormatCount(ulong count)
|
||||
{
|
||||
return $@"{count}x";
|
||||
}
|
||||
|
||||
protected class TransformComboResult : Transform<ulong>
|
||||
{
|
||||
public override ulong CurrentValue
|
||||
{
|
||||
get
|
||||
{
|
||||
double time = Time;
|
||||
if (time < StartTime) return StartValue;
|
||||
if (time >= EndTime) return EndValue;
|
||||
|
||||
return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Apply(Drawable d)
|
||||
{
|
||||
base.Apply(d);
|
||||
(d as ComboResultCounter).VisibleCount = CurrentValue;
|
||||
}
|
||||
|
||||
public TransformComboResult(IClock clock)
|
||||
: base(clock)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -130,7 +130,8 @@
|
||||
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
|
||||
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
|
||||
<Compile Include="GameModes\Edit\EditSongSelect.cs" />
|
||||
<Compile Include="Graphics\UserInterface\ComboCounter.cs" />
|
||||
<Compile Include="GameModes\Play\ComboCounter.cs" />
|
||||
<Compile Include="GameModes\Play\ComboResultCounter.cs" />
|
||||
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
|
||||
<Compile Include="GameModes\Play\Taiko\TaikoComboCounter.cs" />
|
||||
<Compile Include="Input\GlobalHotkeys.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user