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

Adjusted StarCounter ctor

This commit is contained in:
Adonais Romero González 2016-10-12 20:51:50 -05:00
parent e9a38f0c4d
commit 73e4359e9d

View File

@ -27,19 +27,35 @@ namespace osu.Game.Graphics.UserInterface
protected Container starContainer; protected Container starContainer;
protected List<TextAwesome> stars = new List<TextAwesome>(); protected List<TextAwesome> stars = new List<TextAwesome>();
public int MaxStars
{
get;
protected set;
}
public ulong StarAnimationDuration = 500; public ulong StarAnimationDuration = 500;
public EasingTypes StarAnimationEasing = EasingTypes.OutElasticHalf; public EasingTypes StarAnimationEasing = EasingTypes.OutElasticHalf;
public ulong FadeDuration = 100; public ulong FadeDuration = 100;
public float MinStarSize = 0.3f; public float MinStarSize = 0.3f;
public float MinStarAlpha = 0.5f; public float MinStarAlpha = 0.5f;
public int MaxStars = 10;
public int StarSize = 20; public int StarSize = 20;
public int StarSpacing = 4; public int StarSpacing = 4;
public StarCounter() : base() public StarCounter(int stars = 10) : base()
{ {
IsRollingProportional = true; IsRollingProportional = true;
RollingDuration = 150; RollingDuration = 150;
MaxStars = stars;
Children = new Drawable[]
{
starContainer = new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
}
};
} }
protected override ulong getProportionalDuration(float currentValue, float newValue) protected override ulong getProportionalDuration(float currentValue, float newValue)
@ -57,16 +73,8 @@ namespace osu.Game.Graphics.UserInterface
{ {
base.Load(game); base.Load(game);
Children = new Drawable[] starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
{ starContainer.Height = StarSize;
starContainer = new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing,
Height = StarSize,
}
};
for (int i = 0; i < MaxStars; i++) for (int i = 0; i < MaxStars; i++)
{ {