2019-01-24 16:43:03 +08:00
|
|
|
|
// 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;
|
2021-12-06 14:31:40 +08:00
|
|
|
|
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;
|
2021-12-06 14:31:40 +08:00
|
|
|
|
using osu.Game.Models;
|
2018-11-28 15:33:42 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2021-11-11 22:18:31 +08:00
|
|
|
|
using osu.Game.Users;
|
2021-12-06 14:31:40 +08:00
|
|
|
|
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
|
|
|
|
{
|
2021-12-06 14:31:40 +08:00
|
|
|
|
[ExcludeFromDynamicCompile]
|
|
|
|
|
[MapTo("Score")]
|
|
|
|
|
public class ScoreInfo : RealmObject, IHasGuidPrimaryKey, IHasRealmFiles, ISoftDelete, IEquatable<ScoreInfo>, IScoreInfo
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2021-12-06 14:31:40 +08:00
|
|
|
|
[PrimaryKey]
|
|
|
|
|
public Guid ID { get; set; } = Guid.NewGuid();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public IList<RealmNamedFileUsage> Files { get; } = null!;
|
2021-04-21 14:16:28 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public string Hash { get; set; } = string.Empty;
|
2018-11-30 16:36:06 +08:00
|
|
|
|
|
2018-11-28 15:39:08 +08:00
|
|
|
|
public bool DeletePending { get; set; }
|
2018-11-30 15:11:09 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public bool Equals(ScoreInfo other) => other.ID == ID;
|
2020-09-29 17:55:06 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
[Indexed]
|
|
|
|
|
public long OnlineID { get; set; } = -1;
|
2020-09-25 19:22:59 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public RealmUser User { get; set; } = null!;
|
2020-09-25 19:22:59 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public long TotalScore { get; set; }
|
2020-09-25 19:22:59 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public int MaxCombo { get; set; }
|
2020-09-25 19:22:59 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public double Accuracy { get; set; }
|
2020-09-25 19:22:59 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public bool HasReplay { get; set; }
|
2020-09-25 19:22:59 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public DateTimeOffset Date { get; set; }
|
2021-07-19 12:02:40 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public double? PP { get; set; }
|
2021-07-19 12:02:40 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public RealmBeatmap Beatmap { get; set; } = null!;
|
2021-07-19 12:02:40 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public RealmRuleset Ruleset { get; set; } = null!;
|
2019-06-12 04:01:57 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
public ScoreRank Rank
|
2019-12-03 12:33:42 +08:00
|
|
|
|
{
|
2021-12-06 14:31:40 +08:00
|
|
|
|
get => (ScoreRank)RankInt;
|
|
|
|
|
set => RankInt = (int)value;
|
2019-12-03 12:33:42 +08:00
|
|
|
|
}
|
2021-10-29 10:48:36 +08:00
|
|
|
|
|
2021-12-06 14:31:40 +08:00
|
|
|
|
[MapTo(nameof(Rank))]
|
|
|
|
|
public int RankInt { get; set; }
|
2021-10-28 17:23:52 +08:00
|
|
|
|
|
|
|
|
|
IRulesetInfo IScoreInfo.Ruleset => Ruleset;
|
2021-12-06 14:31:40 +08:00
|
|
|
|
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
2021-11-11 22:18:31 +08:00
|
|
|
|
IUser IScoreInfo.User => User;
|
2021-11-25 15:35:42 +08:00
|
|
|
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|