mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Fix HoldToQuit appearance and set HoldToQuitButton.ExitAction
This commit is contained in:
parent
21454d1f10
commit
e6d7136a92
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -17,37 +16,36 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public class HoldToQuit : Container
|
public class HoldToQuit : FillFlowContainer
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
private readonly HoldToQuitButton button;
|
public readonly HoldToQuitButton Button;
|
||||||
|
|
||||||
public HoldToQuit()
|
public HoldToQuit()
|
||||||
{
|
{
|
||||||
|
Direction = FillDirection.Horizontal;
|
||||||
|
Spacing = new Vector2(20, 0);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "Hold to Quit",
|
Text = "Hold to Quit",
|
||||||
|
Font = @"Exo2.0-Bold",
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft
|
Origin = Anchor.CentreLeft
|
||||||
},
|
},
|
||||||
button = new HoldToQuitButton(text)
|
Button = new HoldToQuitButton(text)
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HoldToQuitButton : CircularContainer
|
public class HoldToQuitButton : CircularContainer
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
private SpriteIcon icon;
|
private SpriteIcon icon;
|
||||||
private CircularProgress progress;
|
private CircularProgress progress;
|
||||||
|
|
||||||
private Action exitAction;
|
public Action ExitAction { get; set; }
|
||||||
private ScheduledDelegate scheduledExitAction;
|
private ScheduledDelegate scheduledExitAction;
|
||||||
|
|
||||||
private readonly Scheduler scheduler;
|
private readonly Scheduler scheduler;
|
||||||
@ -61,9 +59,6 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
this.text = text;
|
this.text = text;
|
||||||
scheduler = new Scheduler();
|
scheduler = new Scheduler();
|
||||||
stopwatchClock = new StopwatchClock();
|
stopwatchClock = new StopwatchClock();
|
||||||
|
|
||||||
// TODO provide action
|
|
||||||
exitAction = () => Thread.Sleep(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -96,7 +91,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
icon.ScaleTo(1.5f);
|
icon.ScaleTo(1.5f);
|
||||||
text.FadeIn(fade_duration);
|
text.FadeIn(fade_duration);
|
||||||
stopwatchClock.Restart();
|
stopwatchClock.Restart();
|
||||||
scheduledExitAction = scheduler.AddDelayed(exitAction, 1000);
|
scheduledExitAction = scheduler.AddDelayed(ExitAction, 1000);
|
||||||
|
|
||||||
return base.OnMouseDown(state, args);
|
return base.OnMouseDown(state, args);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,8 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hudOverlay.HoldToQuit.Button.ExitAction = Exit;
|
||||||
|
|
||||||
if (ShowStoryboard)
|
if (ShowStoryboard)
|
||||||
initializeStoryboard(false);
|
initializeStoryboard(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user