Rename BeatmapInfo.Version to DifficultyName to match underlying interface

This commit is contained in:
Dean Herbert 2021-11-11 17:19:53 +09:00
parent ebe58cee11
commit 51a353e12d
26 changed files with 37 additions and 41 deletions

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Editor
editorBeatmap.BeatmapInfo.Metadata.Artist = "artist";
editorBeatmap.BeatmapInfo.Metadata.Title = "title";
});
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.Version = "difficulty");
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName = "difficulty");
checkMutations();
@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Editor
return Precision.AlmostEquals(taikoDifficulty.SliderMultiplier, 2);
});
AddAssert("Beatmap has correct metadata", () => editorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && editorBeatmap.BeatmapInfo.Metadata.Title == "title");
AddAssert("Beatmap has correct difficulty name", () => editorBeatmap.BeatmapInfo.Version == "difficulty");
AddAssert("Beatmap has correct difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName == "difficulty");
}
}
}

View File

@ -113,7 +113,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual("Soleily", metadata.Artist);
Assert.AreEqual("Soleily", metadata.ArtistUnicode);
Assert.AreEqual("Gamu", metadata.Author.Username);
Assert.AreEqual("Insane", beatmapInfo.Version);
Assert.AreEqual("Insane", beatmapInfo.DifficultyName);
Assert.AreEqual(string.Empty, metadata.Source);
Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags);
Assert.AreEqual(557821, beatmapInfo.OnlineBeatmapID);

View File

@ -790,12 +790,12 @@ namespace osu.Game.Tests.Beatmaps.IO
// Update via the beatmap, not the beatmap info, to ensure correct linking
BeatmapSetInfo setToUpdate = manager.GetAllUsableBeatmapSets()[0];
Beatmap beatmapToUpdate = (Beatmap)manager.GetWorkingBeatmap(setToUpdate.Beatmaps.First(b => b.RulesetID == 0)).Beatmap;
beatmapToUpdate.BeatmapInfo.Version = "updated";
beatmapToUpdate.BeatmapInfo.DifficultyName = "updated";
manager.Update(setToUpdate);
BeatmapInfo updatedInfo = manager.QueryBeatmap(b => b.ID == beatmapToUpdate.BeatmapInfo.ID);
Assert.That(updatedInfo.Version, Is.EqualTo("updated"));
Assert.That(updatedInfo.DifficultyName, Is.EqualTo("updated"));
}
finally
{
@ -863,7 +863,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var beatmap = working.Beatmap;
beatmap.BeatmapInfo.Version = "difficulty";
beatmap.BeatmapInfo.DifficultyName = "difficulty";
beatmap.BeatmapInfo.Metadata = new BeatmapMetadata
{
Artist = "Artist/With\\Slashes",

View File

@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps
Title = "title",
Author = new APIUser { Username = "creator" }
},
Version = "difficulty"
DifficultyName = "difficulty"
};
Assert.That(beatmap.ToString(), Is.EqualTo("artist - title (creator) [difficulty]"));

View File

@ -34,7 +34,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
Source = "unit tests",
Tags = "look for tags too",
},
Version = "version as well",
DifficultyName = "version as well",
Length = 2500,
BPM = 160,
BeatDivisor = 12,

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Editing
editorBeatmap.BeatmapInfo.Metadata.Artist = "artist";
editorBeatmap.BeatmapInfo.Metadata.Title = "title";
});
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.Version = "difficulty");
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName = "difficulty");
AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("Beatmap contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1);
AddAssert("Beatmap has correct overall difficulty", () => editorBeatmap.Difficulty.OverallDifficulty == 7);
AddAssert("Beatmap has correct metadata", () => editorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && editorBeatmap.BeatmapInfo.Metadata.Title == "title");
AddAssert("Beatmap has correct difficulty name", () => editorBeatmap.BeatmapInfo.Version == "difficulty");
AddAssert("Beatmap has correct difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName == "difficulty");
}
}
}

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
Ruleset = new OsuRuleset().RulesetInfo,
OnlineBeatmapID = beatmapId,
Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
Length = length,
BPM = bpm,
BaseDifficulty = new BeatmapDifficulty

View File

@ -684,7 +684,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
set.Beatmaps.Add(new BeatmapInfo
{
Version = $"Stars: {i}",
DifficultyName = $"Stars: {i}",
Ruleset = new OsuRuleset().RulesetInfo,
StarRating = i,
});
@ -868,7 +868,7 @@ namespace osu.Game.Tests.Visual.SongSelect
yield return new BeatmapInfo
{
OnlineBeatmapID = id++ * 10,
Version = version,
DifficultyName = version,
StarRating = diff,
Ruleset = new OsuRuleset().RulesetInfo,
BaseDifficulty = new BeatmapDifficulty
@ -902,7 +902,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
OnlineBeatmapID = b * 10,
Path = $"extra{b}.osu",
Version = $"Extra {b}",
DifficultyName = $"Extra {b}",
Ruleset = rulesets.GetRuleset((b - 1) % 4),
StarRating = 2,
BaseDifficulty = new BeatmapDifficulty

View File

@ -199,7 +199,7 @@ namespace osu.Game.Tests.Visual.SongSelect
},
Ruleset = ruleset,
StarRating = 6,
Version = $"{ruleset.ShortName}Version",
DifficultyName = $"{ruleset.ShortName}Version",
BaseDifficulty = new BeatmapDifficulty()
},
HitObjects = objects
@ -219,7 +219,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Source = "Verrrrry long Source",
Title = "Verrrrry long Title"
},
Version = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Version",
DifficultyName = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Version",
Status = BeatmapSetOnlineStatus.Graveyard,
},
};

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
Title = title,
},
Version = version,
DifficultyName = version,
StarRating = RNG.NextDouble(0, 10),
}
}));
@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
Title = "Heavy beatmap",
},
Version = "10k objects",
DifficultyName = "10k objects",
StarRating = 99.99f,
}
}));

View File

@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.SongSelect
BaseDifficulty = new BeatmapDifficulty(),
Ruleset = ruleset,
StarRating = difficultyIndex + 1,
Version = $"SR{difficultyIndex + 1}"
DifficultyName = $"SR{difficultyIndex + 1}"
}).ToList()
};

View File

@ -919,7 +919,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
Ruleset = getRuleset(),
OnlineBeatmapID = beatmapId,
Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
Length = length,
BPM = bpm,
BaseDifficulty = new BeatmapDifficulty

View File

@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Username = "TestAuthor"
},
},
Version = "Insane"
DifficultyName = "Insane"
},
}
},

View File

@ -56,7 +56,7 @@ namespace osu.Game.Beatmaps
Title = @"Unknown",
AuthorString = @"Unknown Creator",
},
Version = @"Normal",
DifficultyName = @"Normal",
BaseDifficulty = Difficulty,
};
}

View File

@ -134,9 +134,8 @@ namespace osu.Game.Beatmaps
public double TimelineZoom { get; set; }
// Metadata
public string Version { get; set; }
private string versionString => string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
[Column("Version")]
public string DifficultyName { get; set; }
[JsonProperty("difficulty_rating")]
[Column("StarDifficulty")]
@ -183,9 +182,6 @@ namespace osu.Game.Beatmaps
#region Implementation of IBeatmapInfo
[JsonIgnore]
string IBeatmapInfo.DifficultyName => Version;
[JsonIgnore]
IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata ?? BeatmapSet?.Metadata ?? new BeatmapMetadata();

View File

@ -215,7 +215,7 @@ namespace osu.Game.Beatmaps
var fileInfo = setInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, beatmapInfo.Path, StringComparison.OrdinalIgnoreCase)) ?? new BeatmapSetFileInfo();
// metadata may have changed; update the path with the standard format.
beatmapInfo.Path = GetValidFilename($"{metadata.Artist} - {metadata.Title} ({metadata.Author}) [{beatmapInfo.Version}].osu");
beatmapInfo.Path = GetValidFilename($"{metadata.Artist} - {metadata.Title} ({metadata.Author}) [{beatmapInfo.DifficultyName}].osu");
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();

View File

@ -251,7 +251,7 @@ namespace osu.Game.Beatmaps.Formats
break;
case @"Version":
beatmap.BeatmapInfo.Version = pair.Value;
beatmap.BeatmapInfo.DifficultyName = pair.Value;
break;
case @"Source":

View File

@ -130,7 +130,7 @@ namespace osu.Game.Beatmaps.Formats
writer.WriteLine(FormattableString.Invariant($"Artist: {beatmap.Metadata.Artist}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.ArtistUnicode)) writer.WriteLine(FormattableString.Invariant($"ArtistUnicode: {beatmap.Metadata.ArtistUnicode}"));
writer.WriteLine(FormattableString.Invariant($"Creator: {beatmap.Metadata.Author.Username}"));
writer.WriteLine(FormattableString.Invariant($"Version: {beatmap.BeatmapInfo.Version}"));
writer.WriteLine(FormattableString.Invariant($"Version: {beatmap.BeatmapInfo.DifficultyName}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.Source)) writer.WriteLine(FormattableString.Invariant($"Source: {beatmap.Metadata.Source}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.Tags)) writer.WriteLine(FormattableString.Invariant($"Tags: {beatmap.Metadata.Tags}"));
if (beatmap.BeatmapInfo.OnlineBeatmapID != null) writer.WriteLine(FormattableString.Invariant($"BeatmapID: {beatmap.BeatmapInfo.OnlineBeatmapID}"));

View File

@ -13,7 +13,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
public BeatmapInfo BeatmapInfo { get; }
public DifficultyMenuItem(BeatmapInfo beatmapInfo, bool selected, Action<BeatmapInfo> difficultyChangeFunc)
: base(beatmapInfo.Version ?? "(unnamed)", null)
: base(beatmapInfo.DifficultyName ?? "(unnamed)", null)
{
BeatmapInfo = beatmapInfo;
State.Value = selected;

View File

@ -47,7 +47,7 @@ namespace osu.Game.Screens.Edit.Setup
Empty(),
creatorTextBox = createTextBox<LabelledTextBox>("Creator", metadata.Author.Username),
difficultyTextBox = createTextBox<LabelledTextBox>("Difficulty Name", Beatmap.BeatmapInfo.Version),
difficultyTextBox = createTextBox<LabelledTextBox>("Difficulty Name", Beatmap.BeatmapInfo.DifficultyName),
sourceTextBox = createTextBox<LabelledTextBox>("Source", metadata.Source),
tagsTextBox = createTextBox<LabelledTextBox>("Tags", metadata.Tags)
};
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Edit.Setup
Beatmap.Metadata.Title = RomanisedTitleTextBox.Current.Value;
Beatmap.Metadata.AuthorString = creatorTextBox.Current.Value;
Beatmap.BeatmapInfo.Version = difficultyTextBox.Current.Value;
Beatmap.BeatmapInfo.DifficultyName = difficultyTextBox.Current.Value;
Beatmap.Metadata.Source = sourceTextBox.Current.Value;
Beatmap.Metadata.Tags = tagsTextBox.Current.Value;
}

View File

@ -126,7 +126,7 @@ namespace osu.Game.Screens.Play
{
new OsuSpriteText
{
Text = beatmap?.BeatmapInfo?.Version,
Text = beatmap?.BeatmapInfo?.DifficultyName,
Font = OsuFont.GetFont(size: 26, italics: true),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,

View File

@ -164,7 +164,7 @@ namespace osu.Game.Screens.Ranking.Expanded
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = beatmap.Version,
Text = beatmap.DifficultyName,
Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold),
},
new OsuTextFlowContainer(s => s.Font = OsuFont.Torus.With(size: 12))

View File

@ -229,7 +229,7 @@ namespace osu.Game.Screens.Select
{
VersionLabel = new OsuSpriteText
{
Text = beatmapInfo.Version,
Text = beatmapInfo.DifficultyName,
Font = OsuFont.GetFont(size: 24, italics: true),
RelativeSizeAxes = Axes.X,
Truncate = true,
@ -324,7 +324,7 @@ namespace osu.Game.Screens.Select
});
// no difficulty means it can't have a status to show
if (beatmapInfo.Version == null)
if (beatmapInfo.DifficultyName == null)
StatusPill.Hide();
addInfoLabels();

View File

@ -129,7 +129,7 @@ namespace osu.Game.Screens.Select.Carousel
{
new OsuSpriteText
{
Text = beatmapInfo.Version,
Text = beatmapInfo.DifficultyName,
Font = OsuFont.GetFont(size: 20),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft

View File

@ -253,7 +253,7 @@ namespace osu.Game.Stores
var beatmap = new RealmBeatmap(ruleset, difficulty, metadata)
{
Hash = hash,
DifficultyName = decodedInfo.Version,
DifficultyName = decodedInfo.DifficultyName,
OnlineID = decodedInfo.OnlineBeatmapID ?? -1,
AudioLeadIn = decodedInfo.AudioLeadIn,
StackLeniency = decodedInfo.StackLeniency,

View File

@ -229,7 +229,7 @@ namespace osu.Game.Tests.Visual
AuthorID = beatmap.Metadata.Author.OnlineID,
RulesetID = beatmap.RulesetID,
StarRating = beatmap.StarRating,
DifficultyName = beatmap.Version,
DifficultyName = beatmap.DifficultyName,
}
}
};