mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:47:29 +08:00
Update difficulty icons on headers to match filtered difficulties
This commit is contained in:
parent
f58c554d19
commit
970e55fc4a
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -61,7 +62,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
public bool Filtered { get; set; }
|
||||
public BindableBool Filtered = new BindableBool();
|
||||
|
||||
protected override void ApplyState(PanelSelectedState last = PanelSelectedState.Hidden)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -157,8 +158,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
if (panels == null)
|
||||
throw new ArgumentNullException(nameof(panels));
|
||||
|
||||
foreach (var p in panels)
|
||||
difficultyIcons.Add(new DifficultyIcon(p.Beatmap));
|
||||
difficultyIcons.AddRange(panels.Select(p => new FilterableDifficultyIcon(p)));
|
||||
}
|
||||
|
||||
public MenuItem[] ContextMenuItems
|
||||
@ -178,5 +178,18 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
return items.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public class FilterableDifficultyIcon : DifficultyIcon
|
||||
{
|
||||
private readonly BindableBool filtered = new BindableBool();
|
||||
|
||||
public FilterableDifficultyIcon(BeatmapPanel panel)
|
||||
: base(panel.Beatmap)
|
||||
{
|
||||
filtered.BindTo(panel.Filtered);
|
||||
filtered.ValueChanged += v => this.FadeTo(v ? 0.1f : 1, 100);
|
||||
filtered.TriggerChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Select
|
||||
match &= set.Metadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||
|
||||
foreach (var panel in g.BeatmapPanels)
|
||||
panel.Filtered = !canConvert(panel.Beatmap);
|
||||
panel.Filtered.Value = !canConvert(panel.Beatmap);
|
||||
|
||||
switch (g.State)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user