osu/osu.Game/Screens/Play/ReplayPlayerLoader.cs

33 lines
955 B
C#
Raw Normal View History

// 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 class ReplayPlayerLoader : PlayerLoader
{
private readonly ScoreInfo scoreInfo;
2019-07-08 07:13:03 +00:00
public ReplayPlayerLoader(Score score)
: base(() => new ReplayPlayer(score))
{
if (score.Replay == null)
2019-11-28 14:21:21 +00:00
throw new ArgumentException($"{nameof(score)} must have a non-null {nameof(score.Replay)}.", nameof(score));
scoreInfo = score.ScoreInfo;
}
public override void OnEntering(IScreen last)
{
// these will be reverted thanks to PlayerLoader's lease.
Mods.Value = scoreInfo.Mods;
Ruleset.Value = scoreInfo.Ruleset;
base.OnEntering(last);
}
}
}