mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 06:42:56 +08:00
Merge pull request #4181 from smoogipoo/iscreen
Make everything use the IScreen interface
This commit is contained in:
commit
9b12803e96
@ -16,7 +16,6 @@ using osu.Desktop.Updater;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Platform.Windows;
|
using osu.Framework.Platform.Windows;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Screens;
|
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
namespace osu.Desktop
|
namespace osu.Desktop
|
||||||
@ -63,9 +62,10 @@ namespace osu.Desktop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ScreenChanged(OsuScreen current, Screen newScreen)
|
protected override void ScreenChanged(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
{
|
||||||
base.ScreenChanged(current, newScreen);
|
base.ScreenChanged(lastScreen, newScreen);
|
||||||
|
|
||||||
switch (newScreen)
|
switch (newScreen)
|
||||||
{
|
{
|
||||||
case Intro _:
|
case Intro _:
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -57,7 +58,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
public OsuLogo Logo;
|
public OsuLogo Logo;
|
||||||
private TestScreen screen;
|
private TestScreen screen;
|
||||||
|
|
||||||
public bool ScreenLoaded => screen.IsCurrentScreen;
|
public bool ScreenLoaded => screen.IsCurrentScreen();
|
||||||
|
|
||||||
public TestLoader(double delay)
|
public TestLoader(double delay)
|
||||||
{
|
{
|
||||||
@ -96,7 +97,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public TestScreen()
|
public TestScreen()
|
||||||
{
|
{
|
||||||
Child = new Box
|
InternalChild = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.DarkSlateGray,
|
Colour = Color4.DarkSlateGray,
|
||||||
@ -107,7 +108,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
{
|
{
|
||||||
base.LogoArriving(logo, resuming);
|
base.LogoArriving(logo, resuming);
|
||||||
Child.FadeInFromZero(200);
|
InternalChild.FadeInFromZero(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Multi;
|
using osu.Game.Screens.Multi;
|
||||||
|
|
||||||
@ -15,15 +16,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
OsuScreen currentScreen = new TestMultiplayerSubScreen(index);
|
ScreenStack screenStack = new ScreenStack(new TestMultiplayerSubScreen(index)) { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
currentScreen,
|
screenStack,
|
||||||
new Header(currentScreen)
|
new Header(screenStack)
|
||||||
};
|
};
|
||||||
|
|
||||||
AddStep("push multi screen", () => currentScreen.Push(currentScreen = new TestMultiplayerSubScreen(++index)));
|
AddStep("push multi screen", () => screenStack.CurrentScreen.Push(new TestMultiplayerSubScreen(++index)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestMultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen
|
private class TestMultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Screens.Multi;
|
using osu.Game.Screens.Multi;
|
||||||
using osu.Game.Screens.Multi.Lounge;
|
using osu.Game.Screens.Multi.Lounge;
|
||||||
using osu.Game.Screens.Multi.Lounge.Components;
|
using osu.Game.Screens.Multi.Lounge.Components;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
||||||
|
|
||||||
AddUntilStep(() => !loader.IsCurrentScreen, "wait for no longer current");
|
AddUntilStep(() => !loader.IsCurrentScreen(), "wait for no longer current");
|
||||||
|
|
||||||
AddStep("load slow dummy beatmap", () =>
|
AddStep("load slow dummy beatmap", () =>
|
||||||
{
|
{
|
||||||
@ -42,7 +43,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Scheduler.AddDelayed(() => slow.Ready = true, 5000);
|
Scheduler.AddDelayed(() => slow.Ready = true, 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep(() => !loader.IsCurrentScreen, "wait for no longer current");
|
AddUntilStep(() => !loader.IsCurrentScreen(), "wait for no longer current");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class SlowLoadPlayer : Player
|
protected class SlowLoadPlayer : Player
|
||||||
|
@ -19,16 +19,18 @@ namespace osu.Game.Tests.Visual
|
|||||||
public class TestCaseScreenBreadcrumbControl : OsuTestCase
|
public class TestCaseScreenBreadcrumbControl : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly ScreenBreadcrumbControl breadcrumbs;
|
private readonly ScreenBreadcrumbControl breadcrumbs;
|
||||||
private Screen currentScreen, changedScreen;
|
private readonly ScreenStack screenStack;
|
||||||
|
|
||||||
public TestCaseScreenBreadcrumbControl()
|
public TestCaseScreenBreadcrumbControl()
|
||||||
{
|
{
|
||||||
TestScreen startScreen;
|
|
||||||
OsuSpriteText titleText;
|
OsuSpriteText titleText;
|
||||||
|
|
||||||
|
IScreen startScreen = new TestScreenOne();
|
||||||
|
screenStack = new ScreenStack(startScreen) { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
currentScreen = startScreen = new TestScreenOne(),
|
screenStack,
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -37,7 +39,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(10),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
breadcrumbs = new ScreenBreadcrumbControl(startScreen)
|
breadcrumbs = new ScreenBreadcrumbControl(screenStack)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
},
|
||||||
@ -46,12 +48,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
breadcrumbs.Current.ValueChanged += s =>
|
breadcrumbs.Current.ValueChanged += s => titleText.Text = $"Changed to {s.ToString()}";
|
||||||
{
|
|
||||||
titleText.Text = $"Changed to {s.ToString()}";
|
|
||||||
changedScreen = s;
|
|
||||||
};
|
|
||||||
|
|
||||||
breadcrumbs.Current.TriggerChange();
|
breadcrumbs.Current.TriggerChange();
|
||||||
|
|
||||||
waitForCurrent();
|
waitForCurrent();
|
||||||
@ -60,18 +57,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
pushNext();
|
pushNext();
|
||||||
waitForCurrent();
|
waitForCurrent();
|
||||||
|
|
||||||
AddStep(@"make start current", () =>
|
AddStep(@"make start current", () => startScreen.MakeCurrent());
|
||||||
{
|
|
||||||
startScreen.MakeCurrent();
|
|
||||||
currentScreen = startScreen;
|
|
||||||
});
|
|
||||||
|
|
||||||
waitForCurrent();
|
waitForCurrent();
|
||||||
pushNext();
|
pushNext();
|
||||||
waitForCurrent();
|
waitForCurrent();
|
||||||
AddAssert(@"only 2 items", () => breadcrumbs.Items.Count() == 2);
|
AddAssert(@"only 2 items", () => breadcrumbs.Items.Count() == 2);
|
||||||
AddStep(@"exit current", () => changedScreen.Exit());
|
AddStep(@"exit current", () => screenStack.CurrentScreen.Exit());
|
||||||
AddAssert(@"current screen is first", () => startScreen == changedScreen);
|
AddAssert(@"current screen is first", () => startScreen == screenStack.CurrentScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -80,8 +73,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
breadcrumbs.StripColour = colours.Blue;
|
breadcrumbs.StripColour = colours.Blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushNext() => AddStep(@"push next screen", () => currentScreen = ((TestScreen)currentScreen).PushNext());
|
private void pushNext() => AddStep(@"push next screen", () => ((TestScreen)screenStack.CurrentScreen).PushNext());
|
||||||
private void waitForCurrent() => AddUntilStep(() => currentScreen.IsCurrentScreen, "current screen");
|
private void waitForCurrent() => AddUntilStep(() => screenStack.CurrentScreen.IsCurrentScreen(), "current screen");
|
||||||
|
|
||||||
private abstract class TestScreen : OsuScreen
|
private abstract class TestScreen : OsuScreen
|
||||||
{
|
{
|
||||||
@ -91,14 +84,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
public TestScreen PushNext()
|
public TestScreen PushNext()
|
||||||
{
|
{
|
||||||
TestScreen screen = CreateNextScreen();
|
TestScreen screen = CreateNextScreen();
|
||||||
Push(screen);
|
this.Push(screen);
|
||||||
|
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TestScreen()
|
protected TestScreen()
|
||||||
{
|
{
|
||||||
Child = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -50,6 +50,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
if (!CanShowCursor)
|
if (!CanShowCursor)
|
||||||
{
|
{
|
||||||
currentTarget?.Cursor?.Hide();
|
currentTarget?.Cursor?.Hide();
|
||||||
|
currentTarget = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,45 +10,30 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="BreadcrumbControl"/> which follows the active screen (and allows navigation) in a <see cref="Screen"/> stack.
|
/// A <see cref="BreadcrumbControl"/> which follows the active screen (and allows navigation) in a <see cref="Screen"/> stack.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ScreenBreadcrumbControl : BreadcrumbControl<Screen>
|
public class ScreenBreadcrumbControl : BreadcrumbControl<IScreen>
|
||||||
{
|
{
|
||||||
private Screen last;
|
public ScreenBreadcrumbControl(ScreenStack stack)
|
||||||
|
|
||||||
public ScreenBreadcrumbControl(Screen initialScreen)
|
|
||||||
{
|
{
|
||||||
Current.ValueChanged += newScreen =>
|
stack.ScreenPushed += onPushed;
|
||||||
{
|
stack.ScreenExited += onExited;
|
||||||
if (last != newScreen && !newScreen.IsCurrentScreen)
|
|
||||||
newScreen.MakeCurrent();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPushed(initialScreen);
|
onPushed(null, stack.CurrentScreen);
|
||||||
|
|
||||||
|
Current.ValueChanged += newScreen => newScreen.MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenChanged(Screen newScreen)
|
private void onPushed(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
{
|
||||||
if (newScreen == null) return;
|
AddItem(newScreen);
|
||||||
|
|
||||||
if (last != null)
|
|
||||||
{
|
|
||||||
last.Exited -= screenChanged;
|
|
||||||
last.ModePushed -= onPushed;
|
|
||||||
}
|
|
||||||
|
|
||||||
last = newScreen;
|
|
||||||
|
|
||||||
newScreen.Exited += screenChanged;
|
|
||||||
newScreen.ModePushed += onPushed;
|
|
||||||
|
|
||||||
Current.Value = newScreen;
|
Current.Value = newScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPushed(Screen screen)
|
private void onExited(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
{
|
||||||
Items.ToList().SkipWhile(i => i != Current.Value).Skip(1).ForEach(RemoveItem);
|
if (newScreen != null)
|
||||||
AddItem(screen);
|
Current.Value = newScreen;
|
||||||
|
|
||||||
screenChanged(screen);
|
Items.ToList().SkipWhile(s => s != Current.Value).Skip(1).ForEach(RemoveItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,27 +79,23 @@ namespace osu.Game
|
|||||||
|
|
||||||
public virtual Storage GetStorageForStableInstall() => null;
|
public virtual Storage GetStorageForStableInstall() => null;
|
||||||
|
|
||||||
private Intro intro
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Screen screen = screenStack;
|
|
||||||
while (screen != null && !(screen is Intro))
|
|
||||||
screen = screen.ChildScreen;
|
|
||||||
return screen as Intro;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
||||||
|
|
||||||
private IdleTracker idleTracker;
|
private IdleTracker idleTracker;
|
||||||
|
|
||||||
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||||
|
|
||||||
private OsuScreen screenStack;
|
private BackgroundScreenStack backgroundStack;
|
||||||
|
|
||||||
|
private ParallaxContainer backgroundParallax;
|
||||||
|
|
||||||
|
private ScreenStack screenStack;
|
||||||
private VolumeOverlay volume;
|
private VolumeOverlay volume;
|
||||||
private OnScreenDisplay onscreenDisplay;
|
private OnScreenDisplay onscreenDisplay;
|
||||||
|
private OsuLogo osuLogo;
|
||||||
|
|
||||||
|
private MainMenu menuScreen;
|
||||||
|
private Intro introScreen;
|
||||||
|
|
||||||
private Bindable<int> configRuleset;
|
private Bindable<int> configRuleset;
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
@ -173,6 +169,8 @@ namespace osu.Game
|
|||||||
dependencies.CacheAs(ruleset);
|
dependencies.CacheAs(ruleset);
|
||||||
dependencies.CacheAs<IBindable<RulesetInfo>>(ruleset);
|
dependencies.CacheAs<IBindable<RulesetInfo>>(ruleset);
|
||||||
|
|
||||||
|
dependencies.Cache(osuLogo = new OsuLogo());
|
||||||
|
|
||||||
// bind config int to database RulesetInfo
|
// bind config int to database RulesetInfo
|
||||||
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
||||||
ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
|
ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
|
||||||
@ -211,6 +209,12 @@ namespace osu.Game
|
|||||||
/// <param name="beatmap">The beatmap to select.</param>
|
/// <param name="beatmap">The beatmap to select.</param>
|
||||||
public void PresentBeatmap(BeatmapSetInfo beatmap)
|
public void PresentBeatmap(BeatmapSetInfo beatmap)
|
||||||
{
|
{
|
||||||
|
if (menuScreen == null)
|
||||||
|
{
|
||||||
|
Schedule(() => PresentBeatmap(beatmap));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CloseAllOverlays(false);
|
CloseAllOverlays(false);
|
||||||
|
|
||||||
void setBeatmap()
|
void setBeatmap()
|
||||||
@ -233,16 +237,15 @@ namespace osu.Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (currentScreen)
|
switch (screenStack.CurrentScreen)
|
||||||
{
|
{
|
||||||
case SongSelect _:
|
case SongSelect _:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// navigate to song select if we are not already there.
|
// navigate to song select if we are not already there.
|
||||||
var menu = (MainMenu)intro.ChildScreen;
|
|
||||||
|
|
||||||
menu.MakeCurrent();
|
menuScreen.MakeCurrent();
|
||||||
menu.LoadToSolo();
|
menuScreen.LoadToSolo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,9 +271,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
scoreLoad?.Cancel();
|
scoreLoad?.Cancel();
|
||||||
|
|
||||||
var menu = intro.ChildScreen;
|
if (menuScreen == null)
|
||||||
|
|
||||||
if (menu == null)
|
|
||||||
{
|
{
|
||||||
scoreLoad = Schedule(() => LoadScore(score, false));
|
scoreLoad = Schedule(() => LoadScore(score, false));
|
||||||
return;
|
return;
|
||||||
@ -291,7 +292,7 @@ namespace osu.Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentScreen.AllowExternalScreenChange)
|
if ((screenStack.CurrentScreen as IOsuScreen)?.AllowExternalScreenChange != true)
|
||||||
{
|
{
|
||||||
notifications.Post(new SimpleNotification
|
notifications.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
@ -310,9 +311,9 @@ namespace osu.Game
|
|||||||
|
|
||||||
void loadScore()
|
void loadScore()
|
||||||
{
|
{
|
||||||
if (!menu.IsCurrentScreen)
|
if (!menuScreen.IsCurrentScreen())
|
||||||
{
|
{
|
||||||
menu.MakeCurrent();
|
menuScreen.MakeCurrent();
|
||||||
this.Delay(500).Schedule(loadScore, out scoreLoad);
|
this.Delay(500).Schedule(loadScore, out scoreLoad);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -322,7 +323,7 @@ namespace osu.Game
|
|||||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||||
Beatmap.Value.Mods.Value = databasedScoreInfo.Mods;
|
Beatmap.Value.Mods.Value = databasedScoreInfo.Mods;
|
||||||
|
|
||||||
currentScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
|
menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,11 +337,6 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
|
||||||
// in the cursor being shown for a few frames during the intro.
|
|
||||||
// This prevents the cursor from showing until we have a screen with CursorVisible = true
|
|
||||||
MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
|
||||||
|
|
||||||
// todo: all archive managers should be able to be looped here.
|
// todo: all archive managers should be able to be looped here.
|
||||||
SkinManager.PostNotification = n => notifications?.Post(n);
|
SkinManager.PostNotification = n => notifications?.Post(n);
|
||||||
SkinManager.GetStableStorage = GetStorageForStableInstall;
|
SkinManager.GetStableStorage = GetStorageForStableInstall;
|
||||||
@ -350,6 +346,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
BeatmapManager.PresentBeatmap = PresentBeatmap;
|
BeatmapManager.PresentBeatmap = PresentBeatmap;
|
||||||
|
|
||||||
|
Container logoContainer;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new VolumeControlReceptor
|
new VolumeControlReceptor
|
||||||
@ -361,6 +359,16 @@ namespace osu.Game
|
|||||||
screenContainer = new ScalingContainer(ScalingMode.ExcludeOverlays)
|
screenContainer = new ScalingContainer(ScalingMode.ExcludeOverlays)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
backgroundParallax = new ParallaxContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
|
||||||
|
},
|
||||||
|
screenStack = new ScreenStack { RelativeSizeAxes = Axes.Both },
|
||||||
|
logoContainer = new Container { RelativeSizeAxes = Axes.Both },
|
||||||
|
}
|
||||||
},
|
},
|
||||||
overlayContent = new Container
|
overlayContent = new Container
|
||||||
{
|
{
|
||||||
@ -370,12 +378,17 @@ namespace osu.Game
|
|||||||
idleTracker = new GameIdleTracker(6000)
|
idleTracker = new GameIdleTracker(6000)
|
||||||
});
|
});
|
||||||
|
|
||||||
loadComponentSingleFile(screenStack = new Loader(), d =>
|
dependencies.Cache(backgroundStack);
|
||||||
|
|
||||||
|
screenStack.ScreenPushed += screenPushed;
|
||||||
|
screenStack.ScreenExited += screenExited;
|
||||||
|
|
||||||
|
loadComponentSingleFile(osuLogo, logoContainer.Add);
|
||||||
|
|
||||||
|
loadComponentSingleFile(new Loader
|
||||||
{
|
{
|
||||||
screenStack.ModePushed += screenAdded;
|
RelativeSizeAxes = Axes.Both
|
||||||
screenStack.Exited += screenRemoved;
|
}, screenStack.Push);
|
||||||
screenContainer.Add(screenStack);
|
|
||||||
});
|
|
||||||
|
|
||||||
loadComponentSingleFile(Toolbar = new Toolbar
|
loadComponentSingleFile(Toolbar = new Toolbar
|
||||||
{
|
{
|
||||||
@ -383,7 +396,7 @@ namespace osu.Game
|
|||||||
OnHome = delegate
|
OnHome = delegate
|
||||||
{
|
{
|
||||||
CloseAllOverlays(false);
|
CloseAllOverlays(false);
|
||||||
intro?.ChildScreen?.MakeCurrent();
|
menuScreen?.MakeCurrent();
|
||||||
},
|
},
|
||||||
}, floatingOverlayContent.Add);
|
}, floatingOverlayContent.Add);
|
||||||
|
|
||||||
@ -617,7 +630,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (intro == null) return false;
|
if (introScreen == null) return false;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@ -674,19 +687,20 @@ namespace osu.Game
|
|||||||
|
|
||||||
private Container floatingOverlayContent;
|
private Container floatingOverlayContent;
|
||||||
|
|
||||||
private OsuScreen currentScreen;
|
|
||||||
private FrameworkConfigManager frameworkConfig;
|
private FrameworkConfigManager frameworkConfig;
|
||||||
private ScalingContainer screenContainer;
|
private ScalingContainer screenContainer;
|
||||||
|
|
||||||
protected override bool OnExiting()
|
protected override bool OnExiting()
|
||||||
{
|
{
|
||||||
if (screenStack.ChildScreen == null) return false;
|
if (screenStack.CurrentScreen is Loader)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (intro == null) return true;
|
if (introScreen == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!intro.DidLoadMenu || intro.ChildScreen != null)
|
if (!introScreen.DidLoadMenu || !(screenStack.CurrentScreen is Intro))
|
||||||
{
|
{
|
||||||
Scheduler.Add(intro.MakeCurrent);
|
Scheduler.Add(introScreen.MakeCurrent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,7 +725,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
// we only want to apply these restrictions when we are inside a screen stack.
|
// we only want to apply these restrictions when we are inside a screen stack.
|
||||||
// the use case for not applying is in visual/unit tests.
|
// the use case for not applying is in visual/unit tests.
|
||||||
bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false;
|
bool applyBeatmapRulesetRestrictions = !(screenStack.CurrentScreen as IOsuScreen)?.AllowBeatmapRulesetChange ?? false;
|
||||||
|
|
||||||
ruleset.Disabled = applyBeatmapRulesetRestrictions;
|
ruleset.Disabled = applyBeatmapRulesetRestrictions;
|
||||||
Beatmap.Disabled = applyBeatmapRulesetRestrictions;
|
Beatmap.Disabled = applyBeatmapRulesetRestrictions;
|
||||||
@ -719,7 +733,7 @@ namespace osu.Game
|
|||||||
screenContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
screenContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
|
|
||||||
MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
MenuCursorContainer.CanShowCursor = (screenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -748,24 +762,41 @@ namespace osu.Game
|
|||||||
this.ruleset.Disabled = rulesetDisabled;
|
this.ruleset.Disabled = rulesetDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ScreenChanged(OsuScreen current, Screen newScreen)
|
protected virtual void ScreenChanged(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
{
|
||||||
currentScreen = (OsuScreen)newScreen;
|
switch (newScreen)
|
||||||
|
{
|
||||||
|
case Intro intro:
|
||||||
|
introScreen = intro;
|
||||||
|
break;
|
||||||
|
case MainMenu menu:
|
||||||
|
menuScreen = menu;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newScreen is IOsuScreen newOsuScreen)
|
||||||
|
{
|
||||||
|
backgroundParallax.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * newOsuScreen.BackgroundParallaxAmount;
|
||||||
|
|
||||||
|
OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode;
|
||||||
|
|
||||||
|
if (newOsuScreen.HideOverlaysOnEnter)
|
||||||
|
CloseAllOverlays();
|
||||||
|
else
|
||||||
|
Toolbar.State = Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenAdded(Screen newScreen)
|
private void screenPushed(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
{
|
||||||
ScreenChanged(currentScreen, newScreen);
|
ScreenChanged(lastScreen, newScreen);
|
||||||
Logger.Log($"Screen changed → {newScreen}");
|
Logger.Log($"Screen changed → {newScreen}");
|
||||||
|
|
||||||
newScreen.ModePushed += screenAdded;
|
|
||||||
newScreen.Exited += screenRemoved;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenRemoved(Screen newScreen)
|
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
{
|
||||||
ScreenChanged(currentScreen, newScreen);
|
ScreenChanged(lastScreen, newScreen);
|
||||||
Logger.Log($"Screen changed ← {currentScreen}");
|
Logger.Log($"Screen changed ← {newScreen}");
|
||||||
|
|
||||||
if (newScreen == null)
|
if (newScreen == null)
|
||||||
Exit();
|
Exit();
|
||||||
|
@ -8,22 +8,22 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
{
|
{
|
||||||
public abstract class AccountCreationScreen : Screen
|
public abstract class AccountCreationScreen : Screen
|
||||||
{
|
{
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
Content.FadeOut().Delay(200).FadeIn(200);
|
this.FadeOut().Delay(200).FadeIn(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
Content.FadeIn(200);
|
this.FadeIn(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
Content.FadeOut(200);
|
this.FadeOut(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -143,7 +143,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
focusNextTextbox();
|
focusNextTextbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
processingOverlay.Hide();
|
processingOverlay.Hide();
|
||||||
|
@ -26,12 +26,12 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
|
|
||||||
private const string help_centre_url = "/help/wiki/Help_Centre#login";
|
private const string help_centre_url = "/help/wiki/Help_Centre#login";
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(api.ProvidedUsername))
|
if (string.IsNullOrEmpty(api.ProvidedUsername))
|
||||||
{
|
{
|
||||||
Content.FadeOut();
|
this.FadeOut();
|
||||||
Push(new ScreenEntry());
|
this.Push(new ScreenEntry());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
if (string.IsNullOrEmpty(api.ProvidedUsername))
|
if (string.IsNullOrEmpty(api.ProvidedUsername))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new Sprite
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
new DangerousSettingsButton
|
new DangerousSettingsButton
|
||||||
{
|
{
|
||||||
Text = "I understand. This account isn't for me.",
|
Text = "I understand. This account isn't for me.",
|
||||||
Action = () => Push(new ScreenEntry())
|
Action = () => this.Push(new ScreenEntry())
|
||||||
},
|
},
|
||||||
furtherAssistance = new LinkFlowContainer(cp => { cp.TextSize = 12; })
|
furtherAssistance = new LinkFlowContainer(cp => { cp.TextSize = 12; })
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
@ -16,7 +17,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Child = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
@ -56,7 +57,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
{
|
{
|
||||||
Text = "Let's create an account!",
|
Text = "Let's create an account!",
|
||||||
Margin = new MarginPadding { Vertical = 120 },
|
Margin = new MarginPadding { Vertical = 120 },
|
||||||
Action = () => Push(new ScreenWarning())
|
Action = () => this.Push(new ScreenWarning())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -82,7 +83,7 @@ namespace osu.Game.Overlays
|
|||||||
base.PopIn();
|
base.PopIn();
|
||||||
this.FadeIn(transition_time, Easing.OutQuint);
|
this.FadeIn(transition_time, Easing.OutQuint);
|
||||||
|
|
||||||
if (welcomeScreen.ChildScreen != null)
|
if (welcomeScreen.GetChildScreen() != null)
|
||||||
welcomeScreen.MakeCurrent();
|
welcomeScreen.MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
@ -12,6 +11,12 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
public abstract class BackgroundScreen : Screen, IEquatable<BackgroundScreen>
|
public abstract class BackgroundScreen : Screen, IEquatable<BackgroundScreen>
|
||||||
{
|
{
|
||||||
|
protected BackgroundScreen()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool Equals(BackgroundScreen other)
|
public virtual bool Equals(BackgroundScreen other)
|
||||||
{
|
{
|
||||||
return other?.GetType() == GetType();
|
return other?.GetType() == GetType();
|
||||||
@ -26,64 +31,40 @@ namespace osu.Game.Screens
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Push(Screen screen)
|
|
||||||
{
|
|
||||||
// When trying to push a non-loaded screen, load it asynchronously and re-invoke Push
|
|
||||||
// once it's done.
|
|
||||||
if (screen.LoadState == LoadState.NotLoaded)
|
|
||||||
{
|
|
||||||
LoadComponentAsync(screen, d => Push((BackgroundScreen)d));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the in-progress loading is complete before pushing the screen.
|
|
||||||
while (screen.LoadState < LoadState.Ready)
|
|
||||||
Thread.Sleep(1);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
base.Push(screen);
|
|
||||||
}
|
|
||||||
catch (ScreenAlreadyExitedException)
|
|
||||||
{
|
|
||||||
// screen may have exited before the push was successful.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
Content.Scale = new Vector2(1 + x_movement_amount / DrawSize.X * 2);
|
Scale = new Vector2(1 + x_movement_amount / DrawSize.X * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
Content.FadeOut();
|
this.FadeOut();
|
||||||
Content.MoveToX(x_movement_amount);
|
this.MoveToX(x_movement_amount);
|
||||||
|
|
||||||
Content.FadeIn(transition_length, Easing.InOutQuart);
|
this.FadeIn(transition_length, Easing.InOutQuart);
|
||||||
Content.MoveToX(0, transition_length, Easing.InOutQuart);
|
this.MoveToX(0, transition_length, Easing.InOutQuart);
|
||||||
|
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
Content.MoveToX(-x_movement_amount, transition_length, Easing.InOutQuart);
|
this.MoveToX(-x_movement_amount, transition_length, Easing.InOutQuart);
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
Content.FadeOut(transition_length, Easing.OutExpo);
|
this.FadeOut(transition_length, Easing.OutExpo);
|
||||||
Content.MoveToX(x_movement_amount, transition_length, Easing.OutExpo);
|
this.MoveToX(x_movement_amount, transition_length, Easing.OutExpo);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
Content.MoveToX(0, transition_length, Easing.OutExpo);
|
this.MoveToX(0, transition_length, Easing.OutExpo);
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
osu.Game/Screens/BackgroundScreenStack.cs
Normal file
32
osu.Game/Screens/BackgroundScreenStack.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens
|
||||||
|
{
|
||||||
|
public class BackgroundScreenStack : ScreenStack
|
||||||
|
{
|
||||||
|
public BackgroundScreenStack()
|
||||||
|
{
|
||||||
|
Scale = new Vector2(1.06f);
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public float ParallaxAmount { set => parallax.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * value; }
|
||||||
|
|
||||||
|
public new void Push(BackgroundScreen screen)
|
||||||
|
{
|
||||||
|
if (screen == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen)CurrentScreen, screen))
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.Push(screen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.Depth = newDepth;
|
b.Depth = newDepth;
|
||||||
Add(Background = b);
|
AddInternal(Background = b);
|
||||||
Background.BlurSigma = BlurTarget;
|
Background.BlurSigma = BlurTarget;
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -12,14 +12,14 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
{
|
{
|
||||||
public BackgroundScreenBlack()
|
public BackgroundScreenBlack()
|
||||||
{
|
{
|
||||||
Child = new Box
|
InternalChild = new Box
|
||||||
{
|
{
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
public BackgroundScreenCustom(string textureName)
|
public BackgroundScreenCustom(string textureName)
|
||||||
{
|
{
|
||||||
this.textureName = textureName;
|
this.textureName = textureName;
|
||||||
Add(new Background(textureName));
|
AddInternal(new Background(textureName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(BackgroundScreen other)
|
public override bool Equals(BackgroundScreen other)
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
Background?.FadeOut(800, Easing.InOutSine);
|
Background?.FadeOut(800, Easing.InOutSine);
|
||||||
Background?.Expire();
|
Background?.Expire();
|
||||||
|
|
||||||
Add(Background = newBackground);
|
AddInternal(Background = newBackground);
|
||||||
currentDisplay++;
|
currentDisplay++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
private Box bottomBackground;
|
private Box bottomBackground;
|
||||||
@ -65,7 +65,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
SummaryTimeline timeline;
|
SummaryTimeline timeline;
|
||||||
PlaybackControl playback;
|
PlaybackControl playback;
|
||||||
|
|
||||||
Children = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap),
|
new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItem("Exit", MenuItemType.Standard, Exit)
|
new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,20 +194,20 @@ namespace osu.Game.Screens.Edit
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
Beatmap.Value.Track?.Stop();
|
Beatmap.Value.Track?.Stop();
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
Background.FadeColour(Color4.DarkGray, 500);
|
Background.FadeColour(Color4.DarkGray, 500);
|
||||||
Beatmap.Value.Track?.Stop();
|
Beatmap.Value.Track?.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
Background.FadeColour(Color4.White, 500);
|
Background.FadeColour(Color4.White, 500);
|
||||||
if (Beatmap.Value.Track != null)
|
if (Beatmap.Value.Track != null)
|
||||||
|
39
osu.Game/Screens/IOsuScreen.cs
Normal file
39
osu.Game/Screens/IOsuScreen.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens
|
||||||
|
{
|
||||||
|
public interface IOsuScreen : IScreen
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
|
||||||
|
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
|
||||||
|
/// </summary>
|
||||||
|
bool AllowBeatmapRulesetChange { get; }
|
||||||
|
|
||||||
|
bool AllowExternalScreenChange { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
||||||
|
/// </summary>
|
||||||
|
bool CursorVisible { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether all overlays should be hidden when this screen is entered or resumed.
|
||||||
|
/// </summary>
|
||||||
|
bool HideOverlaysOnEnter { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether overlays should be able to be opened once this screen is entered or resumed.
|
||||||
|
/// </summary>
|
||||||
|
OverlayActivation InitialOverlayActivationMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of parallax to be applied while this screen is displayed.
|
||||||
|
/// </summary>
|
||||||
|
float BackgroundParallaxAmount { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -17,9 +17,9 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
private bool showDisclaimer;
|
private bool showDisclaimer;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
|
|
||||||
protected override bool AllowBackButton => false;
|
protected override bool AllowBackButton => false;
|
||||||
|
|
||||||
@ -55,11 +55,11 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
|
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
LoadComponentAsync(precompiler = CreateShaderPrecompiler(), Add);
|
LoadComponentAsync(precompiler = CreateShaderPrecompiler(), AddInternal);
|
||||||
LoadComponentAsync(loadableScreen = CreateLoadableScreen());
|
LoadComponentAsync(loadableScreen = CreateLoadableScreen());
|
||||||
|
|
||||||
checkIfLoaded();
|
checkIfLoaded();
|
||||||
@ -73,7 +73,7 @@ namespace osu.Game.Screens
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Push(loadableScreen);
|
this.Push(loadableScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -23,8 +23,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
private Color4 iconColour;
|
private Color4 iconColour;
|
||||||
private LinkFlowContainer textFlow;
|
private LinkFlowContainer textFlow;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
icon = new SpriteIcon
|
icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
LoadComponentAsync(intro = new Intro());
|
LoadComponentAsync(intro = new Intro());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
@ -130,12 +130,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
supporterDrawables.ForEach(d => d.FadeOut().Delay(2000).FadeIn(500));
|
supporterDrawables.ForEach(d => d.FadeOut().Delay(2000).FadeIn(500));
|
||||||
|
|
||||||
Content
|
this
|
||||||
.FadeInFromZero(500)
|
.FadeInFromZero(500)
|
||||||
.Then(5500)
|
.Then(5500)
|
||||||
.FadeOut(250)
|
.FadeOut(250)
|
||||||
.ScaleTo(0.9f, 250, Easing.InQuint)
|
.ScaleTo(0.9f, 250, Easing.InQuint)
|
||||||
.Finally(d => Push(intro));
|
.Finally(d => this.Push(intro));
|
||||||
|
|
||||||
heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop();
|
heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
private SampleChannel welcome;
|
private SampleChannel welcome;
|
||||||
private SampleChannel seeya;
|
private SampleChannel seeya;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
DidLoadMenu = true;
|
DidLoadMenu = true;
|
||||||
Push(mainMenu);
|
this.Push(mainMenu);
|
||||||
}, delay_step_one);
|
}, delay_step_one);
|
||||||
}, delay_step_two);
|
}, delay_step_two);
|
||||||
}
|
}
|
||||||
@ -145,22 +145,21 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
Content.FadeOut(300);
|
this.FadeOut(300);
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
//cancel exiting if we haven't loaded the menu yet.
|
//cancel exiting if we haven't loaded the menu yet.
|
||||||
return !DidLoadMenu;
|
return !DidLoadMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
if (!(last is MainMenu))
|
this.FadeIn(300);
|
||||||
Content.FadeIn(300);
|
|
||||||
|
|
||||||
double fadeOutTime = EXIT_DELAY;
|
double fadeOutTime = EXIT_DELAY;
|
||||||
//we also handle the exit transition.
|
//we also handle the exit transition.
|
||||||
@ -169,7 +168,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
else
|
else
|
||||||
fadeOutTime = 500;
|
fadeOutTime = 500;
|
||||||
|
|
||||||
Scheduler.AddDelayed(Exit, fadeOutTime);
|
Scheduler.AddDelayed(this.Exit, fadeOutTime);
|
||||||
|
|
||||||
//don't want to fade out completely else we will stop running updates and shit will hit the fan.
|
//don't want to fade out completely else we will stop running updates and shit will hit the fan.
|
||||||
Game.FadeTo(0.01f, fadeOutTime);
|
Game.FadeTo(0.01f, fadeOutTime);
|
||||||
|
@ -25,28 +25,25 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
private readonly ButtonSystem buttons;
|
private readonly ButtonSystem buttons;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
|
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
|
||||||
|
|
||||||
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
|
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
|
||||||
|
|
||||||
public override bool AllowExternalScreenChange => true;
|
public override bool AllowExternalScreenChange => true;
|
||||||
|
|
||||||
private readonly BackgroundScreenDefault background;
|
|
||||||
private Screen songSelect;
|
private Screen songSelect;
|
||||||
|
|
||||||
private readonly MenuSideFlashes sideFlashes;
|
private readonly MenuSideFlashes sideFlashes;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => background;
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||||
|
|
||||||
public MainMenu()
|
public MainMenu()
|
||||||
{
|
{
|
||||||
background = new BackgroundScreenDefault();
|
InternalChildren = new Drawable[]
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new ExitConfirmOverlay
|
new ExitConfirmOverlay
|
||||||
{
|
{
|
||||||
Action = Exit,
|
Action = this.Exit,
|
||||||
},
|
},
|
||||||
new ParallaxContainer
|
new ParallaxContainer
|
||||||
{
|
{
|
||||||
@ -55,12 +52,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
buttons = new ButtonSystem
|
buttons = new ButtonSystem
|
||||||
{
|
{
|
||||||
OnChart = delegate { Push(new ChartListing()); },
|
OnChart = delegate { this.Push(new ChartListing()); },
|
||||||
OnDirect = delegate { Push(new OnlineListing()); },
|
OnDirect = delegate {this.Push(new OnlineListing()); },
|
||||||
OnEdit = delegate { Push(new Editor()); },
|
OnEdit = delegate {this.Push(new Editor()); },
|
||||||
OnSolo = onSolo,
|
OnSolo = onSolo,
|
||||||
OnMulti = delegate { Push(new Multiplayer()); },
|
OnMulti = delegate {this.Push(new Multiplayer()); },
|
||||||
OnExit = Exit,
|
OnExit = this.Exit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -73,10 +70,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
case ButtonSystemState.Initial:
|
case ButtonSystemState.Initial:
|
||||||
case ButtonSystemState.Exit:
|
case ButtonSystemState.Exit:
|
||||||
background.FadeColour(Color4.White, 500, Easing.OutSine);
|
Background.FadeColour(Color4.White, 500, Easing.OutSine);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine);
|
Background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -85,8 +82,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuGame game = null)
|
private void load(OsuGame game = null)
|
||||||
{
|
{
|
||||||
LoadComponentAsync(background);
|
|
||||||
|
|
||||||
if (game != null)
|
if (game != null)
|
||||||
{
|
{
|
||||||
buttons.OnSettings = game.ToggleSettings;
|
buttons.OnSettings = game.ToggleSettings;
|
||||||
@ -104,7 +99,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
public void LoadToSolo() => Schedule(onSolo);
|
public void LoadToSolo() => Schedule(onSolo);
|
||||||
|
|
||||||
private void onSolo() => Push(consumeSongSelect());
|
private void onSolo() =>this.Push(consumeSongSelect());
|
||||||
|
|
||||||
private Screen consumeSongSelect()
|
private Screen consumeSongSelect()
|
||||||
{
|
{
|
||||||
@ -113,7 +108,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
buttons.FadeInFromZero(500);
|
buttons.FadeInFromZero(500);
|
||||||
@ -148,8 +143,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
const float length = 300;
|
const float length = 300;
|
||||||
|
|
||||||
Content.FadeIn(length, Easing.OutQuint);
|
this.FadeIn(length, Easing.OutQuint);
|
||||||
Content.MoveTo(new Vector2(0, 0), length, Easing.OutQuint);
|
this.MoveTo(new Vector2(0, 0), length, Easing.OutQuint);
|
||||||
|
|
||||||
sideFlashes.Delay(length).FadeIn(64, Easing.InQuint);
|
sideFlashes.Delay(length).FadeIn(64, Easing.InQuint);
|
||||||
}
|
}
|
||||||
@ -164,13 +159,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private void beatmap_ValueChanged(WorkingBeatmap newValue)
|
private void beatmap_ValueChanged(WorkingBeatmap newValue)
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen)
|
if (!this.IsCurrentScreen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
background.Next();
|
((BackgroundScreenDefault)Background).Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
|
||||||
@ -178,26 +173,26 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
buttons.State = ButtonSystemState.EnteringMode;
|
buttons.State = ButtonSystemState.EnteringMode;
|
||||||
|
|
||||||
Content.FadeOut(length, Easing.InSine);
|
this.FadeOut(length, Easing.InSine);
|
||||||
Content.MoveTo(new Vector2(-800, 0), length, Easing.InSine);
|
this.MoveTo(new Vector2(-800, 0), length, Easing.InSine);
|
||||||
|
|
||||||
sideFlashes.FadeOut(64, Easing.OutQuint);
|
sideFlashes.FadeOut(64, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
background.Next();
|
((BackgroundScreenDefault)Background).Next();
|
||||||
|
|
||||||
//we may have consumed our preloaded instance, so let's make another.
|
//we may have consumed our preloaded instance, so let's make another.
|
||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
buttons.State = ButtonSystemState.Exit;
|
buttons.State = ButtonSystemState.Exit;
|
||||||
Content.FadeOut(3000);
|
this.FadeOut(3000);
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +200,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
if (!e.Repeat && e.ControlPressed && e.ShiftPressed && e.Key == Key.D)
|
if (!e.Repeat && e.ControlPressed && e.ShiftPressed && e.Key == Key.D)
|
||||||
{
|
{
|
||||||
Push(new Drawings());
|
this.Push(new Drawings());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
private readonly OsuSpriteText screenType;
|
private readonly OsuSpriteText screenType;
|
||||||
private readonly HeaderBreadcrumbControl breadcrumbs;
|
private readonly HeaderBreadcrumbControl breadcrumbs;
|
||||||
|
|
||||||
public Header(Screen initialScreen)
|
public Header(ScreenStack stack)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = HEIGHT;
|
Height = HEIGHT;
|
||||||
@ -75,7 +75,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
breadcrumbs = new HeaderBreadcrumbControl(initialScreen)
|
breadcrumbs = new HeaderBreadcrumbControl(stack)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
@ -103,8 +103,8 @@ namespace osu.Game.Screens.Multi
|
|||||||
|
|
||||||
private class HeaderBreadcrumbControl : ScreenBreadcrumbControl
|
private class HeaderBreadcrumbControl : ScreenBreadcrumbControl
|
||||||
{
|
{
|
||||||
public HeaderBreadcrumbControl(Screen initialScreen)
|
public HeaderBreadcrumbControl(ScreenStack stack)
|
||||||
: base(initialScreen)
|
: base(stack)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Multi
|
namespace osu.Game.Screens.Multi
|
||||||
{
|
{
|
||||||
public interface IMultiplayerSubScreen
|
public interface IMultiplayerSubScreen : IOsuScreen
|
||||||
{
|
{
|
||||||
|
string Title { get; }
|
||||||
|
|
||||||
string ShortTitle { get; }
|
string ShortTitle { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
@ -17,6 +16,8 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
{
|
{
|
||||||
public class LoungeSubScreen : MultiplayerSubScreen
|
public class LoungeSubScreen : MultiplayerSubScreen
|
||||||
{
|
{
|
||||||
|
public override string Title => "Lounge";
|
||||||
|
|
||||||
protected readonly FilterControl Filter;
|
protected readonly FilterControl Filter;
|
||||||
|
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
@ -24,20 +25,13 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
private readonly Action<Screen> pushGameplayScreen;
|
private readonly Action<Screen> pushGameplayScreen;
|
||||||
private readonly ProcessingOverlay processingOverlay;
|
private readonly ProcessingOverlay processingOverlay;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private IRoomManager roomManager { get; set; }
|
|
||||||
|
|
||||||
public override string Title => "Lounge";
|
|
||||||
|
|
||||||
protected override Drawable TransitionContent => content;
|
|
||||||
|
|
||||||
public LoungeSubScreen(Action<Screen> pushGameplayScreen)
|
public LoungeSubScreen(Action<Screen> pushGameplayScreen)
|
||||||
{
|
{
|
||||||
this.pushGameplayScreen = pushGameplayScreen;
|
this.pushGameplayScreen = pushGameplayScreen;
|
||||||
|
|
||||||
RoomInspector inspector;
|
RoomInspector inspector;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Filter = new FilterControl { Depth = -1 },
|
Filter = new FilterControl { Depth = -1 },
|
||||||
content = new Container
|
content = new Container
|
||||||
@ -81,7 +75,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
|
|
||||||
Filter.Search.Current.ValueChanged += s => filterRooms();
|
Filter.Search.Current.ValueChanged += s => filterRooms();
|
||||||
Filter.Tabs.Current.ValueChanged += t => filterRooms();
|
Filter.Tabs.Current.ValueChanged += t => filterRooms();
|
||||||
Filter.Search.Exit += Exit;
|
Filter.Search.Exit += this.Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -91,8 +85,8 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
content.Padding = new MarginPadding
|
content.Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = Filter.DrawHeight,
|
Top = Filter.DrawHeight,
|
||||||
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + HORIZONTAL_OVERFLOW_PADDING,
|
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||||
Right = SearchableListOverlay.WIDTH_PADDING + HORIZONTAL_OVERFLOW_PADDING,
|
Right = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,20 +95,19 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
Filter.Search.TakeFocus();
|
Filter.Search.TakeFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
Filter.Search.HoldFocus = true;
|
Filter.Search.HoldFocus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
Filter.Search.HoldFocus = false;
|
Filter.Search.HoldFocus = false;
|
||||||
// no base call; don't animate
|
return base.OnExiting(next);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
Filter.Search.HoldFocus = false;
|
Filter.Search.HoldFocus = false;
|
||||||
@ -123,13 +116,13 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
private void filterRooms()
|
private void filterRooms()
|
||||||
{
|
{
|
||||||
rooms.Filter(Filter.CreateCriteria());
|
rooms.Filter(Filter.CreateCriteria());
|
||||||
roomManager?.Filter(Filter.CreateCriteria());
|
Manager?.Filter(Filter.CreateCriteria());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void joinRequested(Room room)
|
private void joinRequested(Room room)
|
||||||
{
|
{
|
||||||
processingOverlay.Show();
|
processingOverlay.Show();
|
||||||
roomManager?.JoinRoom(room, r =>
|
Manager?.JoinRoom(room, r =>
|
||||||
{
|
{
|
||||||
Push(room);
|
Push(room);
|
||||||
processingOverlay.Hide();
|
processingOverlay.Hide();
|
||||||
@ -142,10 +135,10 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
public void Push(Room room)
|
public void Push(Room room)
|
||||||
{
|
{
|
||||||
// Handles the case where a room is clicked 3 times in quick succession
|
// Handles the case where a room is clicked 3 times in quick succession
|
||||||
if (!IsCurrentScreen)
|
if (!this.IsCurrentScreen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Push(new MatchSubScreen(room, s => pushGameplayScreen?.Invoke(s)));
|
this.Push(new MatchSubScreen(room, s => pushGameplayScreen?.Invoke(s)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
public class MatchSubScreen : MultiplayerSubScreen
|
public class MatchSubScreen : MultiplayerSubScreen
|
||||||
{
|
{
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
public override string Title => room.RoomID.Value == null ? "New room" : room.Name.Value;
|
public override string Title => room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||||
public override string ShortTitle => "room";
|
public override string ShortTitle => "room";
|
||||||
|
|
||||||
@ -36,12 +37,6 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private OsuGame game { get; set; }
|
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private IRoomManager manager { get; set; }
|
|
||||||
|
|
||||||
public MatchSubScreen(Room room, Action<Screen> pushGameplayScreen)
|
public MatchSubScreen(Room room, Action<Screen> pushGameplayScreen)
|
||||||
{
|
{
|
||||||
this.room = room;
|
this.room = room;
|
||||||
@ -55,7 +50,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
GridContainer bottomRow;
|
GridContainer bottomRow;
|
||||||
MatchSettingsOverlay settings;
|
MatchSettingsOverlay settings;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new GridContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
@ -77,7 +72,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
{
|
{
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Left = 10 + HORIZONTAL_OVERFLOW_PADDING,
|
Left = 10 + OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||||
Right = 10,
|
Right = 10,
|
||||||
Vertical = 10,
|
Vertical = 10,
|
||||||
},
|
},
|
||||||
@ -89,7 +84,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Left = 10,
|
Left = 10,
|
||||||
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
|
Right = 10 + OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||||
Vertical = 10,
|
Vertical = 10,
|
||||||
},
|
},
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -118,10 +113,9 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect
|
header.OnRequestSelectBeatmap = () => this.Push(new MatchSongSelect
|
||||||
{
|
{
|
||||||
Selected = addPlaylistItem,
|
Selected = addPlaylistItem,
|
||||||
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
header.Tabs.Current.ValueChanged += t =>
|
header.Tabs.Current.ValueChanged += t =>
|
||||||
@ -141,7 +135,11 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
chat.Exit += Exit;
|
chat.Exit += () =>
|
||||||
|
{
|
||||||
|
if (this.IsCurrentScreen())
|
||||||
|
this.Exit();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -150,9 +148,9 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
beatmapManager.ItemAdded += beatmapAdded;
|
beatmapManager.ItemAdded += beatmapAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
manager?.PartRoom();
|
Manager?.PartRoom();
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +167,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
||||||
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID);
|
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID);
|
||||||
|
|
||||||
game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
Game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRuleset(RulesetInfo ruleset)
|
private void setRuleset(RulesetInfo ruleset)
|
||||||
@ -177,7 +175,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
if (ruleset == null)
|
if (ruleset == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
game?.ForcefullySetRuleset(ruleset);
|
Game?.ForcefullySetRuleset(ruleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) => Schedule(() =>
|
private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) => Schedule(() =>
|
||||||
@ -192,7 +190,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
var localBeatmap = beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == bindings.CurrentBeatmap.Value.OnlineBeatmapID);
|
var localBeatmap = beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == bindings.CurrentBeatmap.Value.OnlineBeatmapID);
|
||||||
|
|
||||||
if (localBeatmap != null)
|
if (localBeatmap != null)
|
||||||
game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
Game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
||||||
});
|
});
|
||||||
|
|
||||||
private void addPlaylistItem(PlaylistItem item)
|
private void addPlaylistItem(PlaylistItem item)
|
||||||
@ -209,11 +207,9 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case GameTypeTimeshift _:
|
case GameTypeTimeshift _:
|
||||||
pushGameplayScreen?.Invoke(new PlayerLoader(() => {
|
pushGameplayScreen?.Invoke(new PlayerLoader(() => new TimeshiftPlayer(room, room.Playlist.First().ID)
|
||||||
var player = new TimeshiftPlayer(room, room.Playlist.First().ID);
|
{
|
||||||
player.Exited += _ => leaderboard.RefreshScores();
|
Exited = () => leaderboard.RefreshScores()
|
||||||
|
|
||||||
return player;
|
|
||||||
}));
|
}));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -15,6 +16,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Multi.Lounge;
|
using osu.Game.Screens.Multi.Lounge;
|
||||||
@ -24,31 +26,56 @@ using osuTK;
|
|||||||
namespace osu.Game.Screens.Multi
|
namespace osu.Game.Screens.Multi
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
public class Multiplayer : OsuScreen, IOnlineComponent
|
public class Multiplayer : CompositeDrawable, IOsuScreen, IOnlineComponent
|
||||||
{
|
{
|
||||||
private readonly MultiplayerWaveContainer waves;
|
public bool AllowBeatmapRulesetChange => (screenStack.CurrentScreen as IMultiplayerSubScreen)?.AllowBeatmapRulesetChange ?? true;
|
||||||
|
public bool AllowExternalScreenChange => (screenStack.CurrentScreen as IMultiplayerSubScreen)?.AllowExternalScreenChange ?? true;
|
||||||
|
public bool CursorVisible => (screenStack.CurrentScreen as IMultiplayerSubScreen)?.AllowExternalScreenChange ?? true;
|
||||||
|
|
||||||
public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange;
|
public bool HideOverlaysOnEnter => false;
|
||||||
|
public OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
|
||||||
|
|
||||||
|
public float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
|
public bool ValidForResume { get; set; } = true;
|
||||||
|
public bool ValidForPush { get; set; } = true;
|
||||||
|
|
||||||
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
|
private readonly MultiplayerWaveContainer waves;
|
||||||
|
|
||||||
private readonly OsuButton createButton;
|
private readonly OsuButton createButton;
|
||||||
private readonly LoungeSubScreen loungeSubScreen;
|
private readonly LoungeSubScreen loungeSubScreen;
|
||||||
|
private readonly ScreenStack screenStack;
|
||||||
private OsuScreen currentSubScreen;
|
|
||||||
|
|
||||||
[Cached(Type = typeof(IRoomManager))]
|
[Cached(Type = typeof(IRoomManager))]
|
||||||
private RoomManager roomManager;
|
private RoomManager roomManager;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindableBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuGameBase game { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private APIAccess api { get; set; }
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private OsuLogo logo { get; set; }
|
||||||
|
|
||||||
public Multiplayer()
|
public Multiplayer()
|
||||||
{
|
{
|
||||||
Child = waves = new MultiplayerWaveContainer
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = waves = new MultiplayerWaveContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
};
|
};
|
||||||
|
|
||||||
Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING };
|
screenStack = new ScreenStack(loungeSubScreen = new LoungeSubScreen(this.Push)) { RelativeSizeAxes = Axes.Both };
|
||||||
|
Padding = new MarginPadding { Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING };
|
||||||
|
|
||||||
waves.AddRange(new Drawable[]
|
waves.AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -76,9 +103,9 @@ namespace osu.Game.Screens.Multi
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = Header.HEIGHT },
|
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||||
Child = loungeSubScreen = new LoungeSubScreen(Push),
|
Child = screenStack
|
||||||
},
|
},
|
||||||
new Header(loungeSubScreen),
|
new Header(screenStack),
|
||||||
createButton = new HeaderButton
|
createButton = new HeaderButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -88,7 +115,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = 10,
|
Top = 10,
|
||||||
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
|
Right = 10 + OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||||
},
|
},
|
||||||
Text = "Create room",
|
Text = "Create room",
|
||||||
Action = () => loungeSubScreen.Push(new Room
|
Action = () => loungeSubScreen.Push(new Room
|
||||||
@ -99,8 +126,8 @@ namespace osu.Game.Screens.Multi
|
|||||||
roomManager = new RoomManager()
|
roomManager = new RoomManager()
|
||||||
});
|
});
|
||||||
|
|
||||||
screenAdded(loungeSubScreen);
|
screenStack.ScreenPushed += screenPushed;
|
||||||
loungeSubScreen.Exited += _ => Exit();
|
screenStack.ScreenExited += screenExited;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IBindable<bool> isIdle = new BindableBool();
|
private readonly IBindable<bool> isIdle = new BindableBool();
|
||||||
@ -122,7 +149,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
|
|
||||||
private void updatePollingRate(bool idle)
|
private void updatePollingRate(bool idle)
|
||||||
{
|
{
|
||||||
roomManager.TimeBetweenPolls = !IsCurrentScreen || !(currentSubScreen is LoungeSubScreen) ? 0 : (idle ? 120000 : 15000);
|
roomManager.TimeBetweenPolls = !this.IsCurrentScreen() || !(screenStack.CurrentScreen is LoungeSubScreen) ? 0 : (idle ? 120000 : 15000);
|
||||||
Logger.Log($"Polling adjusted to {roomManager.TimeBetweenPolls}");
|
Logger.Log($"Polling adjusted to {roomManager.TimeBetweenPolls}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,114 +162,106 @@ namespace osu.Game.Screens.Multi
|
|||||||
private void forcefullyExit()
|
private void forcefullyExit()
|
||||||
{
|
{
|
||||||
// This is temporary since we don't currently have a way to force screens to be exited
|
// This is temporary since we don't currently have a way to force screens to be exited
|
||||||
if (IsCurrentScreen)
|
if (this.IsCurrentScreen())
|
||||||
Exit();
|
this.Exit();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MakeCurrent();
|
this.MakeCurrent();
|
||||||
Schedule(forcefullyExit);
|
Schedule(forcefullyExit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
Content.FadeIn();
|
this.FadeIn();
|
||||||
|
|
||||||
base.OnEntering(last);
|
|
||||||
waves.Show();
|
waves.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
waves.Hide();
|
waves.Hide();
|
||||||
|
|
||||||
Content.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
||||||
|
|
||||||
cancelLooping();
|
cancelLooping();
|
||||||
loungeSubScreen.MakeCurrent();
|
|
||||||
|
if (screenStack.CurrentScreen != null)
|
||||||
|
loungeSubScreen.MakeCurrent();
|
||||||
|
|
||||||
updatePollingRate(isIdle.Value);
|
updatePollingRate(isIdle.Value);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
// the wave overlay transition takes longer than expected to run.
|
||||||
|
logo?.AppendAnimatingAction(() => logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut(), false);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
this.FadeIn(250);
|
||||||
|
this.ScaleTo(1, 250, Easing.OutSine);
|
||||||
|
|
||||||
Content.FadeIn(250);
|
logo?.AppendAnimatingAction(() => OsuScreen.ApplyLogoArrivingDefaults(logo), true);
|
||||||
Content.ScaleTo(1, 250, Easing.OutSine);
|
|
||||||
|
|
||||||
updatePollingRate(isIdle.Value);
|
updatePollingRate(isIdle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
Content.ScaleTo(1.1f, 250, Easing.InSine);
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
Content.FadeOut(250);
|
this.FadeOut(250);
|
||||||
|
|
||||||
cancelLooping();
|
cancelLooping();
|
||||||
roomManager.TimeBetweenPolls = 0;
|
roomManager.TimeBetweenPolls = 0;
|
||||||
|
|
||||||
base.OnSuspending(next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelLooping()
|
private void cancelLooping()
|
||||||
{
|
{
|
||||||
var track = Beatmap.Value.Track;
|
var track = beatmap.Value.Track;
|
||||||
if (track != null)
|
if (track != null)
|
||||||
track.Looping = false;
|
track.Looping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoExiting(OsuLogo logo)
|
|
||||||
{
|
|
||||||
// the wave overlay transition takes longer than expected to run.
|
|
||||||
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
|
|
||||||
base.LogoExiting(logo);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
if (currentSubScreen is MatchSubScreen)
|
if (screenStack.CurrentScreen is MatchSubScreen)
|
||||||
{
|
{
|
||||||
var track = Beatmap.Value.Track;
|
var track = beatmap.Value.Track;
|
||||||
if (track != null)
|
if (track != null)
|
||||||
{
|
{
|
||||||
track.Looping = true;
|
track.Looping = true;
|
||||||
|
|
||||||
if (!track.IsRunning)
|
if (!track.IsRunning)
|
||||||
{
|
{
|
||||||
Game.Audio.AddItemToList(track);
|
game.Audio.AddItemToList(track);
|
||||||
track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
track.Seek(beatmap.Value.Metadata.PreviewTime);
|
||||||
track.Start();
|
track.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createButton.Hide();
|
createButton.Hide();
|
||||||
}
|
}
|
||||||
else if (currentSubScreen is LoungeSubScreen)
|
else if (screenStack.CurrentScreen is LoungeSubScreen)
|
||||||
createButton.Show();
|
createButton.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenAdded(Screen newScreen)
|
private void screenPushed(IScreen lastScreen, IScreen newScreen)
|
||||||
{
|
=> updatePollingRate(isIdle.Value);
|
||||||
currentSubScreen = (OsuScreen)newScreen;
|
|
||||||
updatePollingRate(isIdle.Value);
|
|
||||||
|
|
||||||
newScreen.ModePushed += screenAdded;
|
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||||
newScreen.Exited += screenRemoved;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void screenRemoved(Screen newScreen)
|
|
||||||
{
|
{
|
||||||
if (currentSubScreen is MatchSubScreen)
|
if (lastScreen is MatchSubScreen)
|
||||||
cancelLooping();
|
cancelLooping();
|
||||||
|
|
||||||
currentSubScreen = (OsuScreen)newScreen;
|
|
||||||
updatePollingRate(isIdle.Value);
|
updatePollingRate(isIdle.Value);
|
||||||
|
|
||||||
|
if (screenStack.CurrentScreen == null)
|
||||||
|
this.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -1,49 +1,95 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Multi
|
namespace osu.Game.Screens.Multi
|
||||||
{
|
{
|
||||||
public abstract class MultiplayerSubScreen : OsuScreen, IMultiplayerSubScreen
|
public abstract class MultiplayerSubScreen : CompositeDrawable, IMultiplayerSubScreen, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
protected virtual Drawable TransitionContent => Content;
|
public virtual bool AllowBeatmapRulesetChange => true;
|
||||||
|
public bool AllowExternalScreenChange => true;
|
||||||
|
public bool CursorVisible => true;
|
||||||
|
|
||||||
|
public bool HideOverlaysOnEnter => false;
|
||||||
|
public OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
|
||||||
|
|
||||||
|
public float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
|
public bool ValidForResume { get; set; } = true;
|
||||||
|
public bool ValidForPush { get; set; } = true;
|
||||||
|
|
||||||
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
|
public abstract string Title { get; }
|
||||||
public virtual string ShortTitle => Title;
|
public virtual string ShortTitle => Title;
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
[Resolved]
|
||||||
{
|
protected IBindableBeatmap Beatmap { get; private set; }
|
||||||
base.OnEntering(last);
|
|
||||||
|
|
||||||
Content.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
[Resolved(CanBeNull = true)]
|
||||||
TransitionContent.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
protected OsuGame Game { get; private set; }
|
||||||
TransitionContent.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
protected IRoomManager Manager { get; private set; }
|
||||||
|
|
||||||
|
protected MultiplayerSubScreen()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public virtual void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||||
TransitionContent.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
this.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||||
|
this.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||||
return base.OnExiting(next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public virtual bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||||
|
this.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
Content.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
return false;
|
||||||
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public virtual void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
this.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||||
|
this.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||||
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
|
||||||
TransitionContent.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnSuspending(IScreen next)
|
||||||
|
{
|
||||||
|
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||||
|
this.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnPressed(GlobalAction action)
|
||||||
|
{
|
||||||
|
if (!this.IsCurrentScreen()) return false;
|
||||||
|
|
||||||
|
if (action == GlobalAction.Back)
|
||||||
|
{
|
||||||
|
this.Exit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
||||||
|
|
||||||
|
public override string ToString() => Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
@ -18,6 +19,8 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
{
|
{
|
||||||
public class TimeshiftPlayer : Player
|
public class TimeshiftPlayer : Player
|
||||||
{
|
{
|
||||||
|
public Action Exited;
|
||||||
|
|
||||||
private readonly Room room;
|
private readonly Room room;
|
||||||
private readonly int playlistItemId;
|
private readonly int playlistItemId;
|
||||||
|
|
||||||
@ -50,7 +53,7 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
Exit();
|
this.Exit();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -60,6 +63,16 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool OnExiting(IScreen next)
|
||||||
|
{
|
||||||
|
if (base.OnExiting(next))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Exited?.Invoke();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected override ScoreInfo CreateScore()
|
protected override ScoreInfo CreateScore()
|
||||||
{
|
{
|
||||||
submitScore();
|
submitScore();
|
||||||
@ -79,6 +92,13 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
api.Queue(request);
|
api.Queue(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
Exited = null;
|
||||||
|
}
|
||||||
|
|
||||||
protected override Results CreateResults(ScoreInfo score) => new MatchResults(score, room);
|
protected override Results CreateResults(ScoreInfo score) => new MatchResults(score, room);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -11,17 +10,14 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osuTK;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
{
|
{
|
||||||
public abstract class OsuScreen : Screen, IKeyBindingHandler<GlobalAction>, IHasDescription
|
public abstract class OsuScreen : Screen, IOsuScreen, IKeyBindingHandler<GlobalAction>, IHasDescription
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen.
|
/// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen.
|
||||||
@ -29,8 +25,6 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const float HORIZONTAL_OVERFLOW_PADDING = 50;
|
public const float HORIZONTAL_OVERFLOW_PADDING = 50;
|
||||||
|
|
||||||
public BackgroundScreen Background { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A user-facing title for this screen.
|
/// A user-facing title for this screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -42,80 +36,62 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public virtual bool AllowExternalScreenChange => false;
|
public virtual bool AllowExternalScreenChange => false;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Override to create a BackgroundMode for the current screen.
|
|
||||||
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual BackgroundScreen CreateBackground() => null;
|
|
||||||
|
|
||||||
private Action updateOverlayStates;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether all overlays should be hidden when this screen is entered or resumed.
|
/// Whether all overlays should be hidden when this screen is entered or resumed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool HideOverlaysOnEnter => false;
|
public virtual bool HideOverlaysOnEnter => false;
|
||||||
|
|
||||||
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether overlays should be able to be opened once this screen is entered or resumed.
|
/// Whether overlays should be able to be opened once this screen is entered or resumed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
|
public virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool CursorVisible => true;
|
public virtual bool CursorVisible => true;
|
||||||
|
|
||||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
||||||
|
|
||||||
private OsuLogo logo;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
|
|
||||||
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool AllowBeatmapRulesetChange => true;
|
public virtual bool AllowBeatmapRulesetChange => true;
|
||||||
|
|
||||||
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
protected virtual float BackgroundParallaxAmount => 1;
|
public virtual float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
private ParallaxContainer backgroundParallaxContainer;
|
|
||||||
|
|
||||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
private SampleChannel sampleExit;
|
private SampleChannel sampleExit;
|
||||||
|
|
||||||
|
protected BackgroundScreen Background => backgroundStack?.CurrentScreen as BackgroundScreen;
|
||||||
|
|
||||||
|
private BackgroundScreen localBackground;
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private BackgroundScreenStack backgroundStack { get; set; }
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private OsuLogo logo { get; set; }
|
||||||
|
|
||||||
|
protected OsuScreen()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
|
private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
|
||||||
{
|
{
|
||||||
Beatmap.BindTo(beatmap);
|
Beatmap.BindTo(beatmap);
|
||||||
Ruleset.BindTo(ruleset);
|
Ruleset.BindTo(ruleset);
|
||||||
|
|
||||||
if (osu != null)
|
|
||||||
{
|
|
||||||
OverlayActivationMode.BindTo(osu.OverlayActivationMode);
|
|
||||||
|
|
||||||
updateOverlayStates = () =>
|
|
||||||
{
|
|
||||||
if (HideOverlaysOnEnter)
|
|
||||||
osu.CloseAllOverlays();
|
|
||||||
else
|
|
||||||
osu.Toolbar.State = Visibility.Visible;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool OnPressed(GlobalAction action)
|
public virtual bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return false;
|
if (!this.IsCurrentScreen()) return false;
|
||||||
|
|
||||||
if (action == GlobalAction.Back && AllowBackButton)
|
if (action == GlobalAction.Back && AllowBackButton)
|
||||||
{
|
{
|
||||||
Exit();
|
this.Exit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +100,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton;
|
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton;
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
sampleExit?.Play();
|
sampleExit?.Play();
|
||||||
applyArrivingDefaults(true);
|
applyArrivingDefaults(true);
|
||||||
@ -132,71 +108,32 @@ namespace osu.Game.Screens
|
|||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
onSuspendingLogo();
|
onSuspendingLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
OsuScreen lastOsu = last as OsuScreen;
|
|
||||||
|
|
||||||
BackgroundScreen bg = CreateBackground();
|
|
||||||
|
|
||||||
if (lastOsu?.Background != null)
|
|
||||||
{
|
|
||||||
backgroundParallaxContainer = lastOsu.backgroundParallaxContainer;
|
|
||||||
|
|
||||||
if (bg == null || lastOsu.Background.Equals(bg))
|
|
||||||
//we can keep the previous mode's background.
|
|
||||||
Background = lastOsu.Background;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastOsu.Background.Push(Background = bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bg != null)
|
|
||||||
{
|
|
||||||
// this makes up for the fact our padding changes when the global toolbar is visible.
|
|
||||||
bg.Scale = new Vector2(1.06f);
|
|
||||||
|
|
||||||
AddInternal(backgroundParallaxContainer = new ParallaxContainer
|
|
||||||
{
|
|
||||||
Depth = float.MaxValue,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
Background = bg
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((logo = lastOsu?.logo) == null)
|
|
||||||
LoadComponentAsync(logo = new OsuLogo { Alpha = 0 }, AddInternal);
|
|
||||||
|
|
||||||
applyArrivingDefaults(false);
|
applyArrivingDefaults(false);
|
||||||
|
|
||||||
|
backgroundStack?.Push(localBackground = CreateBackground());
|
||||||
|
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
if (ValidForResume && logo != null)
|
if (ValidForResume && logo != null)
|
||||||
onExitingLogo();
|
onExitingLogo();
|
||||||
|
|
||||||
OsuScreen nextOsu = next as OsuScreen;
|
|
||||||
|
|
||||||
if (Background != null && !Background.Equals(nextOsu?.Background))
|
|
||||||
{
|
|
||||||
Background.Exit();
|
|
||||||
|
|
||||||
//We need to use MakeCurrent in case we are jumping up multiple game screens.
|
|
||||||
nextOsu?.Background?.MakeCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (base.OnExiting(next))
|
if (base.OnExiting(next))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (localBackground != null && backgroundStack?.CurrentScreen == localBackground)
|
||||||
|
backgroundStack?.Exit();
|
||||||
|
|
||||||
Beatmap.UnbindAll();
|
Beatmap.UnbindAll();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -205,6 +142,24 @@ namespace osu.Game.Screens
|
|||||||
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
|
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void LogoArriving(OsuLogo logo, bool resuming)
|
protected virtual void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
{
|
||||||
|
ApplyLogoArrivingDefaults(logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyArrivingDefaults(bool isResuming)
|
||||||
|
{
|
||||||
|
logo?.AppendAnimatingAction(() =>
|
||||||
|
{
|
||||||
|
if (this.IsCurrentScreen()) LogoArriving(logo, isResuming);
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies default animations to an arriving logo.
|
||||||
|
/// Todo: This should not exist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logo">The logo to apply animations to.</param>
|
||||||
|
public static void ApplyLogoArrivingDefaults(OsuLogo logo)
|
||||||
{
|
{
|
||||||
logo.Action = null;
|
logo.Action = null;
|
||||||
logo.FadeOut(300, Easing.OutQuint);
|
logo.FadeOut(300, Easing.OutQuint);
|
||||||
@ -216,24 +171,9 @@ namespace osu.Game.Screens
|
|||||||
logo.Ripple = true;
|
logo.Ripple = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyArrivingDefaults(bool isResuming)
|
|
||||||
{
|
|
||||||
logo.AppendAnimatingAction(() =>
|
|
||||||
{
|
|
||||||
if (IsCurrentScreen) LogoArriving(logo, isResuming);
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
if (backgroundParallaxContainer != null)
|
|
||||||
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
|
||||||
|
|
||||||
OverlayActivationMode.Value = InitialOverlayActivationMode;
|
|
||||||
|
|
||||||
updateOverlayStates?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onExitingLogo()
|
private void onExitingLogo()
|
||||||
{
|
{
|
||||||
logo.AppendAnimatingAction(() => { LogoExiting(logo); }, false);
|
logo?.AppendAnimatingAction(() => LogoExiting(logo), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -245,7 +185,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
private void onSuspendingLogo()
|
private void onSuspendingLogo()
|
||||||
{
|
{
|
||||||
logo.AppendAnimatingAction(() => { LogoSuspending(logo); }, false);
|
logo?.AppendAnimatingAction(() => LogoSuspending(logo), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -254,5 +194,11 @@ namespace osu.Game.Screens
|
|||||||
protected virtual void LogoSuspending(OsuLogo logo)
|
protected virtual void LogoSuspending(OsuLogo logo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override to create a BackgroundMode for the current screen.
|
||||||
|
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual BackgroundScreen CreateBackground() => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
||||||
|
|
||||||
protected override float BackgroundParallaxAmount => 0.1f;
|
public override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
||||||
|
|
||||||
public Action RestartRequested;
|
public Action RestartRequested;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!ScoreProcessor.Mode.Disabled)
|
if (!ScoreProcessor.Mode.Disabled)
|
||||||
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
|
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
|
||||||
{
|
{
|
||||||
@ -225,7 +225,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
fadeOut(true);
|
fadeOut(true);
|
||||||
Restart();
|
Restart();
|
||||||
@ -260,18 +260,18 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void performUserRequestedExit()
|
private void performUserRequestedExit()
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
Exit();
|
this.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
sampleRestart?.Play();
|
sampleRestart?.Play();
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
RestartRequested?.Invoke();
|
RestartRequested?.Invoke();
|
||||||
Exit();
|
this.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate onCompletionEvent;
|
private ScheduledDelegate onCompletionEvent;
|
||||||
@ -290,13 +290,13 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
onCompletionEvent = Schedule(delegate
|
onCompletionEvent = Schedule(delegate
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
var score = CreateScore();
|
var score = CreateScore();
|
||||||
if (RulesetContainer.ReplayScore == null)
|
if (RulesetContainer.ReplayScore == null)
|
||||||
scoreManager.Import(score, true);
|
scoreManager.Import(score, true);
|
||||||
|
|
||||||
Push(CreateResults(score));
|
this.Push(CreateResults(score));
|
||||||
|
|
||||||
onCompletionEvent = null;
|
onCompletionEvent = null;
|
||||||
});
|
});
|
||||||
@ -331,15 +331,15 @@ namespace osu.Game.Screens.Play
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
if (!LoadedBeatmapSuccessfully)
|
if (!LoadedBeatmapSuccessfully)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Content.Alpha = 0;
|
Alpha = 0;
|
||||||
Content
|
this
|
||||||
.ScaleTo(0.7f)
|
.ScaleTo(0.7f)
|
||||||
.ScaleTo(1, 750, Easing.OutQuint)
|
.ScaleTo(1, 750, Easing.OutQuint)
|
||||||
.Delay(250)
|
.Delay(250)
|
||||||
@ -368,13 +368,13 @@ namespace osu.Game.Screens.Play
|
|||||||
pauseContainer.FadeIn(750, Easing.OutQuint);
|
pauseContainer.FadeIn(750, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
fadeOut();
|
fadeOut();
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
if (onCompletionEvent != null)
|
if (onCompletionEvent != null)
|
||||||
{
|
{
|
||||||
@ -401,7 +401,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private void fadeOut(bool instant = false)
|
private void fadeOut(bool instant = false)
|
||||||
{
|
{
|
||||||
float fadeOutDuration = instant ? 0 : 250;
|
float fadeOutDuration = instant ? 0 : 250;
|
||||||
Content.FadeOut(fadeOutDuration);
|
this.FadeOut(fadeOutDuration);
|
||||||
Background?.FadeColour(Color4.White, fadeOutDuration, Easing.OutQuint);
|
Background?.FadeColour(Color4.White, fadeOutDuration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override void UpdateBackgroundElements()
|
protected override void UpdateBackgroundElements()
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
base.UpdateBackgroundElements();
|
base.UpdateBackgroundElements();
|
||||||
|
|
||||||
|
@ -30,10 +30,12 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
|
private Container content;
|
||||||
|
|
||||||
private BeatmapMetadataDisplay info;
|
private BeatmapMetadataDisplay info;
|
||||||
|
|
||||||
private bool hideOverlays;
|
private bool hideOverlays;
|
||||||
protected override bool HideOverlaysOnEnter => hideOverlays;
|
public override bool HideOverlaysOnEnter => hideOverlays;
|
||||||
|
|
||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
|
|
||||||
@ -51,34 +53,42 @@ namespace osu.Game.Screens.Play
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(info = new BeatmapMetadataDisplay(Beatmap.Value)
|
InternalChild = content = new Container
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
});
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
Add(new FillFlowContainer<PlayerSettingsGroup>
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(0, 20),
|
|
||||||
Margin = new MarginPadding(25),
|
|
||||||
Children = new PlayerSettingsGroup[]
|
|
||||||
{
|
{
|
||||||
visualSettings = new VisualSettings(),
|
info = new BeatmapMetadataDisplay(Beatmap.Value)
|
||||||
new InputSettings()
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new FillFlowContainer<PlayerSettingsGroup>
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 20),
|
||||||
|
Margin = new MarginPadding(25),
|
||||||
|
Children = new PlayerSettingsGroup[]
|
||||||
|
{
|
||||||
|
visualSettings = new VisualSettings(),
|
||||||
|
new InputSettings()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
loadNewPlayer();
|
loadNewPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playerLoaded(Player player) => info.Loading = false;
|
private void playerLoaded(Player player) => info.Loading = false;
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
@ -105,21 +115,21 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void contentIn()
|
private void contentIn()
|
||||||
{
|
{
|
||||||
Content.ScaleTo(1, 650, Easing.OutQuint);
|
content.ScaleTo(1, 650, Easing.OutQuint);
|
||||||
Content.FadeInFromZero(400);
|
content.FadeInFromZero(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contentOut()
|
private void contentOut()
|
||||||
{
|
{
|
||||||
Content.ScaleTo(0.7f, 300, Easing.InQuint);
|
content.ScaleTo(0.7f, 300, Easing.InQuint);
|
||||||
Content.FadeOut(250);
|
content.FadeOut(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
Content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
|
|
||||||
contentIn();
|
contentIn();
|
||||||
|
|
||||||
@ -154,11 +164,12 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
if (GetContainingInputManager().HoveredDrawables.Contains(visualSettings))
|
if (GetContainingInputManager()?.HoveredDrawables.Contains(visualSettings) == true)
|
||||||
{
|
{
|
||||||
// show user setting preview
|
// show user setting preview
|
||||||
UpdateBackgroundElements();
|
UpdateBackgroundElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +181,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void pushWhenLoaded()
|
private void pushWhenLoaded()
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -191,7 +202,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
this.Delay(250).Schedule(() =>
|
this.Delay(250).Schedule(() =>
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
loadTask = null;
|
loadTask = null;
|
||||||
|
|
||||||
@ -200,9 +211,9 @@ namespace osu.Game.Screens.Play
|
|||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
|
|
||||||
if (player.LoadedBeatmapSuccessfully)
|
if (player.LoadedBeatmapSuccessfully)
|
||||||
Push(player);
|
this.Push(player);
|
||||||
else
|
else
|
||||||
Exit();
|
this.Exit();
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
@ -218,15 +229,15 @@ namespace osu.Game.Screens.Play
|
|||||||
pushDebounce = null;
|
pushDebounce = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
cancelLoad();
|
cancelLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
Content.ScaleTo(0.7f, 150, Easing.InQuint);
|
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
||||||
this.FadeOut(150);
|
this.FadeOut(150);
|
||||||
cancelLoad();
|
cancelLoad();
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
|
protected new BackgroundScreenBeatmap Background => base.Background as BackgroundScreenBeatmap;
|
||||||
|
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
DimLevel.ValueChanged += _ => UpdateBackgroundElements();
|
DimLevel.ValueChanged += _ => UpdateBackgroundElements();
|
||||||
@ -49,7 +49,7 @@ namespace osu.Game.Screens.Play
|
|||||||
InitializeBackgroundElements();
|
InitializeBackgroundElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
InitializeBackgroundElements();
|
InitializeBackgroundElements();
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// <param name="userChange"></param>
|
/// <param name="userChange"></param>
|
||||||
protected virtual void UpdateBackgroundElements()
|
protected virtual void UpdateBackgroundElements()
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
Background?.FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
Background?.FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
private IEnumerable<Drawable> allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter };
|
private IEnumerable<Drawable> allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter };
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
(Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint);
|
(Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint);
|
||||||
@ -98,7 +98,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
allCircles.ForEach(c =>
|
allCircles.ForEach(c =>
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
Background.ScaleTo(1f, transition_time / 4, Easing.OutQuint);
|
Background.ScaleTo(1f, transition_time / 4, Easing.OutQuint);
|
||||||
|
|
||||||
Content.FadeOut(transition_time / 4);
|
this.FadeOut(transition_time / 4);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new AspectContainer
|
new AspectContainer
|
||||||
{
|
{
|
||||||
@ -260,7 +260,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Action = Exit
|
Action = this.Exit
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
@ -38,51 +38,51 @@ namespace osu.Game.Screens
|
|||||||
if (last != null)
|
if (last != null)
|
||||||
popButton.Alpha = 1;
|
popButton.Alpha = 1;
|
||||||
|
|
||||||
Content.Alpha = 0;
|
Alpha = 0;
|
||||||
textContainer.Position = new Vector2(DrawSize.X / 16, 0);
|
textContainer.Position = new Vector2(DrawSize.X / 16, 0);
|
||||||
|
|
||||||
boxContainer.ScaleTo(0.2f);
|
boxContainer.ScaleTo(0.2f);
|
||||||
boxContainer.RotateTo(-20);
|
boxContainer.RotateTo(-20);
|
||||||
|
|
||||||
using (Content.BeginDelayedSequence(300, true))
|
using (BeginDelayedSequence(300, true))
|
||||||
{
|
{
|
||||||
boxContainer.ScaleTo(1, transition_time, Easing.OutElastic);
|
boxContainer.ScaleTo(1, transition_time, Easing.OutElastic);
|
||||||
boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint);
|
boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint);
|
||||||
|
|
||||||
textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
|
textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
|
||||||
Content.FadeIn(transition_time, Easing.OutExpo);
|
this.FadeIn(transition_time, Easing.OutExpo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo);
|
textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo);
|
||||||
Content.FadeOut(transition_time, Easing.OutExpo);
|
this.FadeOut(transition_time, Easing.OutExpo);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
|
||||||
textContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo);
|
textContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo);
|
||||||
Content.FadeOut(transition_time, Easing.OutExpo);
|
this.FadeOut(transition_time, Easing.OutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
|
textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
|
||||||
Content.FadeIn(transition_time, Easing.OutExpo);
|
this.FadeIn(transition_time, Easing.OutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScreenWhiteBox()
|
public ScreenWhiteBox()
|
||||||
{
|
{
|
||||||
FillFlowContainer childModeButtons;
|
FillFlowContainer childModeButtons;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
boxContainer = new Container
|
boxContainer = new Container
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ namespace osu.Game.Screens
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Action = Exit
|
Action = this.Exit
|
||||||
},
|
},
|
||||||
childModeButtons = new FillFlowContainer
|
childModeButtons = new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -171,7 +171,7 @@ namespace osu.Game.Screens
|
|||||||
HoverColour = getColourFor(t).Lighten(0.2f),
|
HoverColour = getColourFor(t).Lighten(0.2f),
|
||||||
Action = delegate
|
Action = delegate
|
||||||
{
|
{
|
||||||
Push(Activator.CreateInstance(t) as Screen);
|
this.Push(Activator.CreateInstance(t) as Screen);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class EditSongSelect : SongSelect
|
public class EditSongSelect : SongSelect
|
||||||
@ -9,7 +11,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override bool OnStart()
|
protected override bool OnStart()
|
||||||
{
|
{
|
||||||
Exit();
|
this.Exit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Screens.Multi;
|
using osu.Game.Screens.Multi;
|
||||||
|
|
||||||
@ -15,6 +17,11 @@ namespace osu.Game.Screens.Select
|
|||||||
public string ShortTitle => "song selection";
|
public string ShortTitle => "song selection";
|
||||||
public override string Title => ShortTitle.Humanize();
|
public override string Title => ShortTitle.Humanize();
|
||||||
|
|
||||||
|
public MatchSongSelect()
|
||||||
|
{
|
||||||
|
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnStart()
|
protected override bool OnStart()
|
||||||
{
|
{
|
||||||
var item = new PlaylistItem
|
var item = new PlaylistItem
|
||||||
@ -28,8 +35,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
Selected?.Invoke(item);
|
Selected?.Invoke(item);
|
||||||
|
|
||||||
if (IsCurrentScreen)
|
if (this.IsCurrentScreen())
|
||||||
Exit();
|
this.Exit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}, Key.Number3);
|
}, Key.Number3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
player = null;
|
player = null;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
|
LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
|
||||||
{
|
{
|
||||||
if (IsCurrentScreen) Push(player);
|
if (this.IsCurrentScreen())this.Push(player);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Screens.Select
|
|||||||
const float carousel_width = 640;
|
const float carousel_width = 640;
|
||||||
const float filter_height = 100;
|
const float filter_height = 100;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new ParallaxContainer
|
new ParallaxContainer
|
||||||
{
|
{
|
||||||
@ -156,8 +156,8 @@ namespace osu.Game.Screens.Select
|
|||||||
Background = { Width = 2 },
|
Background = { Width = 2 },
|
||||||
Exit = () =>
|
Exit = () =>
|
||||||
{
|
{
|
||||||
if (IsCurrentScreen)
|
if (this.IsCurrentScreen())
|
||||||
Exit();
|
this.Exit();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
if (ShowFooter)
|
if (ShowFooter)
|
||||||
{
|
{
|
||||||
Add(FooterPanels = new Container
|
AddInternal(FooterPanels = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Bottom = Footer.HEIGHT,
|
Bottom = Footer.HEIGHT,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Add(Footer = new Footer
|
AddInternal(Footer = new Footer
|
||||||
{
|
{
|
||||||
OnBack = ExitFromBack,
|
OnBack = ExitFromBack,
|
||||||
});
|
});
|
||||||
@ -210,7 +210,7 @@ namespace osu.Game.Screens.Select
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
BeatmapDetails.Leaderboard.ScoreSelected += s => Push(new SoloResults(s));
|
BeatmapDetails.Leaderboard.ScoreSelected += s =>this.Push(new SoloResults(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
@ -281,13 +281,13 @@ namespace osu.Game.Screens.Select
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit();
|
this.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Edit(BeatmapInfo beatmap = null)
|
public void Edit(BeatmapInfo beatmap = null)
|
||||||
{
|
{
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
|
||||||
Push(new Editor());
|
this.Push(new Editor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -331,7 +331,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
if (beatmap is DummyWorkingBeatmap) return;
|
if (beatmap is DummyWorkingBeatmap) return;
|
||||||
|
|
||||||
if (IsCurrentScreen && !Carousel.SelectBeatmap(beatmap?.BeatmapInfo, false))
|
if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(beatmap?.BeatmapInfo, false))
|
||||||
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
|
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
|
||||||
if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value)
|
if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value)
|
||||||
{
|
{
|
||||||
@ -411,7 +411,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsCurrentScreen) ensurePlayingSelected(preview);
|
if (this.IsCurrentScreen()) ensurePlayingSelected(preview);
|
||||||
UpdateBeatmap(Beatmap.Value);
|
UpdateBeatmap(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,11 +431,11 @@ namespace osu.Game.Screens.Select
|
|||||||
Carousel.SelectNextRandom();
|
Carousel.SelectNextRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
Content.FadeInFromZero(250);
|
this.FadeInFromZero(250);
|
||||||
FilterControl.Activate();
|
FilterControl.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,7 +476,7 @@ namespace osu.Game.Screens.Select
|
|||||||
logo.FadeOut(logo_transition / 2, Easing.Out);
|
logo.FadeOut(logo_transition / 2, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
BeatmapDetails.Leaderboard.RefreshScores();
|
BeatmapDetails.Leaderboard.RefreshScores();
|
||||||
|
|
||||||
@ -490,26 +490,26 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
Content.FadeIn(250);
|
this.FadeIn(250);
|
||||||
|
|
||||||
Content.ScaleTo(1, 250, Easing.OutSine);
|
this.ScaleTo(1, 250, Easing.OutSine);
|
||||||
|
|
||||||
FilterControl.Activate();
|
FilterControl.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
ModSelect.Hide();
|
ModSelect.Hide();
|
||||||
|
|
||||||
Content.ScaleTo(1.1f, 250, Easing.InSine);
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
|
|
||||||
Content.FadeOut(250);
|
this.FadeOut(250);
|
||||||
|
|
||||||
FilterControl.Deactivate();
|
FilterControl.Deactivate();
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
if (ModSelect.State == Visibility.Visible)
|
if (ModSelect.State == Visibility.Visible)
|
||||||
{
|
{
|
||||||
@ -521,7 +521,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
beatmapInfoWedge.State = Visibility.Hidden;
|
beatmapInfoWedge.State = Visibility.Hidden;
|
||||||
|
|
||||||
Content.FadeOut(100);
|
this.FadeOut(100);
|
||||||
|
|
||||||
FilterControl.Deactivate();
|
FilterControl.Deactivate();
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public override bool OnPressed(GlobalAction action)
|
public override bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return false;
|
if (!this.IsCurrentScreen()) return false;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ using osuTK;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
@ -29,7 +30,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
{
|
{
|
||||||
private const string results_filename = "drawings_results.txt";
|
private const string results_filename = "drawings_results.txt";
|
||||||
|
|
||||||
protected override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||||
|
|
||||||
@ -70,13 +71,13 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
if (!TeamList.Teams.Any())
|
if (!TeamList.Teams.Any())
|
||||||
{
|
{
|
||||||
Exit();
|
this.Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingsConfig = new DrawingsConfigManager(storage);
|
drawingsConfig = new DrawingsConfigManager(storage);
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
|
|
||||||
@ -11,38 +13,25 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ScreenTestCase : OsuTestCase
|
public abstract class ScreenTestCase : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly TestOsuScreen baseScreen;
|
private readonly ScreenStack stack;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private BackgroundScreenStack backgroundStack;
|
||||||
|
|
||||||
protected ScreenTestCase()
|
protected ScreenTestCase()
|
||||||
{
|
{
|
||||||
Add(baseScreen = new TestOsuScreen());
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
|
||||||
|
stack = new ScreenStack { RelativeSizeAxes = Axes.Both }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void LoadScreen(OsuScreen screen) => baseScreen.LoadScreen(screen);
|
protected void LoadScreen(OsuScreen screen)
|
||||||
|
|
||||||
public class TestOsuScreen : OsuScreen
|
|
||||||
{
|
{
|
||||||
private OsuScreen nextScreen;
|
if (stack.CurrentScreen != null)
|
||||||
|
stack.Exit();
|
||||||
public void LoadScreen(OsuScreen screen) => Schedule(() =>
|
stack.Push(screen);
|
||||||
{
|
|
||||||
nextScreen = screen;
|
|
||||||
|
|
||||||
if (IsCurrentScreen)
|
|
||||||
{
|
|
||||||
Push(screen);
|
|
||||||
nextScreen = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
MakeCurrent();
|
|
||||||
});
|
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
|
||||||
{
|
|
||||||
base.OnResuming(last);
|
|
||||||
if (nextScreen != null)
|
|
||||||
LoadScreen(nextScreen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.125.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.131.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -104,8 +104,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.125.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.131.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.125.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.131.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user