2017-05-30 16:12:11 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-06-23 20:39:21 +08:00
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2017-07-11 11:26:49 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2017-05-30 16:12:11 +08:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Database;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Online.Multiplayer;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multiplayer
|
|
|
|
|
{
|
|
|
|
|
public class RoomInspector : Container
|
|
|
|
|
{
|
2017-05-31 09:23:00 +08:00
|
|
|
|
private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 };
|
2017-05-31 06:13:05 +08:00
|
|
|
|
private const float transition_duration = 100;
|
2017-05-31 06:53:06 +08:00
|
|
|
|
private const float ruleset_height = 30;
|
2017-05-30 16:12:11 +08:00
|
|
|
|
|
|
|
|
|
private readonly Box statusStrip;
|
2017-05-31 08:41:20 +08:00
|
|
|
|
private readonly Container coverContainer, rulesetContainer, gameTypeContainer, flagContainer;
|
2017-05-31 06:35:37 +08:00
|
|
|
|
private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow;
|
2017-05-30 16:12:11 +08:00
|
|
|
|
private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher;
|
|
|
|
|
private readonly ScrollContainer participantsScroll;
|
|
|
|
|
|
2017-05-31 09:23:00 +08:00
|
|
|
|
private readonly Bindable<string> nameBind = new Bindable<string>();
|
|
|
|
|
private readonly Bindable<User> hostBind = new Bindable<User>();
|
|
|
|
|
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
|
|
|
|
|
private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
|
|
|
|
|
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
|
|
|
|
|
private readonly Bindable<int?> maxParticipantsBind = new Bindable<int?>();
|
|
|
|
|
private readonly Bindable<User[]> participantsBind = new Bindable<User[]>();
|
2017-05-30 16:12:11 +08:00
|
|
|
|
|
|
|
|
|
private OsuColour colours;
|
|
|
|
|
private LocalisationEngine localisation;
|
|
|
|
|
|
|
|
|
|
private Room room;
|
2017-06-23 21:14:56 +08:00
|
|
|
|
|
2017-05-30 16:12:11 +08:00
|
|
|
|
public Room Room
|
|
|
|
|
{
|
|
|
|
|
get { return room; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == room) return;
|
|
|
|
|
room = value;
|
|
|
|
|
|
|
|
|
|
nameBind.BindTo(Room.Name);
|
|
|
|
|
hostBind.BindTo(Room.Host);
|
|
|
|
|
statusBind.BindTo(Room.Status);
|
2017-05-31 08:41:20 +08:00
|
|
|
|
typeBind.BindTo(Room.Type);
|
2017-05-30 16:12:11 +08:00
|
|
|
|
beatmapBind.BindTo(Room.Beatmap);
|
|
|
|
|
maxParticipantsBind.BindTo(Room.MaxParticipants);
|
|
|
|
|
participantsBind.BindTo(Room.Participants);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RoomInspector()
|
|
|
|
|
{
|
|
|
|
|
Width = 520;
|
|
|
|
|
RelativeSizeAxes = Axes.Y;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"343138"),
|
|
|
|
|
},
|
|
|
|
|
topFlow = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 200,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-05-31 06:35:37 +08:00
|
|
|
|
new Container
|
2017-05-30 16:12:11 +08:00
|
|
|
|
{
|
2017-05-31 06:35:37 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
},
|
|
|
|
|
coverContainer = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-05-30 16:12:11 +08:00
|
|
|
|
},
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
ColourInfo = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding(20),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
2017-05-31 06:13:05 +08:00
|
|
|
|
LayoutDuration = transition_duration,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
participants = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 30,
|
|
|
|
|
Font = @"Exo2.0-Bold"
|
|
|
|
|
},
|
|
|
|
|
participantsSlash = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = @"/",
|
|
|
|
|
TextSize = 30,
|
|
|
|
|
Font = @"Exo2.0-Light"
|
|
|
|
|
},
|
|
|
|
|
maxParticipants = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 30,
|
|
|
|
|
Font = @"Exo2.0-Light"
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
name = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
TextSize = 30,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
statusStrip = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 5,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"28242d"),
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-05-31 09:23:00 +08:00
|
|
|
|
Padding = contentPadding,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Spacing = new Vector2(0f, 5f),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
status = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
2017-05-31 07:02:05 +08:00
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
Height = ruleset_height,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Direction = FillDirection.Horizontal,
|
2017-05-31 06:13:05 +08:00
|
|
|
|
LayoutDuration = transition_duration,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Spacing = new Vector2(5f, 0f),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
rulesetContainer = new Container
|
|
|
|
|
{
|
2017-05-31 09:11:45 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
},
|
2017-05-31 08:41:20 +08:00
|
|
|
|
gameTypeContainer = new Container
|
2017-05-30 16:12:11 +08:00
|
|
|
|
{
|
2017-05-31 09:11:45 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
2017-05-31 07:02:05 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Margin = new MarginPadding { Left = 5 },
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
beatmapTitle = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-BoldItalic",
|
|
|
|
|
},
|
|
|
|
|
beatmapDash = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-BoldItalic",
|
|
|
|
|
},
|
|
|
|
|
beatmapArtist = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-RegularItalic",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
beatmapAuthor = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-05-31 09:23:00 +08:00
|
|
|
|
Padding = contentPadding,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
Height = 15f,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Spacing = new Vector2(5f, 0f),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
flagContainer = new Container
|
|
|
|
|
{
|
|
|
|
|
Width = 22f,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
},
|
2017-05-31 09:11:45 +08:00
|
|
|
|
new Container //todo: team banners
|
2017-05-30 16:12:11 +08:00
|
|
|
|
{
|
|
|
|
|
Width = 38f,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
CornerRadius = 2f,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"ad387e"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "hosted by",
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
host = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-BoldItalic",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
levelRangeContainer = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2017-05-31 09:34:02 +08:00
|
|
|
|
Text = "Rank Range ",
|
2017-05-30 16:12:11 +08:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "#",
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
levelRangeLower = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = " - ",
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "#",
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
},
|
|
|
|
|
levelRangeHigher = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "6251",
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
participantsScroll = new ScrollContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-05-31 09:23:00 +08:00
|
|
|
|
Padding = new MarginPadding { Top = contentPadding.Top, Left = 38, Right = 37 },
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
participantsFlow = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-05-31 06:13:05 +08:00
|
|
|
|
LayoutDuration = transition_duration,
|
2017-05-30 16:12:11 +08:00
|
|
|
|
Spacing = new Vector2(5f),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nameBind.ValueChanged += displayName;
|
|
|
|
|
hostBind.ValueChanged += displayUser;
|
|
|
|
|
maxParticipantsBind.ValueChanged += displayMaxParticipants;
|
|
|
|
|
participantsBind.ValueChanged += displayParticipants;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2017-07-11 11:26:49 +08:00
|
|
|
|
private void load(OsuColour colours, LocalisationEngine localisation)
|
2017-05-30 16:12:11 +08:00
|
|
|
|
{
|
|
|
|
|
this.localisation = localisation;
|
|
|
|
|
this.colours = colours;
|
|
|
|
|
|
|
|
|
|
beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9;
|
|
|
|
|
host.Colour = colours.Blue;
|
|
|
|
|
|
|
|
|
|
//binded here instead of ctor because dependencies are needed
|
|
|
|
|
statusBind.ValueChanged += displayStatus;
|
2017-05-31 08:41:20 +08:00
|
|
|
|
typeBind.ValueChanged += displayGameType;
|
2017-05-30 16:12:11 +08:00
|
|
|
|
beatmapBind.ValueChanged += displayBeatmap;
|
|
|
|
|
|
|
|
|
|
statusBind.TriggerChange();
|
2017-05-31 08:41:20 +08:00
|
|
|
|
typeBind.TriggerChange();
|
2017-05-30 16:12:11 +08:00
|
|
|
|
beatmapBind.TriggerChange();
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-31 07:02:05 +08:00
|
|
|
|
protected override void UpdateAfterChildren()
|
2017-05-30 16:12:11 +08:00
|
|
|
|
{
|
2017-05-31 07:02:05 +08:00
|
|
|
|
base.UpdateAfterChildren();
|
2017-05-30 16:12:11 +08:00
|
|
|
|
|
|
|
|
|
participantsScroll.Height = DrawHeight - topFlow.DrawHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void displayName(string value)
|
|
|
|
|
{
|
|
|
|
|
name.Text = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void displayUser(User value)
|
|
|
|
|
{
|
|
|
|
|
host.Text = value.Username;
|
2017-05-31 09:11:45 +08:00
|
|
|
|
flagContainer.Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new DrawableFlag(value.Country?.FlagName ?? @"__")
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
};
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void displayStatus(RoomStatus value)
|
|
|
|
|
{
|
|
|
|
|
status.Text = value.Message;
|
|
|
|
|
|
|
|
|
|
foreach (Drawable d in new Drawable[] { statusStrip, status })
|
2017-05-31 06:13:05 +08:00
|
|
|
|
d.FadeColour(value.GetAppropriateColour(colours), transition_duration);
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-31 08:41:20 +08:00
|
|
|
|
private void displayGameType(GameType value)
|
|
|
|
|
{
|
|
|
|
|
gameTypeContainer.Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new DrawableGameType(value)
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(ruleset_height),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-30 16:12:11 +08:00
|
|
|
|
private void displayBeatmap(BeatmapInfo value)
|
|
|
|
|
{
|
|
|
|
|
if (value != null)
|
|
|
|
|
{
|
2017-05-31 06:35:37 +08:00
|
|
|
|
coverContainer.FadeIn(transition_duration);
|
|
|
|
|
coverContainer.Children = new[]
|
|
|
|
|
{
|
2017-07-11 11:26:49 +08:00
|
|
|
|
new AsyncLoadWrapper(new CoverSprite(value.BeatmapSet)
|
2017-05-31 06:35:37 +08:00
|
|
|
|
{
|
2017-06-28 17:24:23 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-05-31 06:35:37 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
FillMode = FillMode.Fill,
|
|
|
|
|
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
|
|
|
|
|
}) { RelativeSizeAxes = Axes.Both }
|
|
|
|
|
};
|
|
|
|
|
|
2017-05-31 06:13:05 +08:00
|
|
|
|
rulesetContainer.FadeIn(transition_duration);
|
2017-05-30 16:12:11 +08:00
|
|
|
|
rulesetContainer.Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new DifficultyIcon(value)
|
|
|
|
|
{
|
2017-05-31 06:53:06 +08:00
|
|
|
|
Size = new Vector2(ruleset_height),
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
|
|
|
|
|
beatmapDash.Text = @" - ";
|
|
|
|
|
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
|
|
|
|
|
beatmapAuthor.Text = $"mapped by {value.Metadata.Author}";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-31 06:35:37 +08:00
|
|
|
|
coverContainer.FadeOut(transition_duration);
|
2017-05-31 06:13:05 +08:00
|
|
|
|
rulesetContainer.FadeOut(transition_duration);
|
2017-05-30 16:12:11 +08:00
|
|
|
|
|
|
|
|
|
beatmapTitle.Current = null;
|
|
|
|
|
beatmapArtist.Current = null;
|
|
|
|
|
|
|
|
|
|
beatmapTitle.Text = "Changing map";
|
|
|
|
|
beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void displayMaxParticipants(int? value)
|
|
|
|
|
{
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
2017-05-31 06:13:05 +08:00
|
|
|
|
participantsSlash.FadeOut(transition_duration);
|
|
|
|
|
maxParticipants.FadeOut(transition_duration);
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-31 06:13:05 +08:00
|
|
|
|
participantsSlash.FadeIn(transition_duration);
|
|
|
|
|
maxParticipants.FadeIn(transition_duration);
|
2017-05-30 16:12:11 +08:00
|
|
|
|
maxParticipants.Text = value.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void displayParticipants(User[] value)
|
|
|
|
|
{
|
|
|
|
|
participants.Text = value.Length.ToString();
|
|
|
|
|
|
|
|
|
|
var ranks = value.Select(u => u.GlobalRank);
|
|
|
|
|
levelRangeLower.Text = ranks.Min().ToString();
|
|
|
|
|
levelRangeHigher.Text = ranks.Max().ToString();
|
|
|
|
|
|
2017-06-24 18:56:35 +08:00
|
|
|
|
participantsFlow.ChildrenEnumerable = value.Select(u => new UserTile(u));
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class UserTile : Container, IHasTooltip
|
|
|
|
|
{
|
|
|
|
|
private readonly User user;
|
|
|
|
|
|
|
|
|
|
public string TooltipText => user.Username;
|
|
|
|
|
|
|
|
|
|
public UserTile(User user)
|
|
|
|
|
{
|
|
|
|
|
this.user = user;
|
|
|
|
|
Size = new Vector2(70f);
|
|
|
|
|
CornerRadius = 5f;
|
|
|
|
|
Masking = true;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"27252d"),
|
|
|
|
|
},
|
|
|
|
|
new UpdateableAvatar
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
User = user,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-07-11 11:26:49 +08:00
|
|
|
|
|
|
|
|
|
private class CoverSprite : Sprite
|
|
|
|
|
{
|
|
|
|
|
private readonly BeatmapSetInfo set;
|
|
|
|
|
|
|
|
|
|
public CoverSprite(BeatmapSetInfo set)
|
|
|
|
|
{
|
|
|
|
|
this.set = set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(TextureStore textures)
|
|
|
|
|
{
|
2017-07-13 09:27:39 +08:00
|
|
|
|
if (set.OnlineInfo?.Covers?.Cover != null)
|
|
|
|
|
Texture = textures.Get(set.OnlineInfo.Covers.Cover);
|
2017-07-11 11:26:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|