mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Remove "current" multiplayer room item
This commit is contained in:
@ -33,6 +33,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
public Action RequestBeatmapSelection;
|
||||
|
||||
private MatchBeatmapPanel beatmapPanel;
|
||||
private ModDisplay modDisplay;
|
||||
|
||||
public Header()
|
||||
{
|
||||
@ -44,7 +45,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
BeatmapSelectButton beatmapButton;
|
||||
ModDisplay modDisplay;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -120,9 +120,12 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
},
|
||||
};
|
||||
|
||||
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods?.ToArray() ?? Array.Empty<Mod>(), true);
|
||||
|
||||
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
|
||||
|
||||
Playlist.ItemsAdded += _ => updateMods();
|
||||
Playlist.ItemsRemoved += _ => updateMods();
|
||||
|
||||
updateMods();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -131,6 +134,13 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
ShowBeatmapPanel.BindValueChanged(value => beatmapPanel.FadeTo(value.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
|
||||
}
|
||||
|
||||
private void updateMods()
|
||||
{
|
||||
var item = Playlist.FirstOrDefault();
|
||||
|
||||
modDisplay.Current.Value = item?.RequiredMods?.ToArray() ?? Array.Empty<Mod>();
|
||||
}
|
||||
|
||||
private class BeatmapSelectButton : HeaderButton
|
||||
{
|
||||
[Resolved(typeof(Room), nameof(Room.RoomID))]
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -18,6 +19,8 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public Action OnStart;
|
||||
|
||||
private ReadyButton readyButton;
|
||||
|
||||
public Info()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -27,7 +30,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ReadyButton readyButton;
|
||||
HostInfo hostInfo;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
@ -89,9 +91,17 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
},
|
||||
};
|
||||
|
||||
CurrentItem.BindValueChanged(item => readyButton.Beatmap.Value = item.NewValue?.Beatmap.Value, true);
|
||||
|
||||
hostInfo.Host.BindTo(Host);
|
||||
|
||||
Playlist.ItemsAdded += _ => updateBeatmap();
|
||||
Playlist.ItemsRemoved += _ => updateBeatmap();
|
||||
|
||||
updateBeatmap();
|
||||
}
|
||||
|
||||
private void updateBeatmap()
|
||||
{
|
||||
readyButton.Beatmap.Value = Playlist.FirstOrDefault()?.Beatmap.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
// 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.Linq;
|
||||
using System.Threading;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Direct;
|
||||
@ -32,10 +32,13 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
CurrentItem.BindValueChanged(item => loadNewPanel(item.NewValue?.Beatmap.Value), true);
|
||||
Playlist.ItemsAdded += _ => loadNewPanel();
|
||||
Playlist.ItemsRemoved += _ => loadNewPanel();
|
||||
|
||||
loadNewPanel();
|
||||
}
|
||||
|
||||
private void loadNewPanel(BeatmapInfo beatmap)
|
||||
private void loadNewPanel()
|
||||
{
|
||||
loadCancellation?.Cancel();
|
||||
request?.Cancel();
|
||||
@ -44,6 +47,8 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
panel?.Expire();
|
||||
panel = null;
|
||||
|
||||
var beatmap = Playlist.FirstOrDefault()?.Beatmap.Value;
|
||||
|
||||
if (beatmap?.OnlineBeatmapID == null)
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user