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

Fix all remaining db structure issues

This commit is contained in:
Dean Herbert 2017-10-19 14:05:11 +09:00
parent 71d614b813
commit 5d5ea5fb2e
34 changed files with 259 additions and 309 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps
AuthorString = @"Unknown Creator", AuthorString = @"Unknown Creator",
}, },
Version = @"Normal", Version = @"Normal",
Difficulty = new BeatmapDifficulty() BaseDifficulty = new BeatmapDifficulty()
}; };
} }
} }

View File

@ -15,8 +15,6 @@ namespace osu.Game.Beatmaps
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; } public int ID { get; set; }
public int BeatmapInfoID { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY; public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY; public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY; public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;

View File

@ -20,7 +20,6 @@ namespace osu.Game.Beatmaps
public int BeatmapVersion; public int BeatmapVersion;
[JsonProperty("id")] [JsonProperty("id")]
[NotMapped]
public int? OnlineBeatmapID { get; set; } public int? OnlineBeatmapID { get; set; }
[JsonProperty("beatmapset_id")] [JsonProperty("beatmapset_id")]
@ -36,8 +35,7 @@ namespace osu.Game.Beatmaps
public int BaseDifficultyID { get; set; } public int BaseDifficultyID { get; set; }
[Required] public BeatmapDifficulty BaseDifficulty { get; set; }
public BeatmapDifficulty Difficulty { get; set; }
[NotMapped] [NotMapped]
public BeatmapMetrics Metrics { get; set; } public BeatmapMetrics Metrics { get; set; }
@ -55,7 +53,6 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.). /// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.).
/// </summary> /// </summary>
[NotMapped]
[JsonProperty("file_md5")] [JsonProperty("file_md5")]
public string MD5Hash { get; set; } public string MD5Hash { get; set; }

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -16,19 +17,14 @@ namespace osu.Game.Beatmaps
[NotMapped] [NotMapped]
public int? OnlineBeatmapSetID { get; set; } public int? OnlineBeatmapSetID { get; set; }
public int? BeatmapSetInfoID { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
public int? BeatmapInfoID { get; set; }
public BeatmapInfo BeatmapInfo { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string TitleUnicode { get; set; } public string TitleUnicode { get; set; }
public string Artist { get; set; } public string Artist { get; set; }
public string ArtistUnicode { get; set; } public string ArtistUnicode { get; set; }
public List<BeatmapInfo> Beatmaps { get; set; }
public List<BeatmapSetInfo> BeatmapSets { get; set; }
/// <summary> /// <summary>
/// Helper property to deserialize a username to <see cref="User"/>. /// Helper property to deserialize a username to <see cref="User"/>.
/// </summary> /// </summary>

View File

@ -137,7 +137,7 @@ namespace osu.Game.Beatmaps
public IEnumerable<BeatmapSetInfo> BeatmapSets => GetContext().BeatmapSetInfo public IEnumerable<BeatmapSetInfo> BeatmapSets => GetContext().BeatmapSetInfo
.Include(s => s.Metadata) .Include(s => s.Metadata)
.Include(s => s.Beatmaps).ThenInclude(s => s.Ruleset) .Include(s => s.Beatmaps).ThenInclude(s => s.Ruleset)
.Include(s => s.Beatmaps).ThenInclude(b => b.Difficulty) .Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata) .Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
.Include(s => s.Files).ThenInclude(f => f.FileInfo); .Include(s => s.Files).ThenInclude(f => f.FileInfo);
@ -145,6 +145,6 @@ namespace osu.Game.Beatmaps
.Include(b => b.BeatmapSet).ThenInclude(s => s.Metadata) .Include(b => b.BeatmapSet).ThenInclude(s => s.Metadata)
.Include(b => b.Metadata) .Include(b => b.Metadata)
.Include(b => b.Ruleset) .Include(b => b.Ruleset)
.Include(b => b.Difficulty); .Include(b => b.BaseDifficulty);
} }
} }

View File

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

View File

@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps
AuthorString = "no one", AuthorString = "no one",
}, },
BeatmapSet = new BeatmapSetInfo(), BeatmapSet = new BeatmapSetInfo(),
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
DrainRate = 0, DrainRate = 0,
CircleSize = 0, CircleSize = 0,

View File

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

View File

@ -196,7 +196,7 @@ namespace osu.Game.Beatmaps.Formats
{ {
var pair = splitKeyVal(line, ':'); var pair = splitKeyVal(line, ':');
var difficulty = beatmap.BeatmapInfo.Difficulty; var difficulty = beatmap.BeatmapInfo.BaseDifficulty;
switch (pair.Key) switch (pair.Key)
{ {
case @"HPDrainRate": case @"HPDrainRate":
@ -674,7 +674,7 @@ namespace osu.Game.Beatmaps.Formats
} }
foreach (var hitObject in beatmap.HitObjects) foreach (var hitObject in beatmap.HitObjects)
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty); hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
} }
private KeyValuePair<string, string> splitKeyVal(string line, char separator) private KeyValuePair<string, string> splitKeyVal(string line, char separator)

View File

@ -65,20 +65,22 @@ namespace osu.Game.Database
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);
modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.MD5Hash); modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.MD5Hash);
modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.Hash); modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.Hash);
modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.DeletePending); modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.DeletePending);
modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.Hash); modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.Hash);
modelBuilder.Entity<DatabasedKeyBinding>().HasIndex(b => b.Variant); modelBuilder.Entity<DatabasedKeyBinding>().HasIndex(b => b.Variant);
modelBuilder.Entity<DatabasedKeyBinding>().HasIndex(b => b.IntAction); modelBuilder.Entity<DatabasedKeyBinding>().HasIndex(b => b.IntAction);
modelBuilder.Entity<FileInfo>().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity<FileInfo>().HasIndex(b => b.Hash).IsUnique();
modelBuilder.Entity<FileInfo>().HasIndex(b => b.ReferenceCount); modelBuilder.Entity<FileInfo>().HasIndex(b => b.ReferenceCount);
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Name).IsUnique();
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.InstantiationInfo).IsUnique();
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Available); modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Available);
modelBuilder.Entity<BeatmapMetadata>().HasOne(m => m.BeatmapSetInfo).WithOne(s => s.Metadata).OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BaseDifficulty);
modelBuilder.Entity<BeatmapMetadata>().HasOne(m => m.BeatmapInfo).WithOne(b => b.Metadata).OnDelete(DeleteBehavior.Cascade);
} }
private class OsuDbLoggerFactory : ILoggerFactory private class OsuDbLoggerFactory : ILoggerFactory

View File

@ -10,7 +10,7 @@ using System;
namespace osu.Game.Migrations namespace osu.Game.Migrations
{ {
[DbContext(typeof(OsuDbContext))] [DbContext(typeof(OsuDbContext))]
[Migration("20171018125509_InitialCreate")] [Migration("20171019041408_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -26,8 +26,6 @@ namespace osu.Game.Migrations
b.Property<float>("ApproachRate"); b.Property<float>("ApproachRate");
b.Property<int>("BeatmapInfoID");
b.Property<float>("CircleSize"); b.Property<float>("CircleSize");
b.Property<float>("DrainRate"); b.Property<float>("DrainRate");
@ -40,9 +38,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoID")
.IsUnique();
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
@ -73,6 +68,10 @@ namespace osu.Game.Migrations
b.Property<string>("MD5Hash"); b.Property<string>("MD5Hash");
b.Property<int?>("MetadataID");
b.Property<int?>("OnlineBeatmapID");
b.Property<string>("Path"); b.Property<string>("Path");
b.Property<int>("RulesetID"); b.Property<int>("RulesetID");
@ -93,12 +92,16 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BaseDifficultyID");
b.HasIndex("BeatmapSetInfoID"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("Hash"); b.HasIndex("Hash");
b.HasIndex("MD5Hash"); b.HasIndex("MD5Hash");
b.HasIndex("MetadataID");
b.HasIndex("RulesetID"); b.HasIndex("RulesetID");
b.ToTable("BeatmapInfo"); b.ToTable("BeatmapInfo");
@ -120,10 +123,6 @@ namespace osu.Game.Migrations
b.Property<string>("BackgroundFile"); b.Property<string>("BackgroundFile");
b.Property<int?>("BeatmapInfoID");
b.Property<int?>("BeatmapSetInfoID");
b.Property<int>("PreviewTime"); b.Property<int>("PreviewTime");
b.Property<string>("Source"); b.Property<string>("Source");
@ -136,12 +135,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoID")
.IsUnique();
b.HasIndex("BeatmapSetInfoID")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
@ -175,6 +168,8 @@ namespace osu.Game.Migrations
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<int?>("MetadataID");
b.Property<int?>("OnlineBeatmapSetID"); b.Property<int?>("OnlineBeatmapSetID");
b.Property<bool>("Protected"); b.Property<bool>("Protected");
@ -185,6 +180,8 @@ namespace osu.Game.Migrations
b.HasIndex("Hash"); b.HasIndex("Hash");
b.HasIndex("MetadataID");
b.ToTable("BeatmapSetInfo"); b.ToTable("BeatmapSetInfo");
}); });
@ -246,49 +243,31 @@ namespace osu.Game.Migrations
b.HasIndex("Available"); b.HasIndex("Available");
b.HasIndex("InstantiationInfo")
.IsUnique();
b.HasIndex("Name")
.IsUnique();
b.ToTable("RulesetInfo"); b.ToTable("RulesetInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapInfo")
.WithOne("Difficulty")
.HasForeignKey("osu.Game.Beatmaps.BeatmapDifficulty", "BeatmapInfoID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty")
.WithMany()
.HasForeignKey("BaseDifficultyID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
.WithMany("Beatmaps") .WithMany("Beatmaps")
.HasForeignKey("BeatmapSetInfoID") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany("Beatmaps")
.HasForeignKey("MetadataID");
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
.WithMany() .WithMany()
.HasForeignKey("RulesetID") .HasForeignKey("RulesetID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "BeatmapInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSetInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
@ -301,6 +280,13 @@ namespace osu.Game.Migrations
.HasForeignKey("FileInfoID") .HasForeignKey("FileInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany("BeatmapSets")
.HasForeignKey("MetadataID");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@ -9,19 +9,43 @@ namespace osu.Game.Migrations
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapSetInfo", name: "BeatmapDifficulty",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false), ApproachRate = table.Column<float>(type: "REAL", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true), CircleSize = table.Column<float>(type: "REAL", nullable: false),
OnlineBeatmapSetID = table.Column<int>(type: "INTEGER", nullable: true), DrainRate = table.Column<float>(type: "REAL", nullable: false),
Protected = table.Column<bool>(type: "INTEGER", nullable: false) OverallDifficulty = table.Column<float>(type: "REAL", nullable: false),
SliderMultiplier = table.Column<float>(type: "REAL", nullable: false),
SliderTickRate = table.Column<float>(type: "REAL", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID); table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapMetadata",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Artist = table.Column<string>(type: "TEXT", nullable: true),
ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true),
AudioFile = table.Column<string>(type: "TEXT", nullable: true),
Author = table.Column<string>(type: "TEXT", nullable: true),
BackgroundFile = table.Column<string>(type: "TEXT", nullable: true),
PreviewTime = table.Column<int>(type: "INTEGER", nullable: false),
Source = table.Column<string>(type: "TEXT", nullable: true),
Tags = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: true),
TitleUnicode = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -69,6 +93,87 @@ namespace osu.Game.Migrations
table.PrimaryKey("PK_RulesetInfo", x => x.ID); table.PrimaryKey("PK_RulesetInfo", x => x.ID);
}); });
migrationBuilder.CreateTable(
name: "BeatmapSetInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
OnlineBeatmapSetID = table.Column<int>(type: "INTEGER", nullable: true),
Protected = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "BeatmapInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AudioLeadIn = table.Column<int>(type: "INTEGER", nullable: false),
BaseDifficultyID = table.Column<int>(type: "INTEGER", nullable: false),
BeatDivisor = table.Column<int>(type: "INTEGER", nullable: false),
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
Countdown = table.Column<bool>(type: "INTEGER", nullable: false),
DistanceSpacing = table.Column<double>(type: "REAL", nullable: false),
GridSize = table.Column<int>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
Hidden = table.Column<bool>(type: "INTEGER", nullable: false),
LetterboxInBreaks = table.Column<bool>(type: "INTEGER", nullable: false),
MD5Hash = table.Column<string>(type: "TEXT", nullable: true),
MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
OnlineBeatmapID = table.Column<int>(type: "INTEGER", nullable: true),
Path = table.Column<string>(type: "TEXT", nullable: true),
RulesetID = table.Column<int>(type: "INTEGER", nullable: false),
SpecialStyle = table.Column<bool>(type: "INTEGER", nullable: false),
StackLeniency = table.Column<float>(type: "REAL", nullable: false),
StarDifficulty = table.Column<double>(type: "REAL", nullable: false),
StoredBookmarks = table.Column<string>(type: "TEXT", nullable: true),
TimelineZoom = table.Column<double>(type: "REAL", nullable: false),
Version = table.Column<string>(type: "TEXT", nullable: true),
WidescreenStoryboard = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapDifficulty_BaseDifficultyID",
column: x => x.BaseDifficultyID,
principalTable: "BeatmapDifficulty",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetID,
principalTable: "RulesetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapSetFileInfo", name: "BeatmapSetFileInfo",
columns: table => new columns: table => new
@ -96,116 +201,10 @@ namespace osu.Game.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "BeatmapInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AudioLeadIn = table.Column<int>(type: "INTEGER", nullable: false),
BaseDifficultyID = table.Column<int>(type: "INTEGER", nullable: false),
BeatDivisor = table.Column<int>(type: "INTEGER", nullable: false),
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
Countdown = table.Column<bool>(type: "INTEGER", nullable: false),
DistanceSpacing = table.Column<double>(type: "REAL", nullable: false),
GridSize = table.Column<int>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
Hidden = table.Column<bool>(type: "INTEGER", nullable: false),
LetterboxInBreaks = table.Column<bool>(type: "INTEGER", nullable: false),
MD5Hash = table.Column<string>(type: "TEXT", nullable: true),
Path = table.Column<string>(type: "TEXT", nullable: true),
RulesetID = table.Column<int>(type: "INTEGER", nullable: false),
SpecialStyle = table.Column<bool>(type: "INTEGER", nullable: false),
StackLeniency = table.Column<float>(type: "REAL", nullable: false),
StarDifficulty = table.Column<double>(type: "REAL", nullable: false),
StoredBookmarks = table.Column<string>(type: "TEXT", nullable: true),
TimelineZoom = table.Column<double>(type: "REAL", nullable: false),
Version = table.Column<string>(type: "TEXT", nullable: true),
WidescreenStoryboard = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetID,
principalTable: "RulesetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BeatmapDifficulty",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ApproachRate = table.Column<float>(type: "REAL", nullable: false),
BeatmapInfoID = table.Column<int>(type: "INTEGER", nullable: false),
CircleSize = table.Column<float>(type: "REAL", nullable: false),
DrainRate = table.Column<float>(type: "REAL", nullable: false),
OverallDifficulty = table.Column<float>(type: "REAL", nullable: false),
SliderMultiplier = table.Column<float>(type: "REAL", nullable: false),
SliderTickRate = table.Column<float>(type: "REAL", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapDifficulty_BeatmapInfo_BeatmapInfoID",
column: x => x.BeatmapInfoID,
principalTable: "BeatmapInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BeatmapMetadata",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Artist = table.Column<string>(type: "TEXT", nullable: true),
ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true),
AudioFile = table.Column<string>(type: "TEXT", nullable: true),
Author = table.Column<string>(type: "TEXT", nullable: true),
BackgroundFile = table.Column<string>(type: "TEXT", nullable: true),
BeatmapInfoID = table.Column<int>(type: "INTEGER", nullable: true),
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: true),
PreviewTime = table.Column<int>(type: "INTEGER", nullable: false),
Source = table.Column<string>(type: "TEXT", nullable: true),
Tags = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: true),
TitleUnicode = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapMetadata_BeatmapInfo_BeatmapInfoID",
column: x => x.BeatmapInfoID,
principalTable: "BeatmapInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapMetadata_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapDifficulty_BeatmapInfoID", name: "IX_BeatmapInfo_BaseDifficultyID",
table: "BeatmapDifficulty", table: "BeatmapInfo",
column: "BeatmapInfoID", column: "BaseDifficultyID");
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_BeatmapSetInfoID", name: "IX_BeatmapInfo_BeatmapSetInfoID",
@ -222,23 +221,16 @@ namespace osu.Game.Migrations
table: "BeatmapInfo", table: "BeatmapInfo",
column: "MD5Hash"); column: "MD5Hash");
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MetadataID",
table: "BeatmapInfo",
column: "MetadataID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_RulesetID", name: "IX_BeatmapInfo_RulesetID",
table: "BeatmapInfo", table: "BeatmapInfo",
column: "RulesetID"); column: "RulesetID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapMetadata_BeatmapInfoID",
table: "BeatmapMetadata",
column: "BeatmapInfoID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BeatmapMetadata_BeatmapSetInfoID",
table: "BeatmapMetadata",
column: "BeatmapSetInfoID",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID", name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID",
table: "BeatmapSetFileInfo", table: "BeatmapSetFileInfo",
@ -259,6 +251,11 @@ namespace osu.Game.Migrations
table: "BeatmapSetInfo", table: "BeatmapSetInfo",
column: "Hash"); column: "Hash");
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_MetadataID",
table: "BeatmapSetInfo",
column: "MetadataID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_FileInfo_Hash", name: "IX_FileInfo_Hash",
table: "FileInfo", table: "FileInfo",
@ -284,27 +281,12 @@ namespace osu.Game.Migrations
name: "IX_RulesetInfo_Available", name: "IX_RulesetInfo_Available",
table: "RulesetInfo", table: "RulesetInfo",
column: "Available"); column: "Available");
migrationBuilder.CreateIndex(
name: "IX_RulesetInfo_InstantiationInfo",
table: "RulesetInfo",
column: "InstantiationInfo",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RulesetInfo_Name",
table: "RulesetInfo",
column: "Name",
unique: true);
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapDifficulty"); name: "BeatmapInfo");
migrationBuilder.DropTable(
name: "BeatmapMetadata");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapSetFileInfo"); name: "BeatmapSetFileInfo");
@ -313,16 +295,19 @@ namespace osu.Game.Migrations
name: "KeyBinding"); name: "KeyBinding");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapInfo"); name: "BeatmapDifficulty");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "FileInfo"); name: "RulesetInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapSetInfo"); name: "BeatmapSetInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RulesetInfo"); name: "FileInfo");
migrationBuilder.DropTable(
name: "BeatmapMetadata");
} }
} }
} }

View File

@ -25,8 +25,6 @@ namespace osu.Game.Migrations
b.Property<float>("ApproachRate"); b.Property<float>("ApproachRate");
b.Property<int>("BeatmapInfoID");
b.Property<float>("CircleSize"); b.Property<float>("CircleSize");
b.Property<float>("DrainRate"); b.Property<float>("DrainRate");
@ -39,9 +37,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoID")
.IsUnique();
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
@ -72,6 +67,10 @@ namespace osu.Game.Migrations
b.Property<string>("MD5Hash"); b.Property<string>("MD5Hash");
b.Property<int?>("MetadataID");
b.Property<int?>("OnlineBeatmapID");
b.Property<string>("Path"); b.Property<string>("Path");
b.Property<int>("RulesetID"); b.Property<int>("RulesetID");
@ -92,12 +91,16 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BaseDifficultyID");
b.HasIndex("BeatmapSetInfoID"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("Hash"); b.HasIndex("Hash");
b.HasIndex("MD5Hash"); b.HasIndex("MD5Hash");
b.HasIndex("MetadataID");
b.HasIndex("RulesetID"); b.HasIndex("RulesetID");
b.ToTable("BeatmapInfo"); b.ToTable("BeatmapInfo");
@ -119,10 +122,6 @@ namespace osu.Game.Migrations
b.Property<string>("BackgroundFile"); b.Property<string>("BackgroundFile");
b.Property<int?>("BeatmapInfoID");
b.Property<int?>("BeatmapSetInfoID");
b.Property<int>("PreviewTime"); b.Property<int>("PreviewTime");
b.Property<string>("Source"); b.Property<string>("Source");
@ -135,12 +134,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoID")
.IsUnique();
b.HasIndex("BeatmapSetInfoID")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
@ -174,6 +167,8 @@ namespace osu.Game.Migrations
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<int?>("MetadataID");
b.Property<int?>("OnlineBeatmapSetID"); b.Property<int?>("OnlineBeatmapSetID");
b.Property<bool>("Protected"); b.Property<bool>("Protected");
@ -184,6 +179,8 @@ namespace osu.Game.Migrations
b.HasIndex("Hash"); b.HasIndex("Hash");
b.HasIndex("MetadataID");
b.ToTable("BeatmapSetInfo"); b.ToTable("BeatmapSetInfo");
}); });
@ -245,49 +242,31 @@ namespace osu.Game.Migrations
b.HasIndex("Available"); b.HasIndex("Available");
b.HasIndex("InstantiationInfo")
.IsUnique();
b.HasIndex("Name")
.IsUnique();
b.ToTable("RulesetInfo"); b.ToTable("RulesetInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapInfo")
.WithOne("Difficulty")
.HasForeignKey("osu.Game.Beatmaps.BeatmapDifficulty", "BeatmapInfoID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty")
.WithMany()
.HasForeignKey("BaseDifficultyID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
.WithMany("Beatmaps") .WithMany("Beatmaps")
.HasForeignKey("BeatmapSetInfoID") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany("Beatmaps")
.HasForeignKey("MetadataID");
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
.WithMany() .WithMany()
.HasForeignKey("RulesetID") .HasForeignKey("RulesetID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "BeatmapInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSetInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
@ -300,6 +279,13 @@ namespace osu.Game.Migrations
.HasForeignKey("FileInfoID") .HasForeignKey("FileInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany("BeatmapSets")
.HasForeignKey("MetadataID");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

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

View File

@ -264,7 +264,7 @@ namespace osu.Game.Screens.Select
advanced.Beatmap = new BeatmapInfo advanced.Beatmap = new BeatmapInfo
{ {
StarDifficulty = 0, StarDifficulty = 0,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 0, CircleSize = 0,
DrainRate = 0, DrainRate = 0,

View File

@ -32,17 +32,17 @@ namespace osu.Game.Screens.Select.Details
if ((Beatmap?.Ruleset?.ID ?? 0) == 3) if ((Beatmap?.Ruleset?.ID ?? 0) == 3)
{ {
firstValue.Title = "Key Amount"; firstValue.Title = "Key Amount";
firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0); firstValue.Value = (int)Math.Round(Beatmap?.BaseDifficulty?.CircleSize ?? 0);
} }
else else
{ {
firstValue.Title = "Circle Size"; firstValue.Title = "Circle Size";
firstValue.Value = Beatmap?.Difficulty?.CircleSize ?? 0; firstValue.Value = Beatmap?.BaseDifficulty?.CircleSize ?? 0;
} }
hpDrain.Value = beatmap.Difficulty?.DrainRate ?? 0; hpDrain.Value = beatmap.BaseDifficulty?.DrainRate ?? 0;
accuracy.Value = beatmap.Difficulty?.OverallDifficulty ?? 0; accuracy.Value = beatmap.BaseDifficulty?.OverallDifficulty ?? 0;
approachRate.Value = beatmap.Difficulty?.ApproachRate ?? 0; approachRate.Value = beatmap.BaseDifficulty?.ApproachRate ?? 0;
starDifficulty.Value = (float)beatmap.StarDifficulty; starDifficulty.Value = (float)beatmap.StarDifficulty;
} }
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has all the metrics", Tags = "this beatmap has all the metrics",
}, },
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 7, CircleSize = 7,
DrainRate = 1, DrainRate = 1,
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has ratings metrics but not retries or fails", Tags = "this beatmap has ratings metrics but not retries or fails",
}, },
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 6, CircleSize = 6,
DrainRate = 9, DrainRate = 9,
@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has retries and fails but no ratings", Tags = "this beatmap has retries and fails but no ratings",
}, },
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 3.7f, CircleSize = 3.7f,
DrainRate = 6, DrainRate = 6,
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual
Source = "osu!lazer", Source = "osu!lazer",
Tags = "this beatmap has no metrics", Tags = "this beatmap has no metrics",
}, },
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 5, CircleSize = 5,
DrainRate = 5, DrainRate = 5,

View File

@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 1.36, StarDifficulty = 1.36,
Version = @"BASIC", Version = @"BASIC",
Ruleset = mania, Ruleset = mania,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 6.5f, DrainRate = 6.5f,
@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 2.22, StarDifficulty = 2.22,
Version = @"NOVICE", Version = @"NOVICE",
Ruleset = mania, Ruleset = mania,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 7, DrainRate = 7,
@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 3.49, StarDifficulty = 3.49,
Version = @"ADVANCED", Version = @"ADVANCED",
Ruleset = mania, Ruleset = mania,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 7.5f, DrainRate = 7.5f,
@ -149,7 +149,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 4.24, StarDifficulty = 4.24,
Version = @"EXHAUST", Version = @"EXHAUST",
Ruleset = mania, Ruleset = mania,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 8, DrainRate = 8,
@ -177,7 +177,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 5.26, StarDifficulty = 5.26,
Version = @"GRAVITY", Version = @"GRAVITY",
Ruleset = mania, Ruleset = mania,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 4, CircleSize = 4,
DrainRate = 8.5f, DrainRate = 8.5f,
@ -239,7 +239,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 1.40, StarDifficulty = 1.40,
Version = @"yzrin's Kantan", Version = @"yzrin's Kantan",
Ruleset = taiko, Ruleset = taiko,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 2, CircleSize = 2,
DrainRate = 7, DrainRate = 7,
@ -267,7 +267,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 2.23, StarDifficulty = 2.23,
Version = @"Futsuu", Version = @"Futsuu",
Ruleset = taiko, Ruleset = taiko,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 2, CircleSize = 2,
DrainRate = 6, DrainRate = 6,
@ -295,7 +295,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 3.19, StarDifficulty = 3.19,
Version = @"Muzukashii", Version = @"Muzukashii",
Ruleset = taiko, Ruleset = taiko,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 2, CircleSize = 2,
DrainRate = 6, DrainRate = 6,
@ -323,7 +323,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 3.97, StarDifficulty = 3.97,
Version = @"Charlotte's Oni", Version = @"Charlotte's Oni",
Ruleset = taiko, Ruleset = taiko,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 5, CircleSize = 5,
DrainRate = 6, DrainRate = 6,
@ -351,7 +351,7 @@ namespace osu.Game.Tests.Visual
StarDifficulty = 5.08, StarDifficulty = 5.08,
Version = @"Labyrinth Oni", Version = @"Labyrinth Oni",
Ruleset = taiko, Ruleset = taiko,
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
CircleSize = 5, CircleSize = 5,
DrainRate = 5, DrainRate = 5,

View File

@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual
Ruleset = rulesets.AvailableRulesets.First(), Ruleset = rulesets.AvailableRulesets.First(),
Path = "normal.osu", Path = "normal.osu",
Version = "Normal", Version = "Normal",
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
OverallDifficulty = 3.5f, OverallDifficulty = 3.5f,
} }
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual
Ruleset = rulesets.AvailableRulesets.First(), Ruleset = rulesets.AvailableRulesets.First(),
Path = "hard.osu", Path = "hard.osu",
Version = "Hard", Version = "Hard",
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
OverallDifficulty = 5, OverallDifficulty = 5,
} }
@ -102,7 +102,7 @@ namespace osu.Game.Tests.Visual
Ruleset = rulesets.AvailableRulesets.First(), Ruleset = rulesets.AvailableRulesets.First(),
Path = "insane.osu", Path = "insane.osu",
Version = "Insane", Version = "Insane",
Difficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
{ {
OverallDifficulty = 7, OverallDifficulty = 7,
} }

View File

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

View File

@ -281,9 +281,9 @@
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
<Compile Include="Database\DatabaseContextFactory.cs" /> <Compile Include="Database\DatabaseContextFactory.cs" />
<Compile Include="Migrations\20171018125509_InitialCreate.cs" /> <Compile Include="Migrations\20171019041408_InitialCreate.cs" />
<Compile Include="Migrations\20171018125509_InitialCreate.designer.cs"> <Compile Include="Migrations\20171019041408_InitialCreate.designer.cs">
<DependentUpon>20171018125509_InitialCreate.cs</DependentUpon> <DependentUpon>20171019041408_InitialCreate.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" /> <Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />