Initial EF Core commit

This commit is contained in:
TocoToucan
2017-10-04 22:52:12 +03:00
parent de840a5c9e
commit 6a4198d0d6
93 changed files with 730 additions and 708 deletions

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu
{
var sets = beatmaps.GetAllUsableBeatmapSets(false);
if (sets.Count > 0)
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
setInfo = beatmaps.QueryBeatmapSet(s => s.Id == sets[RNG.Next(0, sets.Count - 1)].Id);
}
if (setInfo == null)

View File

@ -230,7 +230,7 @@ namespace osu.Game.Screens.Multiplayer
coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
{
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -239,9 +239,9 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both },
};
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapTitle.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.TitleUnicode, value.BeatmapMetadata.Title);
beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.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.BeatmapSet)
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
@ -341,10 +341,10 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both },
};
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapTitle.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.TitleUnicode, value.BeatmapMetadata.Title);
beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
beatmapAuthor.Text = $"mapped by {value.Metadata.Author}";
beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist);
beatmapAuthor.Text = $"mapped by {value.BeatmapMetadata.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.Ruleset;
ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.RulesetInfo;
var rulesetInstance = ruleset.CreateInstance();
try
{
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID);
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.RulesetInfo.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.Ruleset;
ruleset = beatmap.BeatmapInfo.RulesetInfo;
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?.Metadata ?? new BeatmapMetadata();
var metadata = beatmap?.BeatmapInfo?.BeatmapMetadata ?? 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.Metadata.Author}";
title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
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);
}
}

View File

@ -113,15 +113,15 @@ namespace osu.Game.Screens.Select
});
}
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID));
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.Id == beatmapSet.Id));
internal void UpdateBeatmap(BeatmapInfo beatmap)
{
// todo: this method should not run more than once for the same BeatmapSetInfo.
var set = manager.Refresh(beatmap.BeatmapSet);
var set = manager.Refresh(beatmap.BeatmapSetInfo);
// todo: this method should be smarter as to not recreate panels that haven't changed, etc.
var group = groups.Find(b => b.BeatmapSet.ID == set.ID);
var group = groups.Find(b => b.BeatmapSet.Id == set.Id);
if (group == null)
return;
@ -141,7 +141,7 @@ namespace osu.Game.Screens.Select
if (selectedGroup == group && newGroup.BeatmapPanels.Count > 0)
{
var newSelection =
newGroup.BeatmapPanels.Find(p => p.Beatmap.ID == selectedPanel?.Beatmap.ID) ??
newGroup.BeatmapPanels.Find(p => p.Beatmap.Id == selectedPanel?.Beatmap.Id) ??
newGroup.BeatmapPanels[Math.Min(newGroup.BeatmapPanels.Count - 1, group.BeatmapPanels.IndexOf(selectedPanel))];
selectGroup(newGroup, newSelection);
@ -337,8 +337,8 @@ namespace osu.Game.Screens.Select
{
foreach (var b in beatmapSet.Beatmaps)
{
if (b.Metadata == null)
b.Metadata = beatmapSet.Metadata;
if (b.BeatmapMetadata == null)
b.BeatmapMetadata = beatmapSet.BeatmapMetadata;
}
return new BeatmapGroup(beatmapSet, manager)

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
public BeatmapDeleteDialog(BeatmapSetInfo beatmap)
{
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
BodyText = $@"{beatmap.BeatmapMetadata?.Artist} - {beatmap.BeatmapMetadata?.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.Metadata.Source;
tags.Text = Beatmap.Metadata.Tags;
source.Text = Beatmap.BeatmapMetadata.Source;
tags.Text = Beatmap.BeatmapMetadata.Tags;
var requestedBeatmap = Beatmap;
if (requestedBeatmap.Metrics == null)
@ -264,7 +264,7 @@ namespace osu.Game.Screens.Select
advanced.Beatmap = new BeatmapInfo
{
StarDifficulty = 0,
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = 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.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
BeatmapMetadata metadata = beatmapInfo.BeatmapMetadata ?? beatmap.BeatmapSetInfo?.BeatmapMetadata ?? 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.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
labels.AddRange(beatmapInfo.RulesetInfo.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?.Ruleset?.ID ?? 0) == 3)
if ((Beatmap?.RulesetInfo?.Id ?? 0) == 3)
{
firstValue.Title = "Key Amount";
firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0);
firstValue.Value = (int)Math.Round(Beatmap?.BeatmapDifficulty?.CircleSize ?? 0);
}
else
{
firstValue.Title = "Circle Size";
firstValue.Value = Beatmap?.Difficulty?.CircleSize ?? 0;
firstValue.Value = Beatmap?.BeatmapDifficulty?.CircleSize ?? 0;
}
hpDrain.Value = beatmap.Difficulty?.DrainRate ?? 0;
accuracy.Value = beatmap.Difficulty?.OverallDifficulty ?? 0;
approachRate.Value = beatmap.Difficulty?.ApproachRate ?? 0;
hpDrain.Value = beatmap.BeatmapDifficulty?.DrainRate ?? 0;
accuracy.Value = beatmap.BeatmapDifficulty?.OverallDifficulty ?? 0;
approachRate.Value = beatmap.BeatmapDifficulty?.ApproachRate ?? 0;
starDifficulty.Value = (float)beatmap.StarDifficulty;
}
}

View File

@ -23,12 +23,12 @@ namespace osu.Game.Screens.Select
{
var set = g.BeatmapSet;
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetInfoId == (Ruleset?.Id ?? 0));
bool match = hasCurrentMode;
if (!string.IsNullOrEmpty(SearchText))
match &= set.Metadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0);
match &= set.BeatmapMetadata.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.Metadata.Artist, y.BeatmapSet.Metadata.Artist, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Artist, y.BeatmapSet.BeatmapMetadata.Artist, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Title:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Title, y.BeatmapSet.BeatmapMetadata.Title, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Author:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Author, y.BeatmapSet.BeatmapMetadata.Author, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Difficulty:
groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Scores = null;
getScoresRequest?.Cancel();
if (api == null || Beatmap?.OnlineBeatmapID == null) return;
if (api == null || Beatmap?.BeatmapOnlineInfoId == null) return;
loading.Show();

View File

@ -238,7 +238,7 @@ namespace osu.Game.Screens.Select
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
{
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
bool preview = beatmap?.BeatmapSetInfoId != Beatmap.Value.BeatmapInfo.BeatmapSetInfoId;
Beatmap.Value = manager.GetWorkingBeatmap(beatmap, Beatmap);
ensurePlayingSelected(preview);
@ -261,7 +261,7 @@ namespace osu.Game.Screens.Select
}
else
{
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
if (beatmap.BeatmapSetInfoId == beatmapNoDebounce?.BeatmapSetInfoId)
sampleChangeDifficulty.Play();
else
sampleChangeBeatmap.Play();