mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 12:32:54 +08:00
Merge branch 'master' into glow
This commit is contained in:
commit
5a362be190
@ -6,6 +6,7 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Realms;
|
using Realms;
|
||||||
using Realms.Schema;
|
using Realms.Schema;
|
||||||
|
|
||||||
@ -15,8 +16,12 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
private IList<T> emptySet => Array.Empty<T>();
|
private IList<T> emptySet => Array.Empty<T>();
|
||||||
|
|
||||||
|
[MustDisposeResource]
|
||||||
public IEnumerator<T> GetEnumerator() => emptySet.GetEnumerator();
|
public IEnumerator<T> GetEnumerator() => emptySet.GetEnumerator();
|
||||||
|
|
||||||
|
[MustDisposeResource]
|
||||||
IEnumerator IEnumerable.GetEnumerator() => emptySet.GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => emptySet.GetEnumerator();
|
||||||
|
|
||||||
public int Count => emptySet.Count;
|
public int Count => emptySet.Count;
|
||||||
public T this[int index] => emptySet[index];
|
public T this[int index] => emptySet[index];
|
||||||
public int IndexOf(object? item) => item == null ? -1 : emptySet.IndexOf((T)item);
|
public int IndexOf(object? item) => item == null ? -1 : emptySet.IndexOf((T)item);
|
||||||
|
@ -188,9 +188,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
protected override void UpdateState(ValueChangedEvent<Visibility> state)
|
protected override void UpdateState(ValueChangedEvent<Visibility> state)
|
||||||
{
|
{
|
||||||
base.UpdateState(state);
|
base.UpdateState(state);
|
||||||
|
footerButton.OverlayState.Value = state.NewValue;
|
||||||
if (state.NewValue == Visibility.Hidden)
|
|
||||||
footerButton.IsActive.Value = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
@ -15,8 +13,6 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
{
|
{
|
||||||
public partial class FooterButtonOptionsV2 : FooterButtonV2, IHasPopover
|
public partial class FooterButtonOptionsV2 : FooterButtonV2, IHasPopover
|
||||||
{
|
{
|
||||||
public readonly BindableBool IsActive = new BindableBool();
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colour)
|
private void load(OsuColour colour)
|
||||||
{
|
{
|
||||||
@ -25,31 +21,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
AccentColour = colour.Purple1;
|
AccentColour = colour.Purple1;
|
||||||
Hotkey = GlobalAction.ToggleBeatmapOptions;
|
Hotkey = GlobalAction.ToggleBeatmapOptions;
|
||||||
|
|
||||||
Action = () => IsActive.Toggle();
|
Action = this.ShowPopover;
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
IsActive.BindValueChanged(active =>
|
|
||||||
{
|
|
||||||
OverlayState.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
|
||||||
});
|
|
||||||
|
|
||||||
OverlayState.BindValueChanged(state =>
|
|
||||||
{
|
|
||||||
switch (state.NewValue)
|
|
||||||
{
|
|
||||||
case Visibility.Hidden:
|
|
||||||
this.HidePopover();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Visibility.Visible:
|
|
||||||
this.ShowPopover();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Popover GetPopover() => new BeatmapOptionsPopover(this);
|
public Popover GetPopover() => new BeatmapOptionsPopover(this);
|
||||||
|
@ -25,8 +25,6 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
{
|
{
|
||||||
public partial class FooterButtonV2 : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
|
public partial class FooterButtonV2 : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private const int transition_length = 500;
|
|
||||||
|
|
||||||
// This should be 12 by design, but an extra allowance is added due to the corner radius specification.
|
// This should be 12 by design, but an extra allowance is added due to the corner radius specification.
|
||||||
private const float shear_width = 13.5f;
|
private const float shear_width = 13.5f;
|
||||||
|
|
||||||
@ -70,6 +68,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
private readonly Box bar;
|
private readonly Box bar;
|
||||||
private readonly Box backgroundBox;
|
private readonly Box backgroundBox;
|
||||||
private readonly Box glowBox;
|
private readonly Box glowBox;
|
||||||
|
private readonly Box flashLayer;
|
||||||
|
|
||||||
public FooterButtonV2()
|
public FooterButtonV2()
|
||||||
{
|
{
|
||||||
@ -143,8 +142,15 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
flashLayer = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Colour4.White.Opacity(0.9f),
|
||||||
|
Blending = BlendingParameters.Additive,
|
||||||
|
Alpha = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +166,15 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
|
|
||||||
public GlobalAction? Hotkey;
|
public GlobalAction? Hotkey;
|
||||||
|
|
||||||
private bool handlingMouse;
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
if (Enabled.Value)
|
||||||
|
Flash();
|
||||||
|
|
||||||
|
return base.OnClick(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Flash() => flashLayer.FadeOutFromOne(800, Easing.OutQuint);
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
@ -168,20 +182,6 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
|
||||||
{
|
|
||||||
handlingMouse = true;
|
|
||||||
updateDisplay();
|
|
||||||
return base.OnMouseDown(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseUp(MouseUpEvent e)
|
|
||||||
{
|
|
||||||
handlingMouse = false;
|
|
||||||
updateDisplay();
|
|
||||||
base.OnMouseUp(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e) => updateDisplay();
|
protected override void OnHoverLost(HoverLostEvent e) => updateDisplay();
|
||||||
|
|
||||||
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
@ -196,28 +196,25 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
Color4 backgroundColour = colourProvider.Background3;
|
Color4 backgroundColour = OverlayState.Value == Visibility.Visible ? buttonAccentColour : colourProvider.Background3;
|
||||||
|
Color4 textColour = OverlayState.Value == Visibility.Visible ? colourProvider.Background6 : colourProvider.Content1;
|
||||||
|
Color4 accentColour = OverlayState.Value == Visibility.Visible ? colourProvider.Background6 : buttonAccentColour;
|
||||||
|
|
||||||
if (!Enabled.Value)
|
if (!Enabled.Value)
|
||||||
{
|
backgroundColour = backgroundColour.Darken(1f);
|
||||||
backgroundColour = colourProvider.Background3.Darken(0.4f);
|
else if (IsHovered)
|
||||||
}
|
backgroundColour = backgroundColour.Lighten(0.2f);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (OverlayState.Value == Visibility.Visible)
|
|
||||||
backgroundColour = buttonAccentColour.Darken(0.5f);
|
|
||||||
|
|
||||||
if (IsHovered)
|
backgroundBox.FadeColour(backgroundColour, 150, Easing.OutQuint);
|
||||||
{
|
|
||||||
backgroundColour = backgroundColour.Lighten(0.3f);
|
|
||||||
|
|
||||||
if (handlingMouse)
|
if (!Enabled.Value)
|
||||||
backgroundColour = backgroundColour.Lighten(0.3f);
|
textColour = textColour.Opacity(0.6f);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
backgroundBox.FadeColour(backgroundColour, transition_length, Easing.OutQuint);
|
text.FadeColour(textColour, 150, Easing.OutQuint);
|
||||||
glowBox.Colour = ColourInfo.GradientVertical(buttonAccentColour.Opacity(0f), buttonAccentColour.Opacity(0.2f));
|
icon.FadeColour(accentColour, 150, Easing.OutQuint);
|
||||||
|
bar.FadeColour(accentColour, 150, Easing.OutQuint);
|
||||||
|
|
||||||
|
glowBox.FadeColour(ColourInfo.GradientVertical(buttonAccentColour.Opacity(0f), buttonAccentColour.Opacity(0.2f)), 150, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user