diff --git a/osu.Game/GameModes/Menu/Intro.cs b/osu.Game/GameModes/Menu/Intro.cs index c107fd0c92..57d3f72ea9 100644 --- a/osu.Game/GameModes/Menu/Intro.cs +++ b/osu.Game/GameModes/Menu/Intro.cs @@ -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() diff --git a/osu.Game/GameModes/Menu/MainMenu.cs b/osu.Game/GameModes/Menu/MainMenu.cs index f4b9da2bfe..b9007ab7ab 100644 --- a/osu.Game/GameModes/Menu/MainMenu.cs +++ b/osu.Game/GameModes/Menu/MainMenu.cs @@ -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; diff --git a/osu.Game/GameModes/OsuGameMode.cs b/osu.Game/GameModes/OsuGameMode.cs index 33889e3689..ea9bfcfc1b 100644 --- a/osu.Game/GameModes/OsuGameMode.cs +++ b/osu.Game/GameModes/OsuGameMode.cs @@ -27,6 +27,12 @@ namespace osu.Game.GameModes /// 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 beatmap; diff --git a/osu.Game/GameModes/Play/PlaySongSelect.cs b/osu.Game/GameModes/Play/PlaySongSelect.cs index a05e02ae3b..fd22222f48 100644 --- a/osu.Game/GameModes/Play/PlaySongSelect.cs +++ b/osu.Game/GameModes/Play/PlaySongSelect.cs @@ -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) diff --git a/osu.Game/GameModes/Play/Player.cs b/osu.Game/GameModes/Play/Player.cs index d48e252fa5..fecb076e63 100644 --- a/osu.Game/GameModes/Play/Player.cs +++ b/osu.Game/GameModes/Play/Player.cs @@ -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; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1323e65757..a462c4f0fe 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -18,6 +18,7 @@ using osu.Framework.Input; using osu.Game.Input; using OpenTK.Input; using osu.Framework.Logging; +using osu.Game.GameModes; using osu.Game.Graphics.UserInterface.Volume; namespace osu.Game @@ -25,10 +26,15 @@ namespace osu.Game public class OsuGame : OsuGameBase { public Toolbar Toolbar; - public ChatConsole Chat; - public MusicController MusicController; - public MainMenu MainMenu => intro?.ChildGameMode as MainMenu; - private Intro intro; + + private ChatConsole chat; + + private MusicController musicController; + + private MainMenu mainMenu => modeStack?.ChildGameMode as MainMenu; + private Intro intro => modeStack as Intro; + + private OsuGameMode modeStack; private VolumeControl volume; @@ -86,40 +92,41 @@ namespace osu.Game VolumeSample = Audio.VolumeSample, VolumeTrack = Audio.VolumeTrack }, + overlayContent = new Container{ RelativeSizeAxes = Axes.Both }, new GlobalHotkeys //exists because UserInputManager is at a level below us. { Handler = globalHotkeyPressed } }); - (Options = new OptionsOverlay { Depth = float.MaxValue / 2 }).Preload(game, Add); - - (intro = new Intro + (modeStack = new Intro { Beatmap = Beatmap }).Preload(game, d => { mainContent.Add(d); - intro.ModePushed += modeAdded; - intro.Exited += modeRemoved; - intro.DisplayAsRoot(); + modeStack.ModePushed += modeAdded; + modeStack.Exited += modeRemoved; + modeStack.DisplayAsRoot(); }); - (Chat = new ChatConsole(API)).Preload(game, Add); - (MusicController = new MusicController()).Preload(game, Add); - + //overlay elements + (chat = new ChatConsole(API) { Depth = 0 }).Preload(game, overlayContent.Add); + (musicController = new MusicController()).Preload(game, overlayContent.Add); + (Options = new OptionsOverlay { Depth = 1 }).Preload(game, overlayContent.Add); (Toolbar = new Toolbar { - OnHome = delegate { MainMenu?.MakeCurrent(); }, + Depth = 2, + OnHome = delegate { mainMenu?.MakeCurrent(); }, OnSettings = Options.ToggleVisibility, OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; }, - OnMusicController = MusicController.ToggleVisibility + OnMusicController = musicController.ToggleVisibility }).Preload(game, t => { PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; PlayMode.TriggerChange(); - Add(Toolbar); + overlayContent.Add(Toolbar); }); Cursor.Alpha = 0; @@ -130,7 +137,7 @@ namespace osu.Game switch (args.Key) { case Key.F8: - Chat.ToggleVisibility(); + chat.ToggleVisibility(); return true; } @@ -151,6 +158,8 @@ namespace osu.Game private Container mainContent; + private Container overlayContent; + private void modeChanged(GameMode newMode) { // - Ability to change window size @@ -158,10 +167,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 { diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 7f24801bc1..2e00bef970 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -6,6 +6,7 @@ using System.Linq; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; @@ -73,6 +74,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FlowDirection.VerticalOnly, + Children = new Drawable[] { new SpriteText @@ -114,6 +116,13 @@ namespace osu.Game.Overlays }; } + protected override void Load(BaseGame game) + { + base.Load(game); + + scrollContainer.Padding = new MarginPadding { Top = (game as OsuGame)?.Toolbar.DrawHeight ?? 0 }; + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Overlays/ToolbarButton.cs b/osu.Game/Overlays/ToolbarButton.cs index dcf6b19a3d..8fa5ff10b7 100644 --- a/osu.Game/Overlays/ToolbarButton.cs +++ b/osu.Game/Overlays/ToolbarButton.cs @@ -105,10 +105,11 @@ namespace osu.Game.Overlays tooltip1 = new SpriteText { TextSize = 22, + Font = @"Exo2.0-Bold", }, tooltip2 = new SpriteText { - TextSize = 15 + TextSize = 16 } } }