1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

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.Artist = "artist";
editorBeatmap.BeatmapInfo.Metadata.Title = "title"; editorBeatmap.BeatmapInfo.Metadata.Title = "title";
}); });
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.Version = "difficulty"); AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName = "difficulty");
checkMutations(); checkMutations();
@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Editor
return Precision.AlmostEquals(taikoDifficulty.SliderMultiplier, 2); 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 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.Artist);
Assert.AreEqual("Soleily", metadata.ArtistUnicode); Assert.AreEqual("Soleily", metadata.ArtistUnicode);
Assert.AreEqual("Gamu", metadata.Author.Username); Assert.AreEqual("Gamu", metadata.Author.Username);
Assert.AreEqual("Insane", beatmapInfo.Version); Assert.AreEqual("Insane", beatmapInfo.DifficultyName);
Assert.AreEqual(string.Empty, metadata.Source); Assert.AreEqual(string.Empty, metadata.Source);
Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags); Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags);
Assert.AreEqual(557821, beatmapInfo.OnlineBeatmapID); 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 // Update via the beatmap, not the beatmap info, to ensure correct linking
BeatmapSetInfo setToUpdate = manager.GetAllUsableBeatmapSets()[0]; BeatmapSetInfo setToUpdate = manager.GetAllUsableBeatmapSets()[0];
Beatmap beatmapToUpdate = (Beatmap)manager.GetWorkingBeatmap(setToUpdate.Beatmaps.First(b => b.RulesetID == 0)).Beatmap; Beatmap beatmapToUpdate = (Beatmap)manager.GetWorkingBeatmap(setToUpdate.Beatmaps.First(b => b.RulesetID == 0)).Beatmap;
beatmapToUpdate.BeatmapInfo.Version = "updated"; beatmapToUpdate.BeatmapInfo.DifficultyName = "updated";
manager.Update(setToUpdate); manager.Update(setToUpdate);
BeatmapInfo updatedInfo = manager.QueryBeatmap(b => b.ID == beatmapToUpdate.BeatmapInfo.ID); 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 finally
{ {
@ -863,7 +863,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var beatmap = working.Beatmap; var beatmap = working.Beatmap;
beatmap.BeatmapInfo.Version = "difficulty"; beatmap.BeatmapInfo.DifficultyName = "difficulty";
beatmap.BeatmapInfo.Metadata = new BeatmapMetadata beatmap.BeatmapInfo.Metadata = new BeatmapMetadata
{ {
Artist = "Artist/With\\Slashes", Artist = "Artist/With\\Slashes",

View File

@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps
Title = "title", Title = "title",
Author = new APIUser { Username = "creator" } Author = new APIUser { Username = "creator" }
}, },
Version = "difficulty" DifficultyName = "difficulty"
}; };
Assert.That(beatmap.ToString(), Is.EqualTo("artist - title (creator) [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", Source = "unit tests",
Tags = "look for tags too", Tags = "look for tags too",
}, },
Version = "version as well", DifficultyName = "version as well",
Length = 2500, Length = 2500,
BPM = 160, BPM = 160,
BeatDivisor = 12, BeatDivisor = 12,

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Editing
editorBeatmap.BeatmapInfo.Metadata.Artist = "artist"; editorBeatmap.BeatmapInfo.Metadata.Artist = "artist";
editorBeatmap.BeatmapInfo.Metadata.Title = "title"; 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())); 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 contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1);
AddAssert("Beatmap has correct overall difficulty", () => editorBeatmap.Difficulty.OverallDifficulty == 7); 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 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, Ruleset = new OsuRuleset().RulesetInfo,
OnlineBeatmapID = beatmapId, 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, Length = length,
BPM = bpm, BPM = bpm,
BaseDifficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty

View File

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

View File

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

View File

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

View File

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

View File

@ -919,7 +919,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Ruleset = getRuleset(), Ruleset = getRuleset(),
OnlineBeatmapID = beatmapId, 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, Length = length,
BPM = bpm, BPM = bpm,
BaseDifficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty

View File

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

View File

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

View File

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

View File

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

View File

@ -130,7 +130,7 @@ namespace osu.Game.Beatmaps.Formats
writer.WriteLine(FormattableString.Invariant($"Artist: {beatmap.Metadata.Artist}")); writer.WriteLine(FormattableString.Invariant($"Artist: {beatmap.Metadata.Artist}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.ArtistUnicode)) writer.WriteLine(FormattableString.Invariant($"ArtistUnicode: {beatmap.Metadata.ArtistUnicode}")); 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($"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.Source)) writer.WriteLine(FormattableString.Invariant($"Source: {beatmap.Metadata.Source}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.Tags)) writer.WriteLine(FormattableString.Invariant($"Tags: {beatmap.Metadata.Tags}")); 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}")); 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 BeatmapInfo BeatmapInfo { get; }
public DifficultyMenuItem(BeatmapInfo beatmapInfo, bool selected, Action<BeatmapInfo> difficultyChangeFunc) public DifficultyMenuItem(BeatmapInfo beatmapInfo, bool selected, Action<BeatmapInfo> difficultyChangeFunc)
: base(beatmapInfo.Version ?? "(unnamed)", null) : base(beatmapInfo.DifficultyName ?? "(unnamed)", null)
{ {
BeatmapInfo = beatmapInfo; BeatmapInfo = beatmapInfo;
State.Value = selected; State.Value = selected;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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