1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Add proper toolbar state handling.

This commit is contained in:
Dean Herbert 2016-10-07 20:38:52 +09:00
parent 27a26cfaaf
commit 556420ee58
2 changed files with 30 additions and 3 deletions

View File

@ -59,6 +59,8 @@ namespace osu.Game
}
});
Toolbar.SetState(ToolbarState.Hidden, true);
intro.ModePushed += modeAdded;
intro.Exited += modeRemoved;
@ -78,13 +80,13 @@ namespace osu.Game
// - Frame limiter changes
//central game mode change logic.
if (newMode is Player)
if (newMode is Player || newMode is Intro)
{
Toolbar.FadeOut(100);
Toolbar.SetState(ToolbarState.Hidden);
}
else
{
Toolbar.FadeIn(100);
Toolbar.SetState(ToolbarState.Visible);
}
Cursor.FadeIn(100);

View File

@ -9,6 +9,8 @@ using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Game.Configuration;
using System;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Timing;
using osu.Game.GameModes.Play;
namespace osu.Game.Overlays
@ -23,6 +25,23 @@ namespace osu.Game.Overlays
private ToolbarModeSelector modeSelector;
public void SetState(ToolbarState state, bool instant = false)
{
int time = instant ? 0 : 200;
switch (state)
{
case ToolbarState.Hidden:
MoveToY(-Size.Y, time, EasingTypes.InQuint);
FadeOut(time);
break;
case ToolbarState.Visible:
MoveToY(0, time, EasingTypes.OutQuint);
FadeIn(time);
break;
}
}
public override void Load()
{
base.Load();
@ -91,4 +110,10 @@ namespace osu.Game.Overlays
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);
}
public enum ToolbarState
{
Visible,
Hidden,
}
}