1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Update difficulty icons on headers to match filtered difficulties

This commit is contained in:
Dean Herbert 2017-12-11 20:49:27 +09:00
parent f58c554d19
commit 970e55fc4a
3 changed files with 18 additions and 4 deletions

View File

@ -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)
{

View File

@ -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();
}
}
}
}

View File

@ -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)
{