mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:42:58 +08:00
Simplify schedule logic in DrawableRoomPlaylistItem
This commit is contained in:
parent
9a88339f0c
commit
49cdcffa30
@ -13,7 +13,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Threading;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -87,23 +86,15 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
SelectedItem.BindValueChanged(selected => maskingContainer.BorderThickness = selected.NewValue == Model ? 5 : 0, true);
|
SelectedItem.BindValueChanged(selected => maskingContainer.BorderThickness = selected.NewValue == Model ? 5 : 0, true);
|
||||||
|
|
||||||
beatmap.BindValueChanged(_ => scheduleRefresh());
|
beatmap.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||||
ruleset.BindValueChanged(_ => scheduleRefresh());
|
ruleset.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||||
|
requiredMods.CollectionChanged += (_, __) => Scheduler.AddOnce(refresh);
|
||||||
requiredMods.CollectionChanged += (_, __) => scheduleRefresh();
|
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate scheduledRefresh;
|
|
||||||
private PanelBackground panelBackground;
|
private PanelBackground panelBackground;
|
||||||
|
|
||||||
private void scheduleRefresh()
|
|
||||||
{
|
|
||||||
scheduledRefresh?.Cancel();
|
|
||||||
scheduledRefresh = Schedule(refresh);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refresh()
|
private void refresh()
|
||||||
{
|
{
|
||||||
difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(32) };
|
difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(32) };
|
||||||
|
Loading…
Reference in New Issue
Block a user