Files
crtr/Assets/Cryville/Crtr/Browsing/Legacy/LegacyChartDetail.cs
2023-12-19 15:23:40 +08:00

35 lines
1.2 KiB
C#

using Cryville.Common;
using Cryville.Crtr.Extension;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Cryville.Crtr.Browsing.Legacy {
public class LegacyChartDetail : IChartDetail, IResourceMeta {
public AsyncDelivery<Texture2D> Cover { get; set; }
public ChartMeta Meta { get; set; }
public string RulesetId { get { return Meta.ruleset; } }
public string Name { get { return Meta.name; } }
public string SongName { get { return Meta.song.name; } }
public TimeSpan Length { get { return TimeSpan.FromSeconds(Meta.length); } }
public IEnumerable<MetaProperty> Properties {
get {
if (Meta == null) yield break;
yield return new MetaProperty("Name", new Dictionary<string, object> {
{ "", string.Format("{0} - {1}", SongName, Name) },
{ "short", Name },
{ "distinct-primary", SongName },
{ "distinct-secondary", Name },
});
yield return new MetaProperty("Image", Cover);
yield return new MetaProperty("Song.Author", Meta.song.author);
yield return new MetaProperty("Author", Meta.author);
yield return new MetaProperty("Length", Length);
yield return new MetaProperty("NoteCount", Meta.note_count);
}
}
}
}