// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Screens.Play.HUD; using osu.Game.Rulesets.Mods; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osuTK; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Select { public class FooterButtonMods : FooterButton, IHasCurrentValue> { public Bindable> Current { get => modDisplay.Current; set => modDisplay.Current = value; } private readonly ModDisplay modDisplay; public FooterButtonMods() { ButtonContentContainer.Add(modDisplay = new ModDisplay { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(0.8f), ExpansionMode = ExpansionMode.AlwaysContracted, }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { SelectedColour = colours.Yellow; DeselectedColour = SelectedColour.Opacity(0.5f); Text = @"mods"; Hotkey = GlobalAction.ToggleModSelection; } protected override void LoadComplete() { base.LoadComplete(); Current.BindValueChanged(_ => updateMultiplierText(), true); } private void updateMultiplierText() { if (Current.Value?.Count > 0) modDisplay.FadeIn(); else modDisplay.FadeOut(); } } }