mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:57:52 +08:00
Do not expose HoldToQuit.HoldToQuitButton
This commit is contained in:
parent
3b84ce7c9f
commit
f8630115d6
@ -22,15 +22,15 @@ namespace osu.Game.Tests.Visual
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
});
|
||||
holdToQuit.Button.ExitAction = () => exitAction = true;
|
||||
holdToQuit.ExitAction = () => exitAction = true;
|
||||
|
||||
var text = holdToQuit.Children.OfType<SpriteText>().Single();
|
||||
|
||||
AddStep("Trigger text fade in/out", () =>
|
||||
{
|
||||
exitAction = false;
|
||||
holdToQuit.Button.TriggerOnMouseDown();
|
||||
holdToQuit.Button.TriggerOnMouseUp();
|
||||
holdToQuit.TriggerOnMouseDown();
|
||||
holdToQuit.TriggerOnMouseUp();
|
||||
});
|
||||
|
||||
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
|
||||
@ -39,10 +39,10 @@ namespace osu.Game.Tests.Visual
|
||||
AddStep("Trigger exit action", () =>
|
||||
{
|
||||
exitAction = false;
|
||||
holdToQuit.Button.TriggerOnMouseDown();
|
||||
holdToQuit.TriggerOnMouseDown();
|
||||
});
|
||||
|
||||
AddUntilStep(() => exitAction, $"{nameof(holdToQuit.Button.ExitAction)} was triggered");
|
||||
AddUntilStep(() => exitAction, $"{nameof(holdToQuit.ExitAction)} was triggered");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class HoldToQuit : FillFlowContainer
|
||||
{
|
||||
public readonly HoldToQuitButton Button;
|
||||
private readonly HoldToQuitButton button;
|
||||
public Action ExitAction
|
||||
{
|
||||
get => button.ExitAction;
|
||||
set => button.ExitAction = value;
|
||||
}
|
||||
|
||||
public HoldToQuit()
|
||||
{
|
||||
@ -32,7 +37,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
Button = new HoldToQuitButton(text)
|
||||
button = new HoldToQuitButton(text)
|
||||
};
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
};
|
||||
|
||||
hudOverlay.HoldToQuit.Button.ExitAction = Exit;
|
||||
hudOverlay.HoldToQuit.ExitAction = Exit;
|
||||
|
||||
if (ShowStoryboard)
|
||||
initializeStoryboard(false);
|
||||
|
Loading…
Reference in New Issue
Block a user