mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Merge pull request #21121 from peppy/improve-ui-control-sound-sync
Update settings UI animation to better suit immediacy of sound effects
This commit is contained in:
@ -35,13 +35,19 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
State = { Value = Visibility.Visible }
|
State = { Value = Visibility.Visible }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
[Test]
|
||||||
|
public void TestBasic()
|
||||||
|
{
|
||||||
|
AddStep("do nothing", () => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFiltering([Values] bool beforeLoad)
|
public void TestFiltering([Values] bool beforeLoad)
|
||||||
{
|
{
|
||||||
|
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
||||||
|
|
||||||
if (beforeLoad)
|
if (beforeLoad)
|
||||||
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
||||||
|
|
||||||
@ -67,6 +73,8 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestFilterAfterLoad()
|
public void TestFilterAfterLoad()
|
||||||
{
|
{
|
||||||
|
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
||||||
|
|
||||||
AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType<IFilterable>().Any());
|
AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType<IFilterable>().Any());
|
||||||
|
|
||||||
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
||||||
@ -75,6 +83,8 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
[Test]
|
[Test]
|
||||||
public void ToggleVisibility()
|
public void ToggleVisibility()
|
||||||
{
|
{
|
||||||
|
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
||||||
|
|
||||||
AddWaitStep("wait some", 5);
|
AddWaitStep("wait some", 5);
|
||||||
AddToggleStep("toggle visibility", _ => settings.ToggleVisibility());
|
AddToggleStep("toggle visibility", _ => settings.ToggleVisibility());
|
||||||
}
|
}
|
||||||
@ -82,6 +92,8 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestTextboxFocusAfterNestedPanelBackButton()
|
public void TestTextboxFocusAfterNestedPanelBackButton()
|
||||||
{
|
{
|
||||||
|
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
||||||
|
|
||||||
AddUntilStep("sections loaded", () => settings.SectionsContainer.Children.Count > 0);
|
AddUntilStep("sections loaded", () => settings.SectionsContainer.Children.Count > 0);
|
||||||
AddUntilStep("top-level textbox focused", () => settings.SectionsContainer.ChildrenOfType<FocusedTextBox>().FirstOrDefault()?.HasFocus == true);
|
AddUntilStep("top-level textbox focused", () => settings.SectionsContainer.ChildrenOfType<FocusedTextBox>().FirstOrDefault()?.HasFocus == true);
|
||||||
|
|
||||||
@ -107,6 +119,8 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestTextboxFocusAfterNestedPanelEscape()
|
public void TestTextboxFocusAfterNestedPanelEscape()
|
||||||
{
|
{
|
||||||
|
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
||||||
|
|
||||||
AddUntilStep("sections loaded", () => settings.SectionsContainer.Children.Count > 0);
|
AddUntilStep("sections loaded", () => settings.SectionsContainer.Children.Count > 0);
|
||||||
AddUntilStep("top-level textbox focused", () => settings.SectionsContainer.ChildrenOfType<FocusedTextBox>().FirstOrDefault()?.HasFocus == true);
|
AddUntilStep("top-level textbox focused", () => settings.SectionsContainer.ChildrenOfType<FocusedTextBox>().FirstOrDefault()?.HasFocus == true);
|
||||||
|
|
||||||
|
@ -58,6 +58,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PlayHoverSample()
|
||||||
|
{
|
||||||
|
if (!Enabled.Value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.PlayHoverSample();
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
|
@ -27,9 +27,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private const float border_width = 3;
|
private const float border_width = 3;
|
||||||
|
|
||||||
private const double animate_in_duration = 200;
|
|
||||||
private const double animate_out_duration = 500;
|
|
||||||
|
|
||||||
private readonly Box fill;
|
private readonly Box fill;
|
||||||
private readonly Container main;
|
private readonly Container main;
|
||||||
|
|
||||||
@ -72,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Colour = GlowColour.Opacity(0),
|
Colour = GlowColour.Opacity(0),
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Radius = 8,
|
Radius = 8,
|
||||||
Roundness = 5,
|
Roundness = 4,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,13 +91,18 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
main.FadeColour(GlowingAccentColour, animate_in_duration, Easing.OutQuint);
|
main.FadeColour(GlowingAccentColour.Lighten(0.5f), 40, Easing.OutQuint)
|
||||||
main.FadeEdgeEffectTo(0.2f, animate_in_duration, Easing.OutQuint);
|
.Then()
|
||||||
|
.FadeColour(GlowingAccentColour, 800, Easing.OutQuint);
|
||||||
|
|
||||||
|
main.FadeEdgeEffectTo(Color4.White.Opacity(0.1f), 40, Easing.OutQuint)
|
||||||
|
.Then()
|
||||||
|
.FadeEdgeEffectTo(GlowColour.Opacity(0.1f), 800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
main.FadeEdgeEffectTo(0, animate_out_duration, Easing.OutQuint);
|
main.FadeEdgeEffectTo(GlowColour.Opacity(0), 800, Easing.OutQuint);
|
||||||
main.FadeColour(AccentColour, animate_out_duration, Easing.OutQuint);
|
main.FadeColour(AccentColour, 800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,14 +165,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void onCurrentValueChanged(ValueChangedEvent<bool> filled)
|
private void onCurrentValueChanged(ValueChangedEvent<bool> filled)
|
||||||
{
|
{
|
||||||
fill.FadeTo(filled.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
const double duration = 200;
|
||||||
|
|
||||||
|
fill.FadeTo(filled.NewValue ? 1 : 0, duration, Easing.OutQuint);
|
||||||
|
|
||||||
if (filled.NewValue)
|
if (filled.NewValue)
|
||||||
main.ResizeWidthTo(1, animate_in_duration, Easing.OutElasticHalf);
|
{
|
||||||
|
main.ResizeWidthTo(1, duration, Easing.OutElasticHalf);
|
||||||
|
main.TransformTo(nameof(BorderThickness), 8.5f, duration, Easing.OutElasticHalf);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
main.ResizeWidthTo(0.9f, animate_out_duration, Easing.OutElastic);
|
{
|
||||||
|
main.ResizeWidthTo(0.75f, duration, Easing.OutQuint);
|
||||||
main.TransformTo(nameof(BorderThickness), filled.NewValue ? 8.5f : border_width, 200, Easing.OutQuint);
|
main.TransformTo(nameof(BorderThickness), border_width, duration, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -95,7 +94,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.White.Opacity(.1f),
|
Colour = Color4.White,
|
||||||
Blending = BlendingParameters.Additive,
|
Blending = BlendingParameters.Additive,
|
||||||
Depth = float.MinValue
|
Depth = float.MinValue
|
||||||
},
|
},
|
||||||
@ -126,7 +125,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (Enabled.Value)
|
if (Enabled.Value)
|
||||||
Background.FlashColour(BackgroundColour.Lighten(0.4f), 200);
|
Background.FlashColour(Color4.White, 800, Easing.OutQuint);
|
||||||
|
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
@ -134,7 +133,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
if (Enabled.Value)
|
if (Enabled.Value)
|
||||||
Hover.FadeIn(200, Easing.OutQuint);
|
{
|
||||||
|
Hover.FadeTo(0.2f, 40, Easing.OutQuint)
|
||||||
|
.Then()
|
||||||
|
.FadeTo(0.1f, 800, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
@ -143,7 +146,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
|
|
||||||
Hover.FadeOut(300);
|
Hover.FadeOut(800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
@ -131,8 +131,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
},
|
},
|
||||||
hoverClickSounds = new HoverClickSounds()
|
hoverClickSounds = new HoverClickSounds()
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.DisabledChanged += disabled => { Alpha = disabled ? 0.3f : 1; };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
@ -154,7 +152,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
CurrentNumber.BindValueChanged(current => TooltipText = getTooltipText(current.NewValue), true);
|
CurrentNumber.BindValueChanged(current => TooltipText = getTooltipText(current.NewValue), true);
|
||||||
Current.DisabledChanged += disabled => hoverClickSounds.Enabled.Value = !disabled;
|
|
||||||
|
Current.BindDisabledChanged(disabled =>
|
||||||
|
{
|
||||||
|
Alpha = disabled ? 0.3f : 1;
|
||||||
|
hoverClickSounds.Enabled.Value = !disabled;
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
@ -180,7 +183,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void updateGlow()
|
private void updateGlow()
|
||||||
{
|
{
|
||||||
Nub.Glowing = IsHovered || IsDragged;
|
Nub.Glowing = !Current.Disabled && (IsHovered || IsDragged);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUserChange(T value)
|
protected override void OnUserChange(T value)
|
||||||
|
Reference in New Issue
Block a user