1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 22:33:05 +08:00

Apply NRT to FooterButtonMods

This commit is contained in:
Bartłomiej Dach 2024-02-01 21:22:36 +01:00
parent 966093f7ce
commit f87ab19731
No known key found for this signature in database

View File

@ -1,15 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -31,28 +28,14 @@ namespace osu.Game.Screens.Select
set => modDisplay.Current = value; set => modDisplay.Current = value;
} }
protected readonly OsuSpriteText MultiplierText; protected OsuSpriteText MultiplierText { get; private set; } = null!;
private readonly ModDisplay modDisplay; private ModDisplay modDisplay = null!;
private ModSettingChangeTracker? modSettingChangeTracker;
private Color4 lowMultiplierColour; private Color4 lowMultiplierColour;
private Color4 highMultiplierColour; private Color4 highMultiplierColour;
public FooterButtonMods()
{
ButtonContentContainer.Add(modDisplay = new ModDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.8f),
ExpansionMode = ExpansionMode.AlwaysContracted,
});
ButtonContentContainer.Add(MultiplierText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
});
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
@ -62,10 +45,24 @@ namespace osu.Game.Screens.Select
highMultiplierColour = colours.Green; highMultiplierColour = colours.Green;
Text = @"mods"; Text = @"mods";
Hotkey = GlobalAction.ToggleModSelection; Hotkey = GlobalAction.ToggleModSelection;
}
[CanBeNull] ButtonContentContainer.AddRange(new Drawable[]
private ModSettingChangeTracker modSettingChangeTracker; {
modDisplay = new ModDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.8f),
ExpansionMode = ExpansionMode.AlwaysContracted,
},
MultiplierText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
}
});
}
protected override void LoadComplete() protected override void LoadComplete()
{ {