mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Add basic RealmScore
implementation
This commit is contained in:
parent
8c0db79ec1
commit
0dd23c46b0
68
osu.Game/Models/RealmScore.cs
Normal file
68
osu.Game/Models/RealmScore.cs
Normal file
@ -0,0 +1,68 @@
|
||||
// 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.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Users;
|
||||
using Realms;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Models
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
[MapTo("Score")]
|
||||
public class RealmScore : RealmObject, IHasGuidPrimaryKey, IHasRealmFiles, ISoftDelete, IEquatable<RealmScore>, 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(RealmScore 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; } = null;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user