Merge pull request #222 from peppy/better-exit-process

Move the actual outro sequence into Intro rather than MainMenu.
This commit is contained in:
Dean Herbert 2016-12-06 00:06:42 +09:00 committed by GitHub
commit e33aaa95a8
5 changed files with 30 additions and 5 deletions

@ -1 +1 @@
Subproject commit 6edd5eacdd25cc8c4f4dbca3414678c0b7dc5deb
Subproject commit a3b2991157ec0bdeb0e73d10e7b845aa16715420

View File

@ -20,6 +20,7 @@
using osu.Game.Database;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Timing;
using osu.Game.Modes;
using osu.Game.Overlays.Toolbar;
using osu.Game.Screens;
@ -154,11 +155,19 @@ protected override void LoadComplete()
private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;
switch (args.Key)
{
case Key.F8:
chat.ToggleVisibility();
return true;
case Key.PageUp:
case Key.PageDown:
var rate = ((Clock as ThrottledFrameClock).Source as StopwatchClock).Rate * (args.Key == Key.PageUp ? 1.1f : 0.9f);
((Clock as ThrottledFrameClock).Source as StopwatchClock).Rate = rate;
Logger.Log($@"Adjusting game clock to {rate}", LoggingTarget.Debug);
return true;
}
if (state.Keyboard.ControlPressed)

View File

@ -144,7 +144,6 @@ private void onPlay()
private void onExit()
{
State = MenuState.Exit;
OnExit?.Invoke();
}

View File

@ -25,6 +25,7 @@ class Intro : OsuGameMode
MainMenu mainMenu;
private AudioSample welcome;
private AudioSample seeya;
private AudioTrack bgm;
internal override bool ShowOverlays => (ParentGameMode as OsuGameMode)?.ShowOverlays ?? false;
@ -58,6 +59,7 @@ public Intro()
private void load(AudioManager audio)
{
welcome = audio.Sample.Get(@"welcome");
seeya = audio.Sample.Get(@"seeya");
bgm = audio.Track.Get(@"circles");
bgm.Looping = true;
@ -106,8 +108,15 @@ protected override bool OnExiting(GameMode next)
protected override void OnResuming(GameMode last)
{
//we are just an intro. if we are resumed, we just want to exit after a short delay (to allow the last mode to transition out).
Scheduler.AddDelayed(Exit, 600);
//we also handle the exit transition.
seeya.Play();
double fadeOutTime = (last.LifetimeEnd - Time.Current) + 100;
Scheduler.AddDelayed(Exit, fadeOutTime);
//don't want to fade out completely else we will stop running updates and shit will hit the fan.
Game.FadeTo(0.01f, fadeOutTime);
base.OnResuming(last);
}

View File

@ -1,6 +1,7 @@
//Copyright (c) 2007-2016 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;
@ -49,7 +50,7 @@ public MainMenu()
OnSolo = delegate { Push(new PlaySongSelect()); },
OnMulti = delegate { Push(new Lobby()); },
OnTest = delegate { Push(new TestBrowser()); },
OnExit = delegate { Scheduler.AddDelayed(Exit, ButtonSystem.EXIT_DELAY); },
OnExit = delegate { Exit(); },
}
}
}
@ -93,5 +94,12 @@ protected override void OnResuming(GameMode last)
Content.FadeIn(length, EasingTypes.OutQuint);
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
}
protected override bool OnExiting(GameMode next)
{
buttons.State = MenuState.Exit;
Content.FadeOut(ButtonSystem.EXIT_DELAY);
return base.OnExiting(next);
}
}
}