Rename attributes in enum to match better with user expectations

This commit is contained in:
Dean Herbert 2022-11-23 16:39:13 +09:00
parent b89689a34a
commit 27473262af

View File

@ -8,6 +8,8 @@ using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -18,6 +20,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Localisation; using osu.Game.Localisation;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Skinning.Components namespace osu.Game.Skinning.Components
{ {
@ -36,6 +39,7 @@ namespace osu.Game.Skinning.Components
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!; private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
private readonly Dictionary<BeatmapAttribute, LocalisableString> valueDictionary = new Dictionary<BeatmapAttribute, LocalisableString>(); private readonly Dictionary<BeatmapAttribute, LocalisableString> valueDictionary = new Dictionary<BeatmapAttribute, LocalisableString>();
private static readonly ImmutableDictionary<BeatmapAttribute, LocalisableString> label_dictionary; private static readonly ImmutableDictionary<BeatmapAttribute, LocalisableString> label_dictionary;
private readonly OsuSpriteText text; private readonly OsuSpriteText text;
@ -49,15 +53,13 @@ namespace osu.Game.Skinning.Components
[BeatmapAttribute.HPDrain] = BeatmapsetsStrings.ShowStatsDrain, [BeatmapAttribute.HPDrain] = BeatmapsetsStrings.ShowStatsDrain,
[BeatmapAttribute.ApproachRate] = BeatmapsetsStrings.ShowStatsAr, [BeatmapAttribute.ApproachRate] = BeatmapsetsStrings.ShowStatsAr,
[BeatmapAttribute.StarRating] = BeatmapsetsStrings.ShowStatsStars, [BeatmapAttribute.StarRating] = BeatmapsetsStrings.ShowStatsStars,
[BeatmapAttribute.Song] = EditorSetupStrings.Title, [BeatmapAttribute.Title] = EditorSetupStrings.Title,
[BeatmapAttribute.Artist] = EditorSetupStrings.Artist, [BeatmapAttribute.Artist] = EditorSetupStrings.Artist,
[BeatmapAttribute.Difficulty] = EditorSetupStrings.DifficultyHeader, [BeatmapAttribute.DifficultyName] = EditorSetupStrings.DifficultyHeader,
//todo: is there a good alternative, to NotificationsOptionsMapping? [BeatmapAttribute.Creator] = EditorSetupStrings.Creator,
[BeatmapAttribute.Mapper] = AccountsStrings.NotificationsOptionsMapping, [BeatmapAttribute.Length] = ArtistStrings.TracklistLength.ToTitle(),
[BeatmapAttribute.Length] = ArtistStrings.TracklistLength, [BeatmapAttribute.RankedStatus] = BeatmapDiscussionsStrings.IndexFormBeatmapsetStatusDefault,
[BeatmapAttribute.Status] = BeatmapDiscussionsStrings.IndexFormBeatmapsetStatusDefault,
[BeatmapAttribute.BPM] = BeatmapsetsStrings.ShowStatsBpm, [BeatmapAttribute.BPM] = BeatmapsetsStrings.ShowStatsBpm,
[BeatmapAttribute.None] = BeatmapAttribute.None.ToString()
}.ToImmutableDictionary(); }.ToImmutableDictionary();
} }
@ -124,20 +126,19 @@ namespace osu.Game.Skinning.Components
double sr = workingBeatmap.BeatmapInfo.StarRating; double sr = workingBeatmap.BeatmapInfo.StarRating;
valueDictionary[BeatmapAttribute.StarRating] = sr.ToString("F2"); valueDictionary[BeatmapAttribute.StarRating] = sr.ToString("F2");
//update song title //update song title
valueDictionary[BeatmapAttribute.Song] = workingBeatmap.BeatmapInfo.Metadata.Title; valueDictionary[BeatmapAttribute.Title] = workingBeatmap.BeatmapInfo.Metadata.Title;
//update artist //update artist
valueDictionary[BeatmapAttribute.Artist] = workingBeatmap.BeatmapInfo.Metadata.Artist; valueDictionary[BeatmapAttribute.Artist] = workingBeatmap.BeatmapInfo.Metadata.Artist;
//update difficulty name //update difficulty name
valueDictionary[BeatmapAttribute.Difficulty] = workingBeatmap.BeatmapInfo.DifficultyName; valueDictionary[BeatmapAttribute.DifficultyName] = workingBeatmap.BeatmapInfo.DifficultyName;
//update mapper //update mapper
valueDictionary[BeatmapAttribute.Mapper] = workingBeatmap.BeatmapInfo.Metadata.Author.Username; valueDictionary[BeatmapAttribute.Creator] = workingBeatmap.BeatmapInfo.Metadata.Author.Username;
//update Length //update Length
valueDictionary[BeatmapAttribute.Length] = TimeSpan.FromMilliseconds(workingBeatmap.BeatmapInfo.Length).ToFormattedDuration(); valueDictionary[BeatmapAttribute.Length] = TimeSpan.FromMilliseconds(workingBeatmap.BeatmapInfo.Length).ToFormattedDuration();
//update Status //update Status
valueDictionary[BeatmapAttribute.Status] = GetBetmapStatus(workingBeatmap.BeatmapInfo.Status); valueDictionary[BeatmapAttribute.RankedStatus] = GetBetmapStatus(workingBeatmap.BeatmapInfo.Status);
//update BPM //update BPM
valueDictionary[BeatmapAttribute.BPM] = workingBeatmap.BeatmapInfo.BPM.ToString("F2"); valueDictionary[BeatmapAttribute.BPM] = workingBeatmap.BeatmapInfo.BPM.ToString("F2");
valueDictionary[BeatmapAttribute.None] = string.Empty;
} }
public static LocalisableString GetBetmapStatus(BeatmapOnlineStatus status) public static LocalisableString GetBetmapStatus(BeatmapOnlineStatus status)
@ -184,13 +185,12 @@ namespace osu.Game.Skinning.Components
Accuracy, Accuracy,
ApproachRate, ApproachRate,
StarRating, StarRating,
Song, Title,
Artist, Artist,
Difficulty, DifficultyName,
Mapper, Creator,
Length, Length,
Status, RankedStatus,
BPM, BPM,
None,
} }
} }