1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00
osu-lazer/osu.Game/Scoring/ScoreInfo.cs
Dean Herbert 3da762e145 Replace EF ScoreInfo with realm version
May contain errors.
2022-01-12 16:57:27 +09:00

69 lines
1.8 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 osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Models;
using osu.Game.Rulesets;
using osu.Game.Users;
using Realms;
#nullable enable
namespace osu.Game.Scoring
{
[ExcludeFromDynamicCompile]
[MapTo("Score")]
public class ScoreInfo : RealmObject, IHasGuidPrimaryKey, IHasRealmFiles, ISoftDelete, IEquatable<ScoreInfo>, IScoreInfo
{
[PrimaryKey]
public Guid ID { get; set; } = Guid.NewGuid();
public IList<RealmNamedFileUsage> Files { get; } = null!;
public string Hash { get; set; } = string.Empty;
public bool DeletePending { get; set; }
public bool Equals(ScoreInfo other) => other.ID == ID;
[Indexed]
public long OnlineID { get; set; } = -1;
public RealmUser User { get; set; } = null!;
public long TotalScore { get; set; }
public int MaxCombo { get; set; }
public double Accuracy { get; set; }
public bool HasReplay { get; set; }
public DateTimeOffset Date { get; set; }
public double? PP { get; set; }
public RealmBeatmap Beatmap { get; set; } = null!;
public RealmRuleset Ruleset { get; set; } = null!;
public ScoreRank Rank
{
get => (ScoreRank)RankInt;
set => RankInt = (int)value;
}
[MapTo(nameof(Rank))]
public int RankInt { get; set; }
IRulesetInfo IScoreInfo.Ruleset => Ruleset;
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
IUser IScoreInfo.User => User;
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
}
}