mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Refactor for formatting sanity
This commit is contained in:
parent
8ad19fc2d4
commit
0d72104235
@ -38,13 +38,15 @@ namespace osu.Game.Screens.Play
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
|
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual Action BackAction => () => InternalButtons.Children.Last().Click();
|
protected virtual Action BackAction => () => InternalButtons.Children.LastOrDefault()?.Click();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Action that is invoked when <see cref="GlobalAction.Select"/> is triggered.
|
/// Action that is invoked when <see cref="GlobalAction.Select"/> is triggered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected)?.Click();
|
protected virtual Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected.Value)?.Click();
|
||||||
|
|
||||||
public abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
public abstract string Description { get; }
|
public abstract string Description { get; }
|
||||||
|
|
||||||
protected internal FillFlowContainer<DialogButton> InternalButtons;
|
protected internal FillFlowContainer<DialogButton> InternalButtons;
|
||||||
@ -233,22 +235,20 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (action == GlobalAction.Back)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
case GlobalAction.Back:
|
||||||
BackAction.Invoke();
|
BackAction.Invoke();
|
||||||
return true;
|
return true;
|
||||||
}
|
case GlobalAction.Select:
|
||||||
|
|
||||||
if (action == GlobalAction.Select)
|
|
||||||
{
|
|
||||||
SelectAction.Invoke();
|
SelectAction.Invoke();
|
||||||
return true;
|
return true;
|
||||||
}
|
default:
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
public bool OnReleased(GlobalAction action) => false;
|
||||||
|
|
||||||
private void buttonSelectionChanged(DialogButton button, bool isSelected)
|
private void buttonSelectionChanged(DialogButton button, bool isSelected)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user