From 887aa7496b57aaa8c5ed686da7f244cdbf8d7324 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Fri, 6 Oct 2017 00:23:26 +0300 Subject: [PATCH] Rework EF Core usage in model classes --- .../Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Legacy/DistanceObjectPatternGenerator.cs | 2 +- .../Patterns/Legacy/PatternGenerator.cs | 2 +- .../ManiaDifficultyCalculator.cs | 2 +- .../Scoring/ManiaScoreProcessor.cs | 2 +- .../UI/ManiaRulesetContainer.cs | 10 ++--- .../Scoring/OsuScoreProcessor.cs | 2 +- .../UI/Cursor/GameplayCursor.cs | 2 +- .../Beatmaps/TaikoBeatmapConverter.cs | 12 ++--- .../Scoring/TaikoScoreProcessor.cs | 4 +- .../Tests/TestCaseTaikoPlayfield.cs | 4 +- .../UI/TaikoRulesetContainer.cs | 2 +- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 6 +-- osu.Game/Beatmaps/Beatmap.cs | 2 +- osu.Game/Beatmaps/BeatmapDifficulty.cs | 3 +- osu.Game/Beatmaps/BeatmapInfo.cs | 32 +++++++------- osu.Game/Beatmaps/BeatmapManager.cs | 14 +++--- osu.Game/Beatmaps/BeatmapMetadata.cs | 3 +- osu.Game/Beatmaps/BeatmapSetFileInfo.cs | 8 ++-- osu.Game/Beatmaps/BeatmapSetInfo.cs | 8 ++-- osu.Game/Beatmaps/DifficultyCalculator.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 2 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 +- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 8 ++-- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 4 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 14 +++--- osu.Game/Beatmaps/WorkingBeatmap.cs | 4 +- osu.Game/IO/FileInfo.cs | 3 +- .../Input/Bindings/DatabasedKeyBinding.cs | 6 +-- .../DatabasedKeyBindingInputManager.cs | 2 +- .../API/Requests/GetBeatmapSetsRequest.cs | 6 +-- .../Online/API/Requests/GetScoresRequest.cs | 2 +- osu.Game/Overlays/BeatmapSet/Header.cs | 4 +- osu.Game/Overlays/BeatmapSet/Info.cs | 4 +- osu.Game/Overlays/Direct/DirectGridPanel.cs | 10 ++--- osu.Game/Overlays/Direct/DirectListPanel.cs | 10 ++--- osu.Game/Overlays/DirectOverlay.cs | 6 +-- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Rulesets/RulesetInfo.cs | 4 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 4 +- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 6 +-- osu.Game/Screens/Multiplayer/RoomInspector.cs | 8 ++-- osu.Game/Screens/Play/Player.cs | 6 +-- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 6 +-- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 +-- .../Screens/Select/BeatmapDeleteDialog.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 6 +-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +- .../Screens/Select/Details/AdvancedStats.cs | 12 ++--- osu.Game/Screens/Select/FilterCriteria.cs | 10 ++--- osu.Game/Storyboards/Storyboard.cs | 2 +- .../Tests/Visual/TestCaseBeatmapDetails.cs | 16 +++---- .../Tests/Visual/TestCaseBeatmapSetOverlay.cs | 44 +++++++++---------- osu.Game/Tests/Visual/TestCaseDirect.cs | 44 +++++++++---------- osu.Game/Tests/Visual/TestCaseDrawableRoom.cs | 12 ++--- .../Tests/Visual/TestCasePlaySongSelect.cs | 14 +++--- osu.Game/Tests/Visual/TestCasePlayer.cs | 2 +- .../Tests/Visual/TestCaseRoomInspector.cs | 12 ++--- .../Visual/TestCaseScrollingPlayfield.cs | 4 +- 60 files changed, 216 insertions(+), 223 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 713ee6bb44..d7c86e1f89 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { 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); random = new FastRandom(seed); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 07a7c47f82..20966a75f7 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // The true distance, accounting for any repeats double distance = (distanceData?.Distance ?? 0) * repeatCount; // 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 double osuDuration = distance / osuVelocity; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index d3b743062d..a3173f9784 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (drainTime == 0) 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 = Math.Min(conversionDifficulty.Value, 12); diff --git a/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs index 6a96bc0a7d..b98802db69 100644 --- a/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs @@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Mania return 0; } - protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.BeatmapDifficulty.CircleSize))); + protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize))); } } diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index d6c076803d..a200ba31e2 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Mania.Scoring protected override void SimulateAutoplay(Beatmap 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); hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 3858c60367..3b49d81674 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -88,18 +88,18 @@ namespace osu.Game.Rulesets.Mania.UI protected override BeatmapConverter CreateBeatmapConverter() { 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 { float percentSliderOrSpinner = (float)WorkingBeatmap.Beatmap.HitObjects.Count(h => h is IHasEndTime) / WorkingBeatmap.Beatmap.HitObjects.Count; if (percentSliderOrSpinner < 0.2) AvailableColumns = 7; - else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.CircleSize) >= 5) - AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) > 5 ? 7 : 6; + else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize) >= 5) + AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 5 ? 7 : 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 - 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); diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index b320940e67..50239bf16c 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Scoring protected override void SimulateAutoplay(Beatmap beatmap) { - hpDrainRate = beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate; + hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate; foreach (var obj in beatmap.HitObjects) { diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 724a5f2b7a..adfc946f86 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor 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. - 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); diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 6a8f046800..4f2707ff88 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps { // Rewrite the beatmap info to add the slider velocity multiplier BeatmapInfo info = original.BeatmapInfo.DeepClone(); - info.BeatmapDifficulty.SliderMultiplier *= legacy_velocity_multiplier; + info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier; Beatmap converted = base.ConvertBeatmap(original); @@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps double distance = distanceData.Distance * repeats * legacy_velocity_multiplier; // 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 double taikoDuration = distance / taikoVelocity; @@ -103,12 +103,12 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps speedAdjustedBeatLength *= speedAdjustment; // 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 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 - 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) { @@ -151,13 +151,13 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps Samples = obj.Samples, IsStrong = strong, Duration = taikoDuration, - TickRate = beatmap.BeatmapInfo.BeatmapDifficulty.SliderTickRate == 3 ? 3 : 4, + TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, }; } } 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 { diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 9b208813dc..abdda9676f 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -71,12 +71,12 @@ namespace osu.Game.Rulesets.Taiko.Scoring protected override void SimulateAutoplay(Beatmap 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; hpIncreaseGreat = hpMultiplierNormal * hp_hit_great; 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) { diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs index 8e93d52492..79ee2945ad 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs @@ -67,8 +67,8 @@ namespace osu.Game.Rulesets.Taiko.Tests HitObjects = new List { new CentreHit() }, BeatmapInfo = new BeatmapInfo { - BeatmapDifficulty = new BeatmapDifficulty(), - BeatmapMetadata = new BeatmapMetadata + Difficulty = new BeatmapDifficulty(), + Metadata = new BeatmapMetadata { Artist = @"Unknown", Title = @"Sample Beatmap", diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index ca0a7e058f..f0853aef0e 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.UI StartTime = time, }; - barLine.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BeatmapDifficulty); + barLine.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty); bool isMajor = currentBeat % (int)currentPoint.TimeSignature == 0; Playfield.Add(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 4c71601eed..07a0a7e678 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Beatmaps.Formats using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) { var beatmap = decoder.Decode(new StreamReader(stream)); - var meta = beatmap.BeatmapInfo.BeatmapMetadata; + var meta = beatmap.BeatmapInfo.Metadata; Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId); Assert.AreEqual("Soleily", meta.Artist); 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")) { 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(4, difficulty.CircleSize); Assert.AreEqual(8, difficulty.OverallDifficulty); @@ -143,4 +143,4 @@ namespace osu.Game.Tests.Beatmaps.Formats } } } -} \ No newline at end of file +} diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 0d6cd6f49a..458c2304f2 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps new Color4(121, 9, 13, 255) }; - public BeatmapMetadata Metadata => BeatmapInfo?.BeatmapMetadata ?? BeatmapInfo?.BeatmapSetInfo?.BeatmapMetadata; + public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata; /// /// The HitObjects this Beatmap contains. diff --git a/osu.Game/Beatmaps/BeatmapDifficulty.cs b/osu.Game/Beatmaps/BeatmapDifficulty.cs index e354f3703e..74403e8fb9 100644 --- a/osu.Game/Beatmaps/BeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/BeatmapDifficulty.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace osu.Game.Beatmaps @@ -13,7 +12,7 @@ namespace osu.Game.Beatmaps /// public const float DEFAULT_DIFFICULTY = 5; - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public float DrainRate { get; set; } = DEFAULT_DIFFICULTY; public float CircleSize { get; set; } = DEFAULT_DIFFICULTY; diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 565e1b97d6..d5f89d1d66 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps { public class BeatmapInfo : IEquatable, IJsonSerializable { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } //TODO: should be in database @@ -23,17 +23,18 @@ namespace osu.Game.Beatmaps public int? BeatmapSetOnlineInfoId { get; set; } - [ForeignKey(nameof(BeatmapSetInfo))] public int BeatmapSetInfoId { get; set; } - public BeatmapSetInfo BeatmapSetInfo { get; set; } - [ForeignKey(nameof(BeatmapMetadata))] + public BeatmapSetInfo BeatmapSet { 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 BeatmapDifficulty BeatmapDifficulty { get; set; } + + public BeatmapDifficulty Difficulty { get; set; } [NotMapped] public BeatmapMetrics Metrics { get; set; } @@ -51,6 +52,7 @@ namespace osu.Game.Beatmaps /// /// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.). /// + [NotMapped] [JsonProperty("file_md5")] public string MD5Hash { get; set; } @@ -60,9 +62,9 @@ namespace osu.Game.Beatmaps public float StackLeniency { get; set; } public bool SpecialStyle { get; set; } - [ForeignKey(nameof(RulesetInfo))] public int RulesetInfoId { get; set; } - public RulesetInfo RulesetInfo { get; set; } + + public RulesetInfo Ruleset { get; set; } public bool LetterboxInBreaks { get; set; } public bool WidescreenStoryboard { get; set; } @@ -113,12 +115,12 @@ namespace osu.Game.Beatmaps return Id == other?.Id; } - public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSetInfo != null && other.BeatmapSetInfo != null && - BeatmapSetInfo.Hash == other.BeatmapSetInfo.Hash && - (BeatmapMetadata ?? BeatmapSetInfo.BeatmapMetadata).AudioFile == (other.BeatmapMetadata ?? other.BeatmapSetInfo.BeatmapMetadata).AudioFile; + public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && + BeatmapSet.Hash == other.BeatmapSet.Hash && + (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; - public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSetInfo != null && other.BeatmapSetInfo != null && - BeatmapSetInfo.Hash == other.BeatmapSetInfo.Hash && - (BeatmapMetadata ?? BeatmapSetInfo.BeatmapMetadata).BackgroundFile == (other.BeatmapMetadata ?? other.BeatmapSetInfo.BeatmapMetadata).BackgroundFile; + public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && + BeatmapSet.Hash == other.BeatmapSet.Hash && + (Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile; } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 3b023e34e4..c77163d423 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -200,7 +200,7 @@ namespace osu.Game.Beatmaps 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); @@ -306,11 +306,11 @@ namespace osu.Game.Beatmaps //lock (beatmaps) // beatmaps.Populate(beatmapInfo); - if (beatmapInfo.BeatmapSetInfo == null) + if (beatmapInfo.BeatmapSet == null) throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database."); - if (beatmapInfo.BeatmapMetadata == null) - beatmapInfo.BeatmapMetadata = beatmapInfo.BeatmapSetInfo.BeatmapMetadata; + if (beatmapInfo.Metadata == null) + beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo); @@ -466,7 +466,7 @@ namespace osu.Game.Beatmaps Beatmaps = new List(), Hash = hash, Files = fileInfos, - BeatmapMetadata = metadata + Metadata = metadata }; var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu")); @@ -488,10 +488,10 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash(); // 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. - 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) .Calculate() ?? 0; diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 8266dc9161..fbe8c08eb2 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Newtonsoft.Json; @@ -10,7 +9,7 @@ namespace osu.Game.Beatmaps { public class BeatmapMetadata { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public int? BeatmapSetOnlineInfoId { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs index aec87296a0..a634e5d3eb 100644 --- a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs @@ -9,15 +9,13 @@ namespace osu.Game.Beatmaps { public class BeatmapSetFileInfo { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int ID { get; set; } + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } - [ForeignKey(nameof(BeatmapSetInfo))] public int BeatmapSetInfoId { get; set; } - public BeatmapSetInfo BeatmapSetInfo { get; set; } - [ForeignKey(nameof(FileInfo))] public int FileInfoId { get; set; } + public FileInfo FileInfo { get; set; } [Required] diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 9be00152c3..f3cc01bb08 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; @@ -10,14 +9,14 @@ namespace osu.Game.Beatmaps { public class BeatmapSetInfo { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public int? BeatmapSetOnlineInfoId { get; set; } - [ForeignKey(nameof(BeatmapMetadata))] + public BeatmapMetadata Metadata { get; set; } + public int BeatmapMetadataId { get; set; } - public BeatmapMetadata BeatmapMetadata { get; set; } public List Beatmaps { get; set; } @@ -26,6 +25,7 @@ namespace osu.Game.Beatmaps public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty); + [NotMapped] public bool DeletePending { get; set; } public string Hash { get; set; } diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 1cd0516b0e..60cbf0ac61 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects; foreach (var h in Objects) - h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BeatmapDifficulty); + h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty); PreprocessHitObjects(); } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index dfff949fe9..e216f1b83e 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -135,7 +135,7 @@ namespace osu.Game.Beatmaps.Drawables new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = $"{(beatmap.BeatmapMetadata ?? beatmap.BeatmapSetInfo.BeatmapMetadata).Author}", + Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}", TextSize = 16, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 2981b3b053..42db025a40 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Drawables new ConstrainedIconContainer { RelativeSizeAxes = Axes.Both, - Icon = beatmap.RulesetInfo.CreateInstance().CreateIcon() + Icon = beatmap.Ruleset.CreateInstance().CreateIcon() } }; } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 3746a1fabe..d8cd58d939 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -18,14 +18,14 @@ namespace osu.Game.Beatmaps public DummyWorkingBeatmap(OsuGameBase game) : base(new BeatmapInfo { - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Artist = "please load a beatmap!", Title = "no beatmaps available!", Author = "no one", }, - BeatmapSetInfo = new BeatmapSetInfo(), - BeatmapDifficulty = new BeatmapDifficulty + BeatmapSet = new BeatmapSetInfo(), + Difficulty = new BeatmapDifficulty { DrainRate = 0, CircleSize = 0, @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps SliderMultiplier = 0, SliderTickRate = 0, }, - RulesetInfo = new DummyRulesetInfo() + Ruleset = new DummyRulesetInfo() }) { this.game = game; diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 9d97ca8602..81695c3b5a 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -48,8 +48,8 @@ namespace osu.Game.Beatmaps.Formats { BeatmapInfo = new BeatmapInfo { - BeatmapMetadata = new BeatmapMetadata(), - BeatmapDifficulty = new BeatmapDifficulty(), + Metadata = new BeatmapMetadata(), + Difficulty = new BeatmapDifficulty(), }, }; diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 9d6586ef26..7a03db7348 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps.Formats { var pair = splitKeyVal(line, ':'); - var metadata = beatmap.BeatmapInfo.BeatmapMetadata; + var metadata = beatmap.BeatmapInfo.Metadata; switch (pair.Key) { case @"AudioFilename": @@ -155,7 +155,7 @@ namespace osu.Game.Beatmaps.Formats { var pair = splitKeyVal(line, ':'); - var metadata = beatmap.BeatmapInfo.BeatmapMetadata; + var metadata = beatmap.BeatmapInfo.Metadata; switch (pair.Key) { case @"Title": @@ -177,10 +177,10 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.Version = pair.Value; break; case @"Source": - beatmap.BeatmapInfo.BeatmapMetadata.Source = pair.Value; + beatmap.BeatmapInfo.Metadata.Source = pair.Value; break; case @"Tags": - beatmap.BeatmapInfo.BeatmapMetadata.Tags = pair.Value; + beatmap.BeatmapInfo.Metadata.Tags = pair.Value; break; case @"BeatmapID": beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value); @@ -196,7 +196,7 @@ namespace osu.Game.Beatmaps.Formats { var pair = splitKeyVal(line, ':'); - var difficulty = beatmap.BeatmapInfo.BeatmapDifficulty; + var difficulty = beatmap.BeatmapInfo.Difficulty; switch (pair.Key) { case @"HPDrainRate": @@ -270,7 +270,7 @@ namespace osu.Game.Beatmaps.Formats string filename = split[2].Trim('"'); if (type == EventType.Background) - beatmap.BeatmapInfo.BeatmapMetadata.BackgroundFile = filename; + beatmap.BeatmapInfo.Metadata.BackgroundFile = filename; break; case EventType.Break: @@ -674,7 +674,7 @@ namespace osu.Game.Beatmaps.Formats } foreach (var hitObject in beatmap.HitObjects) - hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BeatmapDifficulty); + hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty); } private KeyValuePair splitKeyVal(string line, char separator) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 4b50e50efe..277846ee80 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps protected WorkingBeatmap(BeatmapInfo beatmapInfo) { BeatmapInfo = beatmapInfo; - BeatmapSetInfo = beatmapInfo.BeatmapSetInfo; - Metadata = beatmapInfo.BeatmapMetadata ?? BeatmapSetInfo?.BeatmapMetadata ?? new BeatmapMetadata(); + BeatmapSetInfo = beatmapInfo.BeatmapSet; + Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); Mods.ValueChanged += mods => applyRateAdjustments(); } diff --git a/osu.Game/IO/FileInfo.cs b/osu.Game/IO/FileInfo.cs index 7ba75eeb0c..29c9729341 100644 --- a/osu.Game/IO/FileInfo.cs +++ b/osu.Game/IO/FileInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.IO; @@ -9,7 +8,7 @@ namespace osu.Game.IO { public class FileInfo { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string Hash { get; set; } diff --git a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs index 73a8e117d3..0098cc47bb 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs @@ -1,22 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using osu.Framework.Input.Bindings; -using osu.Game.Rulesets; namespace osu.Game.Input.Bindings { [Table("KeyBinding")] public class DatabasedKeyBinding : KeyBinding { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } - [ForeignKey(nameof(RulesetInfo))] public int? RulesetInfoId { get; set; } - public RulesetInfo RulesetInfo; public int? Variant { get; set; } diff --git a/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs b/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs index 41a2f54277..ac16500718 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs @@ -51,4 +51,4 @@ namespace osu.Game.Input.Bindings KeyBindings = store.Query(ruleset?.Id, variant); } } -} \ No newline at end of file +} diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs index 37d7a5e2d6..063e548c32 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs @@ -64,7 +64,7 @@ namespace osu.Game.Online.API.Requests return new BeatmapSetInfo { BeatmapSetOnlineInfoId = onlineId, - BeatmapMetadata = this, + Metadata = this, OnlineInfo = new BeatmapSetOnlineInfo { Author = new User @@ -99,8 +99,8 @@ namespace osu.Game.Online.API.Requests { return new BeatmapInfo { - BeatmapMetadata = this, - RulesetInfo = rulesets.GetRuleset(ruleset), + Metadata = this, + Ruleset = rulesets.GetRuleset(ruleset), StarDifficulty = starDifficulty, OnlineInfo = new BeatmapOnlineInfo { diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 6bb654f403..d9e28d3833 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -116,7 +116,7 @@ namespace osu.Game.Online.API.Requests public void ApplyBeatmap(BeatmapInfo beatmap) { Beatmap = beatmap; - Ruleset = beatmap.RulesetInfo; + Ruleset = beatmap.Ruleset; // Evaluate the mod string Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray(); diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 25e598ffb9..a93ccbf704 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -43,8 +43,8 @@ namespace osu.Game.Overlays.BeatmapSet beatmapSet = value; Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet; - title.Text = BeatmapSet.BeatmapMetadata.Title; - artist.Text = BeatmapSet.BeatmapMetadata.Artist; + title.Text = BeatmapSet.Metadata.Title; + artist.Text = BeatmapSet.Metadata.Artist; cover?.FadeOut(400, Easing.Out); coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet) diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index 16cb19dbd7..4a59591a72 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -33,8 +33,8 @@ namespace osu.Game.Overlays.BeatmapSet if (value == beatmapSet) return; beatmapSet = value; - source.Text = BeatmapSet.BeatmapMetadata.Source; - tags.Text = BeatmapSet.BeatmapMetadata.Tags; + source.Text = BeatmapSet.Metadata.Source; + tags.Text = BeatmapSet.Metadata.Tags; } } diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 8d3d91fcd2..1675a2f663 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -66,13 +66,13 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.TitleUnicode, SetInfo.BeatmapMetadata.Title), + Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { - Text = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.ArtistUnicode, SetInfo.BeatmapMetadata.Artist), + Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Font = @"Exo2.0-BoldItalic", }, }, @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Direct }, new OsuSpriteText { - Text = SetInfo.BeatmapMetadata.Author, + Text = SetInfo.Metadata.Author, TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", Shadow = false, @@ -132,11 +132,11 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = $"from {SetInfo.BeatmapMetadata.Source}", + Text = $"from {SetInfo.Metadata.Source}", TextSize = 14, Shadow = false, Colour = colours.Gray5, - Alpha = string.IsNullOrEmpty(SetInfo.BeatmapMetadata.Source) ? 0f : 1f, + Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, }, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index b46ce78654..6702b7394c 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -54,13 +54,13 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Current = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.TitleUnicode, SetInfo.BeatmapMetadata.Title), + Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { - Current = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.ArtistUnicode, SetInfo.BeatmapMetadata.Artist), + Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Font = @"Exo2.0-BoldItalic", }, new FillFlowContainer @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Direct }, new OsuSpriteText { - Text = SetInfo.BeatmapMetadata.Author, + Text = SetInfo.Metadata.Author, TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", }, @@ -109,11 +109,11 @@ namespace osu.Game.Overlays.Direct }, new OsuSpriteText { - Text = $"from {SetInfo.BeatmapMetadata.Source}", + Text = $"from {SetInfo.Metadata.Source}", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 14, - Alpha = string.IsNullOrEmpty(SetInfo.BeatmapMetadata.Source) ? 0f : 1f, + Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, }, diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index df08400ee9..dd2b6613ca 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -57,9 +57,9 @@ namespace osu.Game.Overlays var tags = new List(); foreach (var s in beatmapSets) { - artists.Add(s.BeatmapMetadata.Artist); - songs.Add(s.BeatmapMetadata.Title); - tags.AddRange(s.BeatmapMetadata.Tags.Split(' ')); + artists.Add(s.Metadata.Artist); + songs.Add(s.Metadata.Title); + tags.AddRange(s.Metadata.Tags.Split(' ')); } ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags)); diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 6a8476dddd..723b3f4e96 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Music hoverColour = colours.Yellow; artistColour = colours.Gray9; - var metadata = BeatmapSetInfo.BeatmapMetadata; + var metadata = BeatmapSetInfo.Metadata; FilterTerms = metadata.SearchableTerms; Children = new Drawable[] diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs index 9c51e1e66a..48b3ef23cb 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/RulesetInfo.cs @@ -2,13 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace osu.Game.Rulesets { public class RulesetInfo : IEquatable { - [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int? Id { get; set; } public string Name { get; set; } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 0e784c06af..729df02ffd 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -172,11 +172,11 @@ namespace osu.Game.Rulesets.UI // Apply difficulty adjustments from mods before using Difficulty. foreach (var mod in Mods.OfType()) - mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BeatmapDifficulty); + mod.ApplyToDifficulty(Beatmap.BeatmapInfo.Difficulty); // Apply defaults foreach (var h in Beatmap.HitObjects) - h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BeatmapDifficulty); + h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty); // Post-process the beatmap processor.PostProcess(Beatmap); diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index f3d648e07b..d2f88224c2 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -230,7 +230,7 @@ namespace osu.Game.Screens.Multiplayer coverContainer.FadeIn(transition_duration); coverContainer.Children = new[] { - new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo) + new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -239,9 +239,9 @@ namespace osu.Game.Screens.Multiplayer }) { 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 = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist); + beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index aabbd2be5f..66ce51b428 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -331,7 +331,7 @@ namespace osu.Game.Screens.Multiplayer coverContainer.FadeIn(transition_duration); coverContainer.Children = new[] { - new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo) + new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -341,10 +341,10 @@ namespace osu.Game.Screens.Multiplayer }) { 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 = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist); - beatmapAuthor.Text = $"mapped by {value.BeatmapMetadata.Author}"; + beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); + beatmapAuthor.Text = $"mapped by {value.Metadata.Author}"; } else { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9b0172a1b2..57d6d7f248 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -99,18 +99,18 @@ namespace osu.Game.Screens.Play if (beatmap == null) throw new InvalidOperationException("Beatmap was not loaded"); - ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.RulesetInfo; + ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset; var rulesetInstance = ruleset.CreateInstance(); try { - RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.RulesetInfo.Id); + RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.Ruleset.Id); } catch (BeatmapInvalidForRulesetException) { // 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. - ruleset = beatmap.BeatmapInfo.RulesetInfo; + ruleset = beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true); } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 92369c4f29..9366797f47 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -177,7 +177,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(LocalisationEngine localisation) { - var metadata = beatmap?.BeatmapInfo?.BeatmapMetadata ?? new BeatmapMetadata(); + var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata(); AutoSizeAxes = Axes.Both; Children = new Drawable[] diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 694391a5ff..b01410cff5 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -324,9 +324,9 @@ namespace osu.Game.Screens.Ranking title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; - versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.BeatmapMetadata.Author}"; - title.Current = localisation.GetUnicodePreference(beatmap.BeatmapMetadata.TitleUnicode, beatmap.BeatmapMetadata.Title); - artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapMetadata.ArtistUnicode, beatmap.BeatmapMetadata.Artist); + versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}"; + title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); + artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } } diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 0c31f51c2b..0e0abc001a 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -118,7 +118,7 @@ namespace osu.Game.Screens.Select internal void UpdateBeatmap(BeatmapInfo beatmap) { // 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. 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) { - if (b.BeatmapMetadata == null) - b.BeatmapMetadata = beatmapSet.BeatmapMetadata; + if (b.Metadata == null) + b.Metadata = beatmapSet.Metadata; } return new BeatmapGroup(beatmapSet, manager) diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index 7bd50e1fea..aa37705cdf 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select public BeatmapDeleteDialog(BeatmapSetInfo beatmap) { - BodyText = $@"{beatmap.BeatmapMetadata?.Artist} - {beatmap.BeatmapMetadata?.Title}"; + BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; Icon = FontAwesome.fa_trash_o; HeaderText = @"Confirm deletion of"; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 9d8c76c1fe..a98362e89c 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -188,8 +188,8 @@ namespace osu.Game.Screens.Select ratingsContainer.FadeIn(transition_duration); advanced.Beatmap = Beatmap; description.Text = Beatmap.Version; - source.Text = Beatmap.BeatmapMetadata.Source; - tags.Text = Beatmap.BeatmapMetadata.Tags; + source.Text = Beatmap.Metadata.Source; + tags.Text = Beatmap.Metadata.Tags; var requestedBeatmap = Beatmap; if (requestedBeatmap.Metrics == null) @@ -264,7 +264,7 @@ namespace osu.Game.Screens.Select advanced.Beatmap = new BeatmapInfo { StarDifficulty = 0, - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { CircleSize = 0, DrainRate = 0, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index a940c49b07..76c384b84c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -90,7 +90,7 @@ namespace osu.Game.Screens.Select public BufferedWedgeInfo(WorkingBeatmap beatmap) { BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - BeatmapMetadata metadata = beatmapInfo.BeatmapMetadata ?? beatmap.BeatmapSetInfo?.BeatmapMetadata ?? new BeatmapMetadata(); + BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); List labels = new List(); @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Select })); //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; diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 551f67c51b..e55642431c 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -29,20 +29,20 @@ namespace osu.Game.Screens.Select.Details beatmap = value; //mania specific - if ((Beatmap?.RulesetInfo?.Id ?? 0) == 3) + if ((Beatmap?.Ruleset?.Id ?? 0) == 3) { firstValue.Title = "Key Amount"; - firstValue.Value = (int)Math.Round(Beatmap?.BeatmapDifficulty?.CircleSize ?? 0); + firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0); } else { firstValue.Title = "Circle Size"; - firstValue.Value = Beatmap?.BeatmapDifficulty?.CircleSize ?? 0; + firstValue.Value = Beatmap?.Difficulty?.CircleSize ?? 0; } - hpDrain.Value = beatmap.BeatmapDifficulty?.DrainRate ?? 0; - accuracy.Value = beatmap.BeatmapDifficulty?.OverallDifficulty ?? 0; - approachRate.Value = beatmap.BeatmapDifficulty?.ApproachRate ?? 0; + hpDrain.Value = beatmap.Difficulty?.DrainRate ?? 0; + accuracy.Value = beatmap.Difficulty?.OverallDifficulty ?? 0; + approachRate.Value = beatmap.Difficulty?.ApproachRate ?? 0; starDifficulty.Value = (float)beatmap.StarDifficulty; } } diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index f0bf6c94e7..7ce00422a5 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select bool match = hasCurrentMode; 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) { @@ -45,13 +45,13 @@ namespace osu.Game.Screens.Select { default: 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; 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; 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; case SortMode.Difficulty: groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty)); @@ -59,4 +59,4 @@ namespace osu.Game.Screens.Select } } } -} \ No newline at end of file +} diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index bad31ee55a..59cbe74650 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -37,7 +37,7 @@ namespace osu.Game.Storyboards /// public bool ReplacesBackground(BeatmapInfo beatmapInfo) { - var backgroundPath = beatmapInfo.BeatmapSetInfo?.BeatmapMetadata?.BackgroundFile?.ToLowerInvariant(); + var backgroundPath = beatmapInfo.BeatmapSet?.Metadata?.BackgroundFile?.ToLowerInvariant(); if (backgroundPath == null) return false; diff --git a/osu.Game/Tests/Visual/TestCaseBeatmapDetails.cs b/osu.Game/Tests/Visual/TestCaseBeatmapDetails.cs index e126980edf..cd4d97425b 100644 --- a/osu.Game/Tests/Visual/TestCaseBeatmapDetails.cs +++ b/osu.Game/Tests/Visual/TestCaseBeatmapDetails.cs @@ -24,12 +24,12 @@ namespace osu.Game.Tests.Visual AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo { Version = "All Metrics", - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has all the metrics", }, - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { CircleSize = 7, DrainRate = 1, @@ -48,12 +48,12 @@ namespace osu.Game.Tests.Visual AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo { Version = "Only Ratings", - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has ratings metrics but not retries or fails", }, - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { CircleSize = 6, DrainRate = 9, @@ -70,12 +70,12 @@ namespace osu.Game.Tests.Visual AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo { Version = "Only Retries and Fails", - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has retries and fails but no ratings", }, - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { CircleSize = 3.7f, DrainRate = 6, @@ -93,12 +93,12 @@ namespace osu.Game.Tests.Visual AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo { Version = "No Metrics", - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has no metrics", }, - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { CircleSize = 5, DrainRate = 5, diff --git a/osu.Game/Tests/Visual/TestCaseBeatmapSetOverlay.cs b/osu.Game/Tests/Visual/TestCaseBeatmapSetOverlay.cs index e8027978b4..76ed9979ca 100644 --- a/osu.Game/Tests/Visual/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game/Tests/Visual/TestCaseBeatmapSetOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual { overlay.ShowBeatmapSet(new BeatmapSetInfo { - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Title = @"Lachryma ", Artist = @"Kaneko Chiharu", @@ -64,8 +64,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 1.36, Version = @"BASIC", - RulesetInfo = mania, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = mania, + Difficulty = new BeatmapDifficulty { CircleSize = 4, DrainRate = 6.5f, @@ -92,8 +92,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 2.22, Version = @"NOVICE", - RulesetInfo = mania, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = mania, + Difficulty = new BeatmapDifficulty { CircleSize = 4, DrainRate = 7, @@ -120,8 +120,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 3.49, Version = @"ADVANCED", - RulesetInfo = mania, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = mania, + Difficulty = new BeatmapDifficulty { CircleSize = 4, DrainRate = 7.5f, @@ -148,8 +148,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 4.24, Version = @"EXHAUST", - RulesetInfo = mania, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = mania, + Difficulty = new BeatmapDifficulty { CircleSize = 4, DrainRate = 8, @@ -176,8 +176,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 5.26, Version = @"GRAVITY", - RulesetInfo = mania, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = mania, + Difficulty = new BeatmapDifficulty { CircleSize = 4, DrainRate = 8.5f, @@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual { overlay.ShowBeatmapSet(new BeatmapSetInfo { - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Title = @"Soumatou Labyrinth", Artist = @"Yunomi with Momobako&miko", @@ -238,8 +238,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 1.40, Version = @"yzrin's Kantan", - RulesetInfo = taiko, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = taiko, + Difficulty = new BeatmapDifficulty { CircleSize = 2, DrainRate = 7, @@ -266,8 +266,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 2.23, Version = @"Futsuu", - RulesetInfo = taiko, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = taiko, + Difficulty = new BeatmapDifficulty { CircleSize = 2, DrainRate = 6, @@ -294,8 +294,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 3.19, Version = @"Muzukashii", - RulesetInfo = taiko, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = taiko, + Difficulty = new BeatmapDifficulty { CircleSize = 2, DrainRate = 6, @@ -322,8 +322,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 3.97, Version = @"Charlotte's Oni", - RulesetInfo = taiko, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = taiko, + Difficulty = new BeatmapDifficulty { CircleSize = 5, DrainRate = 6, @@ -350,8 +350,8 @@ namespace osu.Game.Tests.Visual { StarDifficulty = 5.08, Version = @"Labyrinth Oni", - RulesetInfo = taiko, - BeatmapDifficulty = new BeatmapDifficulty + Ruleset = taiko, + Difficulty = new BeatmapDifficulty { CircleSize = 5, DrainRate = 5, diff --git a/osu.Game/Tests/Visual/TestCaseDirect.cs b/osu.Game/Tests/Visual/TestCaseDirect.cs index cb34d28578..36c329b7d0 100644 --- a/osu.Game/Tests/Visual/TestCaseDirect.cs +++ b/osu.Game/Tests/Visual/TestCaseDirect.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual new BeatmapSetInfo { BeatmapSetOnlineInfoId = 578332, - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Title = @"OrVid", Artist = @"An", @@ -65,16 +65,16 @@ namespace osu.Game.Tests.Visual { new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 5.35f, - BeatmapMetadata = new BeatmapMetadata(), + Metadata = new BeatmapMetadata(), }, }, }, new BeatmapSetInfo { BeatmapSetOnlineInfoId = 599627, - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Title = @"tiny lamp", Artist = @"fhana", @@ -97,16 +97,16 @@ namespace osu.Game.Tests.Visual { new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 5.81f, - BeatmapMetadata = new BeatmapMetadata(), + Metadata = new BeatmapMetadata(), }, }, }, new BeatmapSetInfo { BeatmapSetOnlineInfoId = 513268, - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Title = @"At Gwanghwamun", Artist = @"KYUHYUN", @@ -129,23 +129,23 @@ namespace osu.Game.Tests.Visual { new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 0.9f, - BeatmapMetadata = new BeatmapMetadata(), + Metadata = new BeatmapMetadata(), }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 1.1f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 2.02f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 3.49f, }, }, @@ -153,7 +153,7 @@ namespace osu.Game.Tests.Visual new BeatmapSetInfo { BeatmapSetOnlineInfoId = 586841, - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { Title = @"RHAPSODY OF BLUE SKY", Artist = @"fhana", @@ -176,43 +176,43 @@ namespace osu.Game.Tests.Visual { new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 1.26f, - BeatmapMetadata = new BeatmapMetadata(), + Metadata = new BeatmapMetadata(), }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 2.01f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 2.87f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 3.76f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 3.93f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 4.37f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 5.13f, }, new BeatmapInfo { - RulesetInfo = ruleset, + Ruleset = ruleset, StarDifficulty = 5.42f, }, }, diff --git a/osu.Game/Tests/Visual/TestCaseDrawableRoom.cs b/osu.Game/Tests/Visual/TestCaseDrawableRoom.cs index a57bf64c9a..7113bcbff5 100644 --- a/osu.Game/Tests/Visual/TestCaseDrawableRoom.cs +++ b/osu.Game/Tests/Visual/TestCaseDrawableRoom.cs @@ -43,13 +43,13 @@ namespace osu.Game.Tests.Visual Value = new BeatmapInfo { StarDifficulty = 4.65, - RulesetInfo = rulesets.GetRuleset(3), - BeatmapMetadata = new BeatmapMetadata + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata { Title = @"Critical Crystal", Artist = @"Seiryu", }, - BeatmapSetInfo = new BeatmapSetInfo + BeatmapSet = new BeatmapSetInfo { OnlineInfo = new BeatmapSetOnlineInfo { @@ -81,13 +81,13 @@ namespace osu.Game.Tests.Visual Value = new BeatmapInfo { StarDifficulty = 1.96, - RulesetInfo = rulesets.GetRuleset(0), - BeatmapMetadata = new BeatmapMetadata + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata { Title = @"Serendipity", Artist = @"ZAQ", }, - BeatmapSetInfo = new BeatmapSetInfo + BeatmapSet = new BeatmapSetInfo { OnlineInfo = new BeatmapSetOnlineInfo { diff --git a/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs index 12ac7240d6..d7e03d6251 100644 --- a/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs @@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual { BeatmapSetOnlineInfoId = 1234 + i, Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249", - BeatmapMetadata = new BeatmapMetadata + Metadata = new BeatmapMetadata { BeatmapSetOnlineInfoId = 1234 + i, // Create random metadata, then we can check if sorting works based on these @@ -75,10 +75,10 @@ namespace osu.Game.Tests.Visual new BeatmapInfo { BeatmapOnlineInfoId = 1234 + i, - RulesetInfo = rulesets.QueryRulesets().First(), + Ruleset = rulesets.QueryRulesets().First(), Path = "normal.osu", Version = "Normal", - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 3.5f, } @@ -86,10 +86,10 @@ namespace osu.Game.Tests.Visual new BeatmapInfo { BeatmapOnlineInfoId = 1235 + i, - RulesetInfo = rulesets.QueryRulesets().First(), + Ruleset = rulesets.QueryRulesets().First(), Path = "hard.osu", Version = "Hard", - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 5, } @@ -97,10 +97,10 @@ namespace osu.Game.Tests.Visual new BeatmapInfo { BeatmapOnlineInfoId = 1236 + i, - RulesetInfo = rulesets.QueryRulesets().First(), + Ruleset = rulesets.QueryRulesets().First(), Path = "insane.osu", Version = "Insane", - BeatmapDifficulty = new BeatmapDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 7, } diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 98c573f62c..721bfa4c91 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual { var beatmap = CreateBeatmap(); - beatmap.BeatmapInfo.RulesetInfo = r; + beatmap.BeatmapInfo.Ruleset = r; var instance = r.CreateInstance(); diff --git a/osu.Game/Tests/Visual/TestCaseRoomInspector.cs b/osu.Game/Tests/Visual/TestCaseRoomInspector.cs index 41b722841c..dd773b361a 100644 --- a/osu.Game/Tests/Visual/TestCaseRoomInspector.cs +++ b/osu.Game/Tests/Visual/TestCaseRoomInspector.cs @@ -32,14 +32,14 @@ namespace osu.Game.Tests.Visual Value = new BeatmapInfo { StarDifficulty = 3.7, - RulesetInfo = rulesets.GetRuleset(3), - BeatmapMetadata = new BeatmapMetadata + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata { Title = @"Platina", Artist = @"Maaya Sakamoto", Author = @"uwutm8", }, - BeatmapSetInfo = new BeatmapSetInfo + BeatmapSet = new BeatmapSetInfo { OnlineInfo = new BeatmapSetOnlineInfo { @@ -99,14 +99,14 @@ namespace osu.Game.Tests.Visual Value = new BeatmapInfo { StarDifficulty = 7.07, - RulesetInfo = rulesets.GetRuleset(0), - BeatmapMetadata = new BeatmapMetadata + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata { Title = @"FREEDOM DIVE", Artist = @"xi", Author = @"Nakagawa-Kanon", }, - BeatmapSetInfo = new BeatmapSetInfo + BeatmapSet = new BeatmapSetInfo { OnlineInfo = new BeatmapSetOnlineInfo { diff --git a/osu.Game/Tests/Visual/TestCaseScrollingPlayfield.cs b/osu.Game/Tests/Visual/TestCaseScrollingPlayfield.cs index 29623fb05f..d0761e5841 100644 --- a/osu.Game/Tests/Visual/TestCaseScrollingPlayfield.cs +++ b/osu.Game/Tests/Visual/TestCaseScrollingPlayfield.cs @@ -48,8 +48,8 @@ namespace osu.Game.Tests.Visual HitObjects = objects, BeatmapInfo = new BeatmapInfo { - BeatmapDifficulty = new BeatmapDifficulty(), - BeatmapMetadata = new BeatmapMetadata() + Difficulty = new BeatmapDifficulty(), + Metadata = new BeatmapMetadata() } };