1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 10:27:35 +08:00
osu-lazer/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs

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

30 lines
1004 B
C#
Raw Normal View History

2021-09-05 23:26:09 +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.
2022-06-17 15:37:17 +08:00
#nullable disable
2021-09-05 23:26:09 +08:00
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit.Components.Menus
{
public class DifficultyMenuItem : StatefulMenuItem<bool>
{
2021-10-02 23:55:29 +08:00
public BeatmapInfo BeatmapInfo { get; }
2021-09-05 23:26:09 +08:00
public DifficultyMenuItem(BeatmapInfo beatmapInfo, bool selected, Action<BeatmapInfo> difficultyChangeFunc)
2022-01-12 21:34:07 +08:00
: base(string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? "(unnamed)" : beatmapInfo.DifficultyName, null)
2021-09-05 23:26:09 +08:00
{
2021-10-02 23:55:29 +08:00
BeatmapInfo = beatmapInfo;
2021-09-05 23:26:09 +08:00
State.Value = selected;
if (!selected)
Action.Value = () => difficultyChangeFunc.Invoke(beatmapInfo);
}
2022-06-24 13:48:43 +08:00
public override IconUsage? GetIconForState(bool state) => state ? FontAwesome.Solid.Check : null;
2021-09-05 23:26:09 +08:00
}
}