Merge branch 'master' into rooms-request-faster

This commit is contained in:
Dean Herbert
2022-02-22 15:45:05 +09:00
27 changed files with 591 additions and 234 deletions

View File

@ -112,7 +112,27 @@ namespace osu.Game.Online.API.Requests.Responses
public int OnlineID { get; set; } = -1;
public string Name => $@"{nameof(APIRuleset)} (ID: {OnlineID})";
public string ShortName => nameof(APIRuleset);
public string ShortName
{
get
{
// TODO: this should really not exist.
switch (OnlineID)
{
case 0: return "osu";
case 1: return "taiko";
case 2: return "fruits";
case 3: return "mania";
default: throw new ArgumentOutOfRangeException();
}
}
}
public string InstantiationInfo => string.Empty;
public Ruleset CreateInstance() => throw new NotImplementedException();

View File

@ -1,6 +1,7 @@
// 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 System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -16,6 +17,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@ -56,7 +58,7 @@ namespace osu.Game.Online.Leaderboards
public GlowingSpriteText ScoreText { get; private set; }
private Container flagBadgeContainer;
private FillFlowContainer flagBadgeAndDateContainer;
private FillFlowContainer<ModIcon> modsContainer;
private List<ScoreComponentLabel> statisticsLabels;
@ -103,7 +105,7 @@ namespace osu.Game.Online.Leaderboards
content = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = rank_width, },
Padding = new MarginPadding { Left = rank_width },
Children = new Drawable[]
{
new Container
@ -158,32 +160,41 @@ namespace osu.Game.Online.Leaderboards
},
new FillFlowContainer
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0f),
Children = new Drawable[]
{
flagBadgeContainer = new Container
flagBadgeAndDateContainer = new FillFlowContainer
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Size = new Vector2(87f, 20f),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5f, 0f),
Width = 87f,
Masking = true,
Children = new Drawable[]
{
new UpdateableFlag(user.Country)
{
Width = 30,
RelativeSizeAxes = Axes.Y,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(30f, 20f),
},
new DateLabel(Score.Date)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
},
},
new FillFlowContainer
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Left = edge_margin },
@ -243,7 +254,7 @@ namespace osu.Game.Online.Leaderboards
public override void Show()
{
foreach (var d in new[] { avatar, nameLabel, ScoreText, scoreRank, flagBadgeContainer, modsContainer }.Concat(statisticsLabels))
foreach (var d in new[] { avatar, nameLabel, ScoreText, scoreRank, flagBadgeAndDateContainer, modsContainer }.Concat(statisticsLabels))
d.FadeOut();
Alpha = 0;
@ -270,7 +281,7 @@ namespace osu.Game.Online.Leaderboards
using (BeginDelayedSequence(50))
{
var drawables = new Drawable[] { flagBadgeContainer, modsContainer }.Concat(statisticsLabels).ToArray();
var drawables = new Drawable[] { flagBadgeAndDateContainer, modsContainer }.Concat(statisticsLabels).ToArray();
for (int i = 0; i < drawables.Length; i++)
drawables[i].FadeIn(100 + i * 50);
}
@ -377,6 +388,17 @@ namespace osu.Game.Online.Leaderboards
public LocalisableString TooltipText { get; }
}
private class DateLabel : DrawableDate
{
public DateLabel(DateTimeOffset date)
: base(date)
{
Font = OsuFont.GetFont(size: 17, weight: FontWeight.Bold, italics: true);
}
protected override string Format() => Date.ToShortRelativeTime(TimeSpan.FromSeconds(30));
}
public class LeaderboardScoreStatistic
{
public IconUsage Icon;

View File

@ -179,8 +179,7 @@ namespace osu.Game.Online.Rooms
RoomID.Value = other.RoomID.Value;
Name.Value = other.Name.Value;
if (other.Category.Value != RoomCategory.Spotlight)
Category.Value = other.Category.Value;
Category.Value = other.Category.Value;
if (other.Host.Value != null && Host.Value?.Id != other.Host.Value.Id)
Host.Value = other.Host.Value;