1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-21 10:10:09 +08:00

Add back receptor, logo tracking, and own colour provider to screen footer

This commit is contained in:
Salman Ahmed
2024-05-16 06:59:58 +03:00
Unverified
parent 95840672cb
commit 921be3ca01
3 changed files with 126 additions and 33 deletions
+4 -29
View File
@@ -7,19 +7,18 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Screens.Footer;
namespace osu.Game.Graphics.UserInterface
{
// todo: remove this once all screens migrate to display the new game footer and back button.
public partial class BackButton : VisibilityContainer
{
public Action Action;
private readonly TwoLayerButton button;
public BackButton(Receptor receptor = null)
public BackButton(ScreenFooter.BackReceptor receptor = null)
{
Size = TwoLayerButton.SIZE_EXTENDED;
@@ -35,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
if (receptor == null)
{
// if a receptor wasn't provided, create our own locally.
Add(receptor = new Receptor());
Add(receptor = new ScreenFooter.BackReceptor());
}
receptor.OnBackPressed = () => button.TriggerClick();
@@ -59,29 +58,5 @@ namespace osu.Game.Graphics.UserInterface
button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400, Easing.OutQuint);
button.FadeOut(400, Easing.OutQuint);
}
public partial class Receptor : Drawable, IKeyBindingHandler<GlobalAction>
{
public Action OnBackPressed;
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Repeat)
return false;
switch (e.Action)
{
case GlobalAction.Back:
OnBackPressed?.Invoke();
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}
}
}
}