mirror of
https://github.com/ppy/osu.git
synced 2025-02-02 03:22:55 +08:00
Move object counts to BeatmapInfo
This commit is contained in:
parent
fdcf87569c
commit
0171078052
@ -21,6 +21,10 @@ namespace osu.Game.Tournament.Models
|
|||||||
|
|
||||||
public double StarRating { get; set; }
|
public double StarRating { get; set; }
|
||||||
|
|
||||||
|
public int EndTimeObjectCount { get; set; }
|
||||||
|
|
||||||
|
public int TotalObjectCount { get; set; }
|
||||||
|
|
||||||
public IBeatmapMetadataInfo Metadata { get; set; } = new BeatmapMetadata();
|
public IBeatmapMetadataInfo Metadata { get; set; } = new BeatmapMetadata();
|
||||||
|
|
||||||
public IBeatmapDifficultyInfo Difficulty { get; set; } = new BeatmapDifficulty();
|
public IBeatmapDifficultyInfo Difficulty { get; set; } = new BeatmapDifficulty();
|
||||||
@ -41,6 +45,8 @@ namespace osu.Game.Tournament.Models
|
|||||||
Metadata = beatmap.Metadata;
|
Metadata = beatmap.Metadata;
|
||||||
Difficulty = beatmap.Difficulty;
|
Difficulty = beatmap.Difficulty;
|
||||||
Covers = beatmap.BeatmapSet?.Covers ?? new BeatmapSetOnlineCovers();
|
Covers = beatmap.BeatmapSet?.Covers ?? new BeatmapSetOnlineCovers();
|
||||||
|
EndTimeObjectCount = beatmap.EndTimeObjectCount;
|
||||||
|
TotalObjectCount = beatmap.TotalObjectCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(IBeatmapInfo? other) => other is TournamentBeatmap b && this.MatchesOnlineID(b);
|
public bool Equals(IBeatmapInfo? other) => other is TournamentBeatmap b && this.MatchesOnlineID(b);
|
||||||
|
@ -20,7 +20,6 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Scoring.Legacy;
|
using osu.Game.Scoring.Legacy;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using Realms;
|
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
@ -177,9 +176,13 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
Logger.Log("Querying for beatmaps with missing hitobject counts to reprocess...");
|
Logger.Log("Querying for beatmaps with missing hitobject counts to reprocess...");
|
||||||
|
|
||||||
HashSet<Guid> beatmapIds = realmAccess.Run(r => new HashSet<Guid>(r.All<BeatmapInfo>()
|
HashSet<Guid> beatmapIds = new HashSet<Guid>();
|
||||||
.Filter($"{nameof(BeatmapInfo.Difficulty)}.{nameof(BeatmapDifficulty.TotalObjectCount)} == 0")
|
|
||||||
.AsEnumerable().Select(b => b.ID)));
|
realmAccess.Run(r =>
|
||||||
|
{
|
||||||
|
foreach (var b in r.All<BeatmapInfo>().Where(b => b.TotalObjectCount == 0))
|
||||||
|
beatmapIds.Add(b.ID);
|
||||||
|
});
|
||||||
|
|
||||||
Logger.Log($"Found {beatmapIds.Count} beatmaps which require reprocessing.");
|
Logger.Log($"Found {beatmapIds.Count} beatmaps which require reprocessing.");
|
||||||
|
|
||||||
|
@ -21,9 +21,6 @@ namespace osu.Game.Beatmaps
|
|||||||
public double SliderMultiplier { get; set; } = 1.4;
|
public double SliderMultiplier { get; set; } = 1.4;
|
||||||
public double SliderTickRate { get; set; } = 1;
|
public double SliderTickRate { get; set; } = 1;
|
||||||
|
|
||||||
public int EndTimeObjectCount { get; set; }
|
|
||||||
public int TotalObjectCount { get; set; }
|
|
||||||
|
|
||||||
public BeatmapDifficulty()
|
public BeatmapDifficulty()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -47,9 +44,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
difficulty.SliderMultiplier = SliderMultiplier;
|
difficulty.SliderMultiplier = SliderMultiplier;
|
||||||
difficulty.SliderTickRate = SliderTickRate;
|
difficulty.SliderTickRate = SliderTickRate;
|
||||||
|
|
||||||
difficulty.EndTimeObjectCount = EndTimeObjectCount;
|
|
||||||
difficulty.TotalObjectCount = TotalObjectCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void CopyFrom(IBeatmapDifficultyInfo other)
|
public virtual void CopyFrom(IBeatmapDifficultyInfo other)
|
||||||
@ -61,9 +55,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
SliderMultiplier = other.SliderMultiplier;
|
SliderMultiplier = other.SliderMultiplier;
|
||||||
SliderTickRate = other.SliderTickRate;
|
SliderTickRate = other.SliderTickRate;
|
||||||
|
|
||||||
EndTimeObjectCount = other.EndTimeObjectCount;
|
|
||||||
TotalObjectCount = other.TotalObjectCount;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,9 +388,7 @@ namespace osu.Game.Beatmaps
|
|||||||
OverallDifficulty = decodedDifficulty.OverallDifficulty,
|
OverallDifficulty = decodedDifficulty.OverallDifficulty,
|
||||||
ApproachRate = decodedDifficulty.ApproachRate,
|
ApproachRate = decodedDifficulty.ApproachRate,
|
||||||
SliderMultiplier = decodedDifficulty.SliderMultiplier,
|
SliderMultiplier = decodedDifficulty.SliderMultiplier,
|
||||||
SliderTickRate = decodedDifficulty.SliderTickRate,
|
SliderTickRate = decodedDifficulty.SliderTickRate
|
||||||
EndTimeObjectCount = decoded.HitObjects.Count(h => h is IHasDuration),
|
|
||||||
TotalObjectCount = decoded.HitObjects.Count
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var metadata = new BeatmapMetadata
|
var metadata = new BeatmapMetadata
|
||||||
@ -428,6 +426,8 @@ namespace osu.Game.Beatmaps
|
|||||||
GridSize = decodedInfo.GridSize,
|
GridSize = decodedInfo.GridSize,
|
||||||
TimelineZoom = decodedInfo.TimelineZoom,
|
TimelineZoom = decodedInfo.TimelineZoom,
|
||||||
MD5Hash = memoryStream.ComputeMD5Hash(),
|
MD5Hash = memoryStream.ComputeMD5Hash(),
|
||||||
|
EndTimeObjectCount = decoded.HitObjects.Count(h => h is IHasDuration),
|
||||||
|
TotalObjectCount = decoded.HitObjects.Count
|
||||||
};
|
};
|
||||||
|
|
||||||
beatmaps.Add(beatmap);
|
beatmaps.Add(beatmap);
|
||||||
|
@ -120,6 +120,10 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool Hidden { get; set; }
|
public bool Hidden { get; set; }
|
||||||
|
|
||||||
|
public int EndTimeObjectCount { get; set; }
|
||||||
|
|
||||||
|
public int TotalObjectCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset any fetched online linking information (and history).
|
/// Reset any fetched online linking information (and history).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -91,8 +91,8 @@ namespace osu.Game.Beatmaps
|
|||||||
var working = workingBeatmapCache.GetWorkingBeatmap(beatmapInfo);
|
var working = workingBeatmapCache.GetWorkingBeatmap(beatmapInfo);
|
||||||
var beatmap = working.Beatmap;
|
var beatmap = working.Beatmap;
|
||||||
|
|
||||||
beatmapInfo.Difficulty.EndTimeObjectCount = beatmap.HitObjects.Count(h => h is IHasDuration);
|
beatmapInfo.EndTimeObjectCount = beatmap.HitObjects.Count(h => h is IHasDuration);
|
||||||
beatmapInfo.Difficulty.TotalObjectCount = beatmap.HitObjects.Count;
|
beatmapInfo.TotalObjectCount = beatmap.HitObjects.Count;
|
||||||
|
|
||||||
// And invalidate again afterwards as re-fetching the most up-to-date database metadata will be required.
|
// And invalidate again afterwards as re-fetching the most up-to-date database metadata will be required.
|
||||||
workingBeatmapCache.Invalidate(beatmapInfo);
|
workingBeatmapCache.Invalidate(beatmapInfo);
|
||||||
|
@ -44,19 +44,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
double SliderTickRate { get; }
|
double SliderTickRate { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The number of hitobjects in the beatmap with a distinct end time.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Canonically, these are hitobjects are either sliders or spinners.
|
|
||||||
/// </remarks>
|
|
||||||
int EndTimeObjectCount { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The total number of hitobjects in the beatmap.
|
|
||||||
/// </summary>
|
|
||||||
int TotalObjectCount { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
|
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -61,5 +61,18 @@ namespace osu.Game.Beatmaps
|
|||||||
/// The basic star rating for this beatmap (with no mods applied).
|
/// The basic star rating for this beatmap (with no mods applied).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double StarRating { get; }
|
double StarRating { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of hitobjects in the beatmap with a distinct end time.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Canonically, these are hitobjects are either sliders or spinners.
|
||||||
|
/// </remarks>
|
||||||
|
int EndTimeObjectCount { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total number of hitobjects in the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
int TotalObjectCount { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"difficulty_rating")]
|
[JsonProperty(@"difficulty_rating")]
|
||||||
public double StarRating { get; set; }
|
public double StarRating { get; set; }
|
||||||
|
|
||||||
|
public int EndTimeObjectCount => SliderCount + SpinnerCount;
|
||||||
|
|
||||||
|
public int TotalObjectCount => CircleCount + SliderCount + SpinnerCount;
|
||||||
|
|
||||||
[JsonProperty(@"drain")]
|
[JsonProperty(@"drain")]
|
||||||
public float DrainRate { get; set; }
|
public float DrainRate { get; set; }
|
||||||
|
|
||||||
@ -108,9 +112,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
DrainRate = DrainRate,
|
DrainRate = DrainRate,
|
||||||
CircleSize = CircleSize,
|
CircleSize = CircleSize,
|
||||||
ApproachRate = ApproachRate,
|
ApproachRate = ApproachRate,
|
||||||
OverallDifficulty = OverallDifficulty,
|
OverallDifficulty = OverallDifficulty
|
||||||
EndTimeObjectCount = SliderCount + SpinnerCount,
|
|
||||||
TotalObjectCount = CircleCount + SliderCount + SpinnerCount
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IBeatmapSetInfo? IBeatmapInfo.BeatmapSet => BeatmapSet;
|
IBeatmapSetInfo? IBeatmapInfo.BeatmapSet => BeatmapSet;
|
||||||
|
@ -62,8 +62,8 @@ namespace osu.Game.Rulesets.Scoring.Legacy
|
|||||||
SourceRuleset = beatmapInfo.Ruleset,
|
SourceRuleset = beatmapInfo.Ruleset,
|
||||||
CircleSize = beatmapInfo.Difficulty.CircleSize,
|
CircleSize = beatmapInfo.Difficulty.CircleSize,
|
||||||
OverallDifficulty = beatmapInfo.Difficulty.OverallDifficulty,
|
OverallDifficulty = beatmapInfo.Difficulty.OverallDifficulty,
|
||||||
EndTimeObjectCount = beatmapInfo.Difficulty.EndTimeObjectCount,
|
EndTimeObjectCount = beatmapInfo.EndTimeObjectCount,
|
||||||
TotalObjectCount = beatmapInfo.Difficulty.TotalObjectCount
|
TotalObjectCount = beatmapInfo.TotalObjectCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user