1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:03:13 +08:00

Replace compatibility properties with direct references

This commit is contained in:
Dean Herbert 2022-01-12 18:05:25 +09:00
parent 482cf29e28
commit eb70a1eeb7
10 changed files with 16 additions and 32 deletions

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps
public BeatmapMetadata Metadata { get; set; } = new BeatmapMetadata();
[IgnoreMap]
[Backlink(nameof(ScoreInfo.Beatmap))]
[Backlink(nameof(ScoreInfo.BeatmapInfo))]
public IQueryable<ScoreInfo> Scores { get; } = null!;
public BeatmapInfo(RulesetInfo ruleset, BeatmapDifficulty difficulty, BeatmapMetadata metadata)

View File

@ -31,15 +31,5 @@ namespace osu.Game.Models
}
IFileInfo INamedFileUsage.File => File;
#region Compatibility properties
public RealmFile FileInfo
{
get => File;
set => File = value;
}
#endregion
}
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Edit.Checks
foreach (var file in beatmapSet.Files)
{
using (Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.GetStoragePath()))
using (Stream data = context.WorkingBeatmap.GetStream(file.File.GetStoragePath()))
{
if (data == null)
continue;

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Edit.Checks
foreach (var file in beatmapSet.Files)
{
using (Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.GetStoragePath()))
using (Stream data = context.WorkingBeatmap.GetStream(file.File.GetStoragePath()))
{
if (data?.Length == 0)
yield return new IssueTemplateZeroBytes(this).Create(file.Filename);

View File

@ -49,7 +49,7 @@ namespace osu.Game.Scoring
public ScoreInfo(BeatmapInfo beatmap, RulesetInfo ruleset, RealmUser realmUser)
{
Ruleset = ruleset;
Beatmap = beatmap;
BeatmapInfo = beatmap;
RealmUser = realmUser;
}
@ -94,7 +94,7 @@ namespace osu.Game.Scoring
public double? PP { get; set; }
public BeatmapInfo Beatmap { get; set; } = null!;
public BeatmapInfo BeatmapInfo { get; set; } = null!;
public RulesetInfo Ruleset { get; set; } = null!;
@ -129,7 +129,7 @@ namespace osu.Game.Scoring
public int RankInt { get; set; }
IRulesetInfo IScoreInfo.Ruleset => Ruleset;
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
IBeatmapInfo IScoreInfo.Beatmap => BeatmapInfo;
IUser IScoreInfo.User => User;
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
@ -139,13 +139,7 @@ namespace osu.Game.Scoring
private Mod[]? mods;
public Guid BeatmapInfoID => Beatmap.ID;
public BeatmapInfo BeatmapInfo
{
get => Beatmap;
set => Beatmap = value;
}
public Guid BeatmapInfoID => BeatmapInfo.ID;
public int UserID => RealmUser.OnlineID;

View File

@ -70,7 +70,7 @@ namespace osu.Game.Scoring
// Compute difficulties asynchronously first to prevent blocking via the GetTotalScore() call below.
foreach (var s in scores)
{
await difficultyCache.GetDifficultyAsync(s.Beatmap, s.Ruleset, s.Mods, cancellationToken).ConfigureAwait(false);
await difficultyCache.GetDifficultyAsync(s.BeatmapInfo, s.Ruleset, s.Mods, cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
}
}
@ -154,11 +154,11 @@ namespace osu.Game.Scoring
// This score is guaranteed to be an osu!stable score.
// The combo must be determined through either the beatmap's max combo value or the difficulty calculator, as lazer's scoring has changed and the score statistics cannot be used.
if (score.Beatmap.MaxCombo != null)
beatmapMaxCombo = score.Beatmap.MaxCombo.Value;
if (score.BeatmapInfo.MaxCombo != null)
beatmapMaxCombo = score.BeatmapInfo.MaxCombo.Value;
else
{
if (!score.Beatmap.IsManaged || difficulties == null)
if (!score.BeatmapInfo.IsManaged || difficulties == null)
{
// We don't have enough information (max combo) to compute the score, so use the provided score.
return score.TotalScore;

View File

@ -58,8 +58,8 @@ namespace osu.Game.Scoring
protected override Task Populate(ScoreInfo model, ArchiveReader? archive, Realm realm, CancellationToken cancellationToken = default)
{
// Ensure the beatmap is not detached.
if (!model.Beatmap.IsManaged)
model.Beatmap = realm.Find<BeatmapInfo>(model.Beatmap.ID);
if (!model.BeatmapInfo.IsManaged)
model.BeatmapInfo = realm.Find<BeatmapInfo>(model.BeatmapInfo.ID);
if (!model.Ruleset.IsManaged)
model.Ruleset = realm.Find<RulesetInfo>(model.Ruleset.ShortName);

View File

@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel
base.LoadComplete();
scoreSubscription = realmFactory.Context.All<ScoreInfo>()
.Filter($"{nameof(ScoreInfo.Beatmap)}.{nameof(BeatmapInfo.ID)} = $0", beatmapInfo.ID)
.Filter($"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} = $0", beatmapInfo.ID)
.QueryAsyncWithNotifications((_, changes, ___) =>
{
if (changes == null)

View File

@ -110,7 +110,7 @@ namespace osu.Game.Screens.Select.Leaderboards
return;
scoreSubscription = realmFactory.Context.All<ScoreInfo>()
.Filter($"{nameof(ScoreInfo.Beatmap)}.{nameof(BeatmapInfo.ID)} = $0", beatmapInfo.ID)
.Filter($"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} = $0", beatmapInfo.ID)
.QueryAsyncWithNotifications((_, changes, ___) =>
{
if (changes == null)

View File

@ -97,7 +97,7 @@ namespace osu.Game.Storyboards
{
Drawable drawable = null;
string storyboardPath = BeatmapInfo.BeatmapSet?.Files.FirstOrDefault(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.FileInfo.GetStoragePath();
string storyboardPath = BeatmapInfo.BeatmapSet?.Files.FirstOrDefault(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.File.GetStoragePath();
if (!string.IsNullOrEmpty(storyboardPath))
drawable = new Sprite { Texture = textureStore.Get(storyboardPath) };