mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Add ToRomanisableString()
This commit is contained in:
parent
512cec3458
commit
cfaaf2e83e
@ -7,6 +7,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO.Serialization;
|
using osu.Game.IO.Serialization;
|
||||||
@ -127,6 +128,8 @@ namespace osu.Game.Beatmaps
|
|||||||
// Metadata
|
// Metadata
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
|
|
||||||
|
public string VersionString => string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
|
||||||
|
|
||||||
[JsonProperty("difficulty_rating")]
|
[JsonProperty("difficulty_rating")]
|
||||||
public double StarDifficulty { get; set; }
|
public double StarDifficulty { get; set; }
|
||||||
|
|
||||||
@ -143,11 +146,12 @@ 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()
|
public override string ToString() => $"{Metadata ?? BeatmapSet?.Metadata} {VersionString}".Trim();
|
||||||
{
|
|
||||||
string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
|
|
||||||
|
|
||||||
return $"{Metadata ?? BeatmapSet?.Metadata} {version}".Trim();
|
public RomanisableString ToRomanisableString()
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -71,6 +72,12 @@ namespace osu.Game.Beatmaps
|
|||||||
return $"{Artist} - {Title} {author}".Trim();
|
return $"{Artist} - {Title} {author}".Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RomanisableString ToRomanisableString()
|
||||||
|
{
|
||||||
|
string author = Author == null ? string.Empty : $"({Author})";
|
||||||
|
return new RomanisableString($"{ArtistUnicode} - {TitleUnicode} {author}".Trim(), $"{Artist} - {Title} {author}".Trim());
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string[] SearchableTerms => new[]
|
public string[] SearchableTerms => new[]
|
||||||
{
|
{
|
||||||
|
@ -107,18 +107,11 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
private void refresh()
|
private void refresh()
|
||||||
{
|
{
|
||||||
var beatmapMetadata = Item.Beatmap.Value.Metadata ?? Item.Beatmap.Value.BeatmapSet?.Metadata;
|
|
||||||
difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value, requiredMods) { Size = new Vector2(32) };
|
difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value, requiredMods) { Size = new Vector2(32) };
|
||||||
|
|
||||||
beatmapText.Clear();
|
beatmapText.Clear();
|
||||||
var text = new List<SpriteText>
|
beatmapText.AddLink(new List<SpriteText>{ new OsuSpriteText { Text = Item.Beatmap.Value.ToRomanisableString() } }
|
||||||
{
|
, LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString());
|
||||||
new OsuSpriteText { Text = new RomanisableString(beatmapMetadata.ArtistUnicode, beatmapMetadata.Artist) },
|
|
||||||
new OsuSpriteText { Text = " - " },
|
|
||||||
new OsuSpriteText { Text = new RomanisableString(beatmapMetadata.TitleUnicode, beatmapMetadata.Title) },
|
|
||||||
new OsuSpriteText { Text = $" ({beatmapMetadata.Author}) [{Item.Beatmap.Value.Version}]" }
|
|
||||||
};
|
|
||||||
beatmapText.AddLink(text, LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString());
|
|
||||||
|
|
||||||
authorText.Clear();
|
authorText.Clear();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user