1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +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;
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);

View File

@ -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;

View File

@ -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);

View File

@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Mania
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)
{
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);

View File

@ -88,18 +88,18 @@ namespace osu.Game.Rulesets.Mania.UI
protected override BeatmapConverter<ManiaHitObject> 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);

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
protected override void SimulateAutoplay(Beatmap<OsuHitObject> beatmap)
{
hpDrainRate = beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate;
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
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 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);

View File

@ -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<TaikoHitObject> 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
{

View File

@ -71,12 +71,12 @@ namespace osu.Game.Rulesets.Taiko.Scoring
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;
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)
{

View File

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

View File

@ -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));

View File

@ -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
}
}
}
}
}

View File

@ -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;
/// <summary>
/// The HitObjects this Beatmap contains.

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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
/// </summary>
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;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps
{
public class BeatmapInfo : IEquatable<BeatmapInfo>, 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
/// <summary>
/// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.).
/// </summary>
[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;
}
}

View File

@ -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<BeatmapInfo>(),
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;

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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; }

View File

@ -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]

View File

@ -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<BeatmapInfo> 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; }

View File

@ -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();
}

View File

@ -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

View File

@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Drawables
new ConstrainedIconContainer
{
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)
: 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;

View File

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

View File

@ -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<string, string> splitKeyVal(string line, char separator)

View File

@ -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();
}

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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; }

View File

@ -1,22 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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; }

View File

@ -51,4 +51,4 @@ namespace osu.Game.Input.Bindings
KeyBindings = store.Query(ruleset?.Id, variant);
}
}
}
}

View File

@ -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
{

View File

@ -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();

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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,
},
},
},

View File

@ -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,
},
},
},

View File

@ -57,9 +57,9 @@ namespace osu.Game.Overlays
var tags = new List<string>();
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));

View File

@ -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[]

View File

@ -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<RulesetInfo>
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int? Id { 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.
foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
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);

View File

@ -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
{

View File

@ -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
{

View File

@ -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);
}

View File

@ -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[]

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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";

View File

@ -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,

View File

@ -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<InfoLabel> labels = new List<InfoLabel>();
@ -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;

View File

@ -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;
}
}

View File

@ -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
}
}
}
}
}

View File

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

View File

@ -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,

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual
{
overlay.ShowBeatmapSet(new BeatmapSetInfo
{
BeatmapMetadata = new BeatmapMetadata
Metadata = new BeatmapMetadata
{
Title = @"Lachryma <Re:QueenM>",
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,

View File

@ -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,
},
},

View File

@ -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
{

View File

@ -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,
}

View File

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

View File

@ -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
{

View File

@ -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()
}
};