mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:43:22 +08:00
Fix backgrounds not quite working
This commit is contained in:
parent
450e4cd223
commit
bac4f42eac
@ -9,21 +9,28 @@ using osu.Framework.Graphics.Sprites;
|
||||
|
||||
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]
|
||||
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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -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 =>
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user