1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:23:22 +08:00

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

View File

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

View File

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