1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

Rework EF Core usage in model classes

This commit is contained in:
TocoToucan 2017-10-06 00:23:26 +03:00
parent 6a4198d0d6
commit 887aa7496b
60 changed files with 216 additions and 223 deletions

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
{ {
beatmap = original; beatmap = original;
BeatmapDifficulty difficulty = original.BeatmapInfo.BeatmapDifficulty; BeatmapDifficulty difficulty = original.BeatmapInfo.Difficulty;
int seed = (int)Math.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)Math.Round(difficulty.ApproachRate); int seed = (int)Math.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)Math.Round(difficulty.ApproachRate);
random = new FastRandom(seed); random = new FastRandom(seed);

View File

@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
// The true distance, accounting for any repeats // The true distance, accounting for any repeats
double distance = (distanceData?.Distance ?? 0) * repeatCount; double distance = (distanceData?.Distance ?? 0) * repeatCount;
// The velocity of the osu! hit object - calculated as the velocity of a slider // The velocity of the osu! hit object - calculated as the velocity of a slider
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BeatmapDifficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / timingPoint.BeatLength; double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / timingPoint.BeatLength;
// The duration of the osu! hit object // The duration of the osu! hit object
double osuDuration = distance / osuVelocity; double osuDuration = distance / osuVelocity;

View File

@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (drainTime == 0) if (drainTime == 0)
drainTime = 10000; drainTime = 10000;
BeatmapDifficulty difficulty = Beatmap.BeatmapInfo.BeatmapDifficulty; BeatmapDifficulty difficulty = Beatmap.BeatmapInfo.Difficulty;
conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + Beatmap.HitObjects.Count / drainTime * 9f) / 38f * 5f / 1.15; conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + Beatmap.HitObjects.Count / drainTime * 9f) / 38f * 5f / 1.15;
conversionDifficulty = Math.Min(conversionDifficulty.Value, 12); conversionDifficulty = Math.Min(conversionDifficulty.Value, 12);

View File

@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Mania
return 0; return 0;
} }
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.BeatmapDifficulty.CircleSize))); protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize)));
} }
} }

View File

@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
protected override void SimulateAutoplay(Beatmap<ManiaHitObject> beatmap) protected override void SimulateAutoplay(Beatmap<ManiaHitObject> beatmap)
{ {
BeatmapDifficulty difficulty = beatmap.BeatmapInfo.BeatmapDifficulty; BeatmapDifficulty difficulty = beatmap.BeatmapInfo.Difficulty;
hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max); hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max);
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max); hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max);

View File

@ -88,18 +88,18 @@ namespace osu.Game.Rulesets.Mania.UI
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter()
{ {
if (IsForCurrentRuleset) if (IsForCurrentRuleset)
AvailableColumns = (int)Math.Max(1, Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.CircleSize)); AvailableColumns = (int)Math.Max(1, Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize));
else else
{ {
float percentSliderOrSpinner = (float)WorkingBeatmap.Beatmap.HitObjects.Count(h => h is IHasEndTime) / WorkingBeatmap.Beatmap.HitObjects.Count; float percentSliderOrSpinner = (float)WorkingBeatmap.Beatmap.HitObjects.Count(h => h is IHasEndTime) / WorkingBeatmap.Beatmap.HitObjects.Count;
if (percentSliderOrSpinner < 0.2) if (percentSliderOrSpinner < 0.2)
AvailableColumns = 7; AvailableColumns = 7;
else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.CircleSize) >= 5) else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize) >= 5)
AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) > 5 ? 7 : 6; AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 5 ? 7 : 6;
else if (percentSliderOrSpinner > 0.6) else if (percentSliderOrSpinner > 0.6)
AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) > 4 ? 5 : 4; AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 4 ? 5 : 4;
else else
AvailableColumns = Math.Max(4, Math.Min((int)Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) + 1, 7)); AvailableColumns = Math.Max(4, Math.Min((int)Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) + 1, 7));
} }
return new ManiaBeatmapConverter(IsForCurrentRuleset, AvailableColumns); return new ManiaBeatmapConverter(IsForCurrentRuleset, AvailableColumns);

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
protected override void SimulateAutoplay(Beatmap<OsuHitObject> beatmap) protected override void SimulateAutoplay(Beatmap<OsuHitObject> beatmap)
{ {
hpDrainRate = beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate; hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
foreach (var obj in beatmap.HitObjects) foreach (var obj in beatmap.HitObjects)
{ {

View File

@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
if (autoCursorScale && beatmap.Value != null) if (autoCursorScale && beatmap.Value != null)
{ {
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier. // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BeatmapDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY); scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.Difficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY);
} }
cursorContainer.Scale = new Vector2(scale); cursorContainer.Scale = new Vector2(scale);

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
{ {
// Rewrite the beatmap info to add the slider velocity multiplier // Rewrite the beatmap info to add the slider velocity multiplier
BeatmapInfo info = original.BeatmapInfo.DeepClone(); BeatmapInfo info = original.BeatmapInfo.DeepClone();
info.BeatmapDifficulty.SliderMultiplier *= legacy_velocity_multiplier; info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original); Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
double distance = distanceData.Distance * repeats * legacy_velocity_multiplier; double distance = distanceData.Distance * repeats * legacy_velocity_multiplier;
// The velocity of the taiko hit object - calculated as the velocity of a drum roll // The velocity of the taiko hit object - calculated as the velocity of a drum roll
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.BeatmapDifficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength; double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
// The duration of the taiko hit object // The duration of the taiko hit object
double taikoDuration = distance / taikoVelocity; double taikoDuration = distance / taikoVelocity;
@ -103,12 +103,12 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
speedAdjustedBeatLength *= speedAdjustment; speedAdjustedBeatLength *= speedAdjustment;
// The velocity of the osu! hit object - calculated as the velocity of a slider // The velocity of the osu! hit object - calculated as the velocity of a slider
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BeatmapDifficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength; double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
// The duration of the osu! hit object // The duration of the osu! hit object
double osuDuration = distance / osuVelocity; double osuDuration = distance / osuVelocity;
// If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat // If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat
double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.BeatmapDifficulty.SliderTickRate, taikoDuration / repeats); double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats);
if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength)
{ {
@ -151,13 +151,13 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
Samples = obj.Samples, Samples = obj.Samples,
IsStrong = strong, IsStrong = strong,
Duration = taikoDuration, Duration = taikoDuration,
TickRate = beatmap.BeatmapInfo.BeatmapDifficulty.SliderTickRate == 3 ? 3 : 4, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4,
}; };
} }
} }
else if (endTimeData != null) else if (endTimeData != null)
{ {
double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier; double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;
yield return new Swell yield return new Swell
{ {

View File

@ -71,12 +71,12 @@ namespace osu.Game.Rulesets.Taiko.Scoring
protected override void SimulateAutoplay(Beatmap<TaikoHitObject> beatmap) protected override void SimulateAutoplay(Beatmap<TaikoHitObject> beatmap)
{ {
double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate, 0.5, 0.75, 0.98)); double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, 0.5, 0.75, 0.98));
hpIncreaseTick = hp_hit_tick; hpIncreaseTick = hp_hit_tick;
hpIncreaseGreat = hpMultiplierNormal * hp_hit_great; hpIncreaseGreat = hpMultiplierNormal * hp_hit_great;
hpIncreaseGood = hpMultiplierNormal * hp_hit_good; hpIncreaseGood = hpMultiplierNormal * hp_hit_good;
hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max); hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max);
foreach (var obj in beatmap.HitObjects) foreach (var obj in beatmap.HitObjects)
{ {

View File

@ -67,8 +67,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
HitObjects = new List<HitObject> { new CentreHit() }, HitObjects = new List<HitObject> { new CentreHit() },
BeatmapInfo = new BeatmapInfo BeatmapInfo = new BeatmapInfo
{ {
BeatmapDifficulty = new BeatmapDifficulty(), Difficulty = new BeatmapDifficulty(),
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Artist = @"Unknown", Artist = @"Unknown",
Title = @"Sample Beatmap", Title = @"Sample Beatmap",

View File

@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.UI
StartTime = time, StartTime = time,
}; };
barLine.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BeatmapDifficulty); barLine.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty);
bool isMajor = currentBeat % (int)currentPoint.TimeSignature == 0; bool isMajor = currentBeat % (int)currentPoint.TimeSignature == 0;
Playfield.Add(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); Playfield.Add(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine));

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{ {
var beatmap = decoder.Decode(new StreamReader(stream)); var beatmap = decoder.Decode(new StreamReader(stream));
var meta = beatmap.BeatmapInfo.BeatmapMetadata; var meta = beatmap.BeatmapInfo.Metadata;
Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId); Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId);
Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("Soleily", meta.ArtistUnicode);
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{ {
var beatmap = decoder.Decode(new StreamReader(stream)); var beatmap = decoder.Decode(new StreamReader(stream));
var difficulty = beatmap.BeatmapInfo.BeatmapDifficulty; var difficulty = beatmap.BeatmapInfo.Difficulty;
Assert.AreEqual(6.5f, difficulty.DrainRate); Assert.AreEqual(6.5f, difficulty.DrainRate);
Assert.AreEqual(4, difficulty.CircleSize); Assert.AreEqual(4, difficulty.CircleSize);
Assert.AreEqual(8, difficulty.OverallDifficulty); Assert.AreEqual(8, difficulty.OverallDifficulty);

View File

@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps
new Color4(121, 9, 13, 255) new Color4(121, 9, 13, 255)
}; };
public BeatmapMetadata Metadata => BeatmapInfo?.BeatmapMetadata ?? BeatmapInfo?.BeatmapSetInfo?.BeatmapMetadata; public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
/// <summary> /// <summary>
/// The HitObjects this Beatmap contains. /// The HitObjects this Beatmap contains.

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace osu.Game.Beatmaps namespace osu.Game.Beatmaps
@ -13,7 +12,7 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
public const float DEFAULT_DIFFICULTY = 5; public const float DEFAULT_DIFFICULTY = 5;
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY; public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY; public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps
{ {
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
//TODO: should be in database //TODO: should be in database
@ -23,17 +23,18 @@ namespace osu.Game.Beatmaps
public int? BeatmapSetOnlineInfoId { get; set; } public int? BeatmapSetOnlineInfoId { get; set; }
[ForeignKey(nameof(BeatmapSetInfo))]
public int BeatmapSetInfoId { get; set; } public int BeatmapSetInfoId { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
[ForeignKey(nameof(BeatmapMetadata))] public BeatmapSetInfo BeatmapSet { get; set; }
public int BeatmapMetadataId { get; set; } public int BeatmapMetadataId { get; set; }
public BeatmapMetadata BeatmapMetadata { get; set; }
[ForeignKey(nameof(BeatmapDifficulty))] public BeatmapMetadata Metadata { get; set; }
//[Required]
public int BeatmapDifficultyId { get; set; } public int BeatmapDifficultyId { get; set; }
public BeatmapDifficulty BeatmapDifficulty { get; set; }
public BeatmapDifficulty Difficulty { get; set; }
[NotMapped] [NotMapped]
public BeatmapMetrics Metrics { get; set; } public BeatmapMetrics Metrics { get; set; }
@ -51,6 +52,7 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.). /// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.).
/// </summary> /// </summary>
[NotMapped]
[JsonProperty("file_md5")] [JsonProperty("file_md5")]
public string MD5Hash { get; set; } public string MD5Hash { get; set; }
@ -60,9 +62,9 @@ namespace osu.Game.Beatmaps
public float StackLeniency { get; set; } public float StackLeniency { get; set; }
public bool SpecialStyle { get; set; } public bool SpecialStyle { get; set; }
[ForeignKey(nameof(RulesetInfo))]
public int RulesetInfoId { get; set; } public int RulesetInfoId { get; set; }
public RulesetInfo RulesetInfo { get; set; }
public RulesetInfo Ruleset { get; set; }
public bool LetterboxInBreaks { get; set; } public bool LetterboxInBreaks { get; set; }
public bool WidescreenStoryboard { get; set; } public bool WidescreenStoryboard { get; set; }
@ -113,12 +115,12 @@ namespace osu.Game.Beatmaps
return Id == other?.Id; return Id == other?.Id;
} }
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSetInfo != null && other.BeatmapSetInfo != null && public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSetInfo.Hash == other.BeatmapSetInfo.Hash && BeatmapSet.Hash == other.BeatmapSet.Hash &&
(BeatmapMetadata ?? BeatmapSetInfo.BeatmapMetadata).AudioFile == (other.BeatmapMetadata ?? other.BeatmapSetInfo.BeatmapMetadata).AudioFile; (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSetInfo != null && other.BeatmapSetInfo != null && public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSetInfo.Hash == other.BeatmapSetInfo.Hash && BeatmapSet.Hash == other.BeatmapSet.Hash &&
(BeatmapMetadata ?? BeatmapSetInfo.BeatmapMetadata).BackgroundFile == (other.BeatmapMetadata ?? other.BeatmapSetInfo.BeatmapMetadata).BackgroundFile; (Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile;
} }
} }

View File

@ -200,7 +200,7 @@ namespace osu.Game.Beatmaps
ProgressNotification downloadNotification = new ProgressNotification ProgressNotification downloadNotification = new ProgressNotification
{ {
Text = $"Downloading {beatmapSetInfo.BeatmapMetadata.Artist} - {beatmapSetInfo.BeatmapMetadata.Title}", Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}",
}; };
var request = new DownloadBeatmapSetRequest(beatmapSetInfo); var request = new DownloadBeatmapSetRequest(beatmapSetInfo);
@ -306,11 +306,11 @@ namespace osu.Game.Beatmaps
//lock (beatmaps) //lock (beatmaps)
// beatmaps.Populate(beatmapInfo); // beatmaps.Populate(beatmapInfo);
if (beatmapInfo.BeatmapSetInfo == null) if (beatmapInfo.BeatmapSet == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database."); throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database.");
if (beatmapInfo.BeatmapMetadata == null) if (beatmapInfo.Metadata == null)
beatmapInfo.BeatmapMetadata = beatmapInfo.BeatmapSetInfo.BeatmapMetadata; beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo);
@ -466,7 +466,7 @@ namespace osu.Game.Beatmaps
Beatmaps = new List<BeatmapInfo>(), Beatmaps = new List<BeatmapInfo>(),
Hash = hash, Hash = hash,
Files = fileInfos, Files = fileInfos,
BeatmapMetadata = metadata Metadata = metadata
}; };
var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu")); var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));
@ -488,10 +488,10 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash(); beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.BeatmapMetadata = null; beatmap.BeatmapInfo.Metadata = null;
// TODO: this should be done in a better place once we actually need to dynamically update it. // TODO: this should be done in a better place once we actually need to dynamically update it.
beatmap.BeatmapInfo.RulesetInfo = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId); beatmap.BeatmapInfo.Ruleset = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId);
beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
.Calculate() ?? 0; .Calculate() ?? 0;

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -10,7 +9,7 @@ namespace osu.Game.Beatmaps
{ {
public class BeatmapMetadata public class BeatmapMetadata
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
public int? BeatmapSetOnlineInfoId { get; set; } public int? BeatmapSetOnlineInfoId { get; set; }

View File

@ -9,15 +9,13 @@ namespace osu.Game.Beatmaps
{ {
public class BeatmapSetFileInfo public class BeatmapSetFileInfo
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; } public int Id { get; set; }
[ForeignKey(nameof(BeatmapSetInfo))]
public int BeatmapSetInfoId { get; set; } public int BeatmapSetInfoId { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
[ForeignKey(nameof(FileInfo))]
public int FileInfoId { get; set; } public int FileInfoId { get; set; }
public FileInfo FileInfo { get; set; } public FileInfo FileInfo { get; set; }
[Required] [Required]

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@ -10,14 +9,14 @@ namespace osu.Game.Beatmaps
{ {
public class BeatmapSetInfo public class BeatmapSetInfo
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
public int? BeatmapSetOnlineInfoId { get; set; } public int? BeatmapSetOnlineInfoId { get; set; }
[ForeignKey(nameof(BeatmapMetadata))] public BeatmapMetadata Metadata { get; set; }
public int BeatmapMetadataId { get; set; } public int BeatmapMetadataId { get; set; }
public BeatmapMetadata BeatmapMetadata { get; set; }
public List<BeatmapInfo> Beatmaps { get; set; } public List<BeatmapInfo> Beatmaps { get; set; }
@ -26,6 +25,7 @@ namespace osu.Game.Beatmaps
public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty); public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
[NotMapped]
public bool DeletePending { get; set; } public bool DeletePending { get; set; }
public string Hash { get; set; } public string Hash { get; set; }

View File

@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps
Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects; Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects;
foreach (var h in Objects) foreach (var h in Objects)
h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BeatmapDifficulty); h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty);
PreprocessHitObjects(); PreprocessHitObjects();
} }

View File

@ -135,7 +135,7 @@ namespace osu.Game.Beatmaps.Drawables
new OsuSpriteText new OsuSpriteText
{ {
Font = @"Exo2.0-MediumItalic", Font = @"Exo2.0-MediumItalic",
Text = $"{(beatmap.BeatmapMetadata ?? beatmap.BeatmapSetInfo.BeatmapMetadata).Author}", Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
TextSize = 16, TextSize = 16,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft Origin = Anchor.BottomLeft

View File

@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Drawables
new ConstrainedIconContainer new ConstrainedIconContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Icon = beatmap.RulesetInfo.CreateInstance().CreateIcon() Icon = beatmap.Ruleset.CreateInstance().CreateIcon()
} }
}; };
} }

View File

@ -18,14 +18,14 @@ namespace osu.Game.Beatmaps
public DummyWorkingBeatmap(OsuGameBase game) public DummyWorkingBeatmap(OsuGameBase game)
: base(new BeatmapInfo : base(new BeatmapInfo
{ {
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Artist = "please load a beatmap!", Artist = "please load a beatmap!",
Title = "no beatmaps available!", Title = "no beatmaps available!",
Author = "no one", Author = "no one",
}, },
BeatmapSetInfo = new BeatmapSetInfo(), BeatmapSet = new BeatmapSetInfo(),
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
DrainRate = 0, DrainRate = 0,
CircleSize = 0, CircleSize = 0,
@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps
SliderMultiplier = 0, SliderMultiplier = 0,
SliderTickRate = 0, SliderTickRate = 0,
}, },
RulesetInfo = new DummyRulesetInfo() Ruleset = new DummyRulesetInfo()
}) })
{ {
this.game = game; this.game = game;

View File

@ -48,8 +48,8 @@ namespace osu.Game.Beatmaps.Formats
{ {
BeatmapInfo = new BeatmapInfo BeatmapInfo = new BeatmapInfo
{ {
BeatmapMetadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
BeatmapDifficulty = new BeatmapDifficulty(), Difficulty = new BeatmapDifficulty(),
}, },
}; };

View File

@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps.Formats
{ {
var pair = splitKeyVal(line, ':'); var pair = splitKeyVal(line, ':');
var metadata = beatmap.BeatmapInfo.BeatmapMetadata; var metadata = beatmap.BeatmapInfo.Metadata;
switch (pair.Key) switch (pair.Key)
{ {
case @"AudioFilename": case @"AudioFilename":
@ -155,7 +155,7 @@ namespace osu.Game.Beatmaps.Formats
{ {
var pair = splitKeyVal(line, ':'); var pair = splitKeyVal(line, ':');
var metadata = beatmap.BeatmapInfo.BeatmapMetadata; var metadata = beatmap.BeatmapInfo.Metadata;
switch (pair.Key) switch (pair.Key)
{ {
case @"Title": case @"Title":
@ -177,10 +177,10 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.Version = pair.Value; beatmap.BeatmapInfo.Version = pair.Value;
break; break;
case @"Source": case @"Source":
beatmap.BeatmapInfo.BeatmapMetadata.Source = pair.Value; beatmap.BeatmapInfo.Metadata.Source = pair.Value;
break; break;
case @"Tags": case @"Tags":
beatmap.BeatmapInfo.BeatmapMetadata.Tags = pair.Value; beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
break; break;
case @"BeatmapID": case @"BeatmapID":
beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value); beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value);
@ -196,7 +196,7 @@ namespace osu.Game.Beatmaps.Formats
{ {
var pair = splitKeyVal(line, ':'); var pair = splitKeyVal(line, ':');
var difficulty = beatmap.BeatmapInfo.BeatmapDifficulty; var difficulty = beatmap.BeatmapInfo.Difficulty;
switch (pair.Key) switch (pair.Key)
{ {
case @"HPDrainRate": case @"HPDrainRate":
@ -270,7 +270,7 @@ namespace osu.Game.Beatmaps.Formats
string filename = split[2].Trim('"'); string filename = split[2].Trim('"');
if (type == EventType.Background) if (type == EventType.Background)
beatmap.BeatmapInfo.BeatmapMetadata.BackgroundFile = filename; beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
break; break;
case EventType.Break: case EventType.Break:
@ -674,7 +674,7 @@ namespace osu.Game.Beatmaps.Formats
} }
foreach (var hitObject in beatmap.HitObjects) foreach (var hitObject in beatmap.HitObjects)
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BeatmapDifficulty); hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty);
} }
private KeyValuePair<string, string> splitKeyVal(string line, char separator) private KeyValuePair<string, string> splitKeyVal(string line, char separator)

View File

@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps
protected WorkingBeatmap(BeatmapInfo beatmapInfo) protected WorkingBeatmap(BeatmapInfo beatmapInfo)
{ {
BeatmapInfo = beatmapInfo; BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapInfo.BeatmapSetInfo; BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.BeatmapMetadata ?? BeatmapSetInfo?.BeatmapMetadata ?? new BeatmapMetadata(); Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
Mods.ValueChanged += mods => applyRateAdjustments(); Mods.ValueChanged += mods => applyRateAdjustments();
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.IO; using System.IO;
@ -9,7 +8,7 @@ namespace osu.Game.IO
{ {
public class FileInfo public class FileInfo
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
public string Hash { get; set; } public string Hash { get; set; }

View File

@ -1,22 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets;
namespace osu.Game.Input.Bindings namespace osu.Game.Input.Bindings
{ {
[Table("KeyBinding")] [Table("KeyBinding")]
public class DatabasedKeyBinding : KeyBinding public class DatabasedKeyBinding : KeyBinding
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int Id { get; set; }
[ForeignKey(nameof(RulesetInfo))]
public int? RulesetInfoId { get; set; } public int? RulesetInfoId { get; set; }
public RulesetInfo RulesetInfo;
public int? Variant { get; set; } public int? Variant { get; set; }

View File

@ -64,7 +64,7 @@ namespace osu.Game.Online.API.Requests
return new BeatmapSetInfo return new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = onlineId, BeatmapSetOnlineInfoId = onlineId,
BeatmapMetadata = this, Metadata = this,
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {
Author = new User Author = new User
@ -99,8 +99,8 @@ namespace osu.Game.Online.API.Requests
{ {
return new BeatmapInfo return new BeatmapInfo
{ {
BeatmapMetadata = this, Metadata = this,
RulesetInfo = rulesets.GetRuleset(ruleset), Ruleset = rulesets.GetRuleset(ruleset),
StarDifficulty = starDifficulty, StarDifficulty = starDifficulty,
OnlineInfo = new BeatmapOnlineInfo OnlineInfo = new BeatmapOnlineInfo
{ {

View File

@ -116,7 +116,7 @@ namespace osu.Game.Online.API.Requests
public void ApplyBeatmap(BeatmapInfo beatmap) public void ApplyBeatmap(BeatmapInfo beatmap)
{ {
Beatmap = beatmap; Beatmap = beatmap;
Ruleset = beatmap.RulesetInfo; Ruleset = beatmap.Ruleset;
// Evaluate the mod string // Evaluate the mod string
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray(); Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();

View File

@ -43,8 +43,8 @@ namespace osu.Game.Overlays.BeatmapSet
beatmapSet = value; beatmapSet = value;
Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet; Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet;
title.Text = BeatmapSet.BeatmapMetadata.Title; title.Text = BeatmapSet.Metadata.Title;
artist.Text = BeatmapSet.BeatmapMetadata.Artist; artist.Text = BeatmapSet.Metadata.Artist;
cover?.FadeOut(400, Easing.Out); cover?.FadeOut(400, Easing.Out);
coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet) coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet)

View File

@ -33,8 +33,8 @@ namespace osu.Game.Overlays.BeatmapSet
if (value == beatmapSet) return; if (value == beatmapSet) return;
beatmapSet = value; beatmapSet = value;
source.Text = BeatmapSet.BeatmapMetadata.Source; source.Text = BeatmapSet.Metadata.Source;
tags.Text = BeatmapSet.BeatmapMetadata.Tags; tags.Text = BeatmapSet.Metadata.Tags;
} }
} }

View File

@ -66,13 +66,13 @@ namespace osu.Game.Overlays.Direct
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.TitleUnicode, SetInfo.BeatmapMetadata.Title), Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
TextSize = 18, TextSize = 18,
Font = @"Exo2.0-BoldItalic", Font = @"Exo2.0-BoldItalic",
}, },
new OsuSpriteText new OsuSpriteText
{ {
Text = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.ArtistUnicode, SetInfo.BeatmapMetadata.Artist), Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Font = @"Exo2.0-BoldItalic", Font = @"Exo2.0-BoldItalic",
}, },
}, },
@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Direct
}, },
new OsuSpriteText new OsuSpriteText
{ {
Text = SetInfo.BeatmapMetadata.Author, Text = SetInfo.Metadata.Author,
TextSize = 14, TextSize = 14,
Font = @"Exo2.0-SemiBoldItalic", Font = @"Exo2.0-SemiBoldItalic",
Shadow = false, Shadow = false,
@ -132,11 +132,11 @@ namespace osu.Game.Overlays.Direct
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = $"from {SetInfo.BeatmapMetadata.Source}", Text = $"from {SetInfo.Metadata.Source}",
TextSize = 14, TextSize = 14,
Shadow = false, Shadow = false,
Colour = colours.Gray5, Colour = colours.Gray5,
Alpha = string.IsNullOrEmpty(SetInfo.BeatmapMetadata.Source) ? 0f : 1f, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
}, },
}, },
}, },

View File

@ -54,13 +54,13 @@ namespace osu.Game.Overlays.Direct
{ {
new OsuSpriteText new OsuSpriteText
{ {
Current = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.TitleUnicode, SetInfo.BeatmapMetadata.Title), Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
TextSize = 18, TextSize = 18,
Font = @"Exo2.0-BoldItalic", Font = @"Exo2.0-BoldItalic",
}, },
new OsuSpriteText new OsuSpriteText
{ {
Current = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.ArtistUnicode, SetInfo.BeatmapMetadata.Artist), Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Font = @"Exo2.0-BoldItalic", Font = @"Exo2.0-BoldItalic",
}, },
new FillFlowContainer new FillFlowContainer
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Direct
}, },
new OsuSpriteText new OsuSpriteText
{ {
Text = SetInfo.BeatmapMetadata.Author, Text = SetInfo.Metadata.Author,
TextSize = 14, TextSize = 14,
Font = @"Exo2.0-SemiBoldItalic", Font = @"Exo2.0-SemiBoldItalic",
}, },
@ -109,11 +109,11 @@ namespace osu.Game.Overlays.Direct
}, },
new OsuSpriteText new OsuSpriteText
{ {
Text = $"from {SetInfo.BeatmapMetadata.Source}", Text = $"from {SetInfo.Metadata.Source}",
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
TextSize = 14, TextSize = 14,
Alpha = string.IsNullOrEmpty(SetInfo.BeatmapMetadata.Source) ? 0f : 1f, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
}, },
}, },
}, },

View File

@ -57,9 +57,9 @@ namespace osu.Game.Overlays
var tags = new List<string>(); var tags = new List<string>();
foreach (var s in beatmapSets) foreach (var s in beatmapSets)
{ {
artists.Add(s.BeatmapMetadata.Artist); artists.Add(s.Metadata.Artist);
songs.Add(s.BeatmapMetadata.Title); songs.Add(s.Metadata.Title);
tags.AddRange(s.BeatmapMetadata.Tags.Split(' ')); tags.AddRange(s.Metadata.Tags.Split(' '));
} }
ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags)); ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags));

View File

@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Music
hoverColour = colours.Yellow; hoverColour = colours.Yellow;
artistColour = colours.Gray9; artistColour = colours.Gray9;
var metadata = BeatmapSetInfo.BeatmapMetadata; var metadata = BeatmapSetInfo.Metadata;
FilterTerms = metadata.SearchableTerms; FilterTerms = metadata.SearchableTerms;
Children = new Drawable[] Children = new Drawable[]

View File

@ -2,13 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema;
namespace osu.Game.Rulesets namespace osu.Game.Rulesets
{ {
public class RulesetInfo : IEquatable<RulesetInfo> public class RulesetInfo : IEquatable<RulesetInfo>
{ {
[Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int? Id { get; set; } public int? Id { get; set; }
public string Name { get; set; } public string Name { get; set; }

View File

@ -172,11 +172,11 @@ namespace osu.Game.Rulesets.UI
// Apply difficulty adjustments from mods before using Difficulty. // Apply difficulty adjustments from mods before using Difficulty.
foreach (var mod in Mods.OfType<IApplicableToDifficulty>()) foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BeatmapDifficulty); mod.ApplyToDifficulty(Beatmap.BeatmapInfo.Difficulty);
// Apply defaults // Apply defaults
foreach (var h in Beatmap.HitObjects) foreach (var h in Beatmap.HitObjects)
h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BeatmapDifficulty); h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty);
// Post-process the beatmap // Post-process the beatmap
processor.PostProcess(Beatmap); processor.PostProcess(Beatmap);

View File

@ -230,7 +230,7 @@ namespace osu.Game.Screens.Multiplayer
coverContainer.FadeIn(transition_duration); coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[] coverContainer.Children = new[]
{ {
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo) new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -239,9 +239,9 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both }, }) { RelativeSizeAxes = Axes.Both },
}; };
beatmapTitle.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.TitleUnicode, value.BeatmapMetadata.Title); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - "; beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist); beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
} }
else else
{ {

View File

@ -331,7 +331,7 @@ namespace osu.Game.Screens.Multiplayer
coverContainer.FadeIn(transition_duration); coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[] coverContainer.Children = new[]
{ {
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo) new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -341,10 +341,10 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both }, }) { RelativeSizeAxes = Axes.Both },
}; };
beatmapTitle.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.TitleUnicode, value.BeatmapMetadata.Title); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - "; beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist); beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
beatmapAuthor.Text = $"mapped by {value.BeatmapMetadata.Author}"; beatmapAuthor.Text = $"mapped by {value.Metadata.Author}";
} }
else else
{ {

View File

@ -99,18 +99,18 @@ namespace osu.Game.Screens.Play
if (beatmap == null) if (beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded"); throw new InvalidOperationException("Beatmap was not loaded");
ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.RulesetInfo; ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset;
var rulesetInstance = ruleset.CreateInstance(); var rulesetInstance = ruleset.CreateInstance();
try try
{ {
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.RulesetInfo.Id); RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.Ruleset.Id);
} }
catch (BeatmapInvalidForRulesetException) catch (BeatmapInvalidForRulesetException)
{ {
// we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset // we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset
// let's try again forcing the beatmap's ruleset. // let's try again forcing the beatmap's ruleset.
ruleset = beatmap.BeatmapInfo.RulesetInfo; ruleset = beatmap.BeatmapInfo.Ruleset;
rulesetInstance = ruleset.CreateInstance(); rulesetInstance = ruleset.CreateInstance();
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true); RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true);
} }

View File

@ -177,7 +177,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LocalisationEngine localisation) private void load(LocalisationEngine localisation)
{ {
var metadata = beatmap?.BeatmapInfo?.BeatmapMetadata ?? new BeatmapMetadata(); var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Children = new Drawable[] Children = new Drawable[]

View File

@ -324,9 +324,9 @@ namespace osu.Game.Screens.Ranking
title.Colour = artist.Colour = colours.BlueDarker; title.Colour = artist.Colour = colours.BlueDarker;
versionMapper.Colour = colours.Gray8; versionMapper.Colour = colours.Gray8;
versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.BeatmapMetadata.Author}"; versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}";
title.Current = localisation.GetUnicodePreference(beatmap.BeatmapMetadata.TitleUnicode, beatmap.BeatmapMetadata.Title); title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapMetadata.ArtistUnicode, beatmap.BeatmapMetadata.Artist); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
} }
} }

View File

@ -118,7 +118,7 @@ namespace osu.Game.Screens.Select
internal void UpdateBeatmap(BeatmapInfo beatmap) internal void UpdateBeatmap(BeatmapInfo beatmap)
{ {
// todo: this method should not run more than once for the same BeatmapSetInfo. // todo: this method should not run more than once for the same BeatmapSetInfo.
var set = manager.Refresh(beatmap.BeatmapSetInfo); var set = manager.Refresh(beatmap.BeatmapSet);
// todo: this method should be smarter as to not recreate panels that haven't changed, etc. // todo: this method should be smarter as to not recreate panels that haven't changed, etc.
var group = groups.Find(b => b.BeatmapSet.Id == set.Id); var group = groups.Find(b => b.BeatmapSet.Id == set.Id);
@ -337,8 +337,8 @@ namespace osu.Game.Screens.Select
{ {
foreach (var b in beatmapSet.Beatmaps) foreach (var b in beatmapSet.Beatmaps)
{ {
if (b.BeatmapMetadata == null) if (b.Metadata == null)
b.BeatmapMetadata = beatmapSet.BeatmapMetadata; b.Metadata = beatmapSet.Metadata;
} }
return new BeatmapGroup(beatmapSet, manager) return new BeatmapGroup(beatmapSet, manager)

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
public BeatmapDeleteDialog(BeatmapSetInfo beatmap) public BeatmapDeleteDialog(BeatmapSetInfo beatmap)
{ {
BodyText = $@"{beatmap.BeatmapMetadata?.Artist} - {beatmap.BeatmapMetadata?.Title}"; BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
Icon = FontAwesome.fa_trash_o; Icon = FontAwesome.fa_trash_o;
HeaderText = @"Confirm deletion of"; HeaderText = @"Confirm deletion of";

View File

@ -188,8 +188,8 @@ namespace osu.Game.Screens.Select
ratingsContainer.FadeIn(transition_duration); ratingsContainer.FadeIn(transition_duration);
advanced.Beatmap = Beatmap; advanced.Beatmap = Beatmap;
description.Text = Beatmap.Version; description.Text = Beatmap.Version;
source.Text = Beatmap.BeatmapMetadata.Source; source.Text = Beatmap.Metadata.Source;
tags.Text = Beatmap.BeatmapMetadata.Tags; tags.Text = Beatmap.Metadata.Tags;
var requestedBeatmap = Beatmap; var requestedBeatmap = Beatmap;
if (requestedBeatmap.Metrics == null) if (requestedBeatmap.Metrics == null)
@ -264,7 +264,7 @@ namespace osu.Game.Screens.Select
advanced.Beatmap = new BeatmapInfo advanced.Beatmap = new BeatmapInfo
{ {
StarDifficulty = 0, StarDifficulty = 0,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 0, CircleSize = 0,
DrainRate = 0, DrainRate = 0,

View File

@ -90,7 +90,7 @@ namespace osu.Game.Screens.Select
public BufferedWedgeInfo(WorkingBeatmap beatmap) public BufferedWedgeInfo(WorkingBeatmap beatmap)
{ {
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
BeatmapMetadata metadata = beatmapInfo.BeatmapMetadata ?? beatmap.BeatmapSetInfo?.BeatmapMetadata ?? new BeatmapMetadata(); BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
List<InfoLabel> labels = new List<InfoLabel>(); List<InfoLabel> labels = new List<InfoLabel>();
@ -114,7 +114,7 @@ namespace osu.Game.Screens.Select
})); }));
//get statistics from the current ruleset. //get statistics from the current ruleset.
labels.AddRange(beatmapInfo.RulesetInfo.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
} }
PixelSnapping = true; PixelSnapping = true;

View File

@ -29,20 +29,20 @@ namespace osu.Game.Screens.Select.Details
beatmap = value; beatmap = value;
//mania specific //mania specific
if ((Beatmap?.RulesetInfo?.Id ?? 0) == 3) if ((Beatmap?.Ruleset?.Id ?? 0) == 3)
{ {
firstValue.Title = "Key Amount"; firstValue.Title = "Key Amount";
firstValue.Value = (int)Math.Round(Beatmap?.BeatmapDifficulty?.CircleSize ?? 0); firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0);
} }
else else
{ {
firstValue.Title = "Circle Size"; firstValue.Title = "Circle Size";
firstValue.Value = Beatmap?.BeatmapDifficulty?.CircleSize ?? 0; firstValue.Value = Beatmap?.Difficulty?.CircleSize ?? 0;
} }
hpDrain.Value = beatmap.BeatmapDifficulty?.DrainRate ?? 0; hpDrain.Value = beatmap.Difficulty?.DrainRate ?? 0;
accuracy.Value = beatmap.BeatmapDifficulty?.OverallDifficulty ?? 0; accuracy.Value = beatmap.Difficulty?.OverallDifficulty ?? 0;
approachRate.Value = beatmap.BeatmapDifficulty?.ApproachRate ?? 0; approachRate.Value = beatmap.Difficulty?.ApproachRate ?? 0;
starDifficulty.Value = (float)beatmap.StarDifficulty; starDifficulty.Value = (float)beatmap.StarDifficulty;
} }
} }

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select
bool match = hasCurrentMode; bool match = hasCurrentMode;
if (!string.IsNullOrEmpty(SearchText)) if (!string.IsNullOrEmpty(SearchText))
match &= set.BeatmapMetadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0); match &= set.Metadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0);
switch (g.State) switch (g.State)
{ {
@ -45,13 +45,13 @@ namespace osu.Game.Screens.Select
{ {
default: default:
case SortMode.Artist: case SortMode.Artist:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Artist, y.BeatmapSet.BeatmapMetadata.Artist, StringComparison.InvariantCultureIgnoreCase)); groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist, StringComparison.InvariantCultureIgnoreCase));
break; break;
case SortMode.Title: case SortMode.Title:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Title, y.BeatmapSet.BeatmapMetadata.Title, StringComparison.InvariantCultureIgnoreCase)); groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase));
break; break;
case SortMode.Author: case SortMode.Author:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Author, y.BeatmapSet.BeatmapMetadata.Author, StringComparison.InvariantCultureIgnoreCase)); groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
break; break;
case SortMode.Difficulty: case SortMode.Difficulty:
groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty)); groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));

View File

@ -37,7 +37,7 @@ namespace osu.Game.Storyboards
/// </summary> /// </summary>
public bool ReplacesBackground(BeatmapInfo beatmapInfo) public bool ReplacesBackground(BeatmapInfo beatmapInfo)
{ {
var backgroundPath = beatmapInfo.BeatmapSetInfo?.BeatmapMetadata?.BackgroundFile?.ToLowerInvariant(); var backgroundPath = beatmapInfo.BeatmapSet?.Metadata?.BackgroundFile?.ToLowerInvariant();
if (backgroundPath == null) if (backgroundPath == null)
return false; return false;

View File

@ -24,12 +24,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo
{ {
Version = "All Metrics", Version = "All Metrics",
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has all the metrics", Tags = "this beatmap has all the metrics",
}, },
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 7, CircleSize = 7,
DrainRate = 1, DrainRate = 1,
@ -48,12 +48,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo
{ {
Version = "Only Ratings", Version = "Only Ratings",
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has ratings metrics but not retries or fails", Tags = "this beatmap has ratings metrics but not retries or fails",
}, },
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 6, CircleSize = 6,
DrainRate = 9, DrainRate = 9,
@ -70,12 +70,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo
{ {
Version = "Only Retries and Fails", Version = "Only Retries and Fails",
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has retries and fails but no ratings", Tags = "this beatmap has retries and fails but no ratings",
}, },
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 3.7f, CircleSize = 3.7f,
DrainRate = 6, DrainRate = 6,
@ -93,12 +93,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo
{ {
Version = "No Metrics", Version = "No Metrics",
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has no metrics", Tags = "this beatmap has no metrics",
}, },
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 5, CircleSize = 5,
DrainRate = 5, DrainRate = 5,

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual
{ {
overlay.ShowBeatmapSet(new BeatmapSetInfo overlay.ShowBeatmapSet(new BeatmapSetInfo
{ {
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"Lachryma <Re:QueenM>", Title = @"Lachryma <Re:QueenM>",
Artist = @"Kaneko Chiharu", Artist = @"Kaneko Chiharu",
@ -64,8 +64,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 1.36, StarDifficulty = 1.36,
Version = @"BASIC", Version = @"BASIC",
RulesetInfo = mania, Ruleset = mania,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 6.5f, DrainRate = 6.5f,
@ -92,8 +92,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 2.22, StarDifficulty = 2.22,
Version = @"NOVICE", Version = @"NOVICE",
RulesetInfo = mania, Ruleset = mania,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 7, DrainRate = 7,
@ -120,8 +120,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 3.49, StarDifficulty = 3.49,
Version = @"ADVANCED", Version = @"ADVANCED",
RulesetInfo = mania, Ruleset = mania,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 7.5f, DrainRate = 7.5f,
@ -148,8 +148,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 4.24, StarDifficulty = 4.24,
Version = @"EXHAUST", Version = @"EXHAUST",
RulesetInfo = mania, Ruleset = mania,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 8, DrainRate = 8,
@ -176,8 +176,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 5.26, StarDifficulty = 5.26,
Version = @"GRAVITY", Version = @"GRAVITY",
RulesetInfo = mania, Ruleset = mania,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 8.5f, DrainRate = 8.5f,
@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual
{ {
overlay.ShowBeatmapSet(new BeatmapSetInfo overlay.ShowBeatmapSet(new BeatmapSetInfo
{ {
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"Soumatou Labyrinth", Title = @"Soumatou Labyrinth",
Artist = @"Yunomi with Momobako&miko", Artist = @"Yunomi with Momobako&miko",
@ -238,8 +238,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 1.40, StarDifficulty = 1.40,
Version = @"yzrin's Kantan", Version = @"yzrin's Kantan",
RulesetInfo = taiko, Ruleset = taiko,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 2, CircleSize = 2,
DrainRate = 7, DrainRate = 7,
@ -266,8 +266,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 2.23, StarDifficulty = 2.23,
Version = @"Futsuu", Version = @"Futsuu",
RulesetInfo = taiko, Ruleset = taiko,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 2, CircleSize = 2,
DrainRate = 6, DrainRate = 6,
@ -294,8 +294,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 3.19, StarDifficulty = 3.19,
Version = @"Muzukashii", Version = @"Muzukashii",
RulesetInfo = taiko, Ruleset = taiko,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 2, CircleSize = 2,
DrainRate = 6, DrainRate = 6,
@ -322,8 +322,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 3.97, StarDifficulty = 3.97,
Version = @"Charlotte's Oni", Version = @"Charlotte's Oni",
RulesetInfo = taiko, Ruleset = taiko,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 5, CircleSize = 5,
DrainRate = 6, DrainRate = 6,
@ -350,8 +350,8 @@ namespace osu.Game.Tests.Visual
{ {
StarDifficulty = 5.08, StarDifficulty = 5.08,
Version = @"Labyrinth Oni", Version = @"Labyrinth Oni",
RulesetInfo = taiko, Ruleset = taiko,
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
CircleSize = 5, CircleSize = 5,
DrainRate = 5, DrainRate = 5,

View File

@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 578332, BeatmapSetOnlineInfoId = 578332,
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"OrVid", Title = @"OrVid",
Artist = @"An", Artist = @"An",
@ -65,16 +65,16 @@ namespace osu.Game.Tests.Visual
{ {
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 5.35f, StarDifficulty = 5.35f,
BeatmapMetadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
}, },
}, },
}, },
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 599627, BeatmapSetOnlineInfoId = 599627,
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"tiny lamp", Title = @"tiny lamp",
Artist = @"fhana", Artist = @"fhana",
@ -97,16 +97,16 @@ namespace osu.Game.Tests.Visual
{ {
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 5.81f, StarDifficulty = 5.81f,
BeatmapMetadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
}, },
}, },
}, },
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 513268, BeatmapSetOnlineInfoId = 513268,
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"At Gwanghwamun", Title = @"At Gwanghwamun",
Artist = @"KYUHYUN", Artist = @"KYUHYUN",
@ -129,23 +129,23 @@ namespace osu.Game.Tests.Visual
{ {
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 0.9f, StarDifficulty = 0.9f,
BeatmapMetadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 1.1f, StarDifficulty = 1.1f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 2.02f, StarDifficulty = 2.02f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 3.49f, StarDifficulty = 3.49f,
}, },
}, },
@ -153,7 +153,7 @@ namespace osu.Game.Tests.Visual
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 586841, BeatmapSetOnlineInfoId = 586841,
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"RHAPSODY OF BLUE SKY", Title = @"RHAPSODY OF BLUE SKY",
Artist = @"fhana", Artist = @"fhana",
@ -176,43 +176,43 @@ namespace osu.Game.Tests.Visual
{ {
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 1.26f, StarDifficulty = 1.26f,
BeatmapMetadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 2.01f, StarDifficulty = 2.01f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 2.87f, StarDifficulty = 2.87f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 3.76f, StarDifficulty = 3.76f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 3.93f, StarDifficulty = 3.93f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 4.37f, StarDifficulty = 4.37f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 5.13f, StarDifficulty = 5.13f,
}, },
new BeatmapInfo new BeatmapInfo
{ {
RulesetInfo = ruleset, Ruleset = ruleset,
StarDifficulty = 5.42f, StarDifficulty = 5.42f,
}, },
}, },

View File

@ -43,13 +43,13 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo Value = new BeatmapInfo
{ {
StarDifficulty = 4.65, StarDifficulty = 4.65,
RulesetInfo = rulesets.GetRuleset(3), Ruleset = rulesets.GetRuleset(3),
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"Critical Crystal", Title = @"Critical Crystal",
Artist = @"Seiryu", Artist = @"Seiryu",
}, },
BeatmapSetInfo = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {
@ -81,13 +81,13 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo Value = new BeatmapInfo
{ {
StarDifficulty = 1.96, StarDifficulty = 1.96,
RulesetInfo = rulesets.GetRuleset(0), Ruleset = rulesets.GetRuleset(0),
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"Serendipity", Title = @"Serendipity",
Artist = @"ZAQ", Artist = @"ZAQ",
}, },
BeatmapSetInfo = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {

View File

@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual
{ {
BeatmapSetOnlineInfoId = 1234 + i, BeatmapSetOnlineInfoId = 1234 + i,
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249", Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
BeatmapSetOnlineInfoId = 1234 + i, BeatmapSetOnlineInfoId = 1234 + i,
// Create random metadata, then we can check if sorting works based on these // Create random metadata, then we can check if sorting works based on these
@ -75,10 +75,10 @@ namespace osu.Game.Tests.Visual
new BeatmapInfo new BeatmapInfo
{ {
BeatmapOnlineInfoId = 1234 + i, BeatmapOnlineInfoId = 1234 + i,
RulesetInfo = rulesets.QueryRulesets().First(), Ruleset = rulesets.QueryRulesets().First(),
Path = "normal.osu", Path = "normal.osu",
Version = "Normal", Version = "Normal",
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
OverallDifficulty = 3.5f, OverallDifficulty = 3.5f,
} }
@ -86,10 +86,10 @@ namespace osu.Game.Tests.Visual
new BeatmapInfo new BeatmapInfo
{ {
BeatmapOnlineInfoId = 1235 + i, BeatmapOnlineInfoId = 1235 + i,
RulesetInfo = rulesets.QueryRulesets().First(), Ruleset = rulesets.QueryRulesets().First(),
Path = "hard.osu", Path = "hard.osu",
Version = "Hard", Version = "Hard",
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
OverallDifficulty = 5, OverallDifficulty = 5,
} }
@ -97,10 +97,10 @@ namespace osu.Game.Tests.Visual
new BeatmapInfo new BeatmapInfo
{ {
BeatmapOnlineInfoId = 1236 + i, BeatmapOnlineInfoId = 1236 + i,
RulesetInfo = rulesets.QueryRulesets().First(), Ruleset = rulesets.QueryRulesets().First(),
Path = "insane.osu", Path = "insane.osu",
Version = "Insane", Version = "Insane",
BeatmapDifficulty = new BeatmapDifficulty Difficulty = new BeatmapDifficulty
{ {
OverallDifficulty = 7, OverallDifficulty = 7,
} }

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual
{ {
var beatmap = CreateBeatmap(); var beatmap = CreateBeatmap();
beatmap.BeatmapInfo.RulesetInfo = r; beatmap.BeatmapInfo.Ruleset = r;
var instance = r.CreateInstance(); var instance = r.CreateInstance();

View File

@ -32,14 +32,14 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo Value = new BeatmapInfo
{ {
StarDifficulty = 3.7, StarDifficulty = 3.7,
RulesetInfo = rulesets.GetRuleset(3), Ruleset = rulesets.GetRuleset(3),
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"Platina", Title = @"Platina",
Artist = @"Maaya Sakamoto", Artist = @"Maaya Sakamoto",
Author = @"uwutm8", Author = @"uwutm8",
}, },
BeatmapSetInfo = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {
@ -99,14 +99,14 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo Value = new BeatmapInfo
{ {
StarDifficulty = 7.07, StarDifficulty = 7.07,
RulesetInfo = rulesets.GetRuleset(0), Ruleset = rulesets.GetRuleset(0),
BeatmapMetadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"FREEDOM DIVE", Title = @"FREEDOM DIVE",
Artist = @"xi", Artist = @"xi",
Author = @"Nakagawa-Kanon", Author = @"Nakagawa-Kanon",
}, },
BeatmapSetInfo = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {

View File

@ -48,8 +48,8 @@ namespace osu.Game.Tests.Visual
HitObjects = objects, HitObjects = objects,
BeatmapInfo = new BeatmapInfo BeatmapInfo = new BeatmapInfo
{ {
BeatmapDifficulty = new BeatmapDifficulty(), Difficulty = new BeatmapDifficulty(),
BeatmapMetadata = new BeatmapMetadata() Metadata = new BeatmapMetadata()
} }
}; };