From 9d1d5a5cea7acf08fec9614725d6487c7f3331b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Nov 2016 15:16:34 +0900 Subject: [PATCH 1/4] Modify toolbar tooltips to be closer to design. --- osu.Game/Overlays/ToolbarButton.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 } } } From fdb83bed79f0d912fa30281df10d22e78cfa0f98 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Nov 2016 15:22:54 +0900 Subject: [PATCH 2/4] Make OsuGameModes self-aware of if they want a toolbar or not. --- osu.Game/GameModes/Menu/Intro.cs | 2 ++ osu.Game/GameModes/Menu/MainMenu.cs | 2 ++ osu.Game/GameModes/OsuGameMode.cs | 6 ++++++ osu.Game/GameModes/Play/PlaySongSelect.cs | 2 +- osu.Game/GameModes/Play/Player.cs | 2 ++ osu.Game/OsuGame.cs | 4 ++-- 6 files changed, 15 insertions(+), 3 deletions(-) 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 d8b73f5f07..3ba60f53f6 100644 --- a/osu.Game/GameModes/OsuGameMode.cs +++ b/osu.Game/GameModes/OsuGameMode.cs @@ -26,6 +26,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 8a72cef0c4..1559d339fe 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -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 { From d9bd3717d0ddd329a514c3851f99972e0b7f0f19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Nov 2016 15:23:10 +0900 Subject: [PATCH 3/4] Re-organise overlay-level elements in OsuGame. --- osu.Game/OsuGame.cs | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1559d339fe..7697965cda 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,9 +26,13 @@ namespace osu.Game public class OsuGame : OsuGameBase { public Toolbar Toolbar; - public ChatConsole Chat; - public MainMenu MainMenu => intro?.ChildGameMode as MainMenu; - private Intro intro; + + private ChatConsole chat; + + private MainMenu mainMenu => modeStack?.ChildGameMode as MainMenu; + private Intro intro => modeStack as Intro; + + private OsuGameMode modeStack; private VolumeControl volume; @@ -85,38 +90,39 @@ 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); - + //overlay elements + (chat = new ChatConsole(API) { Depth = 0 }).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; }, }).Preload(game, t => { PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; PlayMode.TriggerChange(); - Add(Toolbar); + overlayContent.Add(Toolbar); }); Cursor.Alpha = 0; @@ -127,7 +133,7 @@ namespace osu.Game switch (args.Key) { case Key.F8: - Chat.ToggleVisibility(); + chat.ToggleVisibility(); return true; } @@ -148,6 +154,8 @@ namespace osu.Game private Container mainContent; + private Container overlayContent; + private void modeChanged(GameMode newMode) { // - Ability to change window size From a5dcae859c21d68f57d610158c54cb13d603e0fa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Nov 2016 15:23:32 +0900 Subject: [PATCH 4/4] Give OptionsOverlay an offset to make up for toolbar possibly being present. --- osu.Game/Overlays/OptionsOverlay.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 14219b9841..e455a67f1f 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; @@ -72,6 +73,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FlowDirection.VerticalOnly, + Children = new Drawable[] { new SpriteText @@ -112,6 +114,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)