mirror of
https://github.com/ppy/osu
synced 2024-12-15 11:25:29 +00:00
Merge pull request #10993 from LittleEndu/star-scale
Scale stars from 0.4 to 1
This commit is contained in:
commit
30dc0bc019
@ -3,7 +3,6 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -14,44 +13,41 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestFixture]
|
||||
public class TestSceneStarCounter : OsuTestScene
|
||||
{
|
||||
private readonly StarCounter starCounter;
|
||||
private readonly OsuSpriteText starsLabel;
|
||||
|
||||
public TestSceneStarCounter()
|
||||
{
|
||||
StarCounter stars = new StarCounter
|
||||
starCounter = new StarCounter
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Current = 5,
|
||||
};
|
||||
|
||||
Add(stars);
|
||||
Add(starCounter);
|
||||
|
||||
SpriteText starsLabel = new OsuSpriteText
|
||||
starsLabel = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Scale = new Vector2(2),
|
||||
Y = 50,
|
||||
Text = stars.Current.ToString("0.00"),
|
||||
};
|
||||
|
||||
Add(starsLabel);
|
||||
|
||||
AddRepeatStep(@"random value", delegate
|
||||
{
|
||||
stars.Current = RNG.NextSingle() * (stars.StarCount + 1);
|
||||
starsLabel.Text = stars.Current.ToString("0.00");
|
||||
}, 10);
|
||||
setStars(5);
|
||||
|
||||
AddStep(@"Stop animation", delegate
|
||||
{
|
||||
stars.StopAnimation();
|
||||
});
|
||||
AddRepeatStep("random value", () => setStars(RNG.NextSingle() * (starCounter.StarCount + 1)), 10);
|
||||
AddSliderStep("exact value", 0f, 10f, 5f, setStars);
|
||||
AddStep("stop animation", () => starCounter.StopAnimation());
|
||||
AddStep("reset", () => setStars(0));
|
||||
}
|
||||
|
||||
AddStep(@"Reset", delegate
|
||||
{
|
||||
stars.Current = 0;
|
||||
starsLabel.Text = stars.Current.ToString("0.00");
|
||||
});
|
||||
private void setStars(float stars)
|
||||
{
|
||||
starCounter.Current = stars;
|
||||
starsLabel.Text = starCounter.Current.ToString("0.00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public override void DisplayAt(float scale)
|
||||
{
|
||||
scale = Math.Clamp(scale, min_star_scale, 1);
|
||||
scale = (float)Interpolation.Lerp(min_star_scale, 1, Math.Clamp(scale, 0, 1));
|
||||
|
||||
this.FadeTo(scale, fading_duration);
|
||||
Icon.ScaleTo(scale, scaling_duration, scaling_easing);
|
||||
|
Loading…
Reference in New Issue
Block a user