mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Simplify PerformanceCacheLookup
This commit is contained in:
parent
cd15f83f85
commit
fa201be2ad
@ -9,7 +9,6 @@ using JetBrains.Annotations;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
@ -57,34 +56,21 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
public readonly struct PerformanceCacheLookup
|
public readonly struct PerformanceCacheLookup
|
||||||
{
|
{
|
||||||
public readonly double Accuracy;
|
public readonly string ScoreHash;
|
||||||
public readonly int BeatmapId;
|
public readonly int LocalId;
|
||||||
public readonly long TotalScore;
|
|
||||||
public readonly int Combo;
|
|
||||||
public readonly Mod[] Mods;
|
|
||||||
public readonly int RulesetId;
|
|
||||||
|
|
||||||
public PerformanceCacheLookup(ScoreInfo info)
|
public PerformanceCacheLookup(ScoreInfo info)
|
||||||
{
|
{
|
||||||
Accuracy = info.Accuracy;
|
ScoreHash = info.Hash;
|
||||||
BeatmapId = info.Beatmap.ID;
|
LocalId = info.ID;
|
||||||
TotalScore = info.TotalScore;
|
|
||||||
Combo = info.Combo;
|
|
||||||
Mods = info.Mods;
|
|
||||||
RulesetId = info.Ruleset.ID ?? 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
var hash = new HashCode();
|
var hash = new HashCode();
|
||||||
|
|
||||||
hash.Add(Accuracy);
|
hash.Add(ScoreHash);
|
||||||
hash.Add(BeatmapId);
|
hash.Add(LocalId);
|
||||||
hash.Add(TotalScore);
|
|
||||||
hash.Add(Combo);
|
|
||||||
hash.Add(RulesetId);
|
|
||||||
foreach (var mod in Mods)
|
|
||||||
hash.Add(mod);
|
|
||||||
|
|
||||||
return hash.ToHashCode();
|
return hash.ToHashCode();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user