diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index c9b8a4d652..afd06d8415 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -1,7 +1,6 @@ -// Copyright(c) 2007-2018 ppy Pty Ltd. +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - using NUnit.Framework; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs deleted file mode 100644 index 9a4e481ff8..0000000000 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using NUnit.Framework; -using OpenTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Overlays.Changelog.Header; - -namespace osu.Game.Tests.Visual -{ - [TestFixture] - public class TestCaseTextBadgePair : OsuTestCase - { - private readonly Container container; - private readonly Box bottomLine; - private readonly TextBadgePair textBadgePair; - - public TestCaseTextBadgePair() - { - - Add(container = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new OpenTK.Vector2(300, 40), - Children = new Drawable[] - { - new Box - { - Colour = Color4.Gray, - RelativeSizeAxes = Axes.Both, - }, - bottomLine = new Box // purple line - { - Colour = Color4.Purple, - RelativeSizeAxes = Axes.X, - Height = 3, - Anchor = Anchor.BottomLeft, - Origin = Anchor.CentreLeft, - }, - textBadgePair = new TextBadgePair(Color4.White, "testing") - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - } - }, - }); - - AddStep(@"deactivate", () => textBadgePair.Deactivate()); - AddStep(@"activate", () => textBadgePair.Activate()); - AddStep(@"purple text", () => textBadgePair.SetTextColour(Color4.Purple, 100)); - AddStep(@"white text", () => textBadgePair.SetTextColour(Color4.White, 100)); - AddStep(@"purple badge", () => textBadgePair.SetBadgeColour(Color4.Purple, 100)); - AddStep(@"white badge", () => textBadgePair.SetBadgeColour(Color4.White, 100)); - AddStep(@"hide text", () => textBadgePair.HideText(250)); - AddStep(@"show text", () => textBadgePair.ShowText(250)); - AddStep(@"change text", () => textBadgePair.ChangeText(250)); - } - } -} diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index e7f7d44c80..99c9c0accd 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Overlays.Changelog.Streams; using System; @@ -23,7 +24,7 @@ namespace osu.Game.Overlays.Changelog private readonly StreamColour streamColour; public readonly FillFlowContainer badgesContainer; - + public ChangelogStreams() { streamColour = new StreamColour(); @@ -77,5 +78,31 @@ namespace osu.Game.Overlays.Changelog } }; } + + protected override bool OnHover(InputState state) + { + // is this nullreference-safe for badgesContainer? + foreach (StreamBadge streamBadge in badgesContainer.Children) + { + if (SelectedRelease.Value != null) + { + if (SelectedRelease.Value.Name != streamBadge.Name) + { + streamBadge.Deactivate(); + } + } + else streamBadge.Deactivate(); + } + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (SelectedRelease.Value == null) + { + foreach (StreamBadge streamBadge in badgesContainer.Children) streamBadge.Activate(true); + } + base.OnHoverLost(state); + } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 32910e26c6..42f7bd601a 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -9,7 +9,6 @@ using System; namespace osu.Game.Overlays.Changelog.Header { - public class TextBadgePair : ClickableContainer { protected SpriteText text; @@ -18,7 +17,7 @@ namespace osu.Game.Overlays.Changelog.Header public Action OnActivation; public Action OnDeactivation; - + public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { text.FadeColour(newColour, duration, easing); diff --git a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs index e61fa22007..9b70c9ce7f 100644 --- a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs @@ -13,7 +13,7 @@ using System; namespace osu.Game.Overlays.Changelog.Streams { - public class StreamBadge : Container + public class StreamBadge : ClickableContainer { private const float badgeHeight = 56.5f; private const float badgeWidth = 100; @@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Changelog.Streams TextSize = 16, Margin = new MarginPadding { - Top = 5, + Top = 7, } }, new SpriteText @@ -80,6 +80,7 @@ namespace osu.Game.Overlays.Changelog.Streams lineBadge = new Header.LineBadge(false, 2, 4) { Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Width = 1, Colour = colour, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index e47e290075..9d4ec2b806 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -71,13 +71,14 @@ namespace osu.Game.Overlays }; streams.SelectedRelease.ValueChanged += r => { - if (streams.SelectedRelease != null) + if (streams.SelectedRelease.Value != null) header.ShowReleaseStream(r.Name, string.Join(" ", r.Name, r.DisplayVersion)); }; streams.badgesContainer.OnLoadComplete += d => { header.OnListingActivated += () => { + streams.SelectedRelease.Value = null; foreach (StreamBadge item in streams.badgesContainer.Children) { item.Activate(true);