diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj
index 66db439c82..aa8848c55f 100644
--- a/osu.Desktop/osu.Desktop.csproj
+++ b/osu.Desktop/osu.Desktop.csproj
@@ -26,9 +26,9 @@
-
-
-
+
+
+
diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs
index d7fc90e36d..0f3c92a962 100644
--- a/osu.Game/Screens/Play/HUD/ModDisplay.cs
+++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs
@@ -24,6 +24,8 @@ namespace osu.Game.Screens.Play.HUD
public bool DisplayUnrankedText = true;
+ public bool AllowExpand = true;
+
private readonly Bindable> current = new Bindable>();
public Bindable> Current
@@ -88,7 +90,9 @@ namespace osu.Game.Screens.Play.HUD
protected override void LoadComplete()
{
base.LoadComplete();
+
appearTransform();
+ iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
}
private void appearTransform()
@@ -98,14 +102,17 @@ namespace osu.Game.Screens.Play.HUD
else
unrankedText.Hide();
- iconsContainer.FinishTransforms();
- iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
expand();
+
using (iconsContainer.BeginDelayedSequence(1200))
contract();
}
- private void expand() => iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint);
+ private void expand()
+ {
+ if (AllowExpand)
+ iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint);
+ }
private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint);
diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs
index 03b9826e9b..6ba29751b0 100644
--- a/osu.Game/Screens/Select/Footer.cs
+++ b/osu.Game/Screens/Select/Footer.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using osuTK;
using osuTK.Graphics;
-using osuTK.Input;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -20,9 +19,6 @@ namespace osu.Game.Screens.Select
{
private readonly Box modeLight;
- private const float play_song_select_button_width = 100;
- private const float play_song_select_button_height = 50;
-
public const float HEIGHT = 50;
public const int TRANSITION_LENGTH = 300;
@@ -33,57 +29,36 @@ namespace osu.Game.Screens.Select
private readonly FillFlowContainer buttons;
- /// Text on the button.
- /// Colour of the button.
- /// Hotkey of the button.
- /// Action the button does.
- ///
- /// Higher depth to be put on the left, and lower to be put on the right.
- /// Notice this is different to !
- ///
- public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0)
- {
- var button = new FooterButton
- {
- Text = text,
- Height = play_song_select_button_height,
- Width = play_song_select_button_width,
- Depth = depth,
- SelectedColour = colour,
- DeselectedColour = colour.Opacity(0.5f),
- Hotkey = hotkey,
- Hovered = updateModeLight,
- HoverLost = updateModeLight,
- Action = action,
- };
-
- buttons.Add(button);
- buttons.SetLayoutPosition(button, -depth);
- }
-
private readonly List overlays = new List();
- /// Text on the button.
- /// Colour of the button.
- /// Hotkey of the button.
+ /// THe button to be added.
/// The to be toggled by this button.
- ///
- /// Higher depth to be put on the left, and lower to be put on the right.
- /// Notice this is different to !
- ///
- public void AddButton(string text, Color4 colour, OverlayContainer overlay, Key? hotkey = null, float depth = 0)
+ public void AddButton(FooterButton button, OverlayContainer overlay)
{
overlays.Add(overlay);
- AddButton(text, colour, () =>
+ button.Action = () => showOverlay(overlay);
+
+ AddButton(button);
+ }
+
+ /// Button to be added.
+ public void AddButton(FooterButton button)
+ {
+ button.Hovered = updateModeLight;
+ button.HoverLost = updateModeLight;
+
+ buttons.Add(button);
+ }
+
+ private void showOverlay(OverlayContainer overlay)
+ {
+ foreach (var o in overlays)
{
- foreach (var o in overlays)
- {
- if (o == overlay)
- o.ToggleVisibility();
- else
- o.Hide();
- }
- }, hotkey, depth);
+ if (o == overlay)
+ o.ToggleVisibility();
+ else
+ o.Hide();
+ }
}
private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, Easing.OutQuint);
diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs
index 9b98e344ce..e18a086a10 100644
--- a/osu.Game/Screens/Select/FooterButton.cs
+++ b/osu.Game/Screens/Select/FooterButton.cs
@@ -6,6 +6,7 @@ using osuTK;
using osuTK.Graphics;
using osuTK.Input;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
@@ -20,11 +21,11 @@ namespace osu.Game.Screens.Select
public string Text
{
- get => spriteText?.Text;
+ get => SpriteText?.Text;
set
{
- if (spriteText != null)
- spriteText.Text = value;
+ if (SpriteText != null)
+ SpriteText.Text = value;
}
}
@@ -53,7 +54,8 @@ namespace osu.Game.Screens.Select
}
}
- private readonly SpriteText spriteText;
+ protected readonly Container TextContainer;
+ protected readonly SpriteText SpriteText;
private readonly Box box;
private readonly Box light;
@@ -61,8 +63,18 @@ namespace osu.Game.Screens.Select
public FooterButton()
{
+ AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
+ TextContainer = new Container
+ {
+ Size = new Vector2(100, 50),
+ Child = SpriteText = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ }
+ },
box = new Box
{
RelativeSizeAxes = Axes.Both,
@@ -78,11 +90,6 @@ namespace osu.Game.Screens.Select
EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X,
},
- spriteText = new OsuSpriteText
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- }
};
}
diff --git a/osu.Game/Screens/Select/FooterButtonMods.cs b/osu.Game/Screens/Select/FooterButtonMods.cs
new file mode 100644
index 0000000000..c96c5022c0
--- /dev/null
+++ b/osu.Game/Screens/Select/FooterButtonMods.cs
@@ -0,0 +1,60 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Bindables;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Screens.Play.HUD;
+using osu.Game.Rulesets.Mods;
+using System.Collections.Generic;
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Game.Graphics;
+using osuTK;
+using osuTK.Input;
+
+namespace osu.Game.Screens.Select
+{
+ public class FooterButtonMods : FooterButton
+ {
+ public FooterButtonMods(Bindable> mods)
+ {
+ FooterModDisplay modDisplay;
+
+ Add(new Container
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Child = modDisplay = new FooterModDisplay
+ {
+ DisplayUnrankedText = false,
+ Scale = new Vector2(0.8f)
+ },
+ AutoSizeAxes = Axes.Both,
+ Margin = new MarginPadding { Left = 70 }
+ });
+
+ if (mods != null)
+ modDisplay.Current = mods;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ SelectedColour = colours.Yellow;
+ DeselectedColour = SelectedColour.Opacity(0.5f);
+ Text = @"mods";
+ Hotkey = Key.F1;
+ }
+
+ private class FooterModDisplay : ModDisplay
+ {
+ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
+
+ public FooterModDisplay()
+ {
+ AllowExpand = false;
+ }
+ }
+ }
+}
diff --git a/osu.Game/Screens/Select/FooterButtonOptions.cs b/osu.Game/Screens/Select/FooterButtonOptions.cs
new file mode 100644
index 0000000000..c000d8a8c8
--- /dev/null
+++ b/osu.Game/Screens/Select/FooterButtonOptions.cs
@@ -0,0 +1,22 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Game.Graphics;
+using osuTK.Input;
+
+namespace osu.Game.Screens.Select
+{
+ public class FooterButtonOptions : FooterButton
+ {
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ SelectedColour = colours.Blue;
+ DeselectedColour = SelectedColour.Opacity(0.5f);
+ Text = @"options";
+ Hotkey = Key.F3;
+ }
+ }
+}
diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs
new file mode 100644
index 0000000000..14c9eb2035
--- /dev/null
+++ b/osu.Game/Screens/Select/FooterButtonRandom.cs
@@ -0,0 +1,68 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Input.Events;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osuTK.Input;
+
+namespace osu.Game.Screens.Select
+{
+ public class FooterButtonRandom : FooterButton
+ {
+ private readonly SpriteText secondaryText;
+ private bool secondaryActive;
+
+ public FooterButtonRandom()
+ {
+ TextContainer.Add(secondaryText = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Text = @"rewind",
+ Alpha = 0
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ SelectedColour = colours.Green;
+ DeselectedColour = SelectedColour.Opacity(0.5f);
+ Text = @"random";
+ Hotkey = Key.F2;
+ }
+
+ protected override bool OnKeyDown(KeyDownEvent e)
+ {
+ secondaryActive = e.ShiftPressed;
+ updateText();
+ return base.OnKeyDown(e);
+ }
+
+ protected override bool OnKeyUp(KeyUpEvent e)
+ {
+ secondaryActive = e.ShiftPressed;
+ updateText();
+ return base.OnKeyUp(e);
+ }
+
+ private void updateText()
+ {
+ if (secondaryActive)
+ {
+ SpriteText.FadeOut(120, Easing.InQuad);
+ secondaryText.FadeIn(120, Easing.InQuad);
+ }
+ else
+ {
+ SpriteText.FadeIn(120, Easing.InQuad);
+ secondaryText.FadeOut(120, Easing.InQuad);
+ }
+ }
+ }
+}
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 14c362b8ca..d5301116a9 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -223,9 +223,9 @@ namespace osu.Game.Screens.Select
if (Footer != null)
{
- Footer.AddButton(@"mods", colours.Yellow, ModSelect, Key.F1);
- Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
- Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3);
+ Footer.AddButton(new FooterButtonMods(mods), ModSelect);
+ Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
+ Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index b6b4896658..8f733a5c55 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -11,11 +11,11 @@
-
-
-
-
-
+
+
+
+
+