Tidying code and restricting methods

This commit is contained in:
Adonais Romero González
2016-10-15 19:07:07 -05:00
parent 84dcb63ad2
commit 862dc1d7c7
11 changed files with 137 additions and 155 deletions

View File

@ -50,7 +50,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Apply(Drawable d)
{
base.Apply(d);
(d as PercentageCounter).VisibleCount = CurrentValue;
(d as PercentageCounter).DisplayedCount = CurrentValue;
}
public TransformAccuracy(IClock clock)

View File

@ -25,7 +25,7 @@ namespace osu.Game.Graphics.UserInterface
/// </remarks>
protected virtual Type TransformType => typeof(Transform<T>);
protected SpriteText CountSpriteText;
protected SpriteText DisplayedCountSpriteText;
/// <summary>
/// If true, the roll-up duration will be proportional to change in value.
@ -43,24 +43,24 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public virtual EasingTypes RollingEasing => EasingTypes.None;
private T prevVisibleCount;
private T visibleCount;
private T prevDisplayedCount;
private T displayedCount;
/// <summary>
/// Value shown at the current moment.
/// </summary>
public virtual T VisibleCount
public virtual T DisplayedCount
{
get
{
return visibleCount;
return displayedCount;
}
protected set
{
if (visibleCount.Equals(value))
if (displayedCount.Equals(value))
return;
visibleCount = value;
CountSpriteText.Text = FormatCount(value);
displayedCount = value;
DisplayedCountSpriteText.Text = FormatCount(value);
}
}
@ -82,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface
count = value;
if (IsLoaded)
{
TransformCount(visibleCount, count);
TransformCount(displayedCount, count);
}
}
}
@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface
set
{
textSize = value;
CountSpriteText.TextSize = value;
DisplayedCountSpriteText.TextSize = value;
}
}
@ -111,7 +111,7 @@ namespace osu.Game.Graphics.UserInterface
Children = new Drawable[]
{
CountSpriteText = new SpriteText
DisplayedCountSpriteText = new SpriteText
{
Anchor = this.Anchor,
Origin = this.Origin,
@ -125,11 +125,11 @@ namespace osu.Game.Graphics.UserInterface
Flush(false, TransformType);
VisibleCount = Count;
DisplayedCount = Count;
CountSpriteText.Text = FormatCount(count);
CountSpriteText.Anchor = this.Anchor;
CountSpriteText.Origin = this.Origin;
DisplayedCountSpriteText.Text = FormatCount(count);
DisplayedCountSpriteText.Anchor = this.Anchor;
DisplayedCountSpriteText.Origin = this.Origin;
}
/// <summary>
@ -143,12 +143,12 @@ namespace osu.Game.Graphics.UserInterface
}
/// <summary>
/// Stops rollover animation, forcing the visible count to be the actual count.
/// Stops rollover animation, forcing the displayed count to be the actual count.
/// </summary>
public virtual void StopRolling()
{
Flush(false, TransformType);
VisibleCount = Count;
DisplayedCount = Count;
}
/// <summary>
@ -212,7 +212,7 @@ namespace osu.Game.Graphics.UserInterface
if (RollingDuration == 0)
{
VisibleCount = Count;
DisplayedCount = Count;
return;
}

View File

@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
/// <param name="leading">How many leading zeroes the counter will have.</param>
public ScoreCounter(uint leading = 0)
{
CountSpriteText.FixedWidth = true;
DisplayedCountSpriteText.FixedWidth = true;
LeadingZeroes = leading;
}
@ -66,7 +66,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Apply(Drawable d)
{
base.Apply(d);
(d as ScoreCounter).VisibleCount = CurrentValue;
(d as ScoreCounter).DisplayedCount = CurrentValue;
}
public TransformScore(IClock clock)

View File

@ -84,10 +84,10 @@ namespace osu.Game.Graphics.UserInterface
/// <summary>
/// Shows a float count as stars. Used as star difficulty display.
/// </summary>
/// <param name="stars">Maximum amount of stars to display.</param>
public StarCounter(int stars = 10)
/// <param name="maxstars">Maximum amount of stars to display.</param>
public StarCounter(int maxstars = 10)
{
MaxStars = Math.Max(stars, 0);
MaxStars = Math.Max(maxstars, 0);
Children = new Drawable[]
{