Hoist ModState to column level

This commit is contained in:
Bartłomiej Dach
2022-05-11 18:37:31 +02:00
parent 74599c9c62
commit e86444c4bf
4 changed files with 27 additions and 16 deletions

View File

@ -57,9 +57,9 @@ namespace osu.Game.Overlays.Mods
private Sample? sampleOff;
private Sample? sampleOn;
public ModPanel(Mod mod)
public ModPanel(ModState modState)
{
modState = new ModState(mod);
this.modState = modState;
RelativeSizeAxes = Axes.X;
Height = 42;
@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Mods
SwitchContainer = new Container
{
RelativeSizeAxes = Axes.Y,
Child = new ModSwitchSmall(mod)
Child = new ModSwitchSmall(Mod)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Mods
{
new OsuSpriteText
{
Text = mod.Name,
Text = Mod.Name,
Font = OsuFont.TorusAlternate.With(size: 18, weight: FontWeight.SemiBold),
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Margin = new MarginPadding
@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Mods
},
new OsuSpriteText
{
Text = mod.Description,
Text = Mod.Description,
Font = OsuFont.Default.With(size: 12),
RelativeSizeAxes = Axes.X,
Truncate = true,
@ -143,6 +143,11 @@ namespace osu.Game.Overlays.Mods
Action = Active.Toggle;
}
public ModPanel(Mod mod)
: this(new ModState(mod))
{
}
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, OsuColour colours, ISamplePlaybackDisabler? samplePlaybackDisabler)
{