mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09: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]
|
[JsonIgnore]
|
||||||
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarDifficulty);
|
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarDifficulty);
|
||||||
|
|
||||||
public string[] SearchableTerms => new[]
|
public IEnumerable<string> SearchableTerms => ((IBeatmapInfo)this).SearchableTerms;
|
||||||
{
|
|
||||||
Version
|
|
||||||
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
|
||||||
|
|
||||||
public override string ToString() => ((IBeatmapInfo)this).DisplayTitle;
|
public override string ToString() => ((IBeatmapInfo)this).DisplayTitle;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -22,7 +23,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The metadata representing this beatmap. May be shared between multiple beatmaps.
|
/// The metadata representing this beatmap. May be shared between multiple beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IBeatmapMetadataInfo Metadata { get; }
|
IBeatmapMetadataInfo? Metadata { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The difficulty settings for this beatmap.
|
/// The difficulty settings for this beatmap.
|
||||||
@ -76,12 +77,20 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var metadata = Metadata.DisplayTitleRomanisable;
|
var metadata = closestMetadata.DisplayTitleRomanisable;
|
||||||
|
|
||||||
return new RomanisableString($"{metadata.GetPreferred(true)} {versionString}".Trim(), $"{metadata.GetPreferred(false)} {versionString}".Trim());
|
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}]";
|
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…
x
Reference in New Issue
Block a user