diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 12961aeda7..063555cf76 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; @@ -20,7 +19,9 @@ namespace osu.Game.Tests.Visual Add(changelog = new ChangelogOverlay()); AddStep(@"Show", changelog.Show); AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); + + AddWaitStep("wait for hide", 3); + AddStep(@"Show with Lazer 2018.712.0", () => { changelog.FetchAndShowBuild(new APIChangelogBuild @@ -30,9 +31,11 @@ namespace osu.Game.Tests.Visual }); changelog.Show(); }); - AddWaitStep(3); + + AddWaitStep("wait for show", 3); AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); + AddWaitStep("wait for hide", 3); + AddStep(@"Show with listing", () => { changelog.ShowListing(); diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index df2f796407..bfd77ee3c7 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -42,7 +42,6 @@ namespace osu.Game.Tests.Visual AddStep(@"Hide text", () => textBadgePair.HideText(200)); AddStep(@"Show text", () => textBadgePair.ShowText(200)); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider")); - AddWaitStep(1); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?..")); } } diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index b730286608..c4df3b64a3 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -36,6 +36,7 @@ namespace osu.Game.Graphics if (!string.IsNullOrEmpty(name)) if (colours.TryGetValue(name, out ColourInfo colour)) return colour; + return new Color4(0, 0, 0, 255); } } diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs index ef55cb03ef..fc87acab0a 100644 --- a/osu.Game/Graphics/UserInterface/LineBadge.cs +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -1,7 +1,6 @@ // 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.Shapes; @@ -25,11 +24,12 @@ namespace osu.Game.Graphics.UserInterface /// public bool IsHorizontal { - get { return isHorizontal; } + get => isHorizontal; set { if (value == isHorizontal) return; + if (IsLoaded) { FinishTransforms(); @@ -41,6 +41,7 @@ namespace osu.Game.Graphics.UserInterface } else RelativeSizeAxes = value ? Axes.X : Axes.Y; + isHorizontal = value; } } diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index af203d316a..ce546c5358 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -36,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface /// public bool IsEnabled { - get { return isEnabled; } + get => isEnabled; set { isEnabled = value; @@ -77,6 +77,7 @@ namespace osu.Game.Graphics.UserInterface sampleClick?.Play(); Action?.Invoke(); } + return base.OnClick(e); } diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 52b87eda73..6c32abee42 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs index 9d2e20c184..cf5dc5a65a 100644 --- a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests @@ -10,12 +9,19 @@ namespace osu.Game.Online.API.Requests { private readonly string updateStream; - public GetChangelogChartRequest() => updateStream = null; + public GetChangelogChartRequest() + { + updateStream = null; + } - public GetChangelogChartRequest(string updateStreamName) => updateStream = updateStreamName; + public GetChangelogChartRequest(string updateStreamName) + { + updateStream = updateStreamName; + } protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ? updateStream + "/" : "")}chart-config"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 1d485edb4d..087d4bb49c 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 17fb1992f3..483182e720 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index ab4bd9e613..3ae992c22d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs index 0d6487e01a..598928d309 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index aa95b54d0c..1f1bfae40a 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using System; using osuTK.Graphics; @@ -13,7 +12,6 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { - private APIAccess api; private ChangelogContentGroup changelogContentGroup; public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 6f12ff973a..837ce24522 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -65,19 +65,17 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = build.UpdateStream.DisplayName, - TextSize = 28, // web: 24, - Font = @"Exo2.0-Medium", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24, }, new SpriteText { Text = " ", - TextSize = 28, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24, }, new SpriteText { Text = build.DisplayVersion, - TextSize = 28, // web: 24, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24, Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, } @@ -100,9 +98,8 @@ namespace osu.Game.Overlays.Changelog // 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") + ", ", ""), - TextSize = 17, // web: 14, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 17), // web: 14, Colour = OsuColour.FromHex(@"FD5"), - Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 5 }, @@ -130,9 +127,8 @@ namespace osu.Game.Overlays.Changelog // 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") + ", ", ""), - TextSize = 28, // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24, Colour = OsuColour.FromHex(@"FD5"), - Font = @"Exo2.0-Light", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 20 }, @@ -155,14 +151,12 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = build.UpdateStream.DisplayName, - TextSize = 20, // web: 18, - Font = @"Exo2.0-Medium", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), // web: 19, }, new SpriteText { Text = build.DisplayVersion, - TextSize = 20, // web: 18, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 19, Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, }, @@ -226,8 +220,7 @@ namespace osu.Game.Overlays.Changelog ChangelogEntries.Add(new SpriteText { Text = category.Key, - TextSize = 24, // web: 18, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), // web: 24, Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); @@ -240,40 +233,47 @@ namespace osu.Game.Overlays.Changelog AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 5 }, }; + title.AddIcon(FontAwesome.Solid.Check, t => { - t.TextSize = 12; + t.Font = OsuFont.GetFont(size: 12); t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); - title.AddText(entry.Title, t => { t.TextSize = 18; }); + + title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); if (!string.IsNullOrEmpty(entry.Repository)) { - title.AddText(" (", t => t.TextSize = 18); + 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.TextSize = 18; }); - title.AddText(")", t => t.TextSize = 18); + null, t => { t.Font = OsuFont.GetFont(size: 18); }); + title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); } - title.AddText(" by ", t => t.TextSize = 14); + 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.TextSize = 14); + t => t.Font = OsuFont.GetFont(size: 14)); else - title.AddText(entry.GithubUser.DisplayName, t => t.TextSize = 14); //web: 12; + title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 14)); //web: 12; + ChangelogEntries.Add(title); + TextFlowContainer messageContainer = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; + messageContainer.AddText($"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", t => { - t.TextSize = 14; // web: 12, + t.Font = OsuFont.GetFont(size: 14); // web: 12, t.Colour = new Color4(235, 184, 254, 255); }); + ChangelogEntries.Add(messageContainer); } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index c23951bf23..b14e065b1e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; using System; +using osu.Game.Graphics; using osuTK; using osuTK.Graphics; @@ -97,14 +98,12 @@ namespace osu.Game.Overlays.Changelog new OsuSpriteText { Text = "Changelog ", - Font = @"Exo2.0-Light", - TextSize = 38, // web: 30 + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, }, titleStream = new OsuSpriteText { Text = "Listing", - TextSize = 38, // web: 30 - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, Colour = Purple, }, } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 46a46913fd..e044d4c342 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -1,7 +1,6 @@ // 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.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -12,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; using System; +using osu.Game.Graphics; namespace osu.Game.Overlays.Changelog.Header { @@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Changelog.Header { Text = new SpriteText { - TextSize = 21, // web: 16, + Font = OsuFont.GetFont(size: 21), // web: 16, Text = displayText, Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -56,6 +56,8 @@ namespace osu.Game.Overlays.Changelog.Header /// /// The duration of popping in and popping out not combined. /// Full change takes double this time. + /// + /// public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { LineBadge.Collapse(); diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index fc143c46d2..c9ed04168c 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -54,21 +54,18 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = LatestBuild.UpdateStream.DisplayName, - Font = @"Exo2.0-Bold", - TextSize = 14, // web: 12, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), // web: 12, Margin = new MarginPadding { Top = 6 }, }, new SpriteText { Text = LatestBuild.DisplayVersion, - Font = @"Exo2.0-Light", - TextSize = 20, // web: 16, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 16, }, new SpriteText { Text = LatestBuild.Users > 0 ? $"{LatestBuild.Users:N0} users online" : null, - TextSize = 12, // web: 10, - Font = @"Exo2.0-Regular", + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 12), // web: 10, Colour = new Color4(203, 164, 218, 255), }, } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index d3db26889f..8f77862c99 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -161,8 +161,10 @@ namespace osu.Game.Overlays private void fetchListing() { header.ShowListing(); + if (isAtListing) return; + isAtListing = true; var req = new GetChangelogRequest(); badges.SelectNone(); @@ -173,8 +175,10 @@ namespace osu.Game.Overlays public void ShowListing() { header.ShowListing(); + if (isAtListing) return; + isAtListing = true; content.Hide(); listing.Show(); @@ -187,8 +191,8 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - /// Must contain at least and - /// . If and + /// Must contain at least and + /// . If and /// are specified, the header will instantly display them. /// Whether to update badges. Should be set to false in case /// the function is called by selecting a badge, to avoid an infinite loop.