1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 20:33:35 +08:00
Files
osu-lazer/osu.Game/Screens/Play/ReplayPlayerLoader.cs
T
Dean Herbert 7e3cc7cc33 Allow spectator and replay gameplay to load even when window is inactive (#37633)
This used to be the case, but recently changed with the introduction of
[pausing when inactive](https://github.com/ppy/osu/pull/37100). The
change was intended to work for local gameplay modes, but it makes less
sense for spectator/replay where you may want to be watching in the
background while doing something else.

Raised via email.
2026-05-12 10:54:48 +02:00

34 lines
1015 B
C#

// 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;
using osu.Framework.Screens;
using osu.Game.Scoring;
namespace osu.Game.Screens.Play
{
public partial class ReplayPlayerLoader : PlayerLoader
{
public readonly ScoreInfo Score;
public ReplayPlayerLoader(Score score)
: base(() => new ReplayPlayer(score))
{
if (score.Replay == null)
throw new ArgumentException($"{nameof(score)} must have a non-null {nameof(score.Replay)}.", nameof(score));
Score = score.ScoreInfo;
WindowShouldBeActiveForGameplayStart = false;
}
public override void OnEntering(ScreenTransitionEvent e)
{
// these will be reverted thanks to PlayerLoader's lease.
Mods.Value = Score.Mods;
Ruleset.Value = Score.Ruleset;
base.OnEntering(e);
}
}
}