Toolbar is now toggled by the main menu.

This commit is contained in:
Dean Herbert 2017-02-08 19:46:05 +09:00
parent 2e119cd74f
commit a7dac15d05
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
3 changed files with 15 additions and 12 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Toolbar
private ToolbarModeSelector modeSelector; private ToolbarModeSelector modeSelector;
private const int transition_time = 250; private const int transition_time = 300;
private const float alpha_hovering = 0.8f; private const float alpha_hovering = 0.8f;
private const float alpha_normal = 0.6f; private const float alpha_normal = 0.6f;
@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Toolbar
protected override void PopIn() protected override void PopIn()
{ {
MoveToY(0, transition_time, EasingTypes.OutQuint); MoveToY(0, transition_time, EasingTypes.OutQuint);
FadeIn(transition_time, EasingTypes.OutQuint); FadeIn(transition_time / 2, EasingTypes.OutQuint);
} }
protected override void PopOut() protected override void PopOut()

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays.Toolbar;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
@ -33,6 +34,8 @@ namespace osu.Game.Screens.Menu
private AudioSample sampleOsuClick; private AudioSample sampleOsuClick;
private Toolbar toolbar;
private FlowContainerWithOrigin buttonFlow; private FlowContainerWithOrigin buttonFlow;
//todo: make these non-internal somehow. //todo: make these non-internal somehow.
@ -117,9 +120,10 @@ namespace osu.Game.Screens.Menu
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio, OsuGame game)
{ {
sampleOsuClick = audio.Sample.Get(@"Menu/menuhit"); sampleOsuClick = audio.Sample.Get(@"Menu/menuhit");
toolbar = game.Toolbar;
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -150,7 +154,7 @@ namespace osu.Game.Screens.Menu
return true; return true;
} }
return false; return false;
} }
@ -215,6 +219,8 @@ namespace osu.Game.Screens.Menu
switch (state) switch (state)
{ {
case MenuState.Initial: case MenuState.Initial:
toolbar?.Hide();
buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out);
buttonArea.FadeOut(300); buttonArea.FadeOut(300);
@ -239,9 +245,10 @@ namespace osu.Game.Screens.Menu
buttonArea.FadeIn(300); buttonArea.FadeIn(300);
if (lastState == MenuState.Initial) if (lastState == MenuState.Initial)
//todo: this propagates to invisible children and causes delays later down the track (on first MenuState.Play)
buttonArea.Delay(150, true); buttonArea.Delay(150, true);
Scheduler.AddDelayed(() => toolbar?.Show(), 150);
foreach (Button b in buttonsTopLevel) foreach (Button b in buttonsTopLevel)
b.State = ButtonState.Expanded; b.State = ButtonState.Expanded;

View File

@ -1,20 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.GameModes; using osu.Framework.GameModes;
using osu.Framework.GameModes.Testing; using osu.Framework.GameModes.Testing;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Modes;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Charts; using osu.Game.Screens.Charts;
using osu.Game.Screens.Direct; using osu.Game.Screens.Direct;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Multiplayer; using osu.Game.Screens.Multiplayer;
using osu.Game.Screens.Play;
using OpenTK; using OpenTK;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
@ -25,7 +21,7 @@ namespace osu.Game.Screens.Menu
private ButtonSystem buttons; private ButtonSystem buttons;
public override string Name => @"Main Menu"; public override string Name => @"Main Menu";
internal override bool ShowOverlays => true; internal override bool ShowOverlays => buttons.State != MenuState.Initial;
private BackgroundMode background; private BackgroundMode background;
@ -42,7 +38,7 @@ namespace osu.Game.Screens.Menu
ParallaxAmount = 0.01f, ParallaxAmount = 0.01f,
Children = new Drawable[] Children = new Drawable[]
{ {
buttons = new ButtonSystem() buttons = new ButtonSystem
{ {
OnChart = delegate { Push(new ChartListing()); }, OnChart = delegate { Push(new ChartListing()); },
OnDirect = delegate { Push(new OnlineListing()); }, OnDirect = delegate { Push(new OnlineListing()); },
@ -63,11 +59,11 @@ namespace osu.Game.Screens.Menu
background.Preload(game); background.Preload(game);
buttons.OnSettings = game.ToggleOptions; buttons.OnSettings = game.ToggleOptions;
} }
protected override void OnEntering(GameMode last) protected override void OnEntering(GameMode last)
{ {
base.OnEntering(last); base.OnEntering(last);
buttons.FadeInFromZero(500); buttons.FadeInFromZero(500);
} }