Don't rotate when hovering

This commit is contained in:
Dean Herbert 2024-03-25 12:14:40 +08:00
parent d0b164b44f
commit 3847aae57d
No known key found for this signature in database

View File

@ -21,6 +21,8 @@ namespace osu.Game.Screens.Menu
{ {
public partial class OnlineMenuBanner : VisibilityContainer public partial class OnlineMenuBanner : VisibilityContainer
{ {
public double DelayBetweenRotation = 7500;
internal Bindable<APIMenuContent> Current { get; } = new Bindable<APIMenuContent>(new APIMenuContent()); internal Bindable<APIMenuContent> Current { get; } = new Bindable<APIMenuContent>(new APIMenuContent());
private const float transition_duration = 500; private const float transition_duration = 500;
@ -115,21 +117,29 @@ namespace osu.Game.Screens.Menu
{ {
nextDisplay?.Cancel(); nextDisplay?.Cancel();
bool previousShowing = displayIndex >= 0; // If the user is hovering a banner, don't rotate yet.
if (previousShowing) bool anyHovered = content.Any(i => i.IsHovered);
content[displayIndex % content.Count].FadeOut(400, Easing.OutQuint);
displayIndex++; if (!anyHovered)
{
bool previousShowing = displayIndex >= 0;
if (previousShowing)
content[displayIndex % content.Count].FadeOut(400, Easing.OutQuint);
using (BeginDelayedSequence(previousShowing ? 300 : 0)) displayIndex++;
content[displayIndex % content.Count].Show();
using (BeginDelayedSequence(previousShowing ? 300 : 0))
content[displayIndex % content.Count].Show();
}
if (content.Count > 1) if (content.Count > 1)
nextDisplay = Scheduler.AddDelayed(showNext, 12000); {
nextDisplay = Scheduler.AddDelayed(showNext, DelayBetweenRotation);
}
} }
[LongRunningLoad] [LongRunningLoad]
private partial class MenuImage : OsuClickableContainer public partial class MenuImage : OsuClickableContainer
{ {
public readonly APIMenuImage Image; public readonly APIMenuImage Image;