1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Move ChangelogEntries populating logic from constructor to BDL load() to use OsuColour palette +apply review suggestions.

This commit is contained in:
Lucas A 2019-06-07 20:59:56 +02:00
parent e5b64bfa39
commit 342e39776a

View File

@ -13,6 +13,7 @@ using System.Text.RegularExpressions;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osuTK.Graphics;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Changelog
{
@ -45,8 +46,12 @@ namespace osu.Game.Overlays.Changelog
Direction = FillDirection.Vertical,
},
};
}
foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
{
ChangelogEntries.Add(new OsuSpriteText
{
@ -69,19 +74,19 @@ namespace osu.Game.Overlays.Changelog
Margin = new MarginPadding { Vertical = 5 },
};
var entryColor = entry.Major != null && (bool)entry.Major ? OsuColour.FromHex("#fd5") : Color4.White;
var entryColour = entry.Major != null && (bool)entry.Major ? colours.YellowLight : Color4.White;
title.AddIcon(FontAwesome.Solid.Check, t =>
{
t.Font = fontSmall;
t.Colour = entryColor;
t.Colour = entryColour;
t.Padding = new MarginPadding { Left = -17, Right = 5 };
});
title.AddText(entry.Title, t =>
{
t.Font = fontLarge;
t.Colour = entryColor;
t.Colour = entryColour;
});
if (!string.IsNullOrEmpty(entry.Repository))
@ -89,25 +94,25 @@ namespace osu.Game.Overlays.Changelog
title.AddText(" (", t =>
{
t.Font = fontLarge;
t.Colour = entryColor;
t.Colour = entryColour;
});
title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External,
creationParameters: t =>
{
t.Font = fontLarge;
t.Colour = entryColor;
t.Colour = entryColour;
});
title.AddText(")", t =>
{
t.Font = fontLarge;
t.Colour = entryColor;
t.Colour = entryColour;
});
}
title.AddText(" by ", t =>
{
t.Font = fontMedium;
t.Colour = entryColor;
t.Colour = entryColour;
});
if (entry.GithubUser.UserId != null)
@ -118,19 +123,19 @@ namespace osu.Game.Overlays.Changelog
}, t =>
{
t.Font = fontMedium;
t.Colour = entryColor;
t.Colour = entryColour;
});
else if (entry.GithubUser.GithubUrl != null)
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t =>
{
t.Font = fontMedium;
t.Colour = entryColor;
t.Colour = entryColour;
});
else
title.AddText(entry.GithubUser.DisplayName, t =>
{
t.Font = fontSmall;
t.Colour = entryColor;
t.Colour = entryColour;
});
ChangelogEntries.Add(title);