From 342e39776aaa5559401e86d2b6d656f01476acab Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 7 Jun 2019 20:59:56 +0200 Subject: [PATCH] Move ChangelogEntries populating logic from constructor to BDL load() to use OsuColour palette +apply review suggestions. --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 627eb10426..ae5ba3fa4e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -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);