1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 04:32:11 +08:00
Files
osu-lazer/osu.Game/Rulesets/Mods/ModExtensions.cs
T
Dean Herbert d0d5d97cfe Add replay / spectator mode scrolling text back (#36911)
As mentioned in https://github.com/ppy/osu/discussions/36883.

This has caught me off-guard a few times.

Was a quick one to make this work like it does on stable. It doesn't fit
as well as stable because we have a lot of elements at the top of the
screen, but I think it's better than nothing, as it lets you know you're
in a replay quick obviously.

I don't think we can easily localise strings with formatting in them
yet. Maybe using a `MarkdownContainer` or something?
2026-03-11 11:08:26 +01:00

40 lines
1.3 KiB
C#

// 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 System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Scoring;
namespace osu.Game.Rulesets.Mods
{
public static class ModExtensions
{
public static Score CreateScoreFromReplayData(this ICreateReplayData mod, IBeatmap beatmap, IReadOnlyList<Mod> mods)
{
var replayData = mod.CreateReplayData(beatmap, mods);
return new Score
{
Replay = replayData.Replay,
ScoreInfo =
{
Date = DateTimeOffset.Now,
User = new APIUser
{
Id = replayData.User.OnlineID,
Username = replayData.User.Username,
IsBot = replayData.User.IsBot,
}
}
};
}
public static IEnumerable<Mod> AsOrdered(this IEnumerable<Mod> mods) => mods
.OrderBy(m => m.Type)
.ThenBy(m => m.Acronym);
}
}