From 3fa1545ea445f7fe8aca58153e03a839d2a74091 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 May 2019 02:09:08 +0900 Subject: [PATCH] Huge refactor pass focusing on ChangelogContent --- .../Online/TestSceneChangelogOverlay.cs | 2 +- .../Graphics/Containers/OsuHoverContainer.cs | 3 +- .../BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 176 +++++++++-- .../Changelog/ChangelogContentGroup.cs | 280 ------------------ .../Overlays/Changelog/ChangelogListing.cs | 32 +- .../Changelog/ChangelogSingleBuild.cs | 118 ++++++++ .../Overlays/Changelog/Header/Breadcrumb.cs | 3 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 7 +- osu.Game/Overlays/ChangelogOverlay.cs | 2 +- 10 files changed, 294 insertions(+), 331 deletions(-) delete mode 100644 osu.Game/Overlays/Changelog/ChangelogContentGroup.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index e1cb6e6a85..4ac5514019 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -23,8 +23,8 @@ namespace osu.Game.Tests.Visual.Online typeof(ChangelogHeader), typeof(ChangelogContent), typeof(ChangelogListing), + typeof(ChangelogSingleBuild), typeof(ChangelogBuild), - typeof(ChangelogContentGroup), typeof(Breadcrumb), typeof(BreadcrumbListing), typeof(BreadcrumbRelease), diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index d5ae7cba57..b1fe1e81f1 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -22,7 +22,8 @@ namespace osu.Game.Graphics.Containers protected override bool OnHover(HoverEvent e) { - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); + if (Action != null) + EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); return base.OnHover(e); } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index e70bf4c572..89da0fc254 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, }, - date = new SpriteText + date = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 0af117c11e..09706a419e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -1,50 +1,168 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Threading; -using System.Threading.Tasks; -using osu.Framework.Allocation; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using osu.Game.Graphics.Sprites; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { - public class ChangelogBuild : ChangelogContent + public class ChangelogBuild : FillFlowContainer { - private APIChangelogBuild changelogBuild; + public Action SelectBuild; - public ChangelogBuild(APIChangelogBuild changelogBuild) + protected readonly APIChangelogBuild Build; + + public readonly FillFlowContainer ChangelogEntries; + + public ChangelogBuild(APIChangelogBuild build) { - this.changelogBuild = changelogBuild; - } + Build = build; - [BackgroundDependencyLoader] - private void load(CancellationToken? cancellation, IAPIProvider api) - { - var req = new GetChangelogBuildRequest(changelogBuild.UpdateStream.Name, changelogBuild.Version); - bool complete = false; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Padding = new MarginPadding { Horizontal = 70 }; - req.Success += res => + Children = new Drawable[] { - changelogBuild = res; - complete = true; + CreateHeader(), + ChangelogEntries = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + }, }; - req.Failure += _ => complete = true; + var categories = new SortedDictionary>(); - api.Queue(req); + // sort entries by category + foreach (APIChangelogEntry entry in build.ChangelogEntries) + { + if (!categories.ContainsKey(entry.Category)) + categories.Add(entry.Category, new List { entry }); + else + categories[entry.Category].Add(entry); + } - while (!complete && cancellation?.IsCancellationRequested != true) - Task.Delay(1); + foreach (KeyValuePair> category in categories) + { + ChangelogEntries.Add(new OsuSpriteText + { + Text = category.Key, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), + Margin = new MarginPadding { Top = 35, Bottom = 15 }, + }); - var changelogContentGroup = new ChangelogContentGroup(changelogBuild); - changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); - changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, - changelogBuild.Versions.Next?.DisplayVersion); - changelogContentGroup.BuildSelected += SelectBuild; + foreach (APIChangelogEntry entry in category.Value) + { + LinkFlowContainer title = new LinkFlowContainer + { + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Vertical = 5 }, + }; - Add(changelogContentGroup); + title.AddIcon(FontAwesome.Solid.Check, t => + { + t.Font = OsuFont.GetFont(size: 12); + t.Padding = new MarginPadding { Left = -17, Right = 5 }; + }); + + title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); + + if (!string.IsNullOrEmpty(entry.Repository)) + { + title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); + title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", + entry.GithubUrl, Online.Chat.LinkAction.External, null, + null, t => { t.Font = OsuFont.GetFont(size: 18); }); + title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); + } + + title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); + + if (entry.GithubUser.GithubUrl != null) + title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, + Online.Chat.LinkAction.External, null, null, + t => t.Font = OsuFont.GetFont(size: 14)); + else + title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); + + ChangelogEntries.Add(title); + + if (!string.IsNullOrEmpty(entry.MessageHtml)) + { + TextFlowContainer messageContainer = new TextFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }; + + // todo: use markdown parsing once API returns markdown + messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => + { + t.Font = OsuFont.GetFont(size: 12); + t.Colour = new Color4(235, 184, 254, 255); + }); + + ChangelogEntries.Add(messageContainer); + } + } + } } + + protected virtual FillFlowContainer CreateHeader() => new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Top = 20 }, + Children = new Drawable[] + { + new OsuHoverContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Action = () => SelectBuild?.Invoke(Build), + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Horizontal = 40 }, + Children = new[] + { + new OsuSpriteText + { + Text = Build.UpdateStream.DisplayName, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), + }, + new OsuSpriteText + { + Text = " ", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), + }, + new OsuSpriteText + { + Text = Build.DisplayVersion, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19), + Colour = Build.UpdateStream.Colour, + }, + } + } + }, + } + }; } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs deleted file mode 100644 index 44c2c4cf9c..0000000000 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Online.API.Requests.Responses; -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using osu.Game.Overlays.Changelog.Components; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Changelog -{ - public class ChangelogContentGroup : FillFlowContainer - { - private readonly TooltipIconButton chevronPrevious, chevronNext; - - private readonly SortedDictionary> categories = - new SortedDictionary>(); - - public event Action BuildSelected; - - public readonly FillFlowContainer ChangelogEntries; - - public ChangelogContentGroup(APIChangelogBuild build) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; - Padding = new MarginPadding { Horizontal = 70 }; - Children = new Drawable[] - { - new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Top = 20 }, - Children = new Drawable[] - { - chevronPrevious = new TooltipIconButton - { - IsEnabled = false, - Icon = FontAwesome.Solid.ChevronLeft, - Size = new Vector2(24), - Action = () => - { - BuildSelected?.Invoke(build.Versions.Previous); - chevronPrevious.IsEnabled = false; - }, - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Horizontal = 40 }, - Children = new[] - { - new SpriteText - { - Text = build.UpdateStream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24), - }, - new SpriteText - { - Text = " ", - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24), - }, - new SpriteText - { - Text = build.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), - Colour = build.UpdateStream.Colour, - }, - } - }, - chevronNext = new TooltipIconButton - { - IsEnabled = false, - Icon = FontAwesome.Solid.ChevronRight, - Size = new Vector2(24), - Action = () => - { - BuildSelected?.Invoke(build.Versions.Next); - chevronNext.IsEnabled = false; - }, - }, - } - }, - new SpriteText - { - // do we need .ToUniversalTime() here? - // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 14), - Colour = OsuColour.FromHex(@"FD5"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Margin = new MarginPadding { Top = 5 }, - }, - ChangelogEntries = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - }, - }; - } - - public ChangelogContentGroup(APIChangelogBuild build, bool newDate) - { - OsuHoverContainer clickableBuildText; - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; - Padding = new MarginPadding { Horizontal = 70 }; - Children = new Drawable[] - { - new SpriteText - { - // do we need .ToUniversalTime() here? - // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), - Colour = OsuColour.FromHex(@"FD5"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Margin = new MarginPadding { Top = 20 }, - Alpha = newDate ? 1 : 0, - }, - clickableBuildText = new OsuHoverContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Top = 20 }, - Action = () => BuildSelected?.Invoke(build), - Child = new FillFlowContainer - { - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5), - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new SpriteText - { - Text = build.UpdateStream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), - }, - new SpriteText - { - Text = build.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19), - Colour = build.UpdateStream.Colour, - }, - }, - } - }, - ChangelogEntries = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - }, - }; - - // we may not want double clicks, - // can be clicked again only after a delay - clickableBuildText.Action += () => - { - clickableBuildText.Action = null; - clickableBuildText.FadeTo(0.5f, 500); - Scheduler.AddDelayed(() => - { - clickableBuildText.Action = () => BuildSelected?.Invoke(build); - clickableBuildText.FadeIn(500); - }, 2000); - }; - } - - public void UpdateChevronTooltips(string previousVersion, string nextVersion) - { - if (!string.IsNullOrEmpty(previousVersion)) - { - chevronPrevious.TooltipText = previousVersion; - chevronPrevious.IsEnabled = true; - } - - if (!string.IsNullOrEmpty(nextVersion)) - { - chevronNext.TooltipText = nextVersion; - chevronNext.IsEnabled = true; - } - } - - public void GenerateText(List changelogEntries) - { - // sort entries by category - foreach (APIChangelogEntry entry in changelogEntries) - { - if (!categories.ContainsKey(entry.Category)) - categories.Add(entry.Category, new List { entry }); - else - categories[entry.Category].Add(entry); - } - - foreach (KeyValuePair> category in categories) - { - ChangelogEntries.Add(new SpriteText - { - Text = category.Key, - Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), - Margin = new MarginPadding { Top = 35, Bottom = 15 }, - }); - - foreach (APIChangelogEntry entry in category.Value) - { - LinkFlowContainer title = new LinkFlowContainer - { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Vertical = 5 }, - }; - - title.AddIcon(FontAwesome.Solid.Check, t => - { - t.Font = OsuFont.GetFont(size: 12); - t.Padding = new MarginPadding { Left = -17, Right = 5 }; - }); - - title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); - - if (!string.IsNullOrEmpty(entry.Repository)) - { - title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); - title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", - entry.GithubUrl, Online.Chat.LinkAction.External, null, - null, t => { t.Font = OsuFont.GetFont(size: 18); }); - title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); - } - - title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); - - if (entry.GithubUser.GithubUrl != null) - title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, - Online.Chat.LinkAction.External, null, null, - t => t.Font = OsuFont.GetFont(size: 14)); - else - title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); - - ChangelogEntries.Add(title); - - if (!string.IsNullOrEmpty(entry.MessageHtml)) - { - TextFlowContainer messageContainer = new TextFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }; - - // todo: use markdown parsing once API returns markdown - messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => - { - t.Font = OsuFont.GetFont(size: 12); - t.Colour = new Color4(235, 184, 254, 255); - }); - - ChangelogEntries.Add(messageContainer); - } - } - } - } - } -} diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index 8e615d1dc9..907c122232 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -6,6 +6,8 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; using osuTK.Graphics; @@ -23,10 +25,7 @@ namespace osu.Game.Overlays.Changelog [BackgroundDependencyLoader] private void load() { - DateTime currentDate = new DateTime(); - Clear(); - - ChangelogContentGroup changelogContentGroup = null; + DateTime currentDate = DateTime.MinValue; foreach (APIChangelogBuild build in entries) { @@ -43,27 +42,32 @@ namespace osu.Game.Overlays.Changelog }); } - changelogContentGroup = new ChangelogContentGroup(build, true); - changelogContentGroup.BuildSelected += SelectBuild; - changelogContentGroup.GenerateText(build.ChangelogEntries); - Add(changelogContentGroup); + Add(new OsuSpriteText + { + // do we need .ToUniversalTime() here? + // also, this should be a temporary solution to weekdays in >localized< date strings + Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24), + Colour = OsuColour.FromHex(@"FD5"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding { Top = 15 }, + }); + currentDate = build.CreatedAt.Date; } else { - changelogContentGroup?.Add(new Box + Add(new Box { RelativeSizeAxes = Axes.X, Height = 1, Colour = new Color4(32, 24, 35, 255), Margin = new MarginPadding { Top = 30 }, }); - - changelogContentGroup = new ChangelogContentGroup(build, false); - changelogContentGroup.BuildSelected += SelectBuild; - changelogContentGroup.GenerateText(build.ChangelogEntries); - Add(changelogContentGroup); } + + Add(new ChangelogBuild(build) { SelectBuild = SelectBuild }); } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs new file mode 100644 index 0000000000..af4603fddf --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -0,0 +1,118 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +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; +using osu.Game.Overlays.Changelog.Components; +using osuTK; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogSingleBuild : ChangelogContent + { + private APIChangelogBuild build; + + public ChangelogSingleBuild(APIChangelogBuild build) + { + this.build = build; + } + + [BackgroundDependencyLoader] + private void load(CancellationToken? cancellation, IAPIProvider api) + { + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + bool complete = false; + + req.Success += res => + { + build = res; + complete = true; + }; + + req.Failure += _ => complete = true; + + api.Queue(req); + + while (!complete && cancellation?.IsCancellationRequested != true) + Task.Delay(1); + + Children = new Drawable[] + { + new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild }, + }; + } + + public class ChangelogBuildWithNavigation : ChangelogBuild + { + public ChangelogBuildWithNavigation(APIChangelogBuild build) + : base(build) + { + } + + protected override FillFlowContainer CreateHeader() + { + var fill = base.CreateHeader(); + + foreach (var existing in fill.Children.OfType()) + { + existing.Scale = new Vector2(1.25f); + existing.Action = null; + + existing.Add(new OsuSpriteText + { + // do we need .ToUniversalTime() here? + // also, this should be a temporary solution to weekdays in >localized< date strings + Text = Build.CreatedAt.Date.ToLongDateString().Replace(Build.CreatedAt.ToString("dddd") + ", ", ""), + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14), + Colour = OsuColour.FromHex(@"FD5"), + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding { Top = 5 }, + }); + } + + TooltipIconButton left, right; + + fill.AddRange(new[] + { + left = new TooltipIconButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.Solid.ChevronLeft, + Size = new Vector2(24), + TooltipText = Build.Versions?.Previous?.DisplayVersion, + IsEnabled = Build.Versions?.Previous != null, + Action = () => { SelectBuild?.Invoke(Build.Versions.Previous); }, + }, + right = new TooltipIconButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.Solid.ChevronRight, + Size = new Vector2(24), + TooltipText = Build.Versions?.Next?.DisplayVersion, + IsEnabled = Build.Versions?.Next != null, + Action = () => { SelectBuild?.Invoke(Build.Versions.Next); }, + }, + }); + + fill.SetLayoutPosition(left, -1); + fill.SetLayoutPosition(right, 1); + + return fill; + } + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs index c9b1430b5d..f960111a53 100644 --- a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs +++ b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using System; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Components; namespace osu.Game.Overlays.Changelog.Header @@ -33,7 +34,7 @@ namespace osu.Game.Overlays.Changelog.Header RelativeSizeAxes = Axes.Y; Children = new Drawable[] { - Text = new SpriteText + Text = new OsuSpriteText { Font = OsuFont.GetFont(size: 16), Text = displayText, diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index ce2ae8baf6..bdddc1f968 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -11,6 +11,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using System; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Components; using osuTK.Graphics; @@ -51,18 +52,18 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical, Children = new[] { - new SpriteText + new OsuSpriteText { Text = stream.DisplayName, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), Margin = new MarginPadding { Top = 6 }, }, - new SpriteText + new OsuSpriteText { Text = stream.LatestBuild.DisplayVersion, Font = OsuFont.GetFont(weight: FontWeight.Light, size: 16), }, - new SpriteText + new OsuSpriteText { Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 10), diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index f4c0338436..22c362d49d 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -138,7 +138,7 @@ namespace osu.Game.Overlays header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); badges.Current.Value = build.UpdateStream; - loadContent(new ChangelogBuild(build)); + loadContent(new ChangelogSingleBuild(build)); } private bool initialFetchPerformed;