mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Tidying up
This commit is contained in:
@ -30,8 +30,6 @@ namespace osu.Desktop.Tests
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
RollingDuration = 1000,
|
|
||||||
RollingEasing = EasingTypes.Out,
|
|
||||||
Count = 0,
|
Count = 0,
|
||||||
Position = new Vector2(20, 20),
|
Position = new Vector2(20, 20),
|
||||||
};
|
};
|
||||||
@ -43,9 +41,6 @@ namespace osu.Desktop.Tests
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Position = new Vector2(10, 10),
|
Position = new Vector2(10, 10),
|
||||||
InnerCountPosition = new Vector2(10, 10),
|
InnerCountPosition = new Vector2(10, 10),
|
||||||
IsRollingProportional = true,
|
|
||||||
RollingDuration = 20,
|
|
||||||
PopOutDuration = 100,
|
|
||||||
Count = 0,
|
Count = 0,
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
};
|
};
|
||||||
@ -55,9 +50,6 @@ namespace osu.Desktop.Tests
|
|||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
IsRollingProportional = true,
|
|
||||||
RollingDuration = 20,
|
|
||||||
PopOutDuration = 100,
|
|
||||||
Count = 0,
|
Count = 0,
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
};
|
};
|
||||||
@ -68,9 +60,6 @@ namespace osu.Desktop.Tests
|
|||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Position = new Vector2(20, 80),
|
Position = new Vector2(20, 80),
|
||||||
IsRollingProportional = true,
|
|
||||||
RollingDuration = 20,
|
|
||||||
ScaleFactor = 2,
|
|
||||||
Count = 0,
|
Count = 0,
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
};
|
};
|
||||||
@ -81,9 +70,6 @@ namespace osu.Desktop.Tests
|
|||||||
{
|
{
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
RollingDuration = 500,
|
|
||||||
RollingEasing = EasingTypes.Out,
|
|
||||||
Count = 100.0f,
|
|
||||||
Position = new Vector2(20, 60),
|
Position = new Vector2(20, 60),
|
||||||
};
|
};
|
||||||
Add(accuracyCombo);
|
Add(accuracyCombo);
|
||||||
@ -133,9 +119,9 @@ namespace osu.Desktop.Tests
|
|||||||
|
|
||||||
AddButton(@"miss...", delegate
|
AddButton(@"miss...", delegate
|
||||||
{
|
{
|
||||||
standardCombo.RollBack();
|
standardCombo.Roll();
|
||||||
alternativeCombo.RollBack();
|
alternativeCombo.Roll();
|
||||||
catchCombo.RollBack();
|
catchCombo.Roll();
|
||||||
accuracyCombo.Denominator++;
|
accuracyCombo.Denominator++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
@ -47,6 +48,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AccuracyCounter()
|
||||||
|
{
|
||||||
|
RollingDuration = 500;
|
||||||
|
RollingEasing = EasingTypes.Out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
updateCount();
|
||||||
|
StopRolling();
|
||||||
|
}
|
||||||
|
|
||||||
public void SetCount(long num, ulong den)
|
public void SetCount(long num, ulong den)
|
||||||
{
|
{
|
||||||
numerator = num;
|
numerator = num;
|
||||||
@ -72,9 +87,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return count.ToString("0.00") + "%";
|
return count.ToString("0.00") + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ulong getProportionalDuration(float currentValue, float newValue)
|
protected override double getProportionalDuration(float currentValue, float newValue)
|
||||||
{
|
{
|
||||||
return (ulong)(Math.Abs(currentValue - newValue) * RollingDuration);
|
return Math.Abs(currentValue - newValue) * RollingDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class TransformAccuracy : TransformFloat
|
protected class TransformAccuracy : TransformFloat
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public Color4 OriginalColour;
|
public Color4 OriginalColour;
|
||||||
public Color4 TintColour = Color4.OrangeRed;
|
public Color4 TintColour = Color4.OrangeRed;
|
||||||
public int TintDuration = 250;
|
public int TintDuration = 300;
|
||||||
public float ScaleFactor = 2;
|
public float ScaleFactor = 2;
|
||||||
public EasingTypes TintEasing = EasingTypes.None;
|
public EasingTypes TintEasing = EasingTypes.None;
|
||||||
public bool CanAnimateWhenBackwards = false;
|
public bool CanAnimateWhenBackwards = false;
|
||||||
@ -32,11 +32,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
OriginalColour = Colour;
|
OriginalColour = Colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ResetCount()
|
|
||||||
{
|
|
||||||
SetCountWithoutRolling(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
||||||
{
|
{
|
||||||
ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
|
ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
|
||||||
|
@ -25,11 +25,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return count.ToString("#,0");
|
return count.ToString("#,0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RollBack(ulong newValue = 0)
|
public override void Roll(ulong newValue = 0)
|
||||||
{
|
{
|
||||||
popOutSpriteText.Colour = countSpriteText.Colour;
|
popOutSpriteText.Colour = countSpriteText.Colour;
|
||||||
|
|
||||||
base.RollBack(newValue);
|
base.Roll(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,9 +21,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
protected Type transformType => typeof(TransformCombo);
|
protected Type transformType => typeof(TransformCombo);
|
||||||
|
|
||||||
private bool rollbacking = false;
|
private bool rolling = false;
|
||||||
|
|
||||||
protected ulong rollingTotalDuration = 0;
|
protected ulong rollingTotalDuration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true, the roll-down duration will be proportional to the counter.
|
/// If true, the roll-down duration will be proportional to the counter.
|
||||||
@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
|
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
|
||||||
/// element; else duration in milliseconds for the counter roll-up animation in total.
|
/// element; else duration in milliseconds for the counter roll-up animation in total.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong RollingDuration = 0;
|
public ulong RollingDuration = 20;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Easing for the counter rollover animation.
|
/// Easing for the counter rollover animation.
|
||||||
@ -131,16 +131,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
StopRolling();
|
StopRolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets count value, bypassing rollover animation.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="count">New count value.</param>
|
|
||||||
public virtual void SetCountWithoutRolling(ulong count)
|
|
||||||
{
|
|
||||||
Count = count;
|
|
||||||
StopRolling();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops rollover animation, forcing the visible count to be the actual count.
|
/// Stops rollover animation, forcing the visible count to be the actual count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -151,14 +141,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Animates roll-back to an specific value.
|
/// Animates roll-up/roll-back to an specific value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newValue">Target value.</param>
|
/// <param name="newValue">Target value.</param>
|
||||||
public virtual void RollBack(ulong newValue = 0)
|
public virtual void Roll(ulong newValue = 0)
|
||||||
{
|
{
|
||||||
rollbacking = true;
|
rolling = true;
|
||||||
Count = newValue;
|
Count = newValue;
|
||||||
rollbacking = false;
|
rolling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -166,7 +156,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void ResetCount()
|
public virtual void ResetCount()
|
||||||
{
|
{
|
||||||
SetCountWithoutRolling(default(ulong));
|
Count = default(ulong);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
protected virtual ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
||||||
@ -195,7 +185,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected virtual void transformCount(ulong visibleValue, ulong prevValue, ulong currentValue, ulong newValue)
|
protected virtual void transformCount(ulong visibleValue, ulong prevValue, ulong currentValue, ulong newValue)
|
||||||
{
|
{
|
||||||
if (!rollbacking)
|
if (!rolling)
|
||||||
{
|
{
|
||||||
updateComboTransforms();
|
updateComboTransforms();
|
||||||
removeComboTransforms();
|
removeComboTransforms();
|
||||||
|
@ -25,12 +25,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected virtual Type transformType => typeof(Transform<T>);
|
protected virtual Type transformType => typeof(Transform<T>);
|
||||||
|
|
||||||
protected ulong rollingTotalDuration = 0;
|
protected double rollingTotalDuration = 0;
|
||||||
|
|
||||||
protected SpriteText countSpriteText;
|
protected SpriteText countSpriteText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true, the roll-up duration will be proportional to the counter.
|
/// If true, the roll-up duration will be proportional to change in value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsRollingProportional = false;
|
public bool IsRollingProportional = false;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
|
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
|
||||||
/// element; else duration in milliseconds for the counter roll-up animation in total.
|
/// element; else duration in milliseconds for the counter roll-up animation in total.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong RollingDuration = 0;
|
public double RollingDuration = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Easing for the counter rollover animation.
|
/// Easing for the counter rollover animation.
|
||||||
@ -176,7 +176,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <param name="currentValue">Current visible value.</param>
|
/// <param name="currentValue">Current visible value.</param>
|
||||||
/// <param name="newValue">New final value.</param>
|
/// <param name="newValue">New final value.</param>
|
||||||
/// <returns>Calculated rollover duration in milliseconds.</returns>
|
/// <returns>Calculated rollover duration in milliseconds.</returns>
|
||||||
protected virtual ulong getProportionalDuration(T currentValue, T newValue)
|
protected virtual double getProportionalDuration(T currentValue, T newValue)
|
||||||
{
|
{
|
||||||
return RollingDuration;
|
return RollingDuration;
|
||||||
}
|
}
|
||||||
@ -209,13 +209,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentValue">Count value before modification.</param>
|
/// <param name="currentValue">Count value before modification.</param>
|
||||||
/// <param name="newValue">Expected count value after modification-</param>
|
/// <param name="newValue">Expected count value after modification-</param>
|
||||||
/// <remarks>
|
|
||||||
/// Unless you need to set a custom animation according to the current or new value of the count, the
|
|
||||||
/// recommended approach is to call transformCount(CustomTransformer(Clock), currentValue, newValue), where
|
|
||||||
/// CustomTransformer is of type transformerType.
|
|
||||||
/// By using this approach, there is no need to check if the Clock is not null; this validation is done before
|
|
||||||
/// adding the transformer.
|
|
||||||
/// </remarks>
|
|
||||||
/// <seealso cref="transformType"/>
|
/// <seealso cref="transformType"/>
|
||||||
protected virtual void transformCount(T currentValue, T newValue)
|
protected virtual void transformCount(T currentValue, T newValue)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
countSpriteText.FixedWidth = true;
|
countSpriteText.FixedWidth = true;
|
||||||
LeadingZeroes = leading;
|
LeadingZeroes = leading;
|
||||||
|
|
||||||
|
RollingDuration = 1000;
|
||||||
|
RollingEasing = EasingTypes.Out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
@ -42,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.Load(game);
|
base.Load(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
|
protected override double getProportionalDuration(ulong currentValue, ulong newValue)
|
||||||
{
|
{
|
||||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected uint scheduledPopOutCurrentId = 0;
|
protected uint scheduledPopOutCurrentId = 0;
|
||||||
|
|
||||||
public ulong PopOutDuration = 0;
|
public ulong PopOutDuration = 150;
|
||||||
public float PopOutBigScale = 2.0f;
|
public float PopOutBigScale = 2.0f;
|
||||||
public float PopOutSmallScale = 1.1f;
|
public float PopOutSmallScale = 1.1f;
|
||||||
public EasingTypes PopOutEasing = EasingTypes.None;
|
public EasingTypes PopOutEasing = EasingTypes.None;
|
||||||
|
@ -167,27 +167,15 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void transformCount(float currentValue, float newValue)
|
private void transformCount(float currentValue, float newValue)
|
||||||
{
|
{
|
||||||
if (currentValue < newValue)
|
for (int i = 0; i < MaxStars; i++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MaxStars; i++)
|
stars[i].DelayReset();
|
||||||
{
|
stars[i].ClearTransformations();
|
||||||
stars[i].DelayReset();
|
if (currentValue <= newValue)
|
||||||
stars[i].ClearTransformations();
|
stars[i].Delay(Math.Max(i - currentValue, 0) * AnimationDelay);
|
||||||
if (i > currentValue)
|
else
|
||||||
stars[i].Delay((i - currentValue) * AnimationDelay);
|
stars[i].Delay(Math.Max(currentValue - 1 - i, 0) * AnimationDelay);
|
||||||
transformStar(i, newValue);
|
transformStar(i, newValue);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = MaxStars - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
stars[i].DelayReset();
|
|
||||||
stars[i].ClearTransformations();
|
|
||||||
if (i < (currentValue - 1))
|
|
||||||
stars[i].Delay((currentValue - 1 - i) * AnimationDelay);
|
|
||||||
transformStar(i, newValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
transformStartTime = Time;
|
transformStartTime = Time;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user