1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 16:12:53 +08:00
osu-lazer/osu.Game/Overlays/Mods/ModState.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
2.0 KiB
C#
Raw Normal View History

2022-05-12 00:26:52 +08: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.
using osu.Framework.Bindables;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods
{
/// <summary>
/// Wrapper class used to store the current state of a mod shown on the <see cref="ModSelectOverlay"/>.
/// Used primarily to decouple data from drawable logic.
/// </summary>
public class ModState
{
/// <summary>
/// The mod that whose state this instance describes.
/// </summary>
public Mod Mod { get; }
/// <summary>
/// Whether the mod is currently selected.
/// </summary>
public BindableBool Active { get; } = new BindableBool();
/// <summary>
/// Whether the mod requires further customisation.
/// This flag is read by the <see cref="ModSelectOverlay"/> to determine if the customisation panel should be opened after a mod change
/// and cleared after reading.
/// </summary>
public bool PendingConfiguration { get; set; }
2022-05-12 00:26:52 +08:00
/// <summary>
2023-05-02 19:15:33 +08:00
/// Whether the mod is currently valid for selection.
/// This can be <see langword="false"/> in scenarios such as the free mod select overlay, where not all mods are selectable
/// regardless of search criteria imposed by the user selecting.
2022-05-12 00:26:52 +08:00
/// </summary>
2023-05-02 19:15:33 +08:00
public BindableBool ValidForSelection { get; } = new BindableBool(true);
2023-05-06 03:41:30 +08:00
/// <summary>
/// Whether the mod is matching the current textual filter.
2023-05-06 03:41:30 +08:00
/// </summary>
public BindableBool MatchingTextFilter { get; } = new BindableBool(true);
2023-05-06 03:41:30 +08:00
2023-05-02 19:15:33 +08:00
/// <summary>
/// Whether the <see cref="Mod"/> matches all applicable filters and visible for the user to select.
2023-05-02 19:15:33 +08:00
/// </summary>
public bool Visible => MatchingTextFilter.Value && ValidForSelection.Value;
2022-05-12 00:26:52 +08:00
public ModState(Mod mod)
{
Mod = mod;
}
}
}