mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 06:42:56 +08:00
Rewrite DMD
This commit is contained in:
parent
3f93ec8538
commit
324a3723a5
@ -3,14 +3,9 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
@ -20,34 +15,19 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
protected override LocalisableString Label => DifficultyMultiplierDisplayStrings.DifficultyMultiplier;
|
||||
|
||||
private readonly MultiplierCounter multiplierCounter;
|
||||
protected override string CounterFormat => @"N2";
|
||||
|
||||
public DifficultyMultiplierDisplay()
|
||||
{
|
||||
Current.Default = 1d;
|
||||
Current.Value = 1d;
|
||||
Add(new FillFlowContainer
|
||||
Add(new SpriteIcon
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(2, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
multiplierCounter = new MultiplierCounter
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Current = { BindTarget = Current }
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Icon = FontAwesome.Solid.Times,
|
||||
Size = new Vector2(7),
|
||||
Margin = new MarginPadding { Top = 1 }
|
||||
}
|
||||
}
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Icon = FontAwesome.Solid.Times,
|
||||
Size = new Vector2(7),
|
||||
Margin = new MarginPadding { Top = 1 }
|
||||
});
|
||||
}
|
||||
|
||||
@ -57,19 +37,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
// required to prevent the counter initially rolling up from 0 to 1
|
||||
// due to `Current.Value` having a nonstandard default value of 1.
|
||||
multiplierCounter.SetCountWithoutRolling(Current.Value);
|
||||
}
|
||||
|
||||
private class MultiplierCounter : RollingCounter<double>
|
||||
{
|
||||
protected override double RollingDuration => 500;
|
||||
|
||||
protected override LocalisableString FormatCount(double count) => count.ToLocalisableString(@"N2");
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText() => new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
|
||||
};
|
||||
Counter.SetCountWithoutRolling(Current.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user