2021-10-02 01:22:23 +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.
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
|
|
|
#nullable enable
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
{
|
2021-10-02 01:28:35 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The state of an active gameplay session, generally constructed and exposed by <see cref="Player"/>.
|
|
|
|
/// </summary>
|
2021-10-02 01:22:23 +08:00
|
|
|
public class GameplayState
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The final post-convert post-mod-application beatmap.
|
|
|
|
/// </summary>
|
|
|
|
public readonly IBeatmap Beatmap;
|
|
|
|
|
2021-10-02 01:28:35 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The ruleset used in gameplay.
|
|
|
|
/// </summary>
|
2021-10-02 01:22:23 +08:00
|
|
|
public readonly Ruleset Ruleset;
|
|
|
|
|
2021-10-02 01:28:35 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The mods applied to the gameplay.
|
|
|
|
/// </summary>
|
2021-10-02 01:22:23 +08:00
|
|
|
public IReadOnlyList<Mod> Mods;
|
|
|
|
|
2021-10-02 01:28:35 +08:00
|
|
|
/// <summary>
|
|
|
|
/// A bindable tracking the last judgement result applied to any hit object.
|
|
|
|
/// </summary>
|
|
|
|
public IBindable<JudgementResult> LastJudgementResult => lastJudgementResult;
|
|
|
|
|
|
|
|
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
|
|
|
|
|
2021-10-02 01:22:23 +08:00
|
|
|
public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod> mods)
|
|
|
|
{
|
|
|
|
Beatmap = beatmap;
|
|
|
|
Ruleset = ruleset;
|
|
|
|
Mods = mods;
|
|
|
|
}
|
|
|
|
|
2021-10-02 01:28:35 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="GameplayState"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="result">The <see cref="JudgementResult"/> to apply.</param>
|
2021-10-02 01:22:23 +08:00
|
|
|
public void ApplyResult(JudgementResult result) => lastJudgementResult.Value = result;
|
|
|
|
}
|
|
|
|
}
|