mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Redirect more methods to interface implementations
This commit is contained in:
parent
9dae92e78c
commit
d6618a99a3
@ -157,13 +157,9 @@ namespace osu.Game.Beatmaps
|
|||||||
Version
|
Version
|
||||||
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||||
|
|
||||||
public override string ToString() => $"{Metadata ?? BeatmapSet?.Metadata} {versionString}".Trim();
|
public override string ToString() => ((IBeatmapInfo)this).DisplayTitle;
|
||||||
|
|
||||||
public RomanisableString ToRomanisableString()
|
public RomanisableString ToRomanisableString() => ((IBeatmapInfo)this).DisplayTitleRomanisable;
|
||||||
{
|
|
||||||
var metadata = (Metadata ?? BeatmapSet?.Metadata)?.ToRomanisableString() ?? new RomanisableString(null, null);
|
|
||||||
return new RomanisableString($"{metadata.GetPreferred(true)} {versionString}".Trim(), $"{metadata.GetPreferred(false)} {versionString}".Trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Equals(BeatmapInfo other)
|
public bool Equals(BeatmapInfo other)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -83,51 +82,16 @@ namespace osu.Game.Beatmaps
|
|||||||
public int PreviewTime { get; set; }
|
public int PreviewTime { get; set; }
|
||||||
|
|
||||||
public string AudioFile { get; set; }
|
public string AudioFile { get; set; }
|
||||||
|
|
||||||
public string BackgroundFile { get; set; }
|
public string BackgroundFile { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public bool Equals(BeatmapMetadata other) => ((IBeatmapMetadataInfo)this).Equals(other);
|
||||||
{
|
|
||||||
string author = Author == null ? string.Empty : $"({Author})";
|
|
||||||
return $"{Artist} - {Title} {author}".Trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RomanisableString ToRomanisableString()
|
public override string ToString() => ((IBeatmapMetadataInfo)this).DisplayTitle;
|
||||||
{
|
|
||||||
string author = Author == null ? string.Empty : $"({Author})";
|
|
||||||
var artistUnicode = string.IsNullOrEmpty(ArtistUnicode) ? Artist : ArtistUnicode;
|
|
||||||
var titleUnicode = string.IsNullOrEmpty(TitleUnicode) ? Title : TitleUnicode;
|
|
||||||
|
|
||||||
return new RomanisableString($"{artistUnicode} - {titleUnicode} {author}".Trim(), $"{Artist} - {Title} {author}".Trim());
|
public RomanisableString ToRomanisableString() => ((IBeatmapMetadataInfo)this).DisplayTitleRomanisable;
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
public IEnumerable<string> SearchableTerms => ((IBeatmapMetadataInfo)this).SearchableTerms;
|
||||||
public string[] SearchableTerms => new[]
|
|
||||||
{
|
|
||||||
Author?.Username,
|
|
||||||
Artist,
|
|
||||||
ArtistUnicode,
|
|
||||||
Title,
|
|
||||||
TitleUnicode,
|
|
||||||
Source,
|
|
||||||
Tags
|
|
||||||
}.Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
|
||||||
|
|
||||||
public bool Equals(BeatmapMetadata other)
|
|
||||||
{
|
|
||||||
if (other == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return Title == other.Title
|
|
||||||
&& TitleUnicode == other.TitleUnicode
|
|
||||||
&& Artist == other.Artist
|
|
||||||
&& ArtistUnicode == other.ArtistUnicode
|
|
||||||
&& AuthorString == other.AuthorString
|
|
||||||
&& Source == other.Source
|
|
||||||
&& Tags == other.Tags
|
|
||||||
&& PreviewTime == other.PreviewTime
|
|
||||||
&& AudioFile == other.AudioFile
|
|
||||||
&& BackgroundFile == other.BackgroundFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IBeatmapMetadataInfo.Author => AuthorString;
|
string IBeatmapMetadataInfo.Author => AuthorString;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
|
|
||||||
public string StoryboardFile => Files.Find(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename;
|
public string StoryboardFile => ((IBeatmapSetInfo)this).StoryboardFile;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the storage path for the file in this beatmapset with the given filename, if any exists, otherwise null.
|
/// Returns the storage path for the file in this beatmapset with the given filename, if any exists, otherwise null.
|
||||||
|
Loading…
Reference in New Issue
Block a user