1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 21:03:08 +08:00

Proper cover loading

This commit is contained in:
DrabWeb 2017-05-30 19:35:37 -03:00
parent 774d37a058
commit 5d6534031e
2 changed files with 39 additions and 12 deletions

View File

@ -35,6 +35,10 @@ namespace osu.Desktop.VisualTests.Tests
Artist = @"Maaya Sakamoto", Artist = @"Maaya Sakamoto",
Author = @"uwutm8", Author = @"uwutm8",
}, },
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" },
},
}; };
room.MaxParticipants.Value = 200; room.MaxParticipants.Value = 200;
room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 },
@ -79,6 +83,10 @@ namespace osu.Desktop.VisualTests.Tests
Artist = @"FREEDOM DIVE", Artist = @"FREEDOM DIVE",
Author = @"Nakagawa-Kanon", Author = @"Nakagawa-Kanon",
}, },
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" },
},
}; };
newRoom.MaxParticipants.Value = 10; newRoom.MaxParticipants.Value = 10;
newRoom.Participants.Value = new[] newRoom.Participants.Value = new[]

View File

@ -27,15 +27,11 @@ namespace osu.Game.Screens.Multiplayer
private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 };
private const float transition_duration = 100; private const float transition_duration = 100;
private readonly FillFlowContainer topFlow;
private readonly Box statusStrip; private readonly Box statusStrip;
private readonly Container coverContainer, rulesetContainer, flagContainer;
private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow;
private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher;
private readonly Sprite cover;
private readonly FillFlowContainer levelRangeContainer;
private readonly ScrollContainer participantsScroll; private readonly ScrollContainer participantsScroll;
private readonly FillFlowContainer participantsFlow;
private readonly Container rulesetContainer;
private readonly Container flagContainer;
private Bindable<string> nameBind = new Bindable<string>(); private Bindable<string> nameBind = new Bindable<string>();
private Bindable<User> hostBind = new Bindable<User>(); private Bindable<User> hostBind = new Bindable<User>();
@ -46,6 +42,7 @@ namespace osu.Game.Screens.Multiplayer
private OsuColour colours; private OsuColour colours;
private LocalisationEngine localisation; private LocalisationEngine localisation;
private TextureStore textures;
private Room room; private Room room;
public Room Room public Room Room
@ -91,11 +88,21 @@ namespace osu.Game.Screens.Multiplayer
Masking = true, Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
cover = new Sprite new Container
{ {
Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, Children = new Drawable[]
FillMode = FillMode.Fill, {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
coverContainer = new Container
{
RelativeSizeAxes = Axes.Both,
},
},
}, },
new Box new Box
{ {
@ -368,12 +375,11 @@ namespace osu.Game.Screens.Multiplayer
{ {
this.localisation = localisation; this.localisation = localisation;
this.colours = colours; this.colours = colours;
this.textures = textures;
beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9;
host.Colour = colours.Blue; host.Colour = colours.Blue;
cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png");
//binded here instead of ctor because dependencies are needed //binded here instead of ctor because dependencies are needed
statusBind.ValueChanged += displayStatus; statusBind.ValueChanged += displayStatus;
beatmapBind.ValueChanged += displayBeatmap; beatmapBind.ValueChanged += displayBeatmap;
@ -413,6 +419,18 @@ namespace osu.Game.Screens.Multiplayer
{ {
if (value != null) if (value != null)
{ {
coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
{
new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
}) { RelativeSizeAxes = Axes.Both }
};
rulesetContainer.FadeIn(transition_duration); rulesetContainer.FadeIn(transition_duration);
rulesetContainer.Children = new[] rulesetContainer.Children = new[]
{ {
@ -429,6 +447,7 @@ namespace osu.Game.Screens.Multiplayer
} }
else else
{ {
coverContainer.FadeOut(transition_duration);
rulesetContainer.FadeOut(transition_duration); rulesetContainer.FadeOut(transition_duration);
beatmapTitle.Current = null; beatmapTitle.Current = null;