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.
|
|
|
|
|
|
|
|
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-09-06 00:32:38 +08:00
|
|
|
public BeatmapInfo Beatmap { get; }
|
|
|
|
|
2021-09-05 23:26:09 +08:00
|
|
|
public DifficultyMenuItem(BeatmapInfo beatmapInfo, bool selected, Action<BeatmapInfo> difficultyChangeFunc)
|
|
|
|
: base(beatmapInfo.Version ?? "(unnamed)", null)
|
|
|
|
{
|
2021-09-06 00:32:38 +08:00
|
|
|
Beatmap = beatmapInfo;
|
2021-09-05 23:26:09 +08:00
|
|
|
State.Value = selected;
|
|
|
|
|
|
|
|
if (!selected)
|
|
|
|
Action.Value = () => difficultyChangeFunc.Invoke(beatmapInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override IconUsage? GetIconForState(bool state) => state ? (IconUsage?)FontAwesome.Solid.Check : null;
|
|
|
|
}
|
|
|
|
}
|