mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Store maximum statistics to spectator state
This commit is contained in:
parent
e42bd7b31a
commit
e9998f1690
@ -117,11 +117,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
BeatmapID = 0,
|
||||
RulesetID = 0,
|
||||
Mods = user.Mods,
|
||||
MaximumScoringValues = new ScoringValues
|
||||
MaximumStatistics = new Dictionary<HitResult, int>
|
||||
{
|
||||
BaseScore = 10000,
|
||||
MaxCombo = 1000,
|
||||
CountBasicHitObjects = 1000
|
||||
{ HitResult.Perfect, 100 }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ namespace osu.Game.Online.Spectator
|
||||
currentState.RulesetID = score.ScoreInfo.RulesetID;
|
||||
currentState.Mods = score.ScoreInfo.Mods.Select(m => new APIMod(m)).ToArray();
|
||||
currentState.State = SpectatedUserState.Playing;
|
||||
currentState.MaximumScoringValues = state.ScoreProcessor.MaximumScoringValues;
|
||||
currentState.MaximumStatistics = state.ScoreProcessor.MaximumStatistics;
|
||||
|
||||
currentBeatmap = state.Beatmap;
|
||||
currentScore = score;
|
||||
|
@ -152,12 +152,12 @@ namespace osu.Game.Online.Spectator
|
||||
|
||||
scoreInfo.MaxCombo = frame.Header.MaxCombo;
|
||||
scoreInfo.Statistics = frame.Header.Statistics;
|
||||
scoreInfo.MaximumStatistics = spectatorState.MaximumStatistics;
|
||||
|
||||
Accuracy.Value = frame.Header.Accuracy;
|
||||
Combo.Value = frame.Header.Combo;
|
||||
|
||||
scoreProcessor.ExtractScoringValues(frame.Header, out var currentScoringValues, out _);
|
||||
TotalScore.Value = scoreProcessor.ComputeScore(Mode.Value, currentScoringValues, spectatorState.MaximumScoringValues);
|
||||
TotalScore.Value = scoreProcessor.ComputeScore(Mode.Value, scoreInfo);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Online.Spectator
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace osu.Game.Online.Spectator
|
||||
public SpectatedUserState State { get; set; }
|
||||
|
||||
[Key(4)]
|
||||
public ScoringValues MaximumScoringValues { get; set; }
|
||||
public Dictionary<HitResult, int> MaximumStatistics { get; set; } = new Dictionary<HitResult, int>();
|
||||
|
||||
public bool Equals(SpectatorState other)
|
||||
{
|
||||
|
@ -90,17 +90,14 @@ namespace osu.Game.Rulesets.Scoring
|
||||
private readonly double accuracyPortion;
|
||||
private readonly double comboPortion;
|
||||
|
||||
/// <summary>
|
||||
/// Scoring values for a perfect play.
|
||||
/// </summary>
|
||||
public ScoringValues MaximumScoringValues
|
||||
public Dictionary<HitResult, int> MaximumStatistics
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!beatmapApplied)
|
||||
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}.");
|
||||
|
||||
return maximumScoringValues;
|
||||
return maximumResultCounts.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user