mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Add ability for playlist items to be marked as invalid
This commit is contained in:
@ -30,6 +30,11 @@ namespace osu.Game.Online.Rooms
|
|||||||
[JsonProperty("expired")]
|
[JsonProperty("expired")]
|
||||||
public bool Expired { get; set; }
|
public bool Expired { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public IBindable<bool> Valid => valid;
|
||||||
|
|
||||||
|
private readonly Bindable<bool> valid = new BindableBool(true);
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
|
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
|
||||||
|
|
||||||
@ -69,6 +74,8 @@ namespace osu.Game.Online.Rooms
|
|||||||
Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.ID ?? 0);
|
Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.ID ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MarkInvalid() => valid.Value = false;
|
||||||
|
|
||||||
public void MapObjects(RulesetStore rulesets)
|
public void MapObjects(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
Beatmap.Value ??= apiBeatmap;
|
Beatmap.Value ??= apiBeatmap;
|
||||||
|
@ -45,6 +45,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private ModDisplay modDisplay;
|
private ModDisplay modDisplay;
|
||||||
|
|
||||||
private readonly Bindable<IBeatmapInfo> beatmap = new Bindable<IBeatmapInfo>();
|
private readonly Bindable<IBeatmapInfo> beatmap = new Bindable<IBeatmapInfo>();
|
||||||
|
private readonly IBindable<bool> valid = new Bindable<bool>();
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
|
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
|
||||||
|
|
||||||
@ -65,14 +66,18 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
this.allowSelection = allowSelection;
|
this.allowSelection = allowSelection;
|
||||||
|
|
||||||
beatmap.BindTo(item.Beatmap);
|
beatmap.BindTo(item.Beatmap);
|
||||||
|
valid.BindTo(item.Valid);
|
||||||
ruleset.BindTo(item.Ruleset);
|
ruleset.BindTo(item.Ruleset);
|
||||||
requiredMods.BindTo(item.RequiredMods);
|
requiredMods.BindTo(item.RequiredMods);
|
||||||
|
|
||||||
ShowDragHandle.Value = allowEdit;
|
ShowDragHandle.Value = allowEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load()
|
||||||
{
|
{
|
||||||
if (!allowEdit)
|
if (!allowEdit)
|
||||||
HandleColour = HandleColour.Opacity(0);
|
HandleColour = HandleColour.Opacity(0);
|
||||||
@ -88,6 +93,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
beatmap.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
beatmap.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||||
ruleset.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
ruleset.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||||
|
valid.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||||
requiredMods.CollectionChanged += (_, __) => Scheduler.AddOnce(refresh);
|
requiredMods.CollectionChanged += (_, __) => Scheduler.AddOnce(refresh);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
@ -97,6 +103,12 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
private void refresh()
|
private void refresh()
|
||||||
{
|
{
|
||||||
|
if (!valid.Value)
|
||||||
|
{
|
||||||
|
maskingContainer.BorderThickness = 5;
|
||||||
|
maskingContainer.BorderColour = colours.Red;
|
||||||
|
}
|
||||||
|
|
||||||
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) };
|
||||||
|
|
||||||
panelBackground.Beatmap.Value = Item.Beatmap.Value;
|
panelBackground.Beatmap.Value = Item.Beatmap.Value;
|
||||||
|
Reference in New Issue
Block a user