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

Merge pull request #3926 from peppy/hide-version-overlay

Hide version overlay when not in main menu
This commit is contained in:
Dean Herbert 2018-12-27 19:42:41 +09:00 committed by GitHub
commit 00fc5197b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 5 deletions

View File

@ -15,12 +15,16 @@ using Microsoft.Win32;
using osu.Desktop.Updater;
using osu.Framework;
using osu.Framework.Platform.Windows;
using osu.Framework.Screens;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
namespace osu.Desktop
{
internal class OsuGameDesktop : OsuGame
{
private readonly bool noVersionOverlay;
private VersionManager versionManager;
public OsuGameDesktop(string[] args = null)
: base(args)
@ -46,7 +50,7 @@ namespace osu.Desktop
if (!noVersionOverlay)
{
LoadComponentAsync(new VersionManager { Depth = int.MinValue }, v =>
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v =>
{
Add(v);
v.State = Visibility.Visible;
@ -59,6 +63,21 @@ namespace osu.Desktop
}
}
protected override void ScreenChanged(OsuScreen current, Screen newScreen)
{
base.ScreenChanged(current, newScreen);
switch (newScreen)
{
case Intro _:
case MainMenu _:
versionManager.State = Visibility.Visible;
break;
default:
versionManager.State = Visibility.Hidden;
break;
}
}
public override void SetHost(GameHost host)
{
base.SetHost(host);

View File

@ -128,11 +128,12 @@ namespace osu.Desktop.Overlays
protected override void PopIn()
{
this.FadeIn(1000);
this.FadeIn(1400, Easing.OutQuint);
}
protected override void PopOut()
{
this.FadeOut(500, Easing.OutQuint);
}
}
}

View File

@ -716,10 +716,15 @@ namespace osu.Game
this.ruleset.Disabled = rulesetDisabled;
}
private void screenAdded(Screen newScreen)
protected virtual void ScreenChanged(OsuScreen current, Screen newScreen)
{
currentScreen = (OsuScreen)newScreen;
Logger.Log($"Screen changed → {currentScreen}");
}
private void screenAdded(Screen newScreen)
{
ScreenChanged(currentScreen, newScreen);
Logger.Log($"Screen changed → {newScreen}");
newScreen.ModePushed += screenAdded;
newScreen.Exited += screenRemoved;
@ -727,7 +732,7 @@ namespace osu.Game
private void screenRemoved(Screen newScreen)
{
currentScreen = (OsuScreen)newScreen;
ScreenChanged(currentScreen, newScreen);
Logger.Log($"Screen changed ← {currentScreen}");
if (newScreen == null)