1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 00:47:26 +08:00
osu-lazer/osu.Game/Scoring/ScoreInfo.cs

69 lines
1.8 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
using System;
using System.Collections.Generic;
using osu.Framework.Testing;
2018-04-13 17:19:50 +08:00
using osu.Game.Beatmaps;
2018-11-28 15:39:08 +08:00
using osu.Game.Database;
using osu.Game.Models;
2018-11-28 15:33:42 +08:00
using osu.Game.Rulesets;
using osu.Game.Users;
using Realms;
#nullable enable
2018-04-13 17:19:50 +08:00
2018-11-28 15:12:57 +08:00
namespace osu.Game.Scoring
2018-04-13 17:19:50 +08:00
{
[ExcludeFromDynamicCompile]
[MapTo("Score")]
public class ScoreInfo : RealmObject, IHasGuidPrimaryKey, IHasRealmFiles, ISoftDelete, IEquatable<ScoreInfo>, IScoreInfo
2018-04-13 17:19:50 +08:00
{
[PrimaryKey]
public Guid ID { get; set; } = Guid.NewGuid();
2018-04-13 17:19:50 +08:00
public IList<RealmNamedFileUsage> Files { get; } = null!;
2021-04-21 14:16:28 +08:00
public string Hash { get; set; } = string.Empty;
2018-11-28 15:39:08 +08:00
public bool DeletePending { get; set; }
2018-11-30 15:11:09 +08:00
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
2019-12-03 12:33:42 +08:00
{
get => (ScoreRank)RankInt;
set => RankInt = (int)value;
2019-12-03 12:33:42 +08:00
}
[MapTo(nameof(Rank))]
public int RankInt { get; set; }
2021-10-28 17:23:52 +08:00
IRulesetInfo IScoreInfo.Ruleset => Ruleset;
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
IUser IScoreInfo.User => User;
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
2018-04-13 17:19:50 +08:00
}
}