1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Add ScreenStatus property to change the OsuScreen's status + Renamed old ScreenStatus property to InitialScreenStatus

This commit is contained in:
Lucas A 2019-05-02 20:51:19 +02:00
parent 84b41b3886
commit 5d4aa5a12e
7 changed files with 36 additions and 15 deletions

View File

@ -275,6 +275,8 @@ namespace osu.Game.Tests.Visual.Background
private class DummySongSelect : PlaySongSelect
{
protected override UserStatusOnline InitialScreenStatus => null;
protected override BackgroundScreen CreateBackground()
{
FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value);
@ -318,7 +320,7 @@ namespace osu.Game.Tests.Visual.Background
private class FadeAccessibleResults : SoloResults
{
protected override UserStatus ScreenStatus => null;
protected override UserStatusOnline InitialScreenStatus => null;
public FadeAccessibleResults(ScoreInfo score)
: base(score)
@ -332,7 +334,7 @@ namespace osu.Game.Tests.Visual.Background
private class TestPlayer : Player
{
protected override UserStatus ScreenStatus => null;
protected override UserStatusOnline InitialScreenStatus => null;
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
@ -381,7 +383,7 @@ namespace osu.Game.Tests.Visual.Background
public VisualSettings VisualSettingsPos => VisualSettings;
public BackgroundScreen ScreenPos => Background;
protected override UserStatus ScreenStatus => null;
protected override UserStatusOnline InitialScreenStatus => null;
public TestPlayerLoader(Player player)
: base(() => player)

View File

@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public new HUDOverlay HUDOverlay => base.HUDOverlay;
protected override UserStatus ScreenStatus => null;
protected override UserStatusOnline InitialScreenStatus => null;
public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit
private DependencyContainer dependencies;
private GameHost host;
protected override UserStatus ScreenStatus => new UserStatusEditing(Beatmap.Value.BeatmapInfo);
protected override UserStatusOnline InitialScreenStatus => new UserStatusEditing(Beatmap.Value.BeatmapInfo);
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));

View File

@ -55,12 +55,29 @@ namespace osu.Game.Screens
protected new OsuGameBase Game => base.Game as OsuGameBase;
/// <summary>
/// The <see cref="UserStatus"/> to set the user's status automatically to when this screen is entered / resumed.
/// Note that the user status won't be automatically set if :
/// <para>- <see cref="ScreenStatus"/> is overriden and returns null</para>
/// <para>- The current <see cref="UserStatus"/> is <see cref="UserStatusDoNotDisturb"/> or <see cref="UserStatusOffline"/></para>
/// The <see cref="UserStatusOnline"/> to set the user's status automatically to when this screen is entered
/// </summary>
protected virtual UserStatus ScreenStatus => new UserStatusOnline();
protected virtual UserStatusOnline InitialScreenStatus => new UserStatusOnline();
/// <summary>
/// The <see cref="UserStatusOnline"/> for this screen.
/// Note that the status won't be updated for the user if :
/// <para>- The <see cref="ScreenStatus"/> is set to null</para>
/// <para>- The current <see cref="UserStatus"/> of the user is <see cref="UserStatusDoNotDisturb"/> or <see cref="UserStatusOffline"/></para>
/// </summary>
protected UserStatusOnline ScreenStatus
{
set
{
if (value == null) return;
status = value;
setUserStatus(value);
}
get => status;
}
private UserStatusOnline status;
/// <summary>
/// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children).
@ -104,6 +121,8 @@ namespace osu.Game.Screens
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
status = null;
}
[BackgroundDependencyLoader(true)]
@ -136,7 +155,7 @@ namespace osu.Game.Screens
if (api != null)
api.LocalUser.Value.Status.ValueChanged += userStatusChanged;
setUserStatus(ScreenStatus);
ScreenStatus = ScreenStatus;
base.OnResuming(last);
}
@ -167,7 +186,7 @@ namespace osu.Game.Screens
if (api != null)
api.LocalUser.Value.Status.ValueChanged += userStatusChanged;
setUserStatus(ScreenStatus);
ScreenStatus = InitialScreenStatus;
base.OnEntering(last);
}

View File

@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
{
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
protected override UserStatus ScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
protected override UserStatusOnline InitialScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
public override float BackgroundParallaxAmount => 0.1f;

View File

@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play
private bool hideOverlays;
public override bool HideOverlaysOnEnter => hideOverlays;
protected override UserStatus ScreenStatus => null; //shows the previous screen status
protected override UserStatusOnline InitialScreenStatus => null; //shows the previous screen status
public override bool DisallowExternalBeatmapRulesetChanges => true;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select
public override bool AllowExternalScreenChange => true;
protected override UserStatus ScreenStatus => new UserStatusChoosingBeatmap();
protected override UserStatusOnline InitialScreenStatus => new UserStatusChoosingBeatmap();
[BackgroundDependencyLoader]
private void load(OsuColour colours)