diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 4ac5514019..c97ef384d3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -7,7 +7,6 @@ using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Changelog; -using osu.Game.Overlays.Changelog.Header; namespace osu.Game.Tests.Visual.Online { @@ -25,9 +24,6 @@ namespace osu.Game.Tests.Visual.Online typeof(ChangelogListing), typeof(ChangelogSingleBuild), typeof(ChangelogBuild), - typeof(Breadcrumb), - typeof(BreadcrumbListing), - typeof(BreadcrumbRelease), }; protected override void LoadComplete() diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs deleted file mode 100644 index 67b2b9854d..0000000000 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs +++ /dev/null @@ -1,57 +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.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Overlays.Changelog.Header; -using osuTK.Graphics; - -namespace osu.Game.Tests.Visual.UserInterface -{ - public class TestSceneTextBadgePair : OsuTestScene - { - public TestSceneTextBadgePair() - { - Breadcrumb breadcrumb; - - Add(new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Width = 250, - Height = 50, - Children = new Drawable[] - { - new Box - { - Colour = Color4.Gray, - Alpha = 0.5f, - RelativeSizeAxes = Axes.Both, - }, - breadcrumb = new TestBadgePair(Color4.DeepSkyBlue, "Test") - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - } - } - }); - - AddStep(@"Deactivate", breadcrumb.Deactivate); - AddStep(@"Activate", breadcrumb.Activate); - AddStep(@"Hide text", () => breadcrumb.HideText(200)); - AddStep(@"Show text", () => breadcrumb.ShowText(200)); - AddStep(@"Different text", () => breadcrumb.ShowText(200, "This one's a little bit wider")); - AddStep(@"Different text", () => breadcrumb.ShowText(200, "Ok?..")); - } - - private class TestBadgePair : Breadcrumb - { - public TestBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) - : base(badgeColour, displayText, startCollapsed) - { - } - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs deleted file mode 100644 index f960111a53..0000000000 --- a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs +++ /dev/null @@ -1,127 +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.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -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 -{ - public abstract class Breadcrumb : Container - { - protected SpriteText Text; - protected LineBadge LineBadge; - - public bool IsActivated { get; protected set; } - - public Action Action; - - private SampleChannel sampleHover; - private SampleChannel sampleActivate; - - protected Breadcrumb(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) - { - AutoSizeAxes = Axes.X; - RelativeSizeAxes = Axes.Y; - Children = new Drawable[] - { - Text = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 16), - Text = displayText, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Margin = new MarginPadding { Top = 5, Bottom = 15 }, - }, - LineBadge = new LineBadge(startCollapsed) - { - CollapsedSize = 2, - UncollapsedSize = 10, - Colour = badgeColour, - Anchor = Anchor.BottomCentre, - Origin = Anchor.Centre, - } - }; - } - - public virtual void Deactivate() - { - if (!IsActivated) - return; - - IsActivated = false; - LineBadge.Collapse(); - Text.Font = Text.Font.With(weight: FontWeight.Regular); - } - - public virtual void Activate() - { - if (IsActivated) - return; - - IsActivated = true; - LineBadge.Uncollapse(); - Text.Font = Text.Font.With(weight: FontWeight.Bold); - } - - public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) - { - Text.FadeColour(newColour, duration, easing); - } - - public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing); - } - - public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing) - .Then() - .MoveToY(0, duration, easing) - .FadeIn(duration, easing); - - Scheduler.AddDelayed(() => - { - Text.Text = displayText; - LineBadge.Uncollapse(); - }, duration); - } - - protected override bool OnHover(HoverEvent e) - { - if (!IsActivated) - sampleHover?.Play(); - return base.OnHover(e); - } - - protected override bool OnClick(ClickEvent e) - { - Action?.Invoke(); - Activate(); - sampleActivate?.Play(); - - return true; - } - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); - sampleActivate = audio.Sample.Get(@"UI/generic-select-soft"); - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs deleted file mode 100644 index 50db916e7e..0000000000 --- a/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs +++ /dev/null @@ -1,66 +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.Colour; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Changelog.Header -{ - public class BreadcrumbListing : Breadcrumb - { - private readonly ColourInfo badgeColour; - - public BreadcrumbListing(ColourInfo badgeColour) - : base(badgeColour, "Listing", false) - { - this.badgeColour = badgeColour; - Text.Font = Text.Font.With(weight: FontWeight.Bold); - Text.Anchor = Anchor.TopCentre; - Text.Origin = Anchor.TopCentre; - - AutoSizeAxes = Axes.None; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Activate(); - Width = Text.DrawWidth; - } - - public override void Activate() - { - if (IsActivated) - return; - - base.Activate(); - SetTextColour(Color4.White, 100); - } - - public override void Deactivate() - { - if (!IsActivated) - return; - - base.Deactivate(); - SetTextColour(badgeColour, 100); - } - - protected override bool OnHover(HoverEvent e) - { - LineBadge.Uncollapse(); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - if (!IsActivated) - LineBadge.Collapse(); - base.OnHoverLost(e); - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs deleted file mode 100644 index 43711af61b..0000000000 --- a/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs +++ /dev/null @@ -1,35 +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.Colour; -using osu.Game.Graphics; - -namespace osu.Game.Overlays.Changelog.Header -{ - public class BreadcrumbRelease : Breadcrumb - { - private const float transition_duration = 125; - - public BreadcrumbRelease(ColourInfo badgeColour, string displayText) - : base(badgeColour, displayText) - { - Text.Font = Text.Font.With(weight: FontWeight.Bold); - Text.Y = 20; - Text.Alpha = 0; - } - - public void ShowBuild(string displayText = null) - { - ShowText(transition_duration, displayText); - IsActivated = true; - } - - public override void Deactivate() - { - if (!IsActivated) - return; - - HideText(transition_duration); - } - } -}