From bac4f42eac5015c9b20edc22933138fcf4b95f03 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Dec 2018 19:34:37 +0900 Subject: [PATCH] Fix backgrounds not quite working --- .../UpdateableBeatmapBackgroundSprite.cs | 17 ++++++++++++----- .../Online/API/Requests/Responses/APIBeatmap.cs | 6 +----- osu.Game/Online/Multiplayer/Room.cs | 3 --- .../Multi/Lounge/Components/DrawableRoom.cs | 3 +-- .../Multi/Lounge/Components/RoomInspector.cs | 2 +- .../Screens/Multi/Match/Components/Header.cs | 2 +- osu.Game/Screens/Multi/Match/MatchScreen.cs | 2 +- osu.Game/Screens/Multi/RoomManager.cs | 3 +++ 8 files changed, 20 insertions(+), 18 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 5ced21e436..0a9726b121 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -9,21 +9,28 @@ using osu.Framework.Graphics.Sprites; namespace osu.Game.Beatmaps.Drawables { - public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable + public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable { - public readonly IBindable Beatmap = new Bindable(); + public readonly IBindable Beatmap = new Bindable(); [Resolved] - private OsuGameBase game { get; set; } + private BeatmapManager beatmaps { get; set; } public UpdateableBeatmapBackgroundSprite() { Beatmap.BindValueChanged(b => Schedule(() => Model = b)); } - protected override Drawable CreateDrawable(WorkingBeatmap model) + protected override Drawable CreateDrawable(BeatmapInfo model) { - Drawable drawable = model == null ? (Drawable)new DefaultSprite() : new BeatmapBackgroundSprite(model); + Drawable drawable; + + if (model == null) + drawable = new DefaultSprite(); + else if (model.BeatmapSet?.OnlineInfo != null) + drawable = new BeatmapSetCover(model.BeatmapSet); + else + drawable = new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model)); drawable.RelativeSizeAxes = Axes.Both; drawable.Anchor = Anchor.Centre; diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 193ccf1f6b..b96e4bedf6 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -67,11 +67,7 @@ namespace osu.Game.Online.API.Requests.Responses OnlineBeatmapID = OnlineBeatmapID, Version = version, Status = Status, - BeatmapSet = new BeatmapSetInfo - { - OnlineBeatmapSetID = OnlineBeatmapSetID, - Status = BeatmapSet?.Status ?? BeatmapSetOnlineStatus.None - }, + BeatmapSet = BeatmapSet.ToBeatmapSet(rulesets), BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 56c4585b2a..4af92f68ea 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -63,9 +63,6 @@ namespace osu.Game.Online.Multiplayer Type.Value = other.Type; MaxParticipants.Value = other.MaxParticipants; Participants.Value = other.Participants.Value.ToArray(); - - // Temp: - Beatmap.Value = Playlist.FirstOrDefault()?.Beatmap; } } diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index 57ce9fc0b9..647913308d 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -213,8 +213,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components d.FadeColour(s.GetAppropriateColour(colours), transition_duration); }; - background.Beatmap.BindTo(beatmap); - beatmapBind.BindValueChanged(b => beatmap.Value = beatmaps.GetWorkingBeatmap(b)); nameBind.BindValueChanged(n => name.Text = n); @@ -224,6 +222,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components typeBind.BindTo(Room.Type); beatmapBind.BindTo(Room.Beatmap); participantsBind.BindTo(Room.Participants); + background.Beatmap.BindTo(beatmapBind); modeTypeInfo.Beatmap.BindTo(beatmapBind); modeTypeInfo.Type.BindTo(typeBind); diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs index e8de201b8f..5b796b5a3d 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components nameBind.BindValueChanged(n => name.Text = n); - background.Beatmap.BindTo(beatmap); + background.Beatmap.BindTo(beatmapBind); participantInfo.Host.BindTo(hostBind); participantInfo.Participants.BindTo(participantsBind); diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index b5ae3baa15..005378756e 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Multi.Match.Components { public const float HEIGHT = 200; - public readonly IBindable Beatmap = new Bindable(); + public readonly IBindable Beatmap = new Bindable(); private readonly Box tabStrip; diff --git a/osu.Game/Screens/Multi/Match/MatchScreen.cs b/osu.Game/Screens/Multi/Match/MatchScreen.cs index 755b071f30..a2a7c4e70d 100644 --- a/osu.Game/Screens/Multi/Match/MatchScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchScreen.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi.Match }; header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect()); - header.Beatmap.BindTo(Beatmap); + header.Beatmap.BindTo(beatmapBind); header.Tabs.Current.ValueChanged += t => { diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs index fead90f9a2..d6c5a12d33 100644 --- a/osu.Game/Screens/Multi/RoomManager.cs +++ b/osu.Game/Screens/Multi/RoomManager.cs @@ -69,6 +69,9 @@ namespace osu.Game.Screens.Multi pi.SetRulesets(rulesets); } + // Temporarily + r.Beatmap.Value = r.Playlist.FirstOrDefault()?.Beatmap; + var existing = rooms.FirstOrDefault(e => e.RoomID.Value == r.RoomID.Value); if (existing == null) rooms.Add(r);