2019-07-08 13:55:05 +08: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 21:37:39 +08:00
|
|
|
|
using System;
|
2019-12-27 18:36:48 +08:00
|
|
|
|
using osu.Framework.Screens;
|
2019-07-08 14:40:10 +08:00
|
|
|
|
using osu.Game.Scoring;
|
2019-07-08 13:55:05 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
|
{
|
|
|
|
|
public partial class ReplayPlayerLoader : PlayerLoader
|
|
|
|
|
{
|
2020-06-15 19:32:27 +08:00
|
|
|
|
public readonly ScoreInfo Score;
|
2019-07-08 13:55:05 +08:00
|
|
|
|
|
2019-07-08 15:13:03 +08:00
|
|
|
|
public ReplayPlayerLoader(Score score)
|
2019-07-08 14:40:10 +08:00
|
|
|
|
: base(() => new ReplayPlayer(score))
|
2019-07-08 13:55:05 +08:00
|
|
|
|
{
|
2019-07-08 21:37:39 +08:00
|
|
|
|
if (score.Replay == null)
|
2019-11-28 22:21:21 +08:00
|
|
|
|
throw new ArgumentException($"{nameof(score)} must have a non-null {nameof(score.Replay)}.", nameof(score));
|
2019-07-08 21:37:39 +08:00
|
|
|
|
|
2020-06-15 19:32:27 +08:00
|
|
|
|
Score = score.ScoreInfo;
|
2019-07-08 13:55:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-21 23:52:44 +08:00
|
|
|
|
public override void OnEntering(ScreenTransitionEvent e)
|
2019-07-08 13:55:05 +08:00
|
|
|
|
{
|
2019-07-08 21:37:39 +08:00
|
|
|
|
// these will be reverted thanks to PlayerLoader's lease.
|
2020-06-15 19:32:27 +08:00
|
|
|
|
Mods.Value = Score.Mods;
|
|
|
|
|
Ruleset.Value = Score.Ruleset;
|
2019-07-08 13:55:05 +08:00
|
|
|
|
|
2022-04-21 23:52:44 +08:00
|
|
|
|
base.OnEntering(e);
|
2019-07-08 13:55:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|