1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

use LinkFlowContainer directly

This commit is contained in:
cdwcgt 2023-04-03 20:09:49 +09:00
parent 41c01d3929
commit 735b48679e
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
2 changed files with 9 additions and 7 deletions

View File

@ -15,6 +15,7 @@ using System.Linq;
using osu.Framework.Testing;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
@ -290,12 +291,12 @@ namespace osu.Game.Tests.Visual.Online
{
InputManager.MoveMouseTo(overlay.ChildrenOfType<DifficultyIcon>().ElementAt(0));
});
AddAssert("Guset mapper information not show", () => !overlay.ChildrenOfType<BeatmapPicker>().Single().ChildrenOfType<LinkFlowContainer>().Any());
AddAssert("Guset mapper information not show", () => overlay.ChildrenOfType<BeatmapPicker>().Single().ChildrenOfType<OsuSpriteText>().All(s => s.Text != "BanchoBot"));
AddStep("move mouse to guest diff", () =>
{
InputManager.MoveMouseTo(overlay.ChildrenOfType<DifficultyIcon>().ElementAt(1));
});
AddAssert("Guset mapper information show", () => overlay.ChildrenOfType<BeatmapPicker>().Single().ChildrenOfType<LinkFlowContainer>().Any());
AddAssert("Guset mapper information show", () => overlay.ChildrenOfType<BeatmapPicker>().Single().ChildrenOfType<OsuSpriteText>().Any(s => s.Text == "BanchoBot"));
}
private APIBeatmapSet createManyDifficultiesBeatmapSet()

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet
private const float tile_spacing = 2;
private readonly OsuSpriteText version, starRating, starRatingText;
private readonly FillFlowContainer guestMapperContainer;
private readonly LinkFlowContainer guestMapperContainer;
private readonly FillFlowContainer starRatingContainer;
private readonly Statistic plays, favourites;
@ -89,7 +89,8 @@ namespace osu.Game.Overlays.BeatmapSet
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 17, weight: FontWeight.Bold)
},
guestMapperContainer = new FillFlowContainer
guestMapperContainer = new LinkFlowContainer(s =>
s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15))
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomLeft,
@ -209,11 +210,11 @@ namespace osu.Game.Overlays.BeatmapSet
{
guestMapperContainer.Clear();
if (beatmapInfo != null && beatmapSet?.Author.OnlineID != beatmapInfo.AuthorID)
if (beatmapInfo != null && beatmapInfo.AuthorID != beatmapSet?.AuthorID)
{
guestMapperContainer.Child = getGuestMapper(user);
APIUser? user = BeatmapSet?.RelatedUsers?.Single(u => u.OnlineID == beatmapInfo?.AuthorID);
APIUser? user = BeatmapSet?.RelatedUsers?.Single(u => u.OnlineID == beatmapInfo.AuthorID);
if (user != null)
getGuestMapper(user);
}
version.Text = beatmapInfo?.DifficultyName ?? string.Empty;