mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 08:52:55 +08:00
Flash footer freemod/freestyle buttons when active
This commit is contained in:
parent
9c3e9e7c55
commit
218151bb3c
@ -26,6 +26,8 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
public readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>();
|
||||
public readonly IBindable<bool> Freestyle = new Bindable<bool>();
|
||||
|
||||
protected override bool IsActive => FreeMods.Value.Count > 0;
|
||||
|
||||
public new Action Action { set => throw new NotSupportedException("The click action is handled by the button itself."); }
|
||||
|
||||
private OsuSpriteText count = null!;
|
||||
|
@ -8,11 +8,10 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
@ -20,6 +19,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
public readonly Bindable<bool> Freestyle = new Bindable<bool>();
|
||||
|
||||
protected override bool IsActive => Freestyle.Value;
|
||||
|
||||
public new Action Action { set => throw new NotSupportedException("The click action is handled by the button itself."); }
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
protected override UserActivity InitialActivity => new UserActivity.InLobby(room);
|
||||
|
||||
protected readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
protected readonly Bindable<bool> Freestyle = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> Freestyle = new Bindable<bool>(true);
|
||||
|
||||
private readonly Room room;
|
||||
private readonly PlaylistItem? initialItem;
|
||||
|
@ -25,6 +25,11 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected static readonly Vector2 SHEAR = new Vector2(SHEAR_WIDTH / Footer.HEIGHT, 0);
|
||||
|
||||
/// <summary>
|
||||
/// Used to show an initial animation hinting at the enabled state.
|
||||
/// </summary>
|
||||
protected virtual bool IsActive => false;
|
||||
|
||||
public LocalisableString Text
|
||||
{
|
||||
get => SpriteText?.Text ?? default;
|
||||
@ -124,6 +129,18 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
base.LoadComplete();
|
||||
Enabled.BindValueChanged(_ => updateDisplay(), true);
|
||||
|
||||
if (IsActive)
|
||||
{
|
||||
box.ClearTransforms();
|
||||
|
||||
using (box.BeginDelayedSequence(200))
|
||||
{
|
||||
box.FadeIn(200)
|
||||
.Then()
|
||||
.FadeOut(1500, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Action Hovered;
|
||||
|
Loading…
Reference in New Issue
Block a user