mirror of
https://github.com/osukey/osukey.git
synced 2025-05-13 17:47:18 +09:00
Merge pull request #154 from peppy/sidebar-toolbar-coexistence
Make options overlay coexist with toolbar.
This commit is contained in:
commit
ff67b77c5b
@ -26,6 +26,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
private AudioSample welcome;
|
private AudioSample welcome;
|
||||||
private AudioTrack bgm;
|
private AudioTrack bgm;
|
||||||
|
|
||||||
|
internal override bool ShowToolbar => (ParentGameMode as OsuGameMode)?.ShowToolbar ?? false;
|
||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
||||||
|
|
||||||
public Intro()
|
public Intro()
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.GameModes.Menu
|
|||||||
private ButtonSystem buttons;
|
private ButtonSystem buttons;
|
||||||
public override string Name => @"Main Menu";
|
public override string Name => @"Main Menu";
|
||||||
|
|
||||||
|
internal override bool ShowToolbar => true;
|
||||||
|
|
||||||
private BackgroundMode background;
|
private BackgroundMode background;
|
||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => background;
|
protected override BackgroundMode CreateBackground() => background;
|
||||||
|
@ -27,6 +27,12 @@ namespace osu.Game.GameModes
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual BackgroundMode CreateBackground() => null;
|
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 bool boundToBeatmap;
|
||||||
private Bindable<WorkingBeatmap> beatmap;
|
private Bindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
playMode = osuGame.PlayMode;
|
playMode = osuGame.PlayMode;
|
||||||
playMode.ValueChanged += playMode_ValueChanged;
|
playMode.ValueChanged += playMode_ValueChanged;
|
||||||
// Temporary:
|
// Temporary:
|
||||||
scrollContainer.Padding = new MarginPadding { Top = osuGame.Toolbar.Height };
|
scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (database == null)
|
if (database == null)
|
||||||
|
@ -22,6 +22,8 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||||
|
|
||||||
|
internal override bool ShowToolbar => false;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo;
|
public BeatmapInfo BeatmapInfo;
|
||||||
|
|
||||||
public PlayMode PreferredPlayMode;
|
public PlayMode PreferredPlayMode;
|
||||||
|
@ -18,6 +18,7 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Game.GameModes;
|
||||||
using osu.Game.Graphics.UserInterface.Volume;
|
using osu.Game.Graphics.UserInterface.Volume;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
@ -25,10 +26,15 @@ namespace osu.Game
|
|||||||
public class OsuGame : OsuGameBase
|
public class OsuGame : OsuGameBase
|
||||||
{
|
{
|
||||||
public Toolbar Toolbar;
|
public Toolbar Toolbar;
|
||||||
public ChatConsole Chat;
|
|
||||||
public MusicController MusicController;
|
private ChatConsole chat;
|
||||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
|
||||||
private Intro intro;
|
private MusicController musicController;
|
||||||
|
|
||||||
|
private MainMenu mainMenu => modeStack?.ChildGameMode as MainMenu;
|
||||||
|
private Intro intro => modeStack as Intro;
|
||||||
|
|
||||||
|
private OsuGameMode modeStack;
|
||||||
|
|
||||||
private VolumeControl volume;
|
private VolumeControl volume;
|
||||||
|
|
||||||
@ -86,40 +92,41 @@ namespace osu.Game
|
|||||||
VolumeSample = Audio.VolumeSample,
|
VolumeSample = Audio.VolumeSample,
|
||||||
VolumeTrack = Audio.VolumeTrack
|
VolumeTrack = Audio.VolumeTrack
|
||||||
},
|
},
|
||||||
|
overlayContent = new Container{ RelativeSizeAxes = Axes.Both },
|
||||||
new GlobalHotkeys //exists because UserInputManager is at a level below us.
|
new GlobalHotkeys //exists because UserInputManager is at a level below us.
|
||||||
{
|
{
|
||||||
Handler = globalHotkeyPressed
|
Handler = globalHotkeyPressed
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
(Options = new OptionsOverlay { Depth = float.MaxValue / 2 }).Preload(game, Add);
|
(modeStack = new Intro
|
||||||
|
|
||||||
(intro = new Intro
|
|
||||||
{
|
{
|
||||||
Beatmap = Beatmap
|
Beatmap = Beatmap
|
||||||
}).Preload(game, d =>
|
}).Preload(game, d =>
|
||||||
{
|
{
|
||||||
mainContent.Add(d);
|
mainContent.Add(d);
|
||||||
|
|
||||||
intro.ModePushed += modeAdded;
|
modeStack.ModePushed += modeAdded;
|
||||||
intro.Exited += modeRemoved;
|
modeStack.Exited += modeRemoved;
|
||||||
intro.DisplayAsRoot();
|
modeStack.DisplayAsRoot();
|
||||||
});
|
});
|
||||||
|
|
||||||
(Chat = new ChatConsole(API)).Preload(game, Add);
|
//overlay elements
|
||||||
(MusicController = new MusicController()).Preload(game, Add);
|
(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
|
(Toolbar = new Toolbar
|
||||||
{
|
{
|
||||||
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
Depth = 2,
|
||||||
|
OnHome = delegate { mainMenu?.MakeCurrent(); },
|
||||||
OnSettings = Options.ToggleVisibility,
|
OnSettings = Options.ToggleVisibility,
|
||||||
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
||||||
OnMusicController = MusicController.ToggleVisibility
|
OnMusicController = musicController.ToggleVisibility
|
||||||
}).Preload(game, t =>
|
}).Preload(game, t =>
|
||||||
{
|
{
|
||||||
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
||||||
PlayMode.TriggerChange();
|
PlayMode.TriggerChange();
|
||||||
Add(Toolbar);
|
overlayContent.Add(Toolbar);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cursor.Alpha = 0;
|
Cursor.Alpha = 0;
|
||||||
@ -130,7 +137,7 @@ namespace osu.Game
|
|||||||
switch (args.Key)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
case Key.F8:
|
case Key.F8:
|
||||||
Chat.ToggleVisibility();
|
chat.ToggleVisibility();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +158,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
private Container mainContent;
|
private Container mainContent;
|
||||||
|
|
||||||
|
private Container overlayContent;
|
||||||
|
|
||||||
private void modeChanged(GameMode newMode)
|
private void modeChanged(GameMode newMode)
|
||||||
{
|
{
|
||||||
// - Ability to change window size
|
// - Ability to change window size
|
||||||
@ -158,10 +167,10 @@ namespace osu.Game
|
|||||||
// - Frame limiter changes
|
// - Frame limiter changes
|
||||||
|
|
||||||
//central game mode change logic.
|
//central game mode change logic.
|
||||||
if (newMode is Player || newMode is Intro)
|
if ((newMode as OsuGameMode)?.ShowToolbar != true)
|
||||||
{
|
{
|
||||||
Toolbar.State = Visibility.Hidden;
|
Toolbar.State = Visibility.Hidden;
|
||||||
Chat.State = Visibility.Hidden;
|
chat.State = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
@ -73,6 +74,7 @@ namespace osu.Game.Overlays
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
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 OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
@ -105,10 +105,11 @@ namespace osu.Game.Overlays
|
|||||||
tooltip1 = new SpriteText
|
tooltip1 = new SpriteText
|
||||||
{
|
{
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
tooltip2 = new SpriteText
|
tooltip2 = new SpriteText
|
||||||
{
|
{
|
||||||
TextSize = 15
|
TextSize = 16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user