1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Fix several oversights in data linking causing drawable rooms not updating as expected

This commit is contained in:
Dean Herbert 2022-02-24 16:12:15 +09:00
parent 53bbd00675
commit c6d78b9325
3 changed files with 11 additions and 10 deletions

View File

@ -46,6 +46,7 @@ namespace osu.Game.Online.Rooms
public readonly Bindable<RoomPlaylistItemStats> PlaylistItemStats = new Bindable<RoomPlaylistItemStats>();
[JsonProperty("difficulty_range")]
[Cached]
public readonly Bindable<RoomDifficultyRange> DifficultyRange = new Bindable<RoomDifficultyRange>();
[Cached]
@ -190,6 +191,7 @@ namespace osu.Game.Online.Rooms
QueueMode.Value = other.QueueMode.Value;
DifficultyRange.Value = other.DifficultyRange.Value;
PlaylistItemStats.Value = other.PlaylistItemStats.Value;
CurrentPlaylistItem.Value = other.CurrentPlaylistItem.Value;
if (EndDate.Value != null && DateTimeOffset.Now >= EndDate.Value)
Status.Value = new RoomStatusEnded();

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Specialized;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -12,7 +11,6 @@ using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Online.Rooms;
using osuTK;
namespace osu.Game.Screens.OnlinePlay.Components
@ -72,25 +70,23 @@ namespace osu.Game.Screens.OnlinePlay.Components
};
}
[Resolved]
private Room room { get; set; }
protected override void LoadComplete()
{
base.LoadComplete();
Playlist.BindCollectionChanged(updateRange, true);
DifficultyRange.BindValueChanged(_ => updateRange());
Playlist.BindCollectionChanged((_, __) => updateRange(), true);
}
private void updateRange(object sender, NotifyCollectionChangedEventArgs e)
private void updateRange()
{
StarDifficulty minDifficulty;
StarDifficulty maxDifficulty;
if (room.DifficultyRange.Value != null)
if (DifficultyRange.Value != null)
{
minDifficulty = new StarDifficulty(room.DifficultyRange.Value.Min, 0);
maxDifficulty = new StarDifficulty(room.DifficultyRange.Value.Max, 0);
minDifficulty = new StarDifficulty(DifficultyRange.Value.Min, 0);
maxDifficulty = new StarDifficulty(DifficultyRange.Value.Max, 0);
}
else
{

View File

@ -41,6 +41,9 @@ namespace osu.Game.Screens.OnlinePlay
[Resolved(typeof(Room))]
protected BindableList<PlaylistItem> Playlist { get; private set; }
[Resolved(typeof(Room))]
protected Bindable<Room.RoomDifficultyRange> DifficultyRange { get; private set; }
[Resolved(typeof(Room))]
protected Bindable<RoomCategory> Category { get; private set; }