mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 23:12:56 +08:00
Allow buttons to be displayed on more than one state (and share the back button)
This commit is contained in:
parent
1d1b3ca982
commit
a069a673fa
@ -107,12 +107,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
backButton = new MainMenuButton(ButtonSystemStrings.Back, @"back-to-top", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel,
|
backButton = new MainMenuButton(ButtonSystemStrings.Back, @"back-to-top", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel,
|
||||||
-WEDGE_WIDTH)
|
-WEDGE_WIDTH)
|
||||||
{
|
{
|
||||||
VisibleState = ButtonSystemState.Edit,
|
VisibleStateMin = ButtonSystemState.Play,
|
||||||
},
|
VisibleStateMax = ButtonSystemState.Edit,
|
||||||
backButton = new MainMenuButton(ButtonSystemStrings.Back, @"back-to-top", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel,
|
|
||||||
-WEDGE_WIDTH)
|
|
||||||
{
|
|
||||||
VisibleState = ButtonSystemState.Play,
|
|
||||||
},
|
},
|
||||||
logoTrackingContainer.LogoFacade.With(d => d.Scale = new Vector2(0.74f))
|
logoTrackingContainer.LogoFacade.With(d => d.Scale = new Vector2(0.74f))
|
||||||
});
|
});
|
||||||
|
@ -42,9 +42,19 @@ namespace osu.Game.Screens.Menu
|
|||||||
private readonly string sampleName;
|
private readonly string sampleName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The menu state for which we are visible for.
|
/// The menu state for which we are visible for (assuming only one).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ButtonSystemState VisibleState = ButtonSystemState.TopLevel;
|
public ButtonSystemState VisibleState
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
VisibleStateMin = value;
|
||||||
|
VisibleStateMax = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ButtonSystemState VisibleStateMin = ButtonSystemState.TopLevel;
|
||||||
|
public ButtonSystemState VisibleStateMax = ButtonSystemState.TopLevel;
|
||||||
|
|
||||||
private readonly Action? clickAction;
|
private readonly Action? clickAction;
|
||||||
private Sample? sampleClick;
|
private Sample? sampleClick;
|
||||||
@ -313,9 +323,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (value == VisibleState)
|
if (value <= VisibleStateMax && value >= VisibleStateMin)
|
||||||
State = ButtonState.Expanded;
|
State = ButtonState.Expanded;
|
||||||
else if (value < VisibleState)
|
else if (value < VisibleStateMin)
|
||||||
State = ButtonState.Contracted;
|
State = ButtonState.Contracted;
|
||||||
else
|
else
|
||||||
State = ButtonState.Exploded;
|
State = ButtonState.Exploded;
|
||||||
|
Loading…
Reference in New Issue
Block a user