mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 00:42:55 +08:00
Remove new bindables from RoomSubScreen
This commit is contained in:
parent
05200e8970
commit
c70ff11085
@ -69,18 +69,6 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
/// </summary>
|
||||
protected readonly Bindable<IReadOnlyList<Mod>> UserMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
|
||||
/// <summary>
|
||||
/// When players are freely allowed to select their own gameplay style (selected item has a non-null beatmapset id),
|
||||
/// a non-null value indicates a local beatmap selection from the same beatmapset as the selected item.
|
||||
/// </summary>
|
||||
public readonly Bindable<BeatmapInfo?> UserBeatmap = new Bindable<BeatmapInfo?>();
|
||||
|
||||
/// <summary>
|
||||
/// When players are freely allowed to select their own gameplay style (selected item has a non-null beatmapset id),
|
||||
/// a non-null value indicates a local ruleset selection.
|
||||
/// </summary>
|
||||
public readonly Bindable<RulesetInfo?> UserRuleset = new Bindable<RulesetInfo?>();
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IOverlayManager? overlayManager { get; set; }
|
||||
|
||||
@ -273,8 +261,6 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(OnSelectedItemChanged));
|
||||
UserMods.BindValueChanged(_ => Scheduler.AddOnce(OnSelectedItemChanged));
|
||||
UserBeatmap.BindValueChanged(_ => Scheduler.AddOnce(OnSelectedItemChanged));
|
||||
UserRuleset.BindValueChanged(_ => Scheduler.AddOnce(OnSelectedItemChanged));
|
||||
|
||||
beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem);
|
||||
beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateSpecifics());
|
||||
@ -507,14 +493,11 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual APIMod[] GetGameplayMods()
|
||||
=> UserMods.Value.Select(m => new APIMod(m)).Concat(SelectedItem.Value!.RequiredMods).ToArray();
|
||||
protected virtual APIMod[] GetGameplayMods() => UserMods.Value.Select(m => new APIMod(m)).Concat(SelectedItem.Value!.RequiredMods).ToArray();
|
||||
|
||||
protected virtual RulesetInfo GetGameplayRuleset()
|
||||
=> Rulesets.GetRuleset(UserRuleset.Value?.OnlineID ?? SelectedItem.Value!.RulesetID)!;
|
||||
protected virtual RulesetInfo GetGameplayRuleset() => Rulesets.GetRuleset(SelectedItem.Value!.RulesetID)!;
|
||||
|
||||
protected virtual IBeatmapInfo GetGameplayBeatmap()
|
||||
=> UserBeatmap.Value ?? SelectedItem.Value!.Beatmap;
|
||||
protected virtual IBeatmapInfo GetGameplayBeatmap() => SelectedItem.Value!.Beatmap;
|
||||
|
||||
protected abstract void OpenStyleSelection();
|
||||
|
||||
|
@ -388,7 +388,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
return;
|
||||
}
|
||||
|
||||
updateCurrentItem();
|
||||
SelectedItem.Value = Room.Playlist.SingleOrDefault(i => i.ID == client.Room.Settings.PlaylistItemId);
|
||||
|
||||
addItemButton.Alpha = localUserCanAddItem ? 1 : 0;
|
||||
|
||||
@ -400,15 +400,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
private bool localUserCanAddItem => client.IsHost || Room.QueueMode != QueueMode.HostOnly;
|
||||
|
||||
private void updateCurrentItem()
|
||||
{
|
||||
Debug.Assert(client.Room != null);
|
||||
|
||||
SelectedItem.Value = Room.Playlist.SingleOrDefault(i => i.ID == client.Room.Settings.PlaylistItemId);
|
||||
UserBeatmap.Value = client.LocalUser?.BeatmapId == null ? null : UserBeatmap.Value;
|
||||
UserRuleset.Value = client.LocalUser?.RulesetId == null ? null : UserRuleset.Value;
|
||||
}
|
||||
|
||||
private void handleRoomLost() => Schedule(() =>
|
||||
{
|
||||
Logger.Log($"{this} exiting due to loss of room or connection");
|
||||
|
@ -11,11 +11,13 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Input;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Match;
|
||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
@ -46,6 +48,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
private FillFlowContainer progressSection = null!;
|
||||
private DrawableRoomPlaylist drawablePlaylist = null!;
|
||||
|
||||
private readonly Bindable<BeatmapInfo?> userBeatmap = new Bindable<BeatmapInfo?>();
|
||||
private readonly Bindable<RulesetInfo?> userRuleset = new Bindable<RulesetInfo?>();
|
||||
|
||||
public PlaylistsRoomSubScreen(Room room)
|
||||
: base(room, false) // Editing is temporarily not allowed.
|
||||
{
|
||||
@ -78,10 +83,13 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
private void onSelectedItemChanged(ValueChangedEvent<PlaylistItem?> item)
|
||||
{
|
||||
// Simplest for now.
|
||||
UserBeatmap.Value = null;
|
||||
UserRuleset.Value = null;
|
||||
userBeatmap.Value = null;
|
||||
userRuleset.Value = null;
|
||||
}
|
||||
|
||||
protected override IBeatmapInfo GetGameplayBeatmap() => userBeatmap.Value ?? base.GetGameplayBeatmap();
|
||||
protected override RulesetInfo GetGameplayRuleset() => userRuleset.Value ?? base.GetGameplayRuleset();
|
||||
|
||||
private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
@ -313,8 +321,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
|
||||
this.Push(new PlaylistsRoomStyleSelect(Room, item)
|
||||
{
|
||||
Beatmap = { BindTarget = UserBeatmap },
|
||||
Ruleset = { BindTarget = UserRuleset }
|
||||
Beatmap = { BindTarget = userBeatmap },
|
||||
Ruleset = { BindTarget = userRuleset }
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user