2022-02-20 14:48:33 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2022-02-20 14:48:33 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-02-20 15:02:46 +00:00
|
|
|
using osu.Framework.Localisation;
|
2022-02-20 14:48:33 +00:00
|
|
|
using osuTK;
|
2022-05-07 08:48:15 +00:00
|
|
|
using osu.Game.Localisation;
|
2022-02-20 14:48:33 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Mods
|
|
|
|
{
|
2022-09-10 05:21:38 +00:00
|
|
|
public sealed class DifficultyMultiplierDisplay : ModsEffectDisplay
|
2022-02-20 14:48:33 +00:00
|
|
|
{
|
2022-08-27 17:26:05 +00:00
|
|
|
protected override LocalisableString Label => DifficultyMultiplierDisplayStrings.DifficultyMultiplier;
|
2022-02-20 14:48:33 +00:00
|
|
|
|
2022-09-10 20:23:04 +00:00
|
|
|
protected override string CounterFormat => @"N2";
|
2022-02-20 14:48:33 +00:00
|
|
|
|
|
|
|
public DifficultyMultiplierDisplay()
|
|
|
|
{
|
2022-08-29 19:48:45 +00:00
|
|
|
Current.Default = 1d;
|
|
|
|
Current.Value = 1d;
|
2022-09-10 20:23:04 +00:00
|
|
|
Add(new SpriteIcon
|
2022-02-20 14:48:33 +00:00
|
|
|
{
|
2022-09-10 20:23:04 +00:00
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
Icon = FontAwesome.Solid.Times,
|
|
|
|
Size = new Vector2(7),
|
|
|
|
Margin = new MarginPadding { Top = 1 }
|
2022-08-27 17:26:05 +00:00
|
|
|
});
|
2022-02-20 14:48:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
2022-04-05 09:25:27 +00:00
|
|
|
|
2022-03-07 22:11:20 +00:00
|
|
|
// required to prevent the counter initially rolling up from 0 to 1
|
|
|
|
// due to `Current.Value` having a nonstandard default value of 1.
|
2022-09-10 20:23:04 +00:00
|
|
|
Counter.SetCountWithoutRolling(Current.Value);
|
2022-02-20 15:02:46 +00:00
|
|
|
}
|
2022-02-20 14:48:33 +00:00
|
|
|
}
|
|
|
|
}
|