2020-10-28 09:05:15 +00:00
|
|
|
// 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.Allocation;
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
using osu.Game.Online.Spectator;
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
using osu.Game.Screens.Ranking;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
{
|
|
|
|
public class SpectatorResultsScreen : SoloResultsScreen
|
|
|
|
{
|
|
|
|
public SpectatorResultsScreen(ScoreInfo score)
|
2020-11-20 05:35:44 +00:00
|
|
|
: base(score, false)
|
2020-10-28 09:05:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[Resolved]
|
2021-05-20 06:55:07 +00:00
|
|
|
private SpectatorClient spectatorClient { get; set; }
|
2020-10-28 09:05:15 +00:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-05-20 06:55:07 +00:00
|
|
|
spectatorClient.OnUserBeganPlaying += userBeganPlaying;
|
2020-10-28 09:05:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void userBeganPlaying(int userId, SpectatorState state)
|
|
|
|
{
|
|
|
|
if (userId == Score.UserID)
|
2020-10-28 09:47:15 +00:00
|
|
|
{
|
|
|
|
Schedule(() =>
|
|
|
|
{
|
|
|
|
if (this.IsCurrentScreen()) this.Exit();
|
|
|
|
});
|
|
|
|
}
|
2020-10-28 09:05:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
{
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
|
2021-05-20 06:55:07 +00:00
|
|
|
if (spectatorClient != null)
|
|
|
|
spectatorClient.OnUserBeganPlaying -= userBeganPlaying;
|
2020-10-28 09:05:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|