mirror of
https://github.com/ppy/osu
synced 2025-02-17 02:47:19 +00:00
Move BeatmapInfo
's SearchableTerms
implementation to interface
This commit is contained in:
parent
51b7dce16f
commit
f293e008d9
@ -152,10 +152,7 @@ namespace osu.Game.Beatmaps
|
||||
[JsonIgnore]
|
||||
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarDifficulty);
|
||||
|
||||
public string[] SearchableTerms => new[]
|
||||
{
|
||||
Version
|
||||
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
public IEnumerable<string> SearchableTerms => ((IBeatmapInfo)this).SearchableTerms;
|
||||
|
||||
public override string ToString() => ((IBeatmapInfo)this).DisplayTitle;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Logging;
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
@ -22,7 +23,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// The metadata representing this beatmap. May be shared between multiple beatmaps.
|
||||
/// </summary>
|
||||
IBeatmapMetadataInfo Metadata { get; }
|
||||
IBeatmapMetadataInfo? Metadata { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The difficulty settings for this beatmap.
|
||||
@ -76,12 +77,20 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
get
|
||||
{
|
||||
var metadata = Metadata.DisplayTitleRomanisable;
|
||||
var metadata = closestMetadata.DisplayTitleRomanisable;
|
||||
|
||||
return new RomanisableString($"{metadata.GetPreferred(true)} {versionString}".Trim(), $"{metadata.GetPreferred(false)} {versionString}".Trim());
|
||||
}
|
||||
}
|
||||
|
||||
string[] SearchableTerms => new[]
|
||||
{
|
||||
DifficultyName
|
||||
}.Concat(closestMetadata.SearchableTerms).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
|
||||
private string versionString => string.IsNullOrEmpty(DifficultyName) ? string.Empty : $"[{DifficultyName}]";
|
||||
|
||||
// temporary helper methods until we figure which metadata should be where.
|
||||
private IBeatmapMetadataInfo closestMetadata => (Metadata ?? BeatmapSet.Metadata)!;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user