mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Fix background not updated in room
This commit is contained in:
@ -61,7 +61,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colours)
|
private void load(OverlayColourProvider colours)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
// This resolves internal 1px gaps due to applying the (parenting) corner radius and masking across multiple filling background sprites.
|
// This resolves internal 1px gaps due to applying the (parenting) corner radius and masking across multiple filling background sprites.
|
||||||
new Box
|
new Box
|
||||||
@ -69,10 +69,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.Background5,
|
Colour = colours.Background5,
|
||||||
},
|
},
|
||||||
new OnlinePlayBackgroundSprite
|
CreateBackground().With(d =>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
d.RelativeSizeAxes = Axes.Both;
|
||||||
},
|
}),
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Name = @"Room content",
|
Name = @"Room content",
|
||||||
@ -264,6 +264,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual Drawable CreateBackground() => new OnlinePlayBackgroundSprite();
|
||||||
|
|
||||||
private class RoomNameText : OsuSpriteText
|
private class RoomNameText : OsuSpriteText
|
||||||
{
|
{
|
||||||
[Resolved(typeof(Room), nameof(Online.Rooms.Room.Name))]
|
[Resolved(typeof(Room), nameof(Online.Rooms.Room.Name))]
|
||||||
|
@ -58,5 +58,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
if (editButton != null)
|
if (editButton != null)
|
||||||
host.BindValueChanged(h => editButton.Alpha = h.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0, true);
|
host.BindValueChanged(h => editButton.Alpha = h.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateBackground() => new RoomBackgroundSprite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
osu.Game/Screens/OnlinePlay/Match/RoomBackgroundSprite.cs
Normal file
33
osu.Game/Screens/OnlinePlay/Match/RoomBackgroundSprite.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.OnlinePlay.Match
|
||||||
|
{
|
||||||
|
public class RoomBackgroundSprite : RoomSubScreenComposite
|
||||||
|
{
|
||||||
|
protected readonly BeatmapSetCoverType BeatmapSetCoverType;
|
||||||
|
private UpdateableBeatmapBackgroundSprite sprite;
|
||||||
|
|
||||||
|
public RoomBackgroundSprite(BeatmapSetCoverType beatmapSetCoverType = BeatmapSetCoverType.Cover)
|
||||||
|
{
|
||||||
|
BeatmapSetCoverType = beatmapSetCoverType;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
InternalChild = sprite = new UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType) { RelativeSizeAxes = Axes.Both };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
SelectedItem.BindValueChanged(item => sprite.Beatmap.Value = item.NewValue?.Beatmap.Value, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user