1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Fix backgrounds not quite working

This commit is contained in:
smoogipoo 2018-12-12 19:34:37 +09:00
parent 450e4cd223
commit bac4f42eac
8 changed files with 20 additions and 18 deletions

View File

@ -9,21 +9,28 @@ using osu.Framework.Graphics.Sprites;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<WorkingBeatmap> public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<BeatmapInfo>
{ {
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
[Resolved] [Resolved]
private OsuGameBase game { get; set; } private BeatmapManager beatmaps { get; set; }
public UpdateableBeatmapBackgroundSprite() public UpdateableBeatmapBackgroundSprite()
{ {
Beatmap.BindValueChanged(b => Schedule(() => Model = b)); 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.RelativeSizeAxes = Axes.Both;
drawable.Anchor = Anchor.Centre; drawable.Anchor = Anchor.Centre;

View File

@ -67,11 +67,7 @@ namespace osu.Game.Online.API.Requests.Responses
OnlineBeatmapID = OnlineBeatmapID, OnlineBeatmapID = OnlineBeatmapID,
Version = version, Version = version,
Status = Status, Status = Status,
BeatmapSet = new BeatmapSetInfo BeatmapSet = BeatmapSet.ToBeatmapSet(rulesets),
{
OnlineBeatmapSetID = OnlineBeatmapSetID,
Status = BeatmapSet?.Status ?? BeatmapSetOnlineStatus.None
},
BaseDifficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
DrainRate = drainRate, DrainRate = drainRate,

View File

@ -63,9 +63,6 @@ namespace osu.Game.Online.Multiplayer
Type.Value = other.Type; Type.Value = other.Type;
MaxParticipants.Value = other.MaxParticipants; MaxParticipants.Value = other.MaxParticipants;
Participants.Value = other.Participants.Value.ToArray(); Participants.Value = other.Participants.Value.ToArray();
// Temp:
Beatmap.Value = Playlist.FirstOrDefault()?.Beatmap;
} }
} }

View File

@ -213,8 +213,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
d.FadeColour(s.GetAppropriateColour(colours), transition_duration); d.FadeColour(s.GetAppropriateColour(colours), transition_duration);
}; };
background.Beatmap.BindTo(beatmap);
beatmapBind.BindValueChanged(b => beatmap.Value = beatmaps.GetWorkingBeatmap(b)); beatmapBind.BindValueChanged(b => beatmap.Value = beatmaps.GetWorkingBeatmap(b));
nameBind.BindValueChanged(n => name.Text = n); nameBind.BindValueChanged(n => name.Text = n);
@ -224,6 +222,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
typeBind.BindTo(Room.Type); typeBind.BindTo(Room.Type);
beatmapBind.BindTo(Room.Beatmap); beatmapBind.BindTo(Room.Beatmap);
participantsBind.BindTo(Room.Participants); participantsBind.BindTo(Room.Participants);
background.Beatmap.BindTo(beatmapBind);
modeTypeInfo.Beatmap.BindTo(beatmapBind); modeTypeInfo.Beatmap.BindTo(beatmapBind);
modeTypeInfo.Type.BindTo(typeBind); modeTypeInfo.Type.BindTo(typeBind);

View File

@ -180,7 +180,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
nameBind.BindValueChanged(n => name.Text = n); nameBind.BindValueChanged(n => name.Text = n);
background.Beatmap.BindTo(beatmap); background.Beatmap.BindTo(beatmapBind);
participantInfo.Host.BindTo(hostBind); participantInfo.Host.BindTo(hostBind);
participantInfo.Participants.BindTo(participantsBind); participantInfo.Participants.BindTo(participantsBind);

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
public const float HEIGHT = 200; public const float HEIGHT = 200;
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
private readonly Box tabStrip; private readonly Box tabStrip;

View File

@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi.Match
}; };
header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect()); header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect());
header.Beatmap.BindTo(Beatmap); header.Beatmap.BindTo(beatmapBind);
header.Tabs.Current.ValueChanged += t => header.Tabs.Current.ValueChanged += t =>
{ {

View File

@ -69,6 +69,9 @@ namespace osu.Game.Screens.Multi
pi.SetRulesets(rulesets); pi.SetRulesets(rulesets);
} }
// Temporarily
r.Beatmap.Value = r.Playlist.FirstOrDefault()?.Beatmap;
var existing = rooms.FirstOrDefault(e => e.RoomID.Value == r.RoomID.Value); var existing = rooms.FirstOrDefault(e => e.RoomID.Value == r.RoomID.Value);
if (existing == null) if (existing == null)
rooms.Add(r); rooms.Add(r);