2019-07-08 05:55:05 +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.
|
|
|
|
|
2019-07-08 13:37:39 +00:00
|
|
|
using System;
|
2019-12-27 10:36:48 +00:00
|
|
|
using osu.Framework.Screens;
|
2019-07-08 06:40:10 +00:00
|
|
|
using osu.Game.Scoring;
|
2019-07-08 05:55:05 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
{
|
|
|
|
public class ReplayPlayerLoader : PlayerLoader
|
|
|
|
{
|
2020-06-15 11:32:27 +00:00
|
|
|
public readonly ScoreInfo Score;
|
2019-07-08 05:55:05 +00:00
|
|
|
|
2019-07-08 07:13:03 +00:00
|
|
|
public ReplayPlayerLoader(Score score)
|
2019-07-08 06:40:10 +00:00
|
|
|
: base(() => new ReplayPlayer(score))
|
2019-07-08 05:55:05 +00:00
|
|
|
{
|
2019-07-08 13:37:39 +00:00
|
|
|
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));
|
2019-07-08 13:37:39 +00:00
|
|
|
|
2020-06-15 11:32:27 +00:00
|
|
|
Score = score.ScoreInfo;
|
2019-07-08 05:55:05 +00:00
|
|
|
}
|
|
|
|
|
2019-12-27 10:36:48 +00:00
|
|
|
public override void OnEntering(IScreen last)
|
2019-07-08 05:55:05 +00:00
|
|
|
{
|
2019-07-08 13:37:39 +00:00
|
|
|
// these will be reverted thanks to PlayerLoader's lease.
|
2020-06-15 11:32:27 +00:00
|
|
|
Mods.Value = Score.Mods;
|
|
|
|
Ruleset.Value = Score.Ruleset;
|
2019-07-08 05:55:05 +00:00
|
|
|
|
2019-12-27 10:36:48 +00:00
|
|
|
base.OnEntering(last);
|
2019-07-08 05:55:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|