mirror of https://github.com/ppy/osu
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 @@ public ButtonSystem()
|
|||
backButton = new MainMenuButton(ButtonSystemStrings.Back, @"back-to-top", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel,
|
||||
-WEDGE_WIDTH)
|
||||
{
|
||||
VisibleState = 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,
|
||||
VisibleStateMin = ButtonSystemState.Play,
|
||||
VisibleStateMax = ButtonSystemState.Edit,
|
||||
},
|
||||
logoTrackingContainer.LogoFacade.With(d => d.Scale = new Vector2(0.74f))
|
||||
});
|
||||
|
|
|
@ -42,9 +42,19 @@ public partial class MainMenuButton : BeatSyncedContainer, IStateful<ButtonState
|
|||
private readonly string sampleName;
|
||||
|
||||
/// <summary>
|
||||
/// The menu state for which we are visible for.
|
||||
/// The menu state for which we are visible for (assuming only one).
|
||||
/// </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 Sample? sampleClick;
|
||||
|
@ -313,9 +323,9 @@ public ButtonSystemState ButtonSystemState
|
|||
break;
|
||||
|
||||
default:
|
||||
if (value == VisibleState)
|
||||
if (value <= VisibleStateMax && value >= VisibleStateMin)
|
||||
State = ButtonState.Expanded;
|
||||
else if (value < VisibleState)
|
||||
else if (value < VisibleStateMin)
|
||||
State = ButtonState.Contracted;
|
||||
else
|
||||
State = ButtonState.Exploded;
|
||||
|
|
Loading…
Reference in New Issue