mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Make OsuGameModes self-aware of if they want a toolbar or not.
This commit is contained in:
parent
9d1d5a5cea
commit
fdb83bed79
@ -26,6 +26,8 @@ namespace osu.Game.GameModes.Menu
|
||||
private AudioSample welcome;
|
||||
private AudioTrack bgm;
|
||||
|
||||
internal override bool ShowToolbar => (ParentGameMode as OsuGameMode)?.ShowToolbar ?? false;
|
||||
|
||||
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
||||
|
||||
public Intro()
|
||||
|
@ -25,6 +25,8 @@ namespace osu.Game.GameModes.Menu
|
||||
private ButtonSystem buttons;
|
||||
public override string Name => @"Main Menu";
|
||||
|
||||
internal override bool ShowToolbar => true;
|
||||
|
||||
private BackgroundMode background;
|
||||
|
||||
protected override BackgroundMode CreateBackground() => background;
|
||||
|
@ -26,6 +26,12 @@ namespace osu.Game.GameModes
|
||||
/// </summary>
|
||||
protected virtual BackgroundMode CreateBackground() => null;
|
||||
|
||||
internal virtual bool ShowToolbar => true;
|
||||
|
||||
protected new OsuGame Game => base.Game as OsuGame;
|
||||
|
||||
protected float ToolbarPadding => ShowToolbar ? Game.Toolbar.DrawHeight : 0;
|
||||
|
||||
private bool boundToBeatmap;
|
||||
private Bindable<WorkingBeatmap> beatmap;
|
||||
|
||||
|
@ -133,7 +133,7 @@ namespace osu.Game.GameModes.Play
|
||||
playMode = osuGame.PlayMode;
|
||||
playMode.ValueChanged += playMode_ValueChanged;
|
||||
// Temporary:
|
||||
scrollContainer.Padding = new MarginPadding { Top = osuGame.Toolbar.Height };
|
||||
scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding };
|
||||
}
|
||||
|
||||
if (database == null)
|
||||
|
@ -22,6 +22,8 @@ namespace osu.Game.GameModes.Play
|
||||
|
||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||
|
||||
internal override bool ShowToolbar => false;
|
||||
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
public PlayMode PreferredPlayMode;
|
||||
|
@ -155,10 +155,10 @@ namespace osu.Game
|
||||
// - Frame limiter changes
|
||||
|
||||
//central game mode change logic.
|
||||
if (newMode is Player || newMode is Intro)
|
||||
if ((newMode as OsuGameMode)?.ShowToolbar != true)
|
||||
{
|
||||
Toolbar.State = Visibility.Hidden;
|
||||
Chat.State = Visibility.Hidden;
|
||||
chat.State = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user