mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Misc. fixes and improvements
This commit is contained in:
@ -43,7 +43,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public virtual EasingTypes RollingEasing => EasingTypes.None;
|
||||
|
||||
private T prevDisplayedCount;
|
||||
private T displayedCount;
|
||||
|
||||
/// <summary>
|
||||
@ -104,18 +103,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
protected RollingCounter()
|
||||
{
|
||||
Debug.Assert(
|
||||
TransformType.IsSubclassOf(typeof(Transform<T>)) || TransformType == typeof(Transform<T>),
|
||||
@"transformType should be a subclass of Transform<T>."
|
||||
);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
DisplayedCountSpriteText = new SpriteText
|
||||
{
|
||||
Anchor = this.Anchor,
|
||||
Origin = this.Origin,
|
||||
},
|
||||
DisplayedCountSpriteText = new SpriteText(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -195,6 +185,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected virtual void TransformCount(T currentValue, T newValue)
|
||||
{
|
||||
object[] parameters = { Clock };
|
||||
|
||||
Debug.Assert(
|
||||
TransformType.IsSubclassOf(typeof(Transform<T>)) || TransformType == typeof(Transform<T>),
|
||||
@"transformType should be a subclass of Transform<T>."
|
||||
);
|
||||
|
||||
TransformCount((Transform<T>)Activator.CreateInstance(TransformType, parameters), currentValue, newValue);
|
||||
}
|
||||
|
||||
@ -210,7 +206,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
if (Clock == null)
|
||||
return;
|
||||
|
||||
if (RollingDuration == 0)
|
||||
if (RollingDuration < 1)
|
||||
{
|
||||
DisplayedCount = Count;
|
||||
return;
|
||||
|
@ -17,8 +17,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class StarCounter : AutoSizeContainer
|
||||
{
|
||||
private Container starContainer;
|
||||
private List<TextAwesome> stars = new List<TextAwesome>();
|
||||
private readonly Container starContainer;
|
||||
private readonly List<TextAwesome> stars = new List<TextAwesome>();
|
||||
|
||||
private double transformStartTime = 0;
|
||||
|
||||
@ -81,11 +81,17 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows a float count as stars (up to 10). Used as star difficulty display.
|
||||
/// </summary>
|
||||
public StarCounter() : this(10) {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows a float count as stars. Used as star difficulty display.
|
||||
/// </summary>
|
||||
/// <param name="maxstars">Maximum amount of stars to display.</param>
|
||||
public StarCounter(int maxstars = 10)
|
||||
public StarCounter(int maxstars)
|
||||
{
|
||||
MaxStars = Math.Max(maxstars, 0);
|
||||
|
||||
@ -114,6 +120,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = StarSize,
|
||||
Scale = new Vector2(minStarScale),
|
||||
Alpha = minStarAlpha,
|
||||
Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
|
||||
};
|
||||
|
||||
@ -122,8 +130,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
starContainer.Add(star);
|
||||
}
|
||||
|
||||
// Used to recreate initial state.
|
||||
StopAnimation();
|
||||
// Animate initial state from zero.
|
||||
transformCount(0, Count);
|
||||
}
|
||||
|
||||
public void ResetCount()
|
||||
|
Reference in New Issue
Block a user