1
0
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:
Dean Herbert 2016-11-09 15:22:54 +09:00
parent 9d1d5a5cea
commit fdb83bed79
6 changed files with 15 additions and 3 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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
{