1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Line wrapping

This commit is contained in:
Adonais Romero González 2016-10-07 16:14:35 -05:00
parent 35325fab95
commit 965e542eaf
5 changed files with 27 additions and 25 deletions

View File

@ -13,14 +13,14 @@ using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
/// <summary> /// <summary>
/// Allows tint and vertical scaling animation. Used by osu!taiko and osu!mania. /// Allows tint and vertical scaling animation. Used in osu!taiko and osu!mania.
/// </summary> /// </summary>
public class AlternativeComboCounter : ULongCounter // btw, I'm terribly bad with names... OUENDAN! public class AlternativeComboCounter : ULongCounter // btw, I'm terribly bad with names... OUENDAN!
{ {
public Color4 OriginalColour; public Color4 OriginalColour;
public Color4 TintColour = Color4.OrangeRed; public Color4 TintColour = Color4.OrangeRed;
public int TintDuration = 500; public int TintDuration = 500;
public float ScaleFactor = 1; public float ScaleFactor = 2;
public EasingTypes TintEasing = EasingTypes.None; public EasingTypes TintEasing = EasingTypes.None;
public bool CanAnimateWhenBackwards = false; public bool CanAnimateWhenBackwards = false;
@ -72,7 +72,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
if (countSpriteText != null) if (countSpriteText != null)
{ {
countSpriteText.Text = newValue.ToString(@"#,0"); countSpriteText.Text = newValue.ToString("#,0");
if (newValue == 0) if (newValue == 0)
{ {
countSpriteText.FadeOut(TintDuration); countSpriteText.FadeOut(TintDuration);

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
/// <summary> /// <summary>
/// Similar to Standard, but without the 'x' and has colour shadows. Used by osu!catch. /// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch.
/// </summary> /// </summary>
public class CatchComboCounter : StandardComboCounter public class CatchComboCounter : StandardComboCounter
{ {
@ -36,6 +36,7 @@ namespace osu.Game.Graphics.UserInterface
} }
else else
{ {
// Backwards pop-up animation has no tint colour
popOutSpriteText.Colour = countSpriteText.Colour; popOutSpriteText.Colour = countSpriteText.Colour;
transformCount(new TranformULongCounter(Clock), currentValue, newValue); transformCount(new TranformULongCounter(Clock), currentValue, newValue);
} }

View File

@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
/// <summary> /// <summary>
/// Skeleton for a counter with a simple rollover animation. /// Skeleton for a counter with a simple roll-up animation.
/// </summary> /// </summary>
/// <typeparam name="T">Type of the actual counter.</typeparam> /// <typeparam name="T">Type of the actual counter.</typeparam>
public abstract class RollingCounter<T> : Container public abstract class RollingCounter<T> : Container
@ -35,18 +35,18 @@ namespace osu.Game.Graphics.UserInterface
/// <summary> /// <summary>
/// If true, each time the Count is updated, it will roll over from the current visible value. /// If true, each time the Count is updated, it will roll over from the current visible value.
/// Else, it will roll over from the current count value. /// Else, it will roll up from the current count value.
/// </summary> /// </summary>
public bool IsRollingContinuous = true; public bool IsRollingContinuous = true;
/// <summary> /// <summary>
/// If true, the rollover duration will be proportional to the counter. /// If true, the roll-up duration will be proportional to the counter.
/// </summary> /// </summary>
public bool IsRollingProportional = false; public bool IsRollingProportional = false;
/// <summary> /// <summary>
/// If IsRollingProportional = false, duration in milliseconds for the counter rollover animation for each element. /// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each element.
/// If IsRollingProportional = true, duration in milliseconds for the counter rollover animation in total. /// If IsRollingProportional = true, duration in milliseconds for the counter roll-up animation in total.
/// </summary> /// </summary>
public ulong RollingDuration = 0; public ulong RollingDuration = 0;
@ -90,7 +90,10 @@ namespace osu.Game.Graphics.UserInterface
{ {
if (Clock != null) if (Clock != null)
{ {
RollingTotalDuration = IsRollingProportional ? GetProportionalDuration(VisibleCount, value) : RollingDuration; RollingTotalDuration =
IsRollingProportional
? GetProportionalDuration(VisibleCount, value)
: RollingDuration;
transformCount(IsRollingContinuous ? VisibleCount : count, value); transformCount(IsRollingContinuous ? VisibleCount : count, value);
} }
count = value; count = value;
@ -117,11 +120,12 @@ namespace osu.Game.Graphics.UserInterface
} }
/// <summary> /// <summary>
/// Calculates the duration of the rollover animation by using the difference between the current visible value and the new final value. /// Calculates the duration of the roll-up animation by using the difference between the current visible value
/// and the new final value.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Intended to be used in conjunction with IsRolloverProportional = true. /// Intended to be used in conjunction with IsRollingProportional = true.
/// If you're sure your superclass won't never need to be proportional, then it is not necessary to override this function. /// Unless a derived class needs to have a proportional rolling, it is not necessary to override this function.
/// </remarks> /// </remarks>
/// <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>
@ -178,15 +182,17 @@ namespace osu.Game.Graphics.UserInterface
} }
/// <summary> /// <summary>
/// Called when the count is updated to add a transformer that changes the value of the visible count (i.e. implement the rollover animation). /// Called when the count is updated to add a transformer that changes the value of the visible count (i.e.
/// implement the rollover animation).
/// </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> /// <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 /// Unless you need to set a custom animation according to the current or new value of the count, the
/// transformCount(CustomTransformer(Clock), currentValue, newValue), where CustomTransformer is a custom Transformer related to the /// recommended approach is to call transformCount(CustomTransformer(Clock), currentValue, newValue), where
/// type T of the RolloverCounter. /// CustomTransformer is a custom Transformer related to the type T of the RolloverCounter.
/// By using this approach, there is no need to check if the Clock is not null; this validation is done before adding the transformer. /// 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> /// </remarks>
protected abstract void transformCount(T currentValue, T newValue); protected abstract void transformCount(T currentValue, T newValue);

View File

@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
/// <summary> /// <summary>
/// Uses the 'x' symbol and has a pop-out effect while rolling over. Used by osu! standard. /// Uses the 'x' symbol and has a pop-out effect while rolling over. Used in osu! standard.
/// </summary> /// </summary>
public class StandardComboCounter : ULongCounter public class StandardComboCounter : ULongCounter
{ {
@ -44,11 +44,6 @@ namespace osu.Game.Graphics.UserInterface
}); });
} }
public override void ResetCount()
{
SetCountWithoutRolling(0);
}
protected override void updateTextSize() protected override void updateTextSize()
{ {
base.updateTextSize(); base.updateTextSize();

View File

@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
/// <summary> /// <summary>
/// A simple rollover counter that accepts unsigned long values. /// A simple rolling counter that accepts unsigned long values.
/// </summary> /// </summary>
public class ULongCounter : RollingCounter<ulong> public class ULongCounter : RollingCounter<ulong>
{ {