1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-17 17:33:02 +08:00

use already-existing framework extension method

This commit is contained in:
Hivie
2025-08-06 08:42:19 +01:00
Unverified
parent 82f619a58a
commit 2127b6ca4e
@@ -3,9 +3,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using osu.Framework.Extensions;
using osu.Game.Overlays.BeatmapListing;
using osu.Game.Rulesets.Edit.Checks.Components;
@@ -39,8 +38,7 @@ namespace osu.Game.Rulesets.Edit.Checks
{
foreach (var value in Enum.GetValues<T>())
{
string description = getGenreLanguageString(value);
string[] words = description.ToLowerInvariant().Split(' ');
string[] words = value.GetDescription().ToLowerInvariant().Split(' ');
if (words.All(tags.Contains))
return true;
@@ -49,15 +47,6 @@ namespace osu.Game.Rulesets.Edit.Checks
return false;
}
// "Video Game" and "Hip Hop" are multiple words that are properly formatted in the enum's description attribute,
// so we need to use that and fall back to the enum's string value for the rest.
private string getGenreLanguageString(Enum value)
{
var field = value.GetType().GetField(value.ToString());
var attribute = field?.GetCustomAttribute<DescriptionAttribute>();
return attribute?.Description ?? value.ToString();
}
public class IssueTemplateMissingGenre : IssueTemplate
{
public IssueTemplateMissingGenre(ICheck check)