2022-03-29 07:27:42 +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.
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
using osu.Game.Replays;
|
2022-03-30 20:02:51 +00:00
|
|
|
using osu.Game.Scoring;
|
2022-03-29 07:27:42 +00:00
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mods
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A mod which creates full replay data, which is to be played back in place of a local user playing the game.
|
|
|
|
/// </summary>
|
|
|
|
public interface ICreateReplayData
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Create replay data.
|
|
|
|
/// </summary>
|
2022-03-30 20:02:51 +00:00
|
|
|
/// <param name="beatmap">The beatmap to create replay data for.</param>
|
|
|
|
/// <param name="mods">The mods to take into account when creating the replay data.</param>
|
|
|
|
/// <returns>A <see cref="ModReplayData"/> structure, containing the generated replay data.</returns>
|
|
|
|
/// <remarks>
|
|
|
|
/// For callers that want to receive a directly usable <see cref="Score"/> instance,
|
|
|
|
/// the <see cref="ModExtensions.CreateScoreFromReplayData"/> extension method is provided for convenience.
|
|
|
|
/// </remarks>
|
2022-03-30 22:50:46 +00:00
|
|
|
ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList<Mod> mods);
|
2022-03-29 07:27:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Data created by a mod that implements <see cref="ICreateReplayData"/>.
|
|
|
|
/// </summary>
|
|
|
|
public class ModReplayData
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The full replay data.
|
|
|
|
/// </summary>
|
|
|
|
public readonly Replay Replay;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Placeholder user data to show in place of the local user when the associated mod is active.
|
|
|
|
/// </summary>
|
2022-03-31 02:34:23 +00:00
|
|
|
public readonly ModCreatedUser User;
|
2022-03-29 07:27:42 +00:00
|
|
|
|
2022-03-31 02:34:23 +00:00
|
|
|
public ModReplayData(Replay replay, ModCreatedUser user = null)
|
2022-03-29 07:27:42 +00:00
|
|
|
{
|
|
|
|
Replay = replay;
|
2022-03-31 02:34:23 +00:00
|
|
|
User = user ?? new ModCreatedUser();
|
2022-03-29 07:27:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A user which is associated with a replay that was created by a mod (ie. autoplay or cinema).
|
|
|
|
/// </summary>
|
2022-03-31 02:34:23 +00:00
|
|
|
public class ModCreatedUser : IUser
|
2022-03-29 07:27:42 +00:00
|
|
|
{
|
|
|
|
public int OnlineID => APIUser.SYSTEM_USER_ID;
|
|
|
|
public bool IsBot => true;
|
|
|
|
|
|
|
|
public string Username { get; set; } = string.Empty;
|
|
|
|
}
|
|
|
|
}
|