mirror of
https://github.com/ppy/osu.git
synced 2025-01-16 00:52:55 +08:00
Merge pull request #12488 from Denrage/add-missing-author-links
Add missing author links in Beatmap Details
This commit is contained in:
commit
495eb04e2f
@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("check version", () => infoWedge.Info.VersionLabel.Current.Value == $"{ruleset.ShortName}Version");
|
||||
AddAssert("check title", () => infoWedge.Info.TitleLabel.Current.Value == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title");
|
||||
AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Current.Value == $"{ruleset.ShortName}Artist");
|
||||
AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
|
||||
AddAssert("check author", () => infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
|
||||
}
|
||||
|
||||
private void testInfoLabels(int expectedCount)
|
||||
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Current.Value));
|
||||
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Title);
|
||||
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Artist);
|
||||
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any());
|
||||
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any());
|
||||
AddAssert("check no info labels", () => !infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Any());
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
@ -50,7 +52,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
fields.Children = new Drawable[]
|
||||
{
|
||||
new Field("mapped by", BeatmapSet.Metadata.Author.Username, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)),
|
||||
new Field("mapped by", BeatmapSet.Metadata.Author, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)),
|
||||
new Field("submitted", online.Submitted, OsuFont.GetFont(weight: FontWeight.Bold))
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
@ -146,6 +148,25 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Field(string first, User second, FontUsage secondFont)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Direction = FillDirection.Horizontal;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new LinkFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.GetFont(size: 11);
|
||||
}).With(d =>
|
||||
{
|
||||
d.AutoSizeAxes = Axes.Both;
|
||||
d.AddText($"{first} ");
|
||||
d.AddUserLink(second, s => s.Font = secondFont.With(size: 11));
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Ranking.Expanded;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -286,7 +287,7 @@ namespace osu.Game.Screens.Select
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = getMapper(metadata)
|
||||
Child = getMapper(metadata),
|
||||
},
|
||||
infoLabelContainer = new FillFlowContainer
|
||||
{
|
||||
@ -406,24 +407,20 @@ namespace osu.Game.Screens.Select
|
||||
});
|
||||
}
|
||||
|
||||
private OsuSpriteText[] getMapper(BeatmapMetadata metadata)
|
||||
private Drawable getMapper(BeatmapMetadata metadata)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metadata.Author?.Username))
|
||||
return Array.Empty<OsuSpriteText>();
|
||||
if (metadata.Author == null)
|
||||
return Empty();
|
||||
|
||||
return new[]
|
||||
return new LinkFlowContainer(s =>
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "mapped by ",
|
||||
Font = OsuFont.GetFont(size: 15),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = metadata.Author.Username,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15),
|
||||
}
|
||||
};
|
||||
s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15);
|
||||
}).With(d =>
|
||||
{
|
||||
d.AutoSizeAxes = Axes.Both;
|
||||
d.AddText("mapped by ");
|
||||
d.AddUserLink(metadata.Author);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
Loading…
Reference in New Issue
Block a user